Skip to content

Commit

Permalink
Merge pull request #476 from openworm/development
Browse files Browse the repository at this point in the history
Release 0.3.1
  • Loading branch information
tarelli authored Aug 17, 2016
2 parents e60a6c0 + f014dd1 commit 97277ed
Show file tree
Hide file tree
Showing 162 changed files with 33,269 additions and 4,208 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,18 @@ src/main/webapp/css/main.css
/.externalToolBuilders/
/.settings/
.classpath

#WormSim specific stuff
*.css-e
*.less-e
src/main/webapp/js/components/dev/customrenderer/
src/main/webapp/js/components/dev/wormsimbuttonbar/
src/main/webapp/js/components/dev/wormsimlogo/
src/main/webapp/js/components/dev/wormsimsimulationcontrols/
src/main/webapp/js/components/dev/wormsimtutorialhandler/
src/main/webapp/js/components/wormsim.*

#other local directories that may get installed
org.geppetto.core/
org.geppetto.model/
org.geppetto.simulation/
6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
Expand Down Expand Up @@ -33,5 +38,6 @@
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>com.aptana.ruby.core.rubynature</nature>
</natures>
</projectDescription>
13 changes: 1 addition & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@ language: java
before_script:
- npm install -g bower
install:
- git clone https://github.com/openworm/org.geppetto.model.git -b $TRAVIS_BRANCH
- cd org.geppetto.model
- mvn install
- cd ..
- git clone https://github.com/openworm/org.geppetto.core.git -b $TRAVIS_BRANCH
- cd org.geppetto.core
- mvn install
- cd ..
- git clone https://github.com/openworm/org.geppetto.simulation.git -b $TRAVIS_BRANCH
- cd org.geppetto.simulation
- mvn install
- cd ..
- ./travis-install.sh
env:
global:
secure: EvqtUrZj3GsqzAkjZIVf2ZIze6ec72G8Dnkc0J3lKxwDTK6+KgIYgRWUWWO6tzL5Mn3Y+kkiHvyAkrHNPb2QZVBAdOdE3O308WRi64FF71nurd46zE43K/sSxcX/zCoBtxsz49oRcluPWl+nGDi/iKEysgcnQCvz23VWEYHAsOk=
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = function(grunt) {
'src/main/webapp/templates/dist/dashboard.vm': ['src/main/webapp/templates/dashboard.vm'],
'src/main/webapp/WEB-INF/web.xml': ['src/main/webapp/WEB-INF/web.xml'],
'src/main/webapp/templates/dist/GeppettoCoreTests.vm': ['src/main/webapp/templates/GeppettoCoreTests.vm'],
'src/main/webapp/templates/dist/GeppettoComponentsTests.vm': ['src/main/webapp/templates/GeppettoComponentsTests.vm'],
'src/main/webapp/templates/dist/GeppettoFluidDynamicsTests.vm': ['src/main/webapp/templates/GeppettoFluidDynamicsTests.vm'],
'src/main/webapp/templates/dist/GeppettoNeuronalCustomTests.vm': ['src/main/webapp/templates/GeppettoNeuronalCustomTests.vm'],
'src/main/webapp/templates/dist/GeppettoNeuronalTests.vm': ['src/main/webapp/templates/GeppettoNeuronalTests.vm'],
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.geppetto</groupId>
<artifactId>frontend</artifactId>
<version>0.3.0</version>
<version>0.3.1</version>
<name>Geppetto Frontend</name>
<packaging>war</packaging>
<properties>
<contextPath>org.geppetto.frontend</contextPath>
<spring.version>3.1.3.RELEASE</spring.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public String testNeuronalCustom()
return "dist/GeppettoNeuronalCustomTests";
}

@RequestMapping(value = "/GeppettoComponentsTests.html", method = RequestMethod.GET)
public String testComponents()
{
return "dist/GeppettoComponentsTests";
}

@RequestMapping(value = "/GeppettoCoreTests.html", method = RequestMethod.GET)
public String testCore()
{
Expand Down
109 changes: 99 additions & 10 deletions src/main/java/org/geppetto/frontend/controllers/ConnectionHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import org.geppetto.core.utilities.URLReader;
import org.geppetto.core.utilities.Zipper;
import org.geppetto.frontend.Resources;
import org.geppetto.frontend.controllers.WebsocketConnection.RunnableQueryParameters;
import org.geppetto.frontend.messages.OutboundMessages;
import org.geppetto.model.ExperimentState;
import org.geppetto.model.GeppettoModel;
Expand All @@ -81,6 +82,7 @@
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;

/**
Expand Down Expand Up @@ -231,6 +233,31 @@ public void newExperiment(String requestID, long projectId)

}

/**
* @param projectId
*/
public void cloneExperiment(String requestID, long projectId, long experimentID)
{

IGeppettoProject project = retrieveGeppettoProject(projectId);

try
{
IExperiment originalExperiment = retrieveExperiment(experimentID, project);
IExperiment cloneExperiment = geppettoManager.cloneExperiment(requestID, project, originalExperiment);

Gson gson = new Gson();
String json = gson.toJson(cloneExperiment);
websocketConnection.sendMessage(requestID, OutboundMessages.EXPERIMENT_CREATED, json);

}
catch(GeppettoExecutionException | GeppettoAccessException e)
{
error(e, "Error creating a new experiment");
}

}

/**
* @param requestID
* @param experimentID
Expand Down Expand Up @@ -311,14 +338,13 @@ public void runExperiment(String requestID, long experimentID, long projectId)
* @param dataSourceId
* @param variableId
*/
public void fetchVariable(String requestID, Long projectId, Long experimentId, String dataSourceId, String variableId)
public void fetchVariable(String requestID, Long projectId, String dataSourceId, String variableId)
{
IGeppettoProject geppettoProject = retrieveGeppettoProject(projectId);
IExperiment experiment = retrieveExperiment(experimentId, geppettoProject);
try
{
GeppettoModel geppettoModel = geppettoManager.fetchVariable(dataSourceId, variableId, experiment, geppettoProject);
GeppettoModel geppettoModel = geppettoManager.fetchVariable(dataSourceId, variableId, geppettoProject);

String serializedModel = GeppettoSerializer.serializeToJSON(geppettoModel, true);

websocketConnection.sendMessage(requestID, OutboundMessages.VARIABLE_FETCHED, serializedModel);
Expand Down Expand Up @@ -348,28 +374,56 @@ public void fetchVariable(String requestID, Long projectId, Long experimentId, S
* @param experimentId
* @param dataSourceServiceId
* @param variableId
* @throws GeppettoExecutionException
* @throws GeppettoExecutionException
*/
public void resolveImportType(String requestID, Long projectId, Long experimentId, String typePath)
public void resolveImportType(String requestID, Long projectId, List<String> typePaths)
{
IGeppettoProject geppettoProject = retrieveGeppettoProject(projectId);
IExperiment experiment = retrieveExperiment(experimentId, geppettoProject);
try
{
GeppettoModel geppettoModel = geppettoManager.resolveImportType(typePath, experiment, geppettoProject);
GeppettoModel geppettoModel = geppettoManager.resolveImportType(typePaths, geppettoProject);
websocketConnection.sendMessage(requestID, OutboundMessages.IMPORT_TYPE_RESOLVED, GeppettoSerializer.serializeToJSON(geppettoModel, true));
}
catch(IOException e)
{
error(e, "Error importing type " + typePath);
error(e, "Error importing type " + typePaths);
}
catch(GeppettoExecutionException e)
{
error(e, "Error importing type " + typePath);
error(e, "Error importing type " + typePaths);
}

}

public void runQuery(String requestID, Long projectId, List<RunnableQueryParameters> runnableQueries)
{
IGeppettoProject geppettoProject = retrieveGeppettoProject(projectId);
// GeppettoModel geppettoModel = geppettoManager.runQuery(typePaths, geppettoProject);
// websocketConnection.sendMessage(requestID, OutboundMessages.QUERY_RESULT, GeppettoSerializer.serializeToJSON(geppettoModel, true));

}

/**
* @param requestID
* @param projectId
* @param runnableQueries
*/
public void runQueryCount(String requestID, Long projectId, List<RunnableQueryParameters> runnableQueries)
{
IGeppettoProject geppettoProject = retrieveGeppettoProject(projectId);
int count;
try
{
count = geppettoManager.runQueryCount(null, geppettoProject);
// websocketConnection.sendMessage(requestID, OutboundMessages.QUERY_RESULT, GeppettoSerializer.serializeToJSON(geppettoModel, true));
websocketConnection.sendMessage(requestID, OutboundMessages.RETURN_QUERY_COUNT, Integer.toString(count));
}
catch(GeppettoDataSourceException | GeppettoModelException | GeppettoExecutionException e)
{
error(e, "Error running query count");
}
}

/**
* Adds watch lists with variables to be watched
*
Expand Down Expand Up @@ -566,6 +620,40 @@ public void sendScriptData(String requestID, URL url, WebsocketConnection visito
}
}

/**
* @param requestID
* @param url
* @param visitor
*/
public void sendDataSourceResults(String requestID, String dataSourceName, URL url, WebsocketConnection visitor)
{
try
{
String line = null;
StringBuilder sb = new StringBuilder();

BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));

while((line = br.readLine()) != null)
{
sb.append(line + "\n");
}
String script = sb.toString();

JsonObject obj = new JsonObject();
obj.addProperty("data_source_name", dataSourceName);
obj.addProperty("results", script);

String message = obj.toString();

websocketConnection.sendMessage(requestID, OutboundMessages.DATASOURCE_RESULTS_FETCHED, message);
}
catch(IOException e)
{
error(e, "Error while reading the script at " + url);
}
}

/**
* @param requestID
* @param modelPath
Expand Down Expand Up @@ -1127,6 +1215,7 @@ public void saveExperimentProperties(String requestID, long projectId, long expe
}
}
}
websocketConnection.sendMessage(requestID, OutboundMessages.EXPERIMENT_PROPS_SAVED, "");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,27 @@ public void removeConnection(WebsocketConnection websocketConnection)
{
if(_connections.contains(websocketConnection))
{
_connections.remove(websocketConnection.getConnectionID());
if(websocketConnection.getConnectionID() != null)
{
_connections.remove(websocketConnection.getConnectionID());
}
else
{
//TODO Sometimes for some reason the websocketConnection has null as ID, need to investigate more
String toRemove = null;
for(String key : _connections.keySet())
{
if(_connections.get(key).equals(websocketConnection))
{
toRemove = key;
break;
}
}
if(toRemove != null)
{
_connections.remove(toRemove);
}
}
_logger.info("Websocket connection removed " + websocketConnection.getConnectionID());
}
}
Expand Down
Loading

0 comments on commit 97277ed

Please sign in to comment.