_cmps.remove(cmp_.getNamespace());
}
@Override
public void invoke(final Context ctx_) {
JsonServiceRequest req = (JsonServiceRequest)ctx_.getRequest();
final String namespace = req.getNamespace();
final ServiceComponent cmp = _cmps.get(namespace);
if (cmp == null) {
String msg = String.format("No service component found with ns=%s", namespace);
_logger.info(msg);
return;
}
List<?> params = _jsh.deserialize(req.getServiceArgsJson(), List.class);
int nbArgs = params.size() +1; // +1 for context arg
final String serviceName = req.getService();
final Method serviceMethod = cmp.getService(serviceName, nbArgs);
if (serviceMethod == null) {
String msg = String.format("No service=%s found with ns=%s",
serviceName, namespace);
_logger.info(msg);
ctx_.getResponseHandler().addMessage(new Message(0, MessageType.ERROR, msg));
return;
}
try {
final CommonRequestArgs cr = new CommonRequestArgs();
cr.setLang(req.getLang());
cr.setReqId(req.getReqId());
cr.setSessionId(req.getSessionId());
cr.setUserId(req.getUserId());
Context ctx = new Context() {
@Override
public ResponseHandler<Object> getResponseHandler() {
return ctx_.getResponseHandler();
}