org.qedeq.kernel.bo.service.internal
Class ServiceProcessManager

java.lang.Object
  extended by org.qedeq.kernel.bo.service.internal.ServiceProcessManager

public class ServiceProcessManager
extends java.lang.Object

Manage all known processes.


Constructor Summary
ServiceProcessManager(PluginManager pluginManager, ModuleArbiter arbiter)
          Constructor.
 
Method Summary
 InternalModuleServiceCallImpl createServiceCall(Service service, QedeqBo qedeq, Parameters configParameters, Parameters parameters, InternalServiceJob process)
          Create service call.
 InternalServiceJob createServiceJob(java.lang.String id)
          Create a service job for executing a plugin.
 InternalServiceJobImpl createServiceProcess(java.lang.String action)
           
 void endServiceCall(InternalModuleServiceCall call)
          End service call by unlocking previously locked module.
 java.lang.Object executePlugin(java.lang.String id, KernelQedeqBo qedeq, java.lang.Object data, InternalServiceJob process)
          Execute a plugin on an QEDEQ module.
 ModuleServiceResult executeService(ModuleService service, ModuleServiceExecutor executor, QedeqBo qedeq, InternalServiceJob process)
           
 ServiceJob[] getRunningServiceProcesses()
          Get all running service processes.
 ServiceJob[] getServiceProcesses()
          Get all service processes.
 void terminateAllServiceProcesses()
          Terminate all service processes.
 void terminateAndRemoveAllServiceProcesses()
          Remove all service processes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceProcessManager

public ServiceProcessManager(PluginManager pluginManager,
                             ModuleArbiter arbiter)
Constructor.

Parameters:
pluginManager - Collects process information.
arbiter - For module access synchronization.
Method Detail

getServiceProcesses

public ServiceJob[] getServiceProcesses()
Get all service processes.

Returns:
All service processes.

getRunningServiceProcesses

public ServiceJob[] getRunningServiceProcesses()
Get all running service processes. But remember a running process might currently be blocked.

Returns:
All service running processes.

createServiceCall

public InternalModuleServiceCallImpl createServiceCall(Service service,
                                                       QedeqBo qedeq,
                                                       Parameters configParameters,
                                                       Parameters parameters,
                                                       InternalServiceJob process)
                                                throws InterruptException
Create service call. Might block further execution, because an exclusive access to given module is given.

Parameters:
service - The service that runs in current thread.
qedeq - QEDEQ module for service.
configParameters - Config parameters for the service.
parameters - Parameter for this service call.
process - We run in this process.
Returns:
Created service call. Never null (if no InterruptException occurred).
Throws:
InterruptException - User canceled call.

endServiceCall

public void endServiceCall(InternalModuleServiceCall call)
End service call by unlocking previously locked module.

Parameters:
call - End this call, which should be finished, interrupted or halted before.

terminateAndRemoveAllServiceProcesses

public void terminateAndRemoveAllServiceProcesses()
Remove all service processes. All processes are also terminated via interruption.


terminateAllServiceProcesses

public void terminateAllServiceProcesses()
Terminate all service processes.


createServiceProcess

public InternalServiceJobImpl createServiceProcess(java.lang.String action)

executeService

public ModuleServiceResult executeService(ModuleService service,
                                          ModuleServiceExecutor executor,
                                          QedeqBo qedeq,
                                          InternalServiceJob process)
                                   throws InterruptException
Throws:
InterruptException

executePlugin

public java.lang.Object executePlugin(java.lang.String id,
                                      KernelQedeqBo qedeq,
                                      java.lang.Object data,
                                      InternalServiceJob process)
                               throws InterruptException
Execute a plugin on an QEDEQ module.

Parameters:
id - Plugin to use.
qedeq - QEDEQ module to work on.
data - Process parameters.
process - Process. Must not be null..
Returns:
Plugin Specific result object. Might be null.
Throws:
InterruptException - User interrupt occurred.
java.lang.RuntimeException - Plugin unknown or process is not running any more.

createServiceJob

public InternalServiceJob createServiceJob(java.lang.String id)
Create a service job for executing a plugin.

Parameters:
id - Plugin to use.
Returns:
Process.
Throws:
java.lang.RuntimeException - Plugin unknown.


Copyright © 2014. All Rights Reserved.