-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
887 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
./build | ||
./.gradle | ||
./gradle | ||
*.iml | ||
*.ipr | ||
*.iws | ||
gradlew*.* | ||
*.swp | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#Sat Sep 19 22:12:15 PDT 2015 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+540 Bytes
backend/build/classes/main/com/vella/backend/Main$AdministratorActions.class
Binary file not shown.
Binary file added
BIN
+968 Bytes
backend/build/classes/main/com/vella/backend/Main$UsersAction.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+297 Bytes
elasticsearch/build/classes/main/com/vella/elasticsearch/Products.class
Binary file not shown.
Binary file added
BIN
+288 Bytes
elasticsearch/build/classes/main/com/vella/elasticsearch/Query.class
Binary file not shown.
Binary file added
BIN
+309 Bytes
elasticsearch/build/classes/main/com/vella/elasticsearch/QueryBuilder.class
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
11
elasticsearch/source/com/vella/elasticsearch/Products.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
} |
7 changes: 7 additions & 0 deletions
7
elasticsearch/source/com/vella/elasticsearch/QueryBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dropwizard based rest server -- | ||
it receives the requests and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.