Package org.serviceconnector.scmp

Examples of org.serviceconnector.scmp.SCMPMessageFault


    if (th instanceof HasFaultResponseException) {
      ((HasFaultResponseException) th).setFaultResponse(response);
      response.write();
      return;
    }
    SCMPMessageFault fault = new SCMPMessageFault(SCMPVersion.LOWEST, SCMPError.SC_ERROR, th.getMessage()
        + " caught exception in web responder request handler");
    fault.setMessageType(SCMPMsgType.UNDEFINED);
    response.setSCMP(fault);
    response.write();
  }
View Full Code Here


    String sid = this.requestMessage.getSessionId();
    LOGGER.warn("receive exception sid=" + sid + " " + ex.toString());
    SCMPMessage fault = null;
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling
      fault = new SCMPMessageFault(SCMPError.OPERATION_TIMEOUT, "Operation timeout expired on SC sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(SCMPError.CONNECTION_EXCEPTION, "broken connection to server sid=" + sid);
    } else {
      fault = new SCMPMessageFault(SCMPError.SC_ERROR, "error executing " + this.msgType + " sid=" + sid);
    }
    // caching
    SCCacheManager manager = AppContext.getCacheManager();
    if (manager.isCacheEnabled() == true) {
      manager.cacheMessage(this.requestMessage, fault);
View Full Code Here

      } catch (Exception e) {
        LOGGER.error("Sending a response failed.", e);
      }
    } catch (Exception e2) {
      LOGGER.error("run ", e2);
      SCMPMessageFault scmpFault = new SCMPMessageFault(SCMPError.SERVER_ERROR, e2.getMessage());
      scmpFault.setMessageType(SCMPMsgType.UNDEFINED);
      scmpFault.setLocalDateTime();
      response.setSCMP(scmpFault);
      try {
        response.write();
      } catch (Exception ex) {
        LOGGER.error("Sending a response failed.", ex);
View Full Code Here

   *            the scmp req
   * @throws Exception
   *             the exception
   */
  protected void sendBadRequestError(IResponse response, SCMPMessage scmpReq) throws Exception {
    SCMPMessageFault scmpFault = new SCMPMessageFault(SCMPError.BAD_REQUEST, "messagType=" + scmpReq.getMessageType());
    scmpFault.setMessageType(scmpReq.getMessageType());
    scmpFault.setLocalDateTime();
    response.setSCMP(scmpFault);
    response.write();
  }
View Full Code Here

      server.removeSession(this.cascSubscription);
    }
    SCMPMessage fault = null;
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMP Version request
      fault = new SCMPMessageFault(scmpVersion, SCMPError.OPERATION_TIMEOUT,
          "Operation timeout expired on SC csc unsubscribe sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.CONNECTION_EXCEPTION,
          "broken connection on SC csc unsubscribe sid=" + sid);
    } else if (ex instanceof InvalidMaskLengthException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.HV_WRONG_MASK, ex.getMessage() + " sid=" + sid);
    } else {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.SC_ERROR, "executing csc unsubscribe failed sid=" + sid);
    }
    // forward server reply to client
    fault.setIsReply(true);
    fault.setServiceName(serviceName);
    fault.setMessageType(SCMPMsgType.CSC_UNSUBSCRIBE);
View Full Code Here

    SCMPMessage fault = null;
    String serviceName = reqMessage.getServiceName();
    SCMPVersion scmpVersion = reqMessage.getSCMPVersion();
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMP Version request
      fault = new SCMPMessageFault(scmpVersion, SCMPError.OPERATION_TIMEOUT,
          "Operation timeout expired on SC delete session sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.CONNECTION_EXCEPTION, "broken connection on SC delete session sid="
          + sid);
    } else {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.SC_ERROR, "executing delete session failed sid=" + sid);
    }
    // forward server reply to client
    fault.setIsReply(true);
    fault.setServiceName(serviceName);
    fault.setMessageType(this.msgType);
View Full Code Here

    SCMPMessage fault = null;
    SCMPVersion scmpVersion = reqMessage.getSCMPVersion();
    String serviceName = reqMessage.getServiceName();
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMP Version request
      fault = new SCMPMessageFault(scmpVersion, SCMPError.OPERATION_TIMEOUT,
          "Operation timeout expired on SC create session sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.CONNECTION_EXCEPTION, "broken connection on SC create session sid="
          + sid);
    } else {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.SC_ERROR, "executing create session failed sid=" + sid);
    }
    fault.setIsReply(true);
    fault.setServiceName(serviceName);
    fault.setMessageType(this.msgType);
    this.response.setSCMP(fault);
View Full Code Here

    IStatefulServer server = this.subscription.getServer();
    server.removeSession(subscription);
    SCMPMessage fault = null;
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMP Version request
      fault = new SCMPMessageFault(reqMessage.getSCMPVersion(), SCMPError.OPERATION_TIMEOUT, "Operation timeout expired on SC cln unsubscribe sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(reqMessage.getSCMPVersion(), SCMPError.CONNECTION_EXCEPTION, "broken connection on SC cln unsubscribe sid=" + sid);
    } else if (ex instanceof InvalidMaskLengthException) {
      fault = new SCMPMessageFault(reqMessage.getSCMPVersion(), SCMPError.HV_WRONG_MASK, ex.getMessage() + "sid=" + sid);
    } else {
      fault = new SCMPMessageFault(reqMessage.getSCMPVersion(), SCMPError.SC_ERROR, "executing cln unsubscribe failed sid=" + sid);
    }
    // forward server reply to client
    fault.setIsReply(true);
    fault.setServiceName(serviceName);
    fault.setMessageType(SCMPMsgType.CLN_UNSUBSCRIBE);
View Full Code Here

        // 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
      responderCallback.responseCallback(request, response);
      return;
    }
    if (Constants.CC_CMD_SC_VERSION.equalsIgnoreCase(callKey)) {
      LOGGER.debug("sc version request");
      String scVersion = Constants.CC_CMD_SC_VERSION + Constants.EQUAL_SIGN + SCVersion.CURRENT;
      scmpReply.setBody(scVersion);
      response.setSCMP(scmpReply);
      // initiate responder to send reply
      responderCallback.responseCallback(request, response);
      return;
    }

    LOGGER.error("wrong inspect command body=" + bodyString); // body has bad syntax
    scmpReply = new SCMPMessageFault(reqMsg.getSCMPVersion(), SCMPError.V_WRONG_INSPECT_COMMAND, bodyString);
    response.setSCMP(scmpReply);
    // initiate responder to send reply
    responderCallback.responseCallback(request, response);
  }
View Full Code Here

    LOGGER.warn("receive exception sid=" + sid + " " + ex.toString());
    SCMPMessage fault = null;
    SCMPVersion scmpVersion = this.requestMessage.getSCMPVersion();
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMPVersion request
      fault = new SCMPMessageFault(scmpVersion, SCMPError.OPERATION_TIMEOUT, "Operation timeout expired on SC sid="
          + this.sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.CONNECTION_EXCEPTION, "broken connection to server sid=" + this.sid);
    } else {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.SC_ERROR, "error executing " + this.msgType + " sid=" + this.sid);
    }
    // caching
    SCCache cache = AppContext.getSCCache();
    if (cache.isCacheEnabled() == true) {
      cache.cacheMessage(this.requestMessage, fault);
View Full Code Here

TOP

Related Classes of org.serviceconnector.scmp.SCMPMessageFault

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.