public Object onCall(UMOEventContext context) throws Exception { Object result; logger.debug("Message received by MuleManagerComponent"); ByteArrayInputStream in = new ByteArrayInputStream(context.getTransformedMessageAsBytes()); AdminNotification action = (AdminNotification) wireFormat.read(in); if (AdminNotification.ACTION_INVOKE == action.getAction()) { result = invokeAction(action, context); } else if (AdminNotification.ACTION_SEND == action.getAction()) { result = sendAction(action, context); } else if (AdminNotification.ACTION_DISPATCH == action.getAction()) { result = sendAction(action, context); } else if (AdminNotification.ACTION_RECEIVE == action.getAction()) { result = receiveAction(action, context); } else { result = handleException( null, new MuleException( new Message( Messages.EVENT_TYPE_X_NOT_RECOGNISED, "AdminNotification:" + action.getAction()))); } return result; }
protected Object sendAction(AdminNotification action, UMOEventContext context) throws UMOException { UMOMessage result = null; try { UMOEndpoint endpoint = new MuleEndpoint(action.getResourceIdentifier(), false); if (AdminNotification.ACTION_DISPATCH == action.getAction()) { context.dispatchEvent(action.getMessage(), endpoint); return null; } else { endpoint.setRemoteSync(true); result = context.sendEvent(action.getMessage(), endpoint); if (result == null) { return null; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, result); return out.toByteArray(); } } } catch (Exception e) { return handleException(result, e); } }