# HG changeset patch # User ymh # Date 1269020115 -3600 # Node ID 586a7e03cbb43ad46aa0b9411d0f73503da541fe First commit diff -r 000000000000 -r 586a7e03cbb4 .classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.classpath Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 586a7e03cbb4 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,3 @@ +syntax: glob + +build/classes/* diff -r 000000000000 -r 586a7e03cbb4 .project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.project Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,36 @@ + + + mosatags.sonyengine + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + diff -r 000000000000 -r 586a7e03cbb4 .settings/.jsdtscope --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/.jsdtscope Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,11 @@ + + + + + + + + + + + diff -r 000000000000 -r 586a7e03cbb4 .settings/org.eclipse.jdt.core.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.jdt.core.prefs Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,7 @@ +#Fri Mar 12 19:26:32 CET 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff -r 000000000000 -r 586a7e03cbb4 .settings/org.eclipse.wst.common.component --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.wst.common.component Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r 000000000000 -r 586a7e03cbb4 .settings/org.eclipse.wst.common.project.facet.core.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r 000000000000 -r 586a7e03cbb4 .settings/org.eclipse.wst.jsdt.ui.superType.container --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff -r 000000000000 -r 586a7e03cbb4 .settings/org.eclipse.wst.jsdt.ui.superType.name --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,1 @@ +Window \ No newline at end of file diff -r 000000000000 -r 586a7e03cbb4 WebContent/META-INF/MANIFEST.MF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebContent/META-INF/MANIFEST.MF Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/Movies.jar Binary file WebContent/WEB-INF/lib/Movies.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/asm-3.1.jar Binary file WebContent/WEB-INF/lib/asm-3.1.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/csltools.jar Binary file WebContent/WEB-INF/lib/csltools.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/jackson-core-asl-1.1.1.jar Binary file WebContent/WEB-INF/lib/jackson-core-asl-1.1.1.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/je-4.0.92.jar Binary file WebContent/WEB-INF/lib/je-4.0.92.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/jersey-bundle-1.1.5.1.jar Binary file WebContent/WEB-INF/lib/jersey-bundle-1.1.5.1.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/jettison-1.1.jar Binary file WebContent/WEB-INF/lib/jettison-1.1.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/jsr311-api-1.1.1.jar Binary file WebContent/WEB-INF/lib/jsr311-api-1.1.1.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/libsvm.jar Binary file WebContent/WEB-INF/lib/libsvm.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/lib/weka.jar Binary file WebContent/WEB-INF/lib/weka.jar has changed diff -r 000000000000 -r 586a7e03cbb4 WebContent/WEB-INF/web.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebContent/WEB-INF/web.xml Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,27 @@ + + + mosatags.sonyengine + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + + sonyengine + + fr.iri.thd.sonyengine.ServletContainer + + + initDatabasePath + /tmp/db + + 1 + + + sonyengine + /* + + \ No newline at end of file diff -r 000000000000 -r 586a7e03cbb4 build/.keepme diff -r 000000000000 -r 586a7e03cbb4 script/deploy.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/script/deploy.xml Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,37 @@ + + + + + description + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 586a7e03cbb4 script/lib/catalina-ant.jar Binary file script/lib/catalina-ant.jar has changed diff -r 000000000000 -r 586a7e03cbb4 src/HelloResource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HelloResource.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,13 @@ +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path ("helloworld") +public class HelloResource { + + @GET + @Produces ("text/plain") + public String sayHello() { + return "Hello World"; + } +} diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/DataAccessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/DataAccessor.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,26 @@ +package fr.iri.thd.sonyengine; + +import com.sleepycat.je.DatabaseException; +import com.sleepycat.persist.EntityStore; +import com.sleepycat.persist.PrimaryIndex; +import com.sleepycat.persist.SecondaryIndex; + +public class DataAccessor { + + public PrimaryIndex movieFragmentById; + + public PrimaryIndex tagById; + public SecondaryIndex tagByName; + public SecondaryIndex tagBySegment; + + public DataAccessor(EntityStore store) throws DatabaseException { + + movieFragmentById = store.getPrimaryIndex(String.class, MovieFragment.class); + + tagById = store.getPrimaryIndex(String.class, Tag.class); + tagByName = store.getSecondaryIndex(tagById, String.class, "name"); + tagBySegment = store.getSecondaryIndex(tagById, String.class, "segment"); + + } + +} diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/DbEnv.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/DbEnv.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,77 @@ +package fr.iri.thd.sonyengine; + +import java.io.File; + +import com.sleepycat.je.DatabaseException; +import com.sleepycat.je.Environment; +import com.sleepycat.je.EnvironmentConfig; +import com.sleepycat.persist.EntityStore; +import com.sleepycat.persist.StoreConfig; + +public class DbEnv { + + private Environment env; + private EntityStore store; + + // Our constructor does nothing + public DbEnv() {} + + // The setup() method opens the environment and store + // for us. + public void setup(File envHome, boolean readOnly) + throws DatabaseException { + + EnvironmentConfig myEnvConfig = new EnvironmentConfig(); + StoreConfig storeConfig = new StoreConfig(); + + myEnvConfig.setReadOnly(readOnly); + storeConfig.setReadOnly(readOnly); + + // If the environment is opened for write, then we want to be + // able to create the environment and entity store if + // they do not exist. + myEnvConfig.setAllowCreate(!readOnly); + storeConfig.setAllowCreate(!readOnly); + + // Open the environment and entity store + env = new Environment(envHome, myEnvConfig); + store = new EntityStore(env, "EntityStore", storeConfig); + + } + + // Return a handle to the entity store + public EntityStore getEntityStore() { + return store; + } + + // Return a handle to the environment + public Environment getEnv() { + return env; + } + + // Close the store and environment. + public void close() { + if (store != null) { + try { + store.close(); + } catch(DatabaseException dbe) { + System.err.println("Error closing store: " + + dbe.toString()); + throw dbe; + } + } + + if (env != null) { + try { + // Finally, close the environment. + env.close(); + } catch(DatabaseException dbe) { + System.err.println("Error closing DbEnv: " + + dbe.toString()); + throw dbe; + } + } + } + + +} diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/EngineResource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/EngineResource.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,30 @@ +package fr.iri.thd.sonyengine; + +import javax.ws.rs.Path; +import javax.ws.rs.POST; +import javax.ws.rs.PathParam; + +import thd.ThdEngine; + +@Path ("engine") +public class EngineResource { + + @POST + @Path("train") + public String train() { + + ThdEngine.getEngine().reTrain(); + return "ok\n"; + } + + @POST + @Path("train/{id}") + public String train(@PathParam("id") String tagName) { + + ThdEngine.getEngine().reTrain(tagName); + return tagName + " : ok\n"; + } + +} + + diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/MovieFragment.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/MovieFragment.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,24 @@ +package fr.iri.thd.sonyengine; + +import com.sleepycat.persist.model.Entity; +import com.sleepycat.persist.model.PrimaryKey; + +@Entity +public class MovieFragment { + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @PrimaryKey + private String id; + + public MovieFragment(String id) { + this.id = id; + } + +} diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/MovieFragmentResource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/MovieFragmentResource.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,19 @@ +package fr.iri.thd.sonyengine; + +import javax.ws.rs.Path; + +@Path ("segment") +public class MovieFragmentResource { + + public void create(String id) { + } + + public void find(String id, String tag, Float separation, Boolean b) { + } + + + public void get(String id) { + } +} + + diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/ServletContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/ServletContainer.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,36 @@ +package fr.iri.thd.sonyengine; + +import java.io.File; + +import javax.servlet.ServletException; +import javax.ws.rs.core.Application; + +public class ServletContainer extends + com.sun.jersey.spi.container.servlet.ServletContainer { + + /** + * + */ + private static final long serialVersionUID = -447765110849619632L; + + public ServletContainer() { + } + + public ServletContainer(Class appClass) { + super(appClass); + } + + public ServletContainer(Application app) { + super(app); + } + + + public void init() throws ServletException { + super.init(); + + String databasePath = this.getInitParameter("initDatabasePath"); + + DbEnv env = new DbEnv(); + env.setup(new File(databasePath), true); + } +} diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/Tag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/Tag.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,42 @@ +package fr.iri.thd.sonyengine; + +import java.util.UUID; + +import com.sleepycat.persist.model.Entity; +import com.sleepycat.persist.model.PrimaryKey; +import com.sleepycat.persist.model.Relationship; +import com.sleepycat.persist.model.SecondaryKey; + +@Entity +public class Tag { + + @PrimaryKey + private String id = UUID.randomUUID().toString(); + + @SecondaryKey(relate=Relationship.MANY_TO_ONE) + private String name; + + @SecondaryKey(relate=Relationship.MANY_TO_ONE, relatedEntity=MovieFragment.class) + private String segment; + + + public String getId() { + return id; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setSegment(String segment) { + this.segment = segment; + } + + public String getSegment() { + return segment; + } +} diff -r 000000000000 -r 586a7e03cbb4 src/fr/iri/thd/sonyengine/TagResource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fr/iri/thd/sonyengine/TagResource.java Fri Mar 19 18:35:15 2010 +0100 @@ -0,0 +1,13 @@ +package fr.iri.thd.sonyengine; + +import javax.ws.rs.Path; + +@Path ("tag") +public class TagResource { + + public void get(String id) { + } + +} + +