Package org.hpi.dialogue.protocol.response

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


  }

  @Override
  public String execute(HPIClientProtocol clientProtocol) {
    // invoking shutdown
    ServerShutdownResponse shutdownResponse = clientProtocol.serverShutdown();
    if (shutdownResponse.getStatus().equals(Response.Status.SUCCESS)) {
      return shutdownResponse.getMessage();
    } else if (shutdownResponse.getStatus().equals(Response.Status.FAIL)) {
      throw new RuntimeException(shutdownResponse.getMessage());
    } else throw new IllegalStateException("Unkonw the server's status code response");
  }
View Full Code Here


      Response.Status responseStatus = Response.Status.valueOf(ssdHpiMessage.getLeaf(HPIDialogueConstants.STATUS).getValue());
     
      if (serviceName.equals(HPIDialogueConstants.LOGIN_SERVICE)) {
        return new LoginResponse(parameters.getLeaf(HPIDialogueConstants.SESSION_ID).getValue(), responseMessage, responseStatus);
      } else if (serviceName.equals(HPIDialogueConstants.SERVER_SHUTDOWN_SERVICE)) {
        return new ServerShutdownResponse(responseMessage, responseStatus);
      } else if (serviceName.equals(HPIDialogueConstants.LIST_INVOKERS_SERVICE)) {
        List<Invoker> listInvokers = new ArrayList<Invoker>();
       
        SSDObjectArray ssdListInvokers = parameters.getArray(HPIDialogueConstants.LIST_INVOKERS);
        for (int i = 0; i < ssdListInvokers.getSize(); i ++) {
View Full Code Here

    }
   
    public void run() {
        Alert a = null;
        try {
            ServerShutdownResponse shutdownResponse = this.parent.getHPIClientProtocol().serverShutdown();
           
            if (shutdownResponse.getStatus().equals(Response.Status.SUCCESS)) {
                HPIUiAlert.show("Shutdown Server Message", shutdownResponse.getMessage(), "Ok", this.parent.getForm());
            } else {
                HPIUiAlert.show("Server Message", shutdownResponse.getMessage(), "Ok", this.parent.getForm());
            }
        } catch (Exception e) {
            HPIUiAlert.show("Processing Error Message", e.getMessage(), "Back", this.parent.getForm());
        }
        a.setTimeout(Alert.FOREVER);
View Full Code Here

      Response.Status responseStatus = Response.Status.valueOf(ssdHpiMessage.getLeaf(HPIDialogueConstants.STATUS).getValue());
     
      if (serviceName.equals(HPIDialogueConstants.LOGIN_SERVICE)) {
        return new LoginResponse(parameters.getLeaf(HPIDialogueConstants.SESSION_ID).getValue(), responseMessage, responseStatus);
      } else if (serviceName.equals(HPIDialogueConstants.SERVER_SHUTDOWN_SERVICE)) {
        return new ServerShutdownResponse(responseMessage, responseStatus);
      } else if (serviceName.equals(HPIDialogueConstants.LIST_INVOKERS_SERVICE)) {
        Vector listInvokers = new Vector();
       
        SSDObjectArray ssdListInvokers = parameters.getArray(HPIDialogueConstants.LIST_INVOKERS);
        for (int i = 0; i < ssdListInvokers.getSize(); i ++) {
View Full Code Here

            } catch (InterruptedException e) {
              throw new RuntimeException(e);
            }
          }
        }.start();
        response = new ServerShutdownResponse("Request to shutdown server received successfully and schedulled to execute in 5 seconds.", Response.Status.SUCCESS);
      } else throw new IllegalStateException("Request type unknown.");
     
      // writing the serialized response
      serverProtocol.writeResponse(response);
    } catch (Exception e) {
View Full Code Here

      SSDRootObject ssdSettingsData = ssdCtx.getRootObject();

      SSDObjectNode ssdConfiguration = ssdSettingsData.getNode(HPIConstants.CONFIGURATIONS_CONFIG_SERVER);
      int portNumber = Integer.parseInt(ssdConfiguration.getLeaf(HPIConstants.CONFIGURATIONS_PORT_NUMBER).getValue());
      HPIClientProtocol clientProtocol = new HPIClientProtocol("127.0.0.1", portNumber);
      ServerShutdownResponse shutdownResponse = clientProtocol.serverShutdown();
     
      log.info(shutdownResponse.getMessage());
    } catch (Exception e) {
      log.error(e);
      System.exit(1);
    }
    System.exit(0);
View Full Code Here

TOP

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

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.