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