public Object invoke(Message message)
{
RemotingDestination remotingDestination = (RemotingDestination)getDestination();
RemotingMessage remotingMessage = (RemotingMessage)message;
FactoryInstance factoryInstance = remotingDestination.getFactoryInstance();
// We don't allow the client to specify the source for
// Java based services.
String className = factoryInstance.getSource();
remotingMessage.setSource(className);
String methodName = remotingMessage.getOperation();
List parameters = remotingMessage.getParameters();
Object result = null;
try
{
// Test that the target method may be invoked based upon include/exclude method settings.
if (includeMethods != null)
{
RemotingMethod method = (RemotingMethod)includeMethods.get(methodName);
if (method == null)
MethodMatcher.methodNotFound(methodName, null, new Match(null));
// Check method-level security constraint, if defined.
SecurityConstraint constraint = method.getSecurityConstraint();
if (constraint != null)
getDestination().getService().getMessageBroker().getLoginManager().checkConstraint(constraint);
}
else if ((excludeMethods != null) && excludeMethods.containsKey(methodName))
MethodMatcher.methodNotFound(methodName, null, new Match(null));
// Lookup and invoke.
Object instance = createInstance(factoryInstance.getInstanceClass());
if (instance == null)
{
MessageException me = new MessageException("Null instance returned from: " + factoryInstance);
me.setCode("Server.Processing");
throw me;