Class ServiceDispatcher


  • public final class ServiceDispatcher
    extends java.lang.Object
    The global service dispatcher. This is the "engine" part of the Service Engine.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsContext​(java.lang.String name)
      Test if this dispatcher instance contains the local context.
      void deregister​(LocalDispatcher local)
      De-Registers the loader with this ServiceDispatcher
      static void enableJM​(boolean enable)
      Enables/Disables the Job Manager/Scheduler globally (this will not effect any dispatchers already running)
      static void enableJMS​(boolean enable)
      Enables/Disables the JMS listeners globally (this will not effect any dispatchers already running)
      static void enableSvcs​(boolean enable)
      Enables/Disables the startup services globally (this will not effect any dispatchers already running)
      java.util.List<GenericServiceCallback> getCallbacks​(java.lang.String serviceName)
      Provides a list of the enabled callbacks corresponding to a service.
      Delegator getDelegator()
      Gets the Delegator associated with this dispatcher
      GenericEngine getGenericEngine​(java.lang.String engineName)
      Gets the GenericEngine instance that corresponds to the given name
      static ServiceDispatcher getInstance​(Delegator delegator)
      Returns an instance of the ServiceDispatcher associated with this delegator.
      JmsListenerFactory getJMSListenerFactory()
      Gets the JmsListenerFactory which holds the message listeners.
      JobManager getJobManager()
      Gets the JobManager associated with this dispatcher
      DispatchContext getLocalContext​(java.lang.String name)
      Gets the local context from a name
      LocalDispatcher getLocalDispatcher​(java.lang.String name)
      Gets the local dispatcher from a name
      static LocalDispatcher getLocalDispatcher​(java.lang.String name, Delegator delegator)
      Returns a pre-registered instance of the ServiceDispatcher associated with this delegator.
      Security getSecurity()
      Gets the Security object associated with this dispatcher
      static java.util.Map<RunningService,​ServiceDispatcher> getServiceLogMap()  
      void register​(DispatchContext context)
      Registers the loader with this ServiceDispatcher
      void registerCallback​(java.lang.String serviceName, GenericServiceCallback cb)
      Registers a callback by associating it to a service.
      void runAsync​(java.lang.String localName, ModelService service, java.util.Map<java.lang.String,​? extends java.lang.Object> context, boolean persist)
      Run the service asynchronously and IGNORE the result.
      void runAsync​(java.lang.String localName, ModelService service, java.util.Map<java.lang.String,​? extends java.lang.Object> params, GenericRequester requester, boolean persist)
      Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
      java.util.Map<java.lang.String,​java.lang.Object> runSync​(java.lang.String localName, ModelService service, java.util.Map<java.lang.String,​? extends java.lang.Object> context)
      Run the service synchronously and return the result.
      java.util.Map<java.lang.String,​java.lang.Object> runSync​(java.lang.String localName, ModelService modelService, java.util.Map<java.lang.String,​? extends java.lang.Object> params, boolean validateOut)
      Run the service synchronously and return the result.
      void runSyncIgnore​(java.lang.String localName, ModelService service, java.util.Map<java.lang.String,​? extends java.lang.Object> context)
      Run the service synchronously and IGNORE the result.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getLocalDispatcher

        public static LocalDispatcher getLocalDispatcher​(java.lang.String name,
                                                         Delegator delegator)
        Returns a pre-registered instance of the ServiceDispatcher associated with this delegator.
        Parameters:
        name - the name of the DispatchContext
        delegator - the local delegator
        Returns:
        A reference to the LocalDispatcher associated with the DispatchContext
      • getInstance

        public static ServiceDispatcher getInstance​(Delegator delegator)
        Returns an instance of the ServiceDispatcher associated with this delegator.
        Parameters:
        delegator - the local delegator
        Returns:
        A reference to this global ServiceDispatcher
      • register

        public void register​(DispatchContext context)
        Registers the loader with this ServiceDispatcher
        Parameters:
        context - the context of the local dispatcher
      • deregister

        public void deregister​(LocalDispatcher local)
        De-Registers the loader with this ServiceDispatcher
        Parameters:
        local - the LocalDispatcher to de-register
      • registerCallback

        public void registerCallback​(java.lang.String serviceName,
                                     GenericServiceCallback cb)
        Registers a callback by associating it to a service.
        Parameters:
        serviceName - the name of the service to associate the callback with
        cb - the callback to register
      • getCallbacks

        public java.util.List<GenericServiceCallback> getCallbacks​(java.lang.String serviceName)
        Provides a list of the enabled callbacks corresponding to a service. As a side effect, disabled callbacks are removed.
        Parameters:
        serviceName - the name of service whose callbacks should be called
        Returns:
        a list of callbacks corresponding to serviceName
      • getGenericEngine

        public GenericEngine getGenericEngine​(java.lang.String engineName)
                                       throws GenericServiceException
        Gets the GenericEngine instance that corresponds to the given name
        Parameters:
        engineName - Name of the engine
        Returns:
        GenericEngine instance that corresponds to the engineName
        Throws:
        GenericServiceException
      • getJobManager

        public JobManager getJobManager()
        Gets the JobManager associated with this dispatcher
        Returns:
        JobManager that is associated with this dispatcher
      • getJMSListenerFactory

        public JmsListenerFactory getJMSListenerFactory()
        Gets the JmsListenerFactory which holds the message listeners.
        Returns:
        JmsListenerFactory
      • getDelegator

        public Delegator getDelegator()
        Gets the Delegator associated with this dispatcher
        Returns:
        Delegator associated with this dispatcher
      • getSecurity

        public Security getSecurity()
        Gets the Security object associated with this dispatcher
        Returns:
        Security object associated with this dispatcher
      • getLocalContext

        public DispatchContext getLocalContext​(java.lang.String name)
        Gets the local context from a name
        Parameters:
        name - of the context to find.
      • getLocalDispatcher

        public LocalDispatcher getLocalDispatcher​(java.lang.String name)
        Gets the local dispatcher from a name
        Parameters:
        name - of the LocalDispatcher to find.
        Returns:
        LocalDispatcher matching the loader name
      • containsContext

        public boolean containsContext​(java.lang.String name)
        Test if this dispatcher instance contains the local context.
        Parameters:
        name - of the local context
        Returns:
        true if the local context is found in this dispatcher.
      • enableJM

        public static void enableJM​(boolean enable)
        Enables/Disables the Job Manager/Scheduler globally (this will not effect any dispatchers already running)
        Parameters:
        enable -
      • enableJMS

        public static void enableJMS​(boolean enable)
        Enables/Disables the JMS listeners globally (this will not effect any dispatchers already running)
        Parameters:
        enable -
      • enableSvcs

        public static void enableSvcs​(boolean enable)
        Enables/Disables the startup services globally (this will not effect any dispatchers already running)
        Parameters:
        enable -