Skip to content

Commit

Permalink
Integrate ESH-EXSR
Browse files Browse the repository at this point in the history
  • Loading branch information
Conor Flynn committed Mar 13, 2023
1 parent e05ddf1 commit 653694e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ public Engine() {
// source: source of the local stream to initialize
public Response processSTRT(Packet packet) {
// start output processes:
Response out_response = send("OUT", "STRT");
if(out_response.code() != 200)
return out_response;
//TODO: RE-ENABLE
// Response out_response = send("OUT", "STRT");
// if(out_response.code() != 200)
// return out_response;

// start local stream handler processes:
String lsh_type = Config.getProperty("stream", "local.stream.type");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public class Config {
Properties stream_properties = new Properties();
stream_properties.put("general.consumer.types", "socket_consumer");
stream_properties.put("general.producer.types", "socket_producer");
stream_properties.put("rest.socket.address", "DataEngine");
//stream_properties.put("rest.socket.address", "localhost");
//stream_properties.put("rest.socket.address", "DataEngine");
stream_properties.put("rest.socket.address", "localhost");
stream_properties.put("rest.socket.port", "61100");
stream_properties.put("rest.socket.key", "rest-key-reserved");
// stream_properties.put("output.socket.address", "defi-de.idea.rpi.edu");
stream_properties.put("output.socket.address", "RestApp");
// stream_properties.put("output.socket.address", "localhost");
//stream_properties.put("output.socket.address", "RestApp");
stream_properties.put("output.socket.address", "localhost");
stream_properties.put("output.socket.port", "61200");
stream_properties.put("local.stream.type", "mongo_db");
//stream_properties.put("local.stream.type", "mongo_db");
stream_properties.put("local.stream.type", "null");
stream_properties.put("mongodb.properties.uri", "mongodb://MONGO:27017");
stream_properties.put("mongodb.database.state", "main-state-db");
stream_properties.put("mongodb.database.main", "main-db");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@ public ExternalStreamHandler() {
manager = new ExternalStreamManager(this);
}

// type: type of data
public Response processEXSR(Packet packet) {
String validate;
if((validate = packet.validate("type")) != null)
return ResponseFactory.response500("ExternalStreamHandler", validate);

return ResponseFactory.response200(String.format("%s", manager.containsType(packet.getData("type"))));
}

// type: type of data
// url_path (opt): path of the url
// properties (opt):properties required for call
// headers (opt): headers required for call
public Response processRQST(Packet packet) {
String validate;
if((validate = packet.validate("type")) != null)
return ResponseFactory.response500("ExternalStreamHandler", validate);

Object[] response;

// check to see if dated
// if not
if((validate = packet.validate("startDate", "endDate")) != null)
response = manager.request(packet.getData("type"), packet.getData());

// if dated
else
response = manager.request(packet.getData("type"), packet.getData(), packet.getData("startDate"), packet.getData("endDate"));

// check to see if valid
if(!((boolean)response[0])) {

}
}

// // source: source of data
// public Response processEXSR(Packet packet) {
// String validate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ protected ExternalStreamManager(ExternalStreamHandler handler) {
}
}

public boolean containsType(String type) {
return manager.hasRequestFormat(type);
}

protected Object[] request(String type, HashMap<String, String> data) {
return request(type, data, null, null);
}
Expand Down Expand Up @@ -86,6 +90,6 @@ public void processRequest(String collection, HashMap<String, String> data) {
if(data == null || data.isEmpty())
return;


// TODO: FINISH
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ data.path= response,\
# which have specific properties and handlers. Please review documentation to get a full
# list of these tags. To default with no recursive call, set this property to <single>.
# This property we will set to <parameterized> for a clearer example.
recursion.type= parameterized
recursion.type= rest

# [OPTIONAL]:
# - url.recursion.type = static
Expand Down

0 comments on commit 653694e

Please sign in to comment.