use of com.datatorrent.stram.plan.logical.LogicalPlan.ModuleMeta in project apex-core by apache.
the class StramWebServices method getOperatorProperties.
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/properties")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getOperatorProperties(@PathParam("operatorName") String operatorName, @QueryParam("propertyName") String propertyName) throws IOException, JSONException {
init();
OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
BeanMap operatorProperties = null;
if (logicalOperator == null) {
ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName);
if (logicalModule == null) {
throw new NotFoundException();
}
operatorProperties = LogicalPlanConfiguration.getObjectProperties(logicalModule.getOperator());
} else {
operatorProperties = LogicalPlanConfiguration.getObjectProperties(logicalOperator.getOperator());
}
Map<String, Object> m = getPropertiesAsMap(propertyName, operatorProperties);
return new JSONObject(objectMapper.writeValueAsString(m));
}
use of com.datatorrent.stram.plan.logical.LogicalPlan.ModuleMeta in project apex-core by apache.
the class StramWebServices method getPort.
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports/{portName}")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getPort(@PathParam("operatorName") String operatorName, @PathParam("portName") String portName) {
init();
OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
Set<LogicalPlan.InputPortMeta> inputPorts;
Set<LogicalPlan.OutputPortMeta> outputPorts;
if (logicalOperator == null) {
ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName);
if (logicalModule == null) {
throw new NotFoundException();
}
inputPorts = logicalModule.getInputStreams().keySet();
outputPorts = logicalModule.getOutputStreams().keySet();
} else {
inputPorts = logicalOperator.getInputStreams().keySet();
outputPorts = logicalOperator.getOutputStreams().keySet();
}
try {
JSONObject resp = getPortObject(inputPorts, outputPorts, portName);
if (resp != null) {
return resp;
}
} catch (JSONException ex) {
throw new RuntimeException(ex);
}
throw new NotFoundException();
}
use of com.datatorrent.stram.plan.logical.LogicalPlan.ModuleMeta in project apex-core by apache.
the class LogicalPlanConfiguration method setModuleConfiguration.
private void setModuleConfiguration(final LogicalPlan dag, List<AppConf> appConfs, String appName) {
for (final ModuleMeta mw : dag.getAllModules()) {
List<OperatorConf> opConfs = getMatchingChildConf(appConfs, mw.getName(), StramElement.OPERATOR);
Map<String, String> opProps = getProperties(getPropertyArgs(mw), opConfs, appName);
setOperatorProperties(mw.getGenericOperator(), opProps);
}
}
use of com.datatorrent.stram.plan.logical.LogicalPlan.ModuleMeta in project apex-core by apache.
the class StramWebServices method getPorts.
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getPorts(@PathParam("operatorName") String operatorName) {
init();
OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
Set<LogicalPlan.InputPortMeta> inputPorts;
Set<LogicalPlan.OutputPortMeta> outputPorts;
if (logicalOperator == null) {
ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName);
if (logicalModule == null) {
throw new NotFoundException();
}
inputPorts = logicalModule.getInputStreams().keySet();
outputPorts = logicalModule.getOutputStreams().keySet();
} else {
inputPorts = logicalOperator.getInputStreams().keySet();
outputPorts = logicalOperator.getOutputStreams().keySet();
}
JSONObject result = getPortsObjects(inputPorts, outputPorts);
return result;
}
Aggregations