Package org.apache.ofbiz.service
Class ServiceDispatcher
java.lang.Object
org.apache.ofbiz.service.ServiceDispatcher
The global service dispatcher. This is the "engine" part of the Service Engine.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsContext
(String name) Test if this dispatcher instance contains the local context.void
deregister
(LocalDispatcher local) De-Registers the loader with this ServiceDispatcherstatic 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)getCallbacks
(String serviceName) Provides a list of the enabled callbacks corresponding to a service.Gets the Delegator associated with this dispatchergetGenericEngine
(String engineName) Gets the GenericEngine instance that corresponds to the given namestatic ServiceDispatcher
getInstance
(Delegator delegator) Returns an instance of the ServiceDispatcher associated with this delegator.Gets the JmsListenerFactory which holds the message listeners.Gets the JobManager associated with this dispatchergetLocalContext
(String name) Gets the local context from a namegetLocalDispatcher
(String name) Gets the local dispatcher from a namestatic LocalDispatcher
getLocalDispatcher
(String name, Delegator delegator) Returns a pre-registered instance of the ServiceDispatcher associated with this delegator.Gets the Security object associated with this dispatcherstatic Map<RunningService,
ServiceDispatcher> void
register
(DispatchContext context) Registers the loader with this ServiceDispatchervoid
registerCallback
(String serviceName, GenericServiceCallback cb) Registers a callback by associating it to a service.void
runAsync
(String localName, ModelService service, Map<String, ? extends Object> context, boolean persist) Run the service asynchronously and IGNORE the result.void
runAsync
(String localName, ModelService service, Map<String, ? extends Object> params, GenericRequester requester, boolean persist) Run the service asynchronously, passing an instance of GenericRequester that will receive the result.Run the service synchronously and return the result.runSync
(String localName, ModelService modelService, Map<String, ? extends Object> params, boolean validateOut) Run the service synchronously and return the result.void
runSyncIgnore
(String localName, ModelService service, Map<String, ? extends Object> context) Run the service synchronously and IGNORE the result.
-
Field Details
-
LRU_LOG_SIZE
public static final int LRU_LOG_SIZE- See Also:
-
LOCK_RETRIES
public static final int LOCK_RETRIES- See Also:
-
-
Method Details
-
getLocalDispatcher
Returns a pre-registered instance of the ServiceDispatcher associated with this delegator.- Parameters:
name
- the name of the DispatchContextdelegator
- the local delegator- Returns:
- A reference to the LocalDispatcher associated with the DispatchContext
-
getInstance
Returns an instance of the ServiceDispatcher associated with this delegator.- Parameters:
delegator
- the local delegator- Returns:
- A reference to this global ServiceDispatcher
-
register
Registers the loader with this ServiceDispatcher- Parameters:
context
- the context of the local dispatcher
-
deregister
De-Registers the loader with this ServiceDispatcher- Parameters:
local
- the LocalDispatcher to de-register
-
registerCallback
Registers a callback by associating it to a service.- Parameters:
serviceName
- the name of the service to associate the callback withcb
- the callback to register
-
getCallbacks
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
-
runSync
public Map<String,Object> runSync(String localName, ModelService service, Map<String, ? extends Object> context) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service synchronously and return the result.- Parameters:
localName
- Name of the context to use.service
- Service model object.context
- Map of name, value pairs composing the context.- Returns:
- Map of name, value pairs composing the result.
- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runSyncIgnore
public void runSyncIgnore(String localName, ModelService service, Map<String, ? extends Object> context) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service synchronously and IGNORE the result.- Parameters:
localName
- Name of the context to use.service
- Service model object.context
- Map of name, value pairs composing the context.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runSync
public Map<String,Object> runSync(String localName, ModelService modelService, Map<String, ? extends Object> params, boolean validateOut) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service synchronously and return the result.- Parameters:
localName
- Name of the context to use.modelService
- Service model object.params
- Map of name, value pairs composing the parameters.validateOut
- Validate OUT parameters- Returns:
- Map of name, value pairs composing the result.
- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsync
public void runAsync(String localName, ModelService service, Map<String, ? extends Object> params, GenericRequester requester, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously, passing an instance of GenericRequester that will receive the result.- Parameters:
localName
- Name of the context to use.service
- Service model object.params
- Map of name, value pairs composing the parameters.requester
- Object implementing GenericRequester interface which will receive the result.persist
- True for store/run; False for run.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
runAsync
public void runAsync(String localName, ModelService service, Map<String, ? extends Object> context, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceExceptionRun the service asynchronously and IGNORE the result.- Parameters:
localName
- Name of the context to use.service
- Service model object.context
- Map of name, value pairs composing the context.persist
- True for store/run; False for run.- Throws:
ServiceAuthException
ServiceValidationException
GenericServiceException
-
getGenericEngine
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
Gets the JobManager associated with this dispatcher- Returns:
- JobManager that is associated with this dispatcher
-
getJMSListenerFactory
Gets the JmsListenerFactory which holds the message listeners.- Returns:
- JmsListenerFactory
-
getDelegator
Gets the Delegator associated with this dispatcher- Returns:
- Delegator associated with this dispatcher
-
getSecurity
Gets the Security object associated with this dispatcher- Returns:
- Security object associated with this dispatcher
-
getLocalContext
Gets the local context from a name- Parameters:
name
- of the context to find.
-
getLocalDispatcher
Gets the local dispatcher from a name- Parameters:
name
- of the LocalDispatcher to find.- Returns:
- LocalDispatcher matching the loader name
-
containsContext
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
-
-
getServiceLogMap
-