diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cbd4d89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +./build +./.gradle +./gradle +*.iml +*.ipr +*.iws +gradlew*.* +*.swp + + diff --git a/.gradle/2.2/taskArtifacts/cache.properties b/.gradle/2.2/taskArtifacts/cache.properties new file mode 100644 index 0000000..11a6913 --- /dev/null +++ b/.gradle/2.2/taskArtifacts/cache.properties @@ -0,0 +1 @@ +#Sat Sep 19 22:12:15 PDT 2015 diff --git a/.gradle/2.2/taskArtifacts/cache.properties.lock b/.gradle/2.2/taskArtifacts/cache.properties.lock new file mode 100644 index 0000000..0cfc109 Binary files /dev/null and b/.gradle/2.2/taskArtifacts/cache.properties.lock differ diff --git a/.gradle/2.2/taskArtifacts/fileHashes.bin b/.gradle/2.2/taskArtifacts/fileHashes.bin new file mode 100644 index 0000000..4898874 Binary files /dev/null and b/.gradle/2.2/taskArtifacts/fileHashes.bin differ diff --git a/.gradle/2.2/taskArtifacts/fileSnapshots.bin b/.gradle/2.2/taskArtifacts/fileSnapshots.bin new file mode 100644 index 0000000..b580669 Binary files /dev/null and b/.gradle/2.2/taskArtifacts/fileSnapshots.bin differ diff --git a/.gradle/2.2/taskArtifacts/outputFileStates.bin b/.gradle/2.2/taskArtifacts/outputFileStates.bin new file mode 100644 index 0000000..f6a44de Binary files /dev/null and b/.gradle/2.2/taskArtifacts/outputFileStates.bin differ diff --git a/.gradle/2.2/taskArtifacts/taskArtifacts.bin b/.gradle/2.2/taskArtifacts/taskArtifacts.bin new file mode 100644 index 0000000..ca5254c Binary files /dev/null and b/.gradle/2.2/taskArtifacts/taskArtifacts.bin differ diff --git a/api/README.md b/api/README.md new file mode 100644 index 0000000..7730876 --- /dev/null +++ b/api/README.md @@ -0,0 +1 @@ +Define all rest apis here so that both client and frontend can make use of it diff --git a/api/build.gradle b/api/build.gradle new file mode 100644 index 0000000..65bf234 --- /dev/null +++ b/api/build.gradle @@ -0,0 +1,14 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' +} diff --git a/api/build/libs/api-1.0-SNAPSHOT.jar b/api/build/libs/api-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..4c8ed81 Binary files /dev/null and b/api/build/libs/api-1.0-SNAPSHOT.jar differ diff --git a/api/build/tmp/jar/MANIFEST.MF b/api/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/api/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/backend/README.md b/backend/README.md new file mode 100644 index 0000000..172cd7d --- /dev/null +++ b/backend/README.md @@ -0,0 +1,21 @@ +backend logic: +comprises of multiple flows which should be broken into microservices in future: +1. access to db +2. access to elastic search +3. access to cassandra + +// right now backend should not even have a main. +// front end should directly call into this + +deployment will look as follows (later this will all change into different clusters) +1. frontend process in a docker containr +2. backend process in a docker container +3. elastic search in a docker container +4. cassandra/mongodb in a docker container + +// start all containers with -d flag so that they run in daemon mode + +for v.01 +frontend+backend will be one single service -- later this can be broken up into two microservices that will communicate via some messaging scheme + + diff --git a/backend/build.gradle b/backend/build.gradle new file mode 100644 index 0000000..702a065 --- /dev/null +++ b/backend/build.gradle @@ -0,0 +1,17 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' + compile project(":model"), + project(":controller") + compile 'org.codehaus.jackson:jackson-core-asl:1.9.2' + compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.2' + +} diff --git a/backend/build/classes/main/com/vella/backend/Main$AdministratorActions.class b/backend/build/classes/main/com/vella/backend/Main$AdministratorActions.class new file mode 100644 index 0000000..e21badd Binary files /dev/null and b/backend/build/classes/main/com/vella/backend/Main$AdministratorActions.class differ diff --git a/backend/build/classes/main/com/vella/backend/Main$UsersAction.class b/backend/build/classes/main/com/vella/backend/Main$UsersAction.class new file mode 100644 index 0000000..cb23c19 Binary files /dev/null and b/backend/build/classes/main/com/vella/backend/Main$UsersAction.class differ diff --git a/backend/build/classes/main/com/vella/backend/Main.class b/backend/build/classes/main/com/vella/backend/Main.class new file mode 100644 index 0000000..e678024 Binary files /dev/null and b/backend/build/classes/main/com/vella/backend/Main.class differ diff --git a/backend/build/libs/backend-1.0-SNAPSHOT.jar b/backend/build/libs/backend-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..4c8ed81 Binary files /dev/null and b/backend/build/libs/backend-1.0-SNAPSHOT.jar differ diff --git a/backend/build/tmp/jar/MANIFEST.MF b/backend/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/backend/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/backend/source/com/vella/backend/Main.java b/backend/source/com/vella/backend/Main.java new file mode 100644 index 0000000..e1aa7ca --- /dev/null +++ b/backend/source/com/vella/backend/Main.java @@ -0,0 +1,54 @@ +package com.vella.backend; + +import com.vella.model.Game; +import com.vella.model.GameCollection; +import com.vella.model.User; +import com.vella.model.product.Product; + +import java.util.function.Function; +import javax.script.*; + +/** + * Created by s on 8/23/15. + */ +public class Main { + // apis to perform searches against es + // apis to query products/retrieve products from db + // apis to retrieve user info from db + // apis to retrieve game info from db + // apis to retrieve + + public static void main(String[] args) throws ScriptException { + ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); + @SuppressWarnings("unchecked") + Function f = (Function)engine.eval( + String.format("new java.util.function.Function(%s)", "function(x) x.getPrice() == 100")); + for (int i = 1; i < 3; i++) { + System.out.println(f.apply(new Product("" + i, "", "", i * 100, null, null, null))); + } + + } + + public static class AdministratorActions { + public void createNewGame(Game game) { + + } + + } + + public static class UsersAction { + public UsersAction(User user) { + this.user = user; + } + + User user; + + public void createOrUpdateCollection(GameCollection gameCollection) { + gameCollection.getGame().getGameCollections().add(gameCollection); + } + + public void invest(GameCollection gameCollection) { + + } + } +} diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..06a5307 --- /dev/null +++ b/build.gradle @@ -0,0 +1,25 @@ +group 'vella' +version '0.1.0-SNAPSHOT' + +apply plugin: 'java' +apply plugin: 'idea' +sourceCompatibility = 1.8 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' +} +subprojects{ + apply plugin: 'java' + sourceSets.main.java.srcDirs = ['source'] +} + +idea { + module { + downloadJavadoc = true + downloadSources = true + } +} \ No newline at end of file diff --git a/build/libs/server-1.0-SNAPSHOT.jar b/build/libs/server-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..4c8ed81 Binary files /dev/null and b/build/libs/server-1.0-SNAPSHOT.jar differ diff --git a/build/tmp/jar/MANIFEST.MF b/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/controller/build.gradle b/controller/build.gradle new file mode 100644 index 0000000..9e060ba --- /dev/null +++ b/controller/build.gradle @@ -0,0 +1,15 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' + +} diff --git a/crawler/README.md b/crawler/README.md new file mode 100644 index 0000000..babcf15 --- /dev/null +++ b/crawler/README.md @@ -0,0 +1,10 @@ +periodically started by the backend -- this will start a python crawler. +python crawler will do the following: +1. crawl given website(s) and pull data.. +once a product is pulled, its stored in db and indexed at the es +- the product should first be constructed into a json +- we will store this in mongodb + +thats all -- do this for all pulled documents. +when the process exits, java process should know about its exit. + diff --git a/crawler/build.gradle b/crawler/build.gradle new file mode 100644 index 0000000..65bf234 --- /dev/null +++ b/crawler/build.gradle @@ -0,0 +1,14 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' +} diff --git a/crawler/build/libs/crawler-1.0-SNAPSHOT.jar b/crawler/build/libs/crawler-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..4c8ed81 Binary files /dev/null and b/crawler/build/libs/crawler-1.0-SNAPSHOT.jar differ diff --git a/crawler/build/tmp/jar/MANIFEST.MF b/crawler/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/crawler/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/database/build.gradle b/database/build.gradle new file mode 100644 index 0000000..57e751d --- /dev/null +++ b/database/build.gradle @@ -0,0 +1,15 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' + compile project(":model") +} diff --git a/database/build/libs/database-1.0-SNAPSHOT.jar b/database/build/libs/database-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..4c8ed81 Binary files /dev/null and b/database/build/libs/database-1.0-SNAPSHOT.jar differ diff --git a/database/build/tmp/jar/MANIFEST.MF b/database/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/database/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/elasticsearch/README.md b/elasticsearch/README.md new file mode 100644 index 0000000..71f1453 --- /dev/null +++ b/elasticsearch/README.md @@ -0,0 +1,2 @@ +all products are stored here +all users are also stored here diff --git a/elasticsearch/build.gradle b/elasticsearch/build.gradle new file mode 100644 index 0000000..a6cd37a --- /dev/null +++ b/elasticsearch/build.gradle @@ -0,0 +1,16 @@ +group 'vella' +version '1.0-SNAPSHOT' +apply plugin: 'application' + +apply plugin: 'java' +mainClassName = "com.vella.elasticsearch.Query" + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + compile 'org.elasticsearch:elasticsearch:1.5.0' +} diff --git a/elasticsearch/build/classes/main/com/vella/elasticsearch/Main.class b/elasticsearch/build/classes/main/com/vella/elasticsearch/Main.class new file mode 100644 index 0000000..93ccedb Binary files /dev/null and b/elasticsearch/build/classes/main/com/vella/elasticsearch/Main.class differ diff --git a/elasticsearch/build/classes/main/com/vella/elasticsearch/Products.class b/elasticsearch/build/classes/main/com/vella/elasticsearch/Products.class new file mode 100644 index 0000000..6ef31a8 Binary files /dev/null and b/elasticsearch/build/classes/main/com/vella/elasticsearch/Products.class differ diff --git a/elasticsearch/build/classes/main/com/vella/elasticsearch/Query.class b/elasticsearch/build/classes/main/com/vella/elasticsearch/Query.class new file mode 100644 index 0000000..169e05f Binary files /dev/null and b/elasticsearch/build/classes/main/com/vella/elasticsearch/Query.class differ diff --git a/elasticsearch/build/classes/main/com/vella/elasticsearch/QueryBuilder.class b/elasticsearch/build/classes/main/com/vella/elasticsearch/QueryBuilder.class new file mode 100644 index 0000000..85f699c Binary files /dev/null and b/elasticsearch/build/classes/main/com/vella/elasticsearch/QueryBuilder.class differ diff --git a/elasticsearch/build/libs/elasticsearch-1.0-SNAPSHOT.jar b/elasticsearch/build/libs/elasticsearch-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..4c8ed81 Binary files /dev/null and b/elasticsearch/build/libs/elasticsearch-1.0-SNAPSHOT.jar differ diff --git a/elasticsearch/build/tmp/jar/MANIFEST.MF b/elasticsearch/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/elasticsearch/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/elasticsearch/source/com/vella/elasticsearch/Main.java b/elasticsearch/source/com/vella/elasticsearch/Main.java new file mode 100644 index 0000000..994db52 --- /dev/null +++ b/elasticsearch/source/com/vella/elasticsearch/Main.java @@ -0,0 +1,44 @@ +package com.vella.elasticsearch; + +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.client.Client; +import org.elasticsearch.client.transport.TransportClient; +import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.transport.InetSocketTransportAddress; +import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.node.NodeBuilder; + +/** + * Created by s on 9/6/15. + */ +public class Main { + private static final String INDEX = "tmp"; + + public static void main(String []args) { + + + + Client client = NodeBuilder.nodeBuilder() + .client(true) + .node() + .client(); +// Settings settings = ImmutableSettings.settingsBuilder() +// .put("client.transport.sniff", true) +// .put("cluster.name", "my-cluster").build(); +// Client client = new TransportClient(settings) +// .addTransportAddress(new InetSocketTransportAddress("localhost", 9200)); + boolean indexExists = client.admin().indices().prepareExists(INDEX).execute().actionGet().isExists(); + if (indexExists) { + client.admin().indices().prepareDelete(INDEX).execute().actionGet(); + } + client.admin().indices().prepareCreate(INDEX).execute().actionGet(); + + SearchResponse allHits = client.prepareSearch("products") + .addFields("title", "category") + .setQuery(QueryBuilders.matchAllQuery()) + .execute().actionGet(); + System.out.println(allHits.getHits().getAt(0).toString()); + } + +} diff --git a/elasticsearch/source/com/vella/elasticsearch/Products.java b/elasticsearch/source/com/vella/elasticsearch/Products.java new file mode 100644 index 0000000..4b32896 --- /dev/null +++ b/elasticsearch/source/com/vella/elasticsearch/Products.java @@ -0,0 +1,11 @@ +package com.vella.elasticsearch; + +/** + * Created by s on 9/6/15. + */ +public class Products { + // method to add product + // method to remove product + // method to update product + // +} diff --git a/elasticsearch/source/com/vella/elasticsearch/Query.java b/elasticsearch/source/com/vella/elasticsearch/Query.java new file mode 100644 index 0000000..2d305b8 --- /dev/null +++ b/elasticsearch/source/com/vella/elasticsearch/Query.java @@ -0,0 +1,12 @@ +package com.vella.elasticsearch; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.client.Client; +import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.node.Node; +import org.elasticsearch.node.NodeBuilder; +import org.elasticsearch.node.NodeBuilder.*; +/** + * Created by s on 8/23/15. + */ +public class Query { +} diff --git a/elasticsearch/source/com/vella/elasticsearch/QueryBuilder.java b/elasticsearch/source/com/vella/elasticsearch/QueryBuilder.java new file mode 100644 index 0000000..561489b --- /dev/null +++ b/elasticsearch/source/com/vella/elasticsearch/QueryBuilder.java @@ -0,0 +1,7 @@ +package com.vella.elasticsearch; + +/** + * Created by s on 9/6/15. + */ +public class QueryBuilder { +} diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..eebc925 --- /dev/null +++ b/frontend/README.md @@ -0,0 +1,2 @@ +dropwizard based rest server -- +it receives the requests and \ No newline at end of file diff --git a/frontend/build.gradle b/frontend/build.gradle new file mode 100644 index 0000000..01b357f --- /dev/null +++ b/frontend/build.gradle @@ -0,0 +1,17 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' + compile project(":model"), + project(":view"), + project(":controller") +} diff --git a/frontend/build/libs/frontend-1.0-SNAPSHOT.jar b/frontend/build/libs/frontend-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..2503109 Binary files /dev/null and b/frontend/build/libs/frontend-1.0-SNAPSHOT.jar differ diff --git a/frontend/build/tmp/jar/MANIFEST.MF b/frontend/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/frontend/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..2322723 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ba896cc --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sun Aug 23 08:51:26 PDT 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/model/build.gradle b/model/build.gradle new file mode 100644 index 0000000..65bf234 --- /dev/null +++ b/model/build.gradle @@ -0,0 +1,14 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' +} diff --git a/model/build/classes/main/com/vella/model/Game.class b/model/build/classes/main/com/vella/model/Game.class new file mode 100644 index 0000000..cc7f84a Binary files /dev/null and b/model/build/classes/main/com/vella/model/Game.class differ diff --git a/model/build/classes/main/com/vella/model/GameCollection.class b/model/build/classes/main/com/vella/model/GameCollection.class new file mode 100644 index 0000000..3638aa3 Binary files /dev/null and b/model/build/classes/main/com/vella/model/GameCollection.class differ diff --git a/model/build/classes/main/com/vella/model/GameConstraints.class b/model/build/classes/main/com/vella/model/GameConstraints.class new file mode 100644 index 0000000..71f572e Binary files /dev/null and b/model/build/classes/main/com/vella/model/GameConstraints.class differ diff --git a/model/build/classes/main/com/vella/model/Investment.class b/model/build/classes/main/com/vella/model/Investment.class new file mode 100644 index 0000000..bf19bca Binary files /dev/null and b/model/build/classes/main/com/vella/model/Investment.class differ diff --git a/model/build/classes/main/com/vella/model/Notification$NotificationType.class b/model/build/classes/main/com/vella/model/Notification$NotificationType.class new file mode 100644 index 0000000..4050791 Binary files /dev/null and b/model/build/classes/main/com/vella/model/Notification$NotificationType.class differ diff --git a/model/build/classes/main/com/vella/model/Notification.class b/model/build/classes/main/com/vella/model/Notification.class new file mode 100644 index 0000000..1247cb3 Binary files /dev/null and b/model/build/classes/main/com/vella/model/Notification.class differ diff --git a/model/build/classes/main/com/vella/model/User.class b/model/build/classes/main/com/vella/model/User.class new file mode 100644 index 0000000..45e7358 Binary files /dev/null and b/model/build/classes/main/com/vella/model/User.class differ diff --git a/model/build/classes/main/com/vella/model/Vote.class b/model/build/classes/main/com/vella/model/Vote.class new file mode 100644 index 0000000..f19feae Binary files /dev/null and b/model/build/classes/main/com/vella/model/Vote.class differ diff --git a/model/build/classes/main/com/vella/model/product/Category.class b/model/build/classes/main/com/vella/model/product/Category.class new file mode 100644 index 0000000..ba46be2 Binary files /dev/null and b/model/build/classes/main/com/vella/model/product/Category.class differ diff --git a/model/build/classes/main/com/vella/model/product/Product.class b/model/build/classes/main/com/vella/model/product/Product.class new file mode 100644 index 0000000..9cb9d7a Binary files /dev/null and b/model/build/classes/main/com/vella/model/product/Product.class differ diff --git a/model/source/com/vella/model/Game.java b/model/source/com/vella/model/Game.java new file mode 100644 index 0000000..b7aae6a --- /dev/null +++ b/model/source/com/vella/model/Game.java @@ -0,0 +1,42 @@ +package com.vella.model; + +import java.util.List; +import java.util.Set; + +/** + * Created by s on 8/23/15. + * Games table: gameId, game story, list + */ +public class Game { + private final String gameId; + private final String gameStory; + // all predicates should pass + private final List> constraints; // figure out a way to serialize and stored in db! + // leaderboard + private final Set gameCollections; + + public Game(String gameId, String gameStory, List> constraints, Set gameCollections) { + this.gameId = gameId; + this.gameStory = gameStory; + this.constraints = constraints; + this.gameCollections = gameCollections; + } + + public Set getGameCollections() { + return gameCollections; + } + + public List> getConstraints() { + +// constraints.get(0).test() + return constraints; + } + + public String getGameStory() { + return gameStory; + } + + public String getGameId() { + return gameId; + } +} diff --git a/model/source/com/vella/model/GameCollection.java b/model/source/com/vella/model/GameCollection.java new file mode 100644 index 0000000..b5ff462 --- /dev/null +++ b/model/source/com/vella/model/GameCollection.java @@ -0,0 +1,50 @@ +package com.vella.model; + +import com.vella.model.product.Product; + +import java.util.List; + +/** + * Created by s on 8/23/15. + */ +public class GameCollection { + private final Game game; + private final User user; + private final List products; + private final List investments; + private final List upVote; + private final List downVote; + + public Game getGame() { + return game; + } + + public User getUser() { + return user; + } + + public List getProducts() { + return products; + } + + public List getInvestments() { + return investments; + } + + public List getUpVote() { + return upVote; + } + + public List getDownVote() { + return downVote; + } + + public GameCollection(Game game, User user, List products, List investments, List upVote, List downVote) { + this.game = game; + this.user = user; + this.products = products; + this.investments = investments; + this.upVote = upVote; + this.downVote = downVote; + } +} diff --git a/model/source/com/vella/model/GameConstraints.java b/model/source/com/vella/model/GameConstraints.java new file mode 100644 index 0000000..c7feaa3 --- /dev/null +++ b/model/source/com/vella/model/GameConstraints.java @@ -0,0 +1,10 @@ +package com.vella.model; + +import java.io.Serializable; +import java.util.function.Predicate; + +/** + * Created by s on 9/6/15. + */ +public interface GameConstraints { +} diff --git a/model/source/com/vella/model/Investment.java b/model/source/com/vella/model/Investment.java new file mode 100644 index 0000000..be349c8 --- /dev/null +++ b/model/source/com/vella/model/Investment.java @@ -0,0 +1,28 @@ +package com.vella.model; + +/** + * Created by s on 8/23/15. + */ +public class Investment { + private final int amount; + private final User investor; + private final GameCollection collection; + + public User getInvestor() { + return investor; + } + + public GameCollection getCollection() { + return collection; + } + + public int getAmount() { + return amount; + } + + public Investment(int amount, User investor, GameCollection collection) { + this.amount = amount; + this.investor = investor; + this.collection = collection; + } +} diff --git a/model/source/com/vella/model/Notification.java b/model/source/com/vella/model/Notification.java new file mode 100644 index 0000000..07aad1e --- /dev/null +++ b/model/source/com/vella/model/Notification.java @@ -0,0 +1,23 @@ +package com.vella.model; + +/** + * Created by s on 8/23/15. + */ +public class Notification { + NotificationType notificationType; + boolean notified; + private GameCollection collection; + private Game game; + // notification link + + public static enum NotificationType { + COLLECTION_VOTE, + INVESTED, + GAME_COMPLETED, + FRIEND_COLLECTION_CREATE_OR_UPDATE, + FOLLOWING_COLLECTION_UPDATE, + VOTED_COLLECTION_UPDATE, + NEW_GAME,; + + } +} diff --git a/model/source/com/vella/model/User.java b/model/source/com/vella/model/User.java new file mode 100644 index 0000000..0a3acc9 --- /dev/null +++ b/model/source/com/vella/model/User.java @@ -0,0 +1,79 @@ +package com.vella.model; + +import javafx.util.Pair; + +import java.util.List; + +/** + * Created by s on 8/23/15. + */ +public class User { + private final String userId; + private final List friends; + private final List following; // lazy load + private final List followers; // lazy load + private final List> activeGames; + private final List> historyGames; // lazy load + private final List> downVotes; + private final List investments; + private final int currency; + + public User(String userId, List friends, List following, List followers, List> activeGames, List> historyGames, List> downVotes, List investments, int currency) { + this.userId = userId; + this.friends = friends; + this.following = following; + this.followers = followers; + this.activeGames = activeGames; + this.historyGames = historyGames; + this.downVotes = downVotes; + this.investments = investments; + this.currency = currency; + } + + public String getUserId() { + return userId; + } + + public List getFriends() { + return friends; + } + + public List getFollowing() { + return following; + } + + public List getFollowers() { + return followers; + } + + public List> getActiveGames() { + return activeGames; + } + + public List> getHistoryGames() { + return historyGames; + } + + public List> getDownVotes() { + return downVotes; + } + + public List getInvestments() { + return investments; + } + + public int getCurrency() { + return currency; + } + + public List getNotifications() { + return notifications; + } + + public List getOldNotifications() { + return oldNotifications; + } + + List notifications; + List oldNotifications; +} diff --git a/model/source/com/vella/model/Vote.java b/model/source/com/vella/model/Vote.java new file mode 100644 index 0000000..4e3ef3a --- /dev/null +++ b/model/source/com/vella/model/Vote.java @@ -0,0 +1,28 @@ +package com.vella.model; + +/** + * Created by s on 8/23/15. + */ +public class Vote { + private final String user; + private final GameCollection collection; + private final boolean upVote; + + public String getUser() { + return user; + } + + public GameCollection getCollection() { + return collection; + } + + public boolean isUpVote() { + return upVote; + } + + public Vote(String user, GameCollection collection, boolean upVote) { + this.user = user; + this.collection = collection; + this.upVote = upVote; + } +} diff --git a/model/source/com/vella/model/product/Category.java b/model/source/com/vella/model/product/Category.java new file mode 100644 index 0000000..16540ae --- /dev/null +++ b/model/source/com/vella/model/product/Category.java @@ -0,0 +1,22 @@ +package com.vella.model.product; + +/** + * Created by s on 8/23/15. + */ +public class Category { + private final String categoryName; + private final String categoryId; + + public Category(String categoryName, String categoryId) { + this.categoryName = categoryName; + this.categoryId = categoryId; + } + + public String getCategoryName() { + return categoryName; + } + + public String getCategoryId() { + return categoryId; + } +} diff --git a/model/source/com/vella/model/product/Product.java b/model/source/com/vella/model/product/Product.java new file mode 100644 index 0000000..b2dfa8a --- /dev/null +++ b/model/source/com/vella/model/product/Product.java @@ -0,0 +1,57 @@ +package com.vella.model.product; + +import java.util.List; +import java.util.Set; + +/** + * Created by s on 8/23/15. + * Products are stored in the db after a crawl + */ +public class Product { + private final String productName; + private final String skuId; + private final String description; + + public int getPrice() { + return price; + } + + private final int price; + private final Category category; + private final List subcategories; + private final Set tags; + + public Product(String productName, String skuId, String description, int price, Category category, List subcategories, Set tags) { + this.productName = productName; + this.skuId = skuId; + this.description = description; + this.price = price; + this.category = category; + this.subcategories = subcategories; + this.tags = tags; + } + + public String getProductName() { + return productName; + } + + public String getSkuId() { + return skuId; + } + + public String getDescription() { + return description; + } + + public Category getCategory() { + return category; + } + + public List getSubcategories() { + return subcategories; + } + + public Set getTags() { + return tags; + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..a95070c --- /dev/null +++ b/settings.gradle @@ -0,0 +1,12 @@ +rootProject.name = 'server' +include 'api' +include 'frontend' +include 'crawler' +include 'streamstore' +include 'database' +include 'elasticsearch' +include 'backend' +include 'controller' +include 'view' +include 'model' + diff --git a/streamstore/build.gradle b/streamstore/build.gradle new file mode 100644 index 0000000..65bf234 --- /dev/null +++ b/streamstore/build.gradle @@ -0,0 +1,14 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' +} diff --git a/streamstore/build/libs/streamstore-1.0-SNAPSHOT.jar b/streamstore/build/libs/streamstore-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..2503109 Binary files /dev/null and b/streamstore/build/libs/streamstore-1.0-SNAPSHOT.jar differ diff --git a/streamstore/build/tmp/jar/MANIFEST.MF b/streamstore/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/streamstore/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/view/build.gradle b/view/build.gradle new file mode 100644 index 0000000..65bf234 --- /dev/null +++ b/view/build.gradle @@ -0,0 +1,14 @@ +group 'vella' +version '1.0-SNAPSHOT' + +apply plugin: 'java' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile group: 'junit', name: 'junit', version: '4.11' +}