public InvocationResponse dispatchInvocation ( InvocationRequest request ) { String appName = request . getAppName ( ) ; String serviceName = request . getServiceName ( ) ; String componentName = mServiceTable . getComponentForService ( appName , serviceName ) ; if ( componentName == null ) { return InvocationResponse . error ( "Application " + appName + " doesn't have a service named " + serviceName ) ; } AppServiceProxy proxy = mCommunicationAgent . getProxy ( componentName ) ; if ( proxy == null ) { return InvocationResponse . error ( "Cannot bind to service" ) ; } try { return proxy . executeService ( request ) ; } catch ( Throwable t ) { Log . e ( "ServiceRegistry" , "Error dispatching invocation: " , t ) ; return InvocationResponse . error ( "Internal error: " + t . getMessage ( ) ) ; } }
Dispatches an invocation request to the right application . If the application is not found an error response is returned .