Skip to content

Commit

Permalink
Merge pull request #786 from ericstephan/develop
Browse files Browse the repository at this point in the history
adding access to bulk loading simulation input and output simulation …
  • Loading branch information
poorva1209 authored Feb 4, 2019
2 parents 857d0c4 + 2a986d4 commit fc8e233
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
4 changes: 2 additions & 2 deletions gov.pnnl.goss.gridappsd/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
blazegraph.cim2glm;version=8.0,\
httpclient,\
com.bigdata.rdf,\
proven-client,\
proven-message
proven-client;version=0.2.1,\
proven-message;version=0.2

-plugin org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;log=debug

Expand Down
10 changes: 9 additions & 1 deletion gov.pnnl.goss.gridappsd/conf/pnnl.goss.gridappsd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ services.path = /gridappsd/services
# docker-compose default network.
blazegraph.host.path = http://blazegraph:8080/bigdata/namespace/kb/sparql


# Deprecated original path
# Uses docker composed proven host here. Note this is not the
# external address, but from inside one of the containers on the
# docker-compose default network.
proven.path = http://proven:8080/hybrid/rest/v1/repository/provenMessage

# Uses docker composed proven host here. Note this is not the
# external address, but from inside one of the containers on the
# docker-compose default network.
proven.write.path = http://proven:8080/hybrid/rest/v1/repository/addBulkTimeSeries

# Uses docker composed proven host here. Note this is not the
# external address, but from inside one of the containers on the
# docker-compose default network.
proven.query.path = http://proven:8080/hybrid/rest/v1/repository/provenMessage
4 changes: 2 additions & 2 deletions gov.pnnl.goss.gridappsd/run.bnd.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
org.eclipse.jetty.aggregate.jetty-all-server;version=7.6.9,\
javax.servlet-api,\
com.bigdata.rdf,\
proven-message,\
proven-client,\
proven-message;version=0.2,\
proven-client;version=0.2.1,\
javax.ws.rs-api,\
org.apache.commons.codec,\
shacl,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class ProvenTimeSeriesDataManagerImpl implements TimeseriesDataManager, D
String requestId = null;
Gson gson = new Gson();
String provenUri = null;
String provenQueryUri = null;
String provenWriteUri = null;

ProvenProducer provenProducer = new ProvenProducer();

@Start
Expand All @@ -67,7 +70,8 @@ public void start(){

dataManager.registerDataManagerHandler(this, DATA_MANAGER_TYPE);
provenUri = configManager.getConfigurationProperty(GridAppsDConstants.PROVEN_PATH);

provenWriteUri = configManager.getConfigurationProperty(GridAppsDConstants.PROVEN_WRITE_PATH);
provenQueryUri = configManager.getConfigurationProperty(GridAppsDConstants.PROVEN_QUERY_PATH);
try{

Credentials credentials = new UsernamePasswordCredentials(
Expand Down Expand Up @@ -119,7 +123,7 @@ else if(requestContent instanceof String){
@Override
public Serializable query(RequestTimeseriesData requestTimeseriesData) throws Exception {

provenProducer.restProducer(provenUri, null, null);
provenProducer.restProducer(provenQueryUri, null, null);
provenProducer.setMessageInfo("GridAPPSD", "QUERY", this.getClass().getSimpleName(), keywords);
ProvenResponse response = provenProducer.sendMessage(requestTimeseriesData.toString(), requestId);

Expand All @@ -138,20 +142,26 @@ public Serializable query(RequestTimeseriesData requestTimeseriesData) throws Ex

@Override
public void storeSimulationOutput(Serializable message) throws Exception {

provenProducer.restProducer(provenUri, null, null);
provenProducer.setMessageInfo("GridAPPSD", "SimulationOutput", this.getClass().getSimpleName(), keywords);
provenProducer.sendMessage(message.toString(), requestId);
try {
provenProducer.restProducer(provenWriteUri, null, null);
ProvenResponse pmr = provenProducer.sendBulkMessage(message.toString(), null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}



@Override
public void storeSimulationInput(Serializable message) throws Exception {

provenProducer.restProducer(provenUri, null, null);
provenProducer.setMessageInfo("GridAPPSD", "SimulationInput", this.getClass().getSimpleName(), keywords);
provenProducer.sendMessage(message.toString(), requestId);
try {
provenProducer.restProducer(provenWriteUri, null, null);
ProvenResponse pmr = provenProducer.sendBulkMessage(message.toString(), null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public class GridAppsDConstants {
public static final String SERVICES_PATH = "services.path";
public static final String BLAZEGRAPH_HOST_PATH = "blazegraph.host.path";
public static final String PROVEN_PATH = "proven.path";
public static final String PROVEN_WRITE_PATH = "proven.write.path";
public static final String PROVEN_QUERY_PATH = "proven.query.path";

public static final SimpleDateFormat SDF_SIMULATION_REQUEST = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
public static final SimpleDateFormat SDF_GLM_CLOCK = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Expand Down Expand Up @@ -258,4 +260,4 @@ public static void logMessage(LogManager logManager, String fromClass, String me
//??? what to do if they didn't set a log manager?
}
}
}
}

0 comments on commit fc8e233

Please sign in to comment.