Package common

Examples of common.Response


 
  public AOR getAOR(String objectName) {
    AOR lookupAOR = new AOR(this.lookupAddress, this.lookupPort, 0);
    Request request = new Request(lookupAOR, "getAOR",
        (new Object[] {objectName}));
    Response response = Requestor.getInstance().sendInvocation(request);
    return ((AOR) response.getResult());
  }
View Full Code Here


   
    AOR objectAOR = new AOR(localAddress, objectPort, objectId);
    Object[] arguments = new Object[] {objectName, objectAOR};
    AOR lookupAOR = new AOR(this.lookupAddress, this.lookupPort, 0);
    Request request = new Request(lookupAOR, "register", arguments);
    Response response = Requestor.getInstance().sendInvocation(request);
   
    if (!response.getResult().equals("Registrado."))
      Invoker.getInstance().unregister(objectId);
   
    return ((String) response.getResult());
  }
View Full Code Here

  }
 
  public String[] list() {
    AOR lookupAOR = new AOR(this.lookupAddress, this.lookupPort, 0);
    Request request = new Request(lookupAOR, "list", (new Object[] {}));
    Response response = Requestor.getInstance().sendInvocation(request);
    return ((String[]) response.getResult());
  }
View Full Code Here

    return instance;
  }
 
  public byte[] invoke(byte[] serializedRequest) {
    Request request = (Request) Marshaller.deserialize(serializedRequest);
    Response response = new Response();
    int id = request.getAOR().getId();
    String operation = request.getOperation();
    Object[] arguments = request.getArguments();
    Class<?>[] argTypes = new Class<?>[arguments.length];
   
    for (int i = 0; i < arguments.length; i++)
      argTypes[i] = arguments[i].getClass();
   
    try {
      Method method = objectList.get(id).getClass().getMethod(operation,
          argTypes);
      Object result = method.invoke(objectList.get(id), arguments);
      response.setResult(result);
    } catch (NoSuchMethodException | SecurityException |
         IllegalAccessException | IllegalArgumentException |
         InvocationTargetException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

  public void run() {
    String address = this.request.getAOR().getAddress();
    int port = this.request.getAOR().getPort();
    byte[] serializedResponse = CRH.getInstance().send(address, port,
        Marshaller.serialize(request));
    Response response =
        ((Response) Marshaller.deserialize(serializedResponse));
    this.callbackObject.run(response.getResult());
  }
View Full Code Here

TOP

Related Classes of common.Response

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.