Examples of URLString


Examples of org.serviceconnector.util.URLString

  public final void run(final IRequest request, final IResponse response, final IResponderCallback responderCallback)
      throws Exception {
    SCMPMessage reqMsg = request.getMessage();
    String bodyString = (String) reqMsg.getBody();

    URLString urlRequestString = new URLString();
    urlRequestString.parseRequestURLString(bodyString);
    String callKey = urlRequestString.getCallKey();
    String serviceName = urlRequestString.getParamValue(Constants.SERVICE_NAME);

    // SCMP Version request
    SCMPMessage scmpReply = new SCMPMessage(reqMsg.getSCMPVersion());
    scmpReply.setIsReply(true);
    InetAddress localHost = InetAddress.getLocalHost();
    scmpReply.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, localHost.getHostAddress());
    scmpReply.setMessageType(getKey());

    if (Constants.CC_CMD_STATE.equalsIgnoreCase(callKey)) {
      // state for service requested
      LOGGER.debug("state request for service=" + serviceName);
      try {
        // get state of all services
        scmpReply.setBody(this.getStateOfServicesString(serviceName));
      } catch (Exception e) {
        LOGGER.debug("service=" + serviceName + " not found");
        // SCMP Version request
        scmpReply = new SCMPMessageFault(reqMsg.getSCMPVersion(), SCMPError.SERVICE_NOT_FOUND, serviceName);
      }
      response.setSCMP(scmpReply);
      // initiate responder to send reply
      responderCallback.responseCallback(request, response);
      return;
    }
    if (Constants.CC_CMD_SESSIONS.equalsIgnoreCase(callKey)) {
      // state for service requested
      LOGGER.debug("sessions request for service=" + serviceName);
      try {
        // get sessions of all services
        scmpReply.setBody(this.getSessionsOfServicesString(serviceName));
      } catch (Exception e) {
        LOGGER.debug("service=" + serviceName + " not found");
        scmpReply = new SCMPMessageFault(reqMsg.getSCMPVersion(), SCMPError.SERVICE_NOT_FOUND, serviceName);
      }
      response.setSCMP(scmpReply);
      // initiate responder to send reply
      responderCallback.responseCallback(request, response);
      return;
    }
    if (Constants.CC_CMD_SERVICE_CONF.equalsIgnoreCase(callKey)) {
      LOGGER.debug("service configuration request for serviceName=" + serviceName);
      try {
        scmpReply.setBody(this.getServiceConfigurationString(serviceName));
      } catch (Exception e) {
        LOGGER.debug("service=" + serviceName + " not found");
        scmpReply = new SCMPMessageFault(reqMsg.getSCMPVersion(), SCMPError.SERVICE_NOT_FOUND, serviceName);
      }
      response.setSCMP(scmpReply);
      // initiate responder to send reply
      responderCallback.responseCallback(request, response);
      return;
    }
    if (Constants.CC_CMD_INSPECT_CACHE.equalsIgnoreCase(callKey)) {
      String cacheId = urlRequestString.getParamValue("cacheId");
      LOGGER.debug("cache inspect for serviceName=" + serviceName + ", cacheId=" + cacheId);
      String cacheInspectString = this.getCacheInspectString(serviceName, cacheId);
      scmpReply.setBody(cacheInspectString);
      response.setSCMP(scmpReply);
      // initiate responder to send reply
View Full Code Here

Examples of org.serviceconnector.util.URLString

  public void run(IRequest request, IResponse response, IResponderCallback responderCallback) throws Exception {
    SCMPMessage reqMsg = request.getMessage();
    String bodyString = (String) reqMsg.getBody();
    String ipAddress = reqMsg.getHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST);

    URLString urlRequestString = new URLString();
    urlRequestString.parseRequestURLString(bodyString);
    String callKey = urlRequestString.getCallKey();

    // set up response - SCMP Version request
    SCMPMessage scmpReply = new SCMPMessage(reqMsg.getSCMPVersion());
    scmpReply.setIsReply(true);
    scmpReply.setMessageType(getKey());
    InetAddress localHost = InetAddress.getLocalHost();
    scmpReply.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, localHost.getHostAddress());

    String serviceName = urlRequestString.getParamValue(Constants.SERVICE_NAME);

    // kill command
    if ((ipAddress.equals(localHost.getHostAddress())) && Constants.CC_CMD_KILL.equalsIgnoreCase(callKey)) {
      // kill request is allowed from localhost only!
      LOGGER.info("SC stopped by kill console command");
View Full Code Here

Examples of org.serviceconnector.util.URLString

   */
  private static int run(String host, int port, String bodyString) throws Exception {

    int status = 0;
    try {
      URLString urlRequestString = new URLString();
      urlRequestString.parseRequestURLString(bodyString);
      String callKey = urlRequestString.getCallKey();
      String serviceName = urlRequestString.getParamValue("serviceName");

      SCMgmtClient client = new SCMgmtClient(host, port, ConnectionType.NETTY_TCP);
      client.attach();

      if (callKey.equalsIgnoreCase(Constants.CC_CMD_KILL)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.