Github user davidyan74 commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/148#discussion_r47173222
  
    --- Diff: 
engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java ---
    @@ -668,25 +752,29 @@ public JSONObject getPort(@PathParam("operatorName") 
String operatorName, @PathP
         if (logicalOperator == null) {
           throw new NotFoundException();
         }
    +
         try {
    -      for (LogicalPlan.InputPortMeta inputPort : 
logicalOperator.getInputStreams().keySet()) {
    -        if (portName.equals(portName)) {
    -          JSONObject port = new JSONObject();
    -          port.put("name", inputPort.getPortName());
    -          port.put("type", "input");
    -          return port;
    -        }
    -      }
    -      for (LogicalPlan.OutputPortMeta outputPort : 
logicalOperator.getOutputStreams().keySet()) {
    -        if (portName.equals(portName)) {
    -          JSONObject port = new JSONObject();
    -          port.put("name", outputPort.getPortName());
    -          port.put("type", "output");
    -          return port;
    -        }
    -      }
    +      JSONObject resp = 
getPortObject(logicalOperator.getInputStreams().keySet(), 
logicalOperator.getOutputStreams().keySet(), portName);
    +      if (resp != null) return resp;
    +    } catch (JSONException ex) {
    +      throw new RuntimeException(ex);
         }
    -    catch (JSONException ex) {
    +    throw new NotFoundException();
    +  }
    +
    +  @GET
    +  @Path(PATH_LOGICAL_PLAN_MODULES + "/{moduleName}/ports/{portName}")
    +  @Produces(MediaType.APPLICATION_JSON)
    +  public JSONObject getProxyPort(@PathParam("moduleName") String 
moduleName, @PathParam("portName") String portName)
    +  {
    +    ModuleMeta logicalModule = dagManager.getModuleMeta(moduleName);
    +    if (logicalModule == null) {
    +      throw new NotFoundException();
    +    }
    +    try {
    +      JSONObject resp = 
getPortObject(logicalModule.getInputStreams().keySet(), 
logicalModule.getOutputStreams().keySet(), portName);
    +      if (resp != null) return resp;
    --- End diff --
    
    nitpick style: if, while, and for always should be followed by open brace 
even if it's just one line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to