Package org.hpi.dialogue.protocol.response

Examples of org.hpi.dialogue.protocol.response.ListInvokersResponse


  @Override
  public String execute(HPIClientProtocol clientProtocol) {
    // list invokers
    StringBuffer returning = new StringBuffer();
    ListInvokersResponse invokersResponse = clientProtocol.listInvokers(this.getSessionId());
    if (invokersResponse.getStatus().equals(Response.Status.SUCCESS)) {
      List<Invoker> invokers = invokersResponse.getListInvokers();
      if (GeneralsHelper.isCollectionOk(invokers)) {
        for (Invoker invoker : invokers) {
          returning.append("\n");
          returning.append("\t" + invoker.getId());
        }
      } else {
        returning.append("The server has not found no invoker.");
      }
    } else if (invokersResponse.getStatus().equals(Response.Status.FAIL)) {
      returning.append(invokersResponse.getMessage());
    } else throw new IllegalStateException("Unkonw the server's status code response");
   
    return returning.toString();
  }
View Full Code Here


          }
         
          listInvokers.add(invoker);
        }
       
        return new ListInvokersResponse(listInvokers, responseMessage, responseStatus);
      } else if (serviceName.equals(HPIDialogueConstants.DESCRIBE_INVOKER_SERVICE)) {
        SSDObjectNode ssdInvoker = parameters.getNode(HPIDialogueConstants.INVOKER);
        Invoker invoker = new Invoker();
        invoker.setId(ssdInvoker.getLeaf(HPIDialogueConstants.ID).getValue());
        invoker.setDescription(ssdInvoker.getLeaf(HPIDialogueConstants.DESCRIPTION).getValue());
View Full Code Here

        this.parent = parent;
    }
   
    public void run() {
        try {
            ListInvokersResponse listInvokersResponse = this.parent.getHPIClientProtocol().listInvokers(this.parent.getLoginResponse().getSessionId());
            if (listInvokersResponse.getStatus().equals(Response.Status.SUCCESS)) {
                int listSize = listInvokersResponse.getListInvokers().size();
               
                String[] idsInvokers = null;
                if (listSize == 0) {
                    idsInvokers = new String[]{"The server has not found no invoker."};
                } else {
                    idsInvokers = new String[listSize];
                    for (int i = 0; i < listSize; i++) {
                        Invoker invoker = (Invoker) listInvokersResponse.getListInvokers().elementAt(i);
                        idsInvokers[i] = invoker.getId();
                    }
                }
               
                Image[] imageArray = null;
               
                this.cmdBack = new Command("Back", Command.EXIT, 2);
                this.cmdConsultInvoker = new Command("Consult Invoker", Command.ITEM, 1);
               
                this.list = new List("List Invokers", Choice.IMPLICIT, idsInvokers, imageArray);
                this.list.setCommandListener(this);
                this.list.addCommand(this.cmdBack);
                this.list.addCommand(this.cmdConsultInvoker);
               
                this.getDisplay().setCurrent(this.list);
            } else {
                throw new RuntimeException(listInvokersResponse.getMessage());
            }
        } catch (Exception e) {
            HPIUiAlert.show("Server Message", e.getMessage(), "Done", this.parent.getForm());
        }
    }
View Full Code Here

          }
         
          listInvokers.addElement(invoker);
        }
       
        return new ListInvokersResponse(listInvokers, responseMessage, responseStatus);
      } else if (serviceName.equals(HPIDialogueConstants.DESCRIBE_INVOKER_SERVICE)) {
        SSDObjectNode ssdInvoker = parameters.getNode(HPIDialogueConstants.INVOKER);
        Invoker invoker = new Invoker();
        invoker.setId(ssdInvoker.getLeaf(HPIDialogueConstants.ID).getValue());
        invoker.setDescription(ssdInvoker.getLeaf(HPIDialogueConstants.DESCRIPTION).getValue());
View Full Code Here

    try {
      HPISessionManager sessionManager = HPISessionManager.getInstance();
      sessionManager.updateSession(request.getSessionId());
      HPIDataFactory dataFactory = HPIDataFactory.getInstance();
      listInvokers = new ArrayList<Invoker>(dataFactory.getInvokers());
      return new ListInvokersResponse(listInvokers, "List invokers executed successfully.", Response.Status.SUCCESS);
    } catch (HPISessionException e) {
      return new ListInvokersResponse(listInvokers, "The session is not valid. " + e.getMessage(), Response.Status.FAIL);
    }
  }
View Full Code Here

TOP

Related Classes of org.hpi.dialogue.protocol.response.ListInvokersResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.