Examples of URLString


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
    SCMPMessage scmpReply = new SCMPMessage();
    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

    if (this.attached == false) {
      throw new SCServiceException("Client not attached - getStateOfServices not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_SC_VERSION);
    String body = this.inspectCall(Constants.DEFAULT_OPERATION_TIMEOUT_SECONDS, urlString);
    URLString urlResponse = new URLString();
    urlResponse.parseResponseURLString(body);
    return urlResponse.getParameterMap().get(Constants.CC_CMD_SC_VERSION);
  }
View Full Code Here

Examples of org.serviceconnector.util.URLString

      throw new SCServiceException("Client not attached - isServiceEnabled not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_STATE, Constants.SERVICE_NAME, serviceName);
    try {
      String body = this.inspectCall(operationTimeout, urlString);
      URLString urlResponse = new URLString();
      urlResponse.parseResponseURLString(body);
      String value = urlResponse.getParamValue(serviceName);
      if (value != null && value.equals(Constants.STATE_ENABLED)) {
        return true;
      }
      return false;
    } catch (SCServiceException e) {
View Full Code Here

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);

    SCMPMessage scmpReply = new SCMPMessage();
    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");
        scmpReply = new SCMPMessageFault(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(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(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, serviceName + Constants.UNDERLINE + cacheId);
      scmpReply.setBody(cacheInspectString);
      response.setSCMP(scmpReply);
      // initiate responder to send reply
View Full Code Here

Examples of org.serviceconnector.util.URLString

    if (this.attached == false) {
      throw new SCServiceException("Client not attached - getStateOfServices not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_SC_VERSION);
    String body = this.inspectCall(Constants.DEFAULT_OPERATION_TIMEOUT_SECONDS, urlString);
    URLString urlResponse = new URLString();
    urlResponse.parseResponseURLString(body);
    return urlResponse.getParameterMap().get(Constants.CC_CMD_SC_VERSION);
  }
View Full Code Here

Examples of org.serviceconnector.util.URLString

      throw new SCServiceException("Client not attached - isServiceEnabled not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_STATE, Constants.SERVICE_NAME, serviceName);
    try {
      String body = this.inspectCall(operationTimeout, urlString);
      URLString urlResponse = new URLString();
      urlResponse.parseResponseURLString(body);
      String value = urlResponse.getParamValue(serviceName);
      if (value != null && value.equals(Constants.STATE_ENABLED)) {
        return true;
      }
      return false;
    } catch (SCServiceException e) {
View Full Code Here

Examples of org.serviceconnector.util.URLString

      throw new SCServiceException("Client not attached - getStateOfServices not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_STATE, Constants.SERVICE_NAME, serviceNamePattern);
    try {
      String body = this.inspectCall(operationTimeout, urlString);
      URLString urlResponse = new URLString();
      urlResponse.parseResponseURLString(body);
      return urlResponse.getParameterMap();
    } catch (SCServiceException serviceEx) {
      return new HashMap<String, String>();
    } catch (UnsupportedEncodingException e) {
      throw new SCServiceException(e.toString());
    }
View Full Code Here

Examples of org.serviceconnector.util.URLString

      throw new SCServiceException("Client not attached - getServiceConfiguration not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_SERVICE_CONF, Constants.SERVICE_NAME, serviceName);
    try {
      String body = this.inspectCall(operationTimeout, urlString);
      URLString urlResponse = new URLString();
      urlResponse.parseResponseURLString(body);
      return urlResponse.getParameterMap();
    } catch (UnsupportedEncodingException e) {
      throw new SCServiceException(e.toString());
    }
  }
View Full Code Here

Examples of org.serviceconnector.util.URLString

      throw new SCServiceException("Client not attached - isServiceEnabled not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_SESSIONS, Constants.SERVICE_NAME, serviceName);
    String body = this.inspectCall(operationTimeoutSeconds, urlString);
    try {
      URLString urlResponse = new URLString();
      urlResponse.parseResponseURLString(body);
      return urlResponse.getParameterMap();
    } catch (UnsupportedEncodingException e) {
      throw new SCServiceException(e.toString());
    }
  }
View Full Code Here

Examples of org.serviceconnector.util.URLString

      throw new SCServiceException("Client not attached - inspectCache not possible.");
    }
    String urlString = URLString.toURLRequestString(Constants.CC_CMD_INSPECT_CACHE, Constants.CACHE_ID, cacheId);
    String body = this.inspectCall(operationTimeoutSeconds, urlString);
    try {
      URLString urlResponse = new URLString();
      urlResponse.parseResponseURLString(body);
      return urlResponse.getParameterMap();
    } catch (UnsupportedEncodingException e) {
      throw new SCServiceException(e.toString());
    }
  }
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.