Skip to content

Commit

Permalink
first check in
Browse files Browse the repository at this point in the history
  • Loading branch information
shiveshr committed Sep 20, 2015
1 parent a186cc0 commit 55a85f6
Show file tree
Hide file tree
Showing 74 changed files with 887 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
./build
./.gradle
./gradle
*.iml
*.ipr
*.iws
gradlew*.*
*.swp


1 change: 1 addition & 0 deletions .gradle/2.2/taskArtifacts/cache.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#Sat Sep 19 22:12:15 PDT 2015
Binary file added .gradle/2.2/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file added .gradle/2.2/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file added .gradle/2.2/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file added .gradle/2.2/taskArtifacts/outputFileStates.bin
Binary file not shown.
Binary file added .gradle/2.2/taskArtifacts/taskArtifacts.bin
Binary file not shown.
1 change: 1 addition & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Define all rest apis here so that both client and frontend can make use of it
14 changes: 14 additions & 0 deletions api/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
Binary file added api/build/libs/api-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions api/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

21 changes: 21 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -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


17 changes: 17 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
@@ -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'

}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added backend/build/libs/backend-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions backend/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

54 changes: 54 additions & 0 deletions backend/source/com/vella/backend/Main.java
Original file line number Diff line number Diff line change
@@ -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<Product, Boolean> f = (Function<Product, Boolean>)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) {

}
}
}
25 changes: 25 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
}
Binary file added build/libs/server-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

15 changes: 15 additions & 0 deletions controller/build.gradle
Original file line number Diff line number Diff line change
@@ -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'

}
10 changes: 10 additions & 0 deletions crawler/README.md
Original file line number Diff line number Diff line change
@@ -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.

14 changes: 14 additions & 0 deletions crawler/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
Binary file added crawler/build/libs/crawler-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions crawler/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

15 changes: 15 additions & 0 deletions database/build.gradle
Original file line number Diff line number Diff line change
@@ -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")
}
Binary file added database/build/libs/database-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions database/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

2 changes: 2 additions & 0 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all products are stored here
all users are also stored here
16 changes: 16 additions & 0 deletions elasticsearch/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions elasticsearch/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

44 changes: 44 additions & 0 deletions elasticsearch/source/com/vella/elasticsearch/Main.java
Original file line number Diff line number Diff line change
@@ -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());
}

}
11 changes: 11 additions & 0 deletions elasticsearch/source/com/vella/elasticsearch/Products.java
Original file line number Diff line number Diff line change
@@ -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
//
}
12 changes: 12 additions & 0 deletions elasticsearch/source/com/vella/elasticsearch/Query.java
Original file line number Diff line number Diff line change
@@ -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 {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.vella.elasticsearch;

/**
* Created by s on 9/6/15.
*/
public class QueryBuilder {
}
2 changes: 2 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dropwizard based rest server --
it receives the requests and
17 changes: 17 additions & 0 deletions frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -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")
}
Binary file added frontend/build/libs/frontend-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions frontend/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 55a85f6

Please sign in to comment.