org.qedeq.kernel.bo.job
Class InternalModuleServiceCallImpl

java.lang.Object
  extended by org.qedeq.kernel.bo.job.InternalModuleServiceCallImpl
All Implemented Interfaces:
java.lang.Comparable, ModuleServiceCall, InternalModuleServiceCall

public class InternalModuleServiceCallImpl
extends java.lang.Object
implements InternalModuleServiceCall

Single call for a service.

Author:
Michael Meyling

Constructor Summary
InternalModuleServiceCallImpl(Service service, QedeqBo qedeq, Parameters config, Parameters parameters, InternalServiceJob process, ModuleServiceCall parent)
          A new service process within the current thread.
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
           
 void finish(ModuleServiceResult result)
          Set result state for call and stop.
 void finishError(java.lang.String errorMessage)
          Set generic failure result for call and stop.
 void finishOk()
          Set generic success result for call and stop.
 java.lang.String getAction()
          Get description of currently taken action.
 long getBeginTime()
          Get timestamp for service start.
 Parameters getConfigParameters()
          Get global config parameters for service call.
 java.lang.String getConfigParametersString()
          Get global config parameter for service call as string.
 long getDuration()
          Get milliseconds the call was working and not pausing.
 long getEndTime()
          Get timestamp for service stop.
 double getExecutionPercentage()
          Get percentage of currently running plugin execution.
 long getId()
          Get call id.
 InternalServiceJob getInternalServiceProcess()
          Return service process the call was initiated.
 java.lang.String getLocation()
          Where are we now.
 boolean getNewlyBlockedModule()
           
 Parameters getParameters()
          Get call specific parameters for service call.
 java.lang.String getParametersString()
          Get call specific parameters for service call as string.
 ModuleServiceCall getParentServiceCall()
          Return parent service call if any.
 QedeqBo getQedeq()
          Get QEDEQ module we work on.
 Service getService()
          Get service we work for.
 ServiceJob getServiceProcess()
          Return service process the call was initiated by.
 ModuleServiceResult getServiceResult()
          Result of service execution.
 void halt(ModuleServiceResult result)
          Set result state for call and stop.
 void halt(java.lang.String errorMessage)
          Set generic failure result for call and stop.
 int hashCode()
           
 void interrupt()
          Set failure state for call and stop.
 boolean isPaused()
          Is the execution currently paused because we are waiting for another process.
 boolean isRunning()
          Is this service still running? This is also true if the process is paused.
 void pause()
          Signal an execution pause.
 void resume()
          Signal execution resume.
 void setAction(java.lang.String action)
          Set description of currently taken action.
 void setExecutionPercentage(double percentage)
          Set percentage of currently running plugin execution.
 void setNewlyBlockedModule(boolean newlyBlockedModule)
           
 void setServiceCompleteness(ServiceCompleteness completeness)
          Set someone who answers completeness questions.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalModuleServiceCallImpl

public InternalModuleServiceCallImpl(Service service,
                                     QedeqBo qedeq,
                                     Parameters config,
                                     Parameters parameters,
                                     InternalServiceJob process,
                                     ModuleServiceCall parent)
A new service process within the current thread.

Parameters:
service - This service is executed.
qedeq - Module we work on.
config - Current global config parameters for this call.
parameters - Call specific parameters..
process - Service process we run within.
parent - Parent service call if any.
Method Detail

getService

public Service getService()
Description copied from interface: ModuleServiceCall
Get service we work for.

Specified by:
getService in interface ModuleServiceCall
Returns:
service

getQedeq

public QedeqBo getQedeq()
Description copied from interface: ModuleServiceCall
Get QEDEQ module we work on.

Specified by:
getQedeq in interface ModuleServiceCall
Returns:
QEDEQ module.

getConfigParameters

public Parameters getConfigParameters()
Description copied from interface: InternalModuleServiceCall
Get global config parameters for service call.

Specified by:
getConfigParameters in interface InternalModuleServiceCall
Returns:
Service parameter.

getConfigParametersString

public java.lang.String getConfigParametersString()
Description copied from interface: ModuleServiceCall
Get global config parameter for service call as string.

Specified by:
getConfigParametersString in interface ModuleServiceCall
Returns:
Service parameter.

getParameters

public Parameters getParameters()
Description copied from interface: InternalModuleServiceCall
Get call specific parameters for service call.

Specified by:
getParameters in interface InternalModuleServiceCall
Returns:
Service parameter.

getParametersString

public java.lang.String getParametersString()
Description copied from interface: ModuleServiceCall
Get call specific parameters for service call as string.

Specified by:
getParametersString in interface ModuleServiceCall
Returns:
Service parameters.

getBeginTime

public long getBeginTime()
Description copied from interface: ModuleServiceCall
Get timestamp for service start.

Specified by:
getBeginTime in interface ModuleServiceCall
Returns:
Service start timestamp.

getEndTime

public long getEndTime()
Description copied from interface: ModuleServiceCall
Get timestamp for service stop.

Specified by:
getEndTime in interface ModuleServiceCall
Returns:
Service stop timestamp.

getDuration

public long getDuration()
Description copied from interface: ModuleServiceCall
Get milliseconds the call was working and not pausing.

Specified by:
getDuration in interface ModuleServiceCall
Returns:
Work milliseconds.

isPaused

public boolean isPaused()
Description copied from interface: ModuleServiceCall
Is the execution currently paused because we are waiting for another process.

Specified by:
isPaused in interface ModuleServiceCall
Returns:
Are we waiting?

pause

public void pause()
Description copied from interface: InternalModuleServiceCall
Signal an execution pause.

Specified by:
pause in interface InternalModuleServiceCall

resume

public void resume()
Description copied from interface: InternalModuleServiceCall
Signal execution resume.

Specified by:
resume in interface InternalModuleServiceCall

setNewlyBlockedModule

public void setNewlyBlockedModule(boolean newlyBlockedModule)

getNewlyBlockedModule

public boolean getNewlyBlockedModule()

finishOk

public void finishOk()
Description copied from interface: InternalModuleServiceCall
Set generic success result for call and stop. Can only be done if call is still running.

Specified by:
finishOk in interface InternalModuleServiceCall

finishError

public void finishError(java.lang.String errorMessage)
Description copied from interface: InternalModuleServiceCall
Set generic failure result for call and stop. Can only be done if call is still running.

Specified by:
finishError in interface InternalModuleServiceCall
Parameters:
errorMessage - Reason for finishing with error.

finish

public void finish(ModuleServiceResult result)
Description copied from interface: InternalModuleServiceCall
Set result state for call and stop. Can only be done if call is still running.

Specified by:
finish in interface InternalModuleServiceCall
Parameters:
result - Service result.

halt

public void halt(ModuleServiceResult result)
Description copied from interface: InternalModuleServiceCall
Set result state for call and stop. Can only be done if call is still running.

Specified by:
halt in interface InternalModuleServiceCall
Parameters:
result - Must include reason for halting.

halt

public void halt(java.lang.String errorMessage)
Description copied from interface: InternalModuleServiceCall
Set generic failure result for call and stop. Can only be done if call is still running.

Specified by:
halt in interface InternalModuleServiceCall
Parameters:
errorMessage - Reason for halting.

interrupt

public void interrupt()
Description copied from interface: InternalModuleServiceCall
Set failure state for call and stop. Can only be done if call is still running.

Specified by:
interrupt in interface InternalModuleServiceCall

isRunning

public boolean isRunning()
Description copied from interface: ModuleServiceCall
Is this service still running? This is also true if the process is paused.

Specified by:
isRunning in interface ModuleServiceCall
Returns:
Still running?

getServiceProcess

public ServiceJob getServiceProcess()
Description copied from interface: ModuleServiceCall
Return service process the call was initiated by.

Specified by:
getServiceProcess in interface ModuleServiceCall
Returns:
Service process for this call.

getExecutionPercentage

public double getExecutionPercentage()
Description copied from interface: ModuleServiceCall
Get percentage of currently running plugin execution.

Specified by:
getExecutionPercentage in interface ModuleServiceCall
Returns:
Number between 0 and 100.

setExecutionPercentage

public void setExecutionPercentage(double percentage)
Description copied from interface: InternalModuleServiceCall
Set percentage of currently running plugin execution.

Specified by:
setExecutionPercentage in interface InternalModuleServiceCall
Parameters:
percentage - Number between 0 and 100.

getAction

public java.lang.String getAction()
Description copied from interface: ModuleServiceCall
Get description of currently taken action.

Specified by:
getAction in interface ModuleServiceCall
Returns:
We are doing this currently.

getLocation

public java.lang.String getLocation()
Description copied from interface: ModuleServiceCall
Where are we now.

Specified by:
getLocation in interface ModuleServiceCall
Returns:
Location description.

setAction

public void setAction(java.lang.String action)
Description copied from interface: InternalModuleServiceCall
Set description of currently taken action.

Specified by:
setAction in interface InternalModuleServiceCall
Parameters:
action - We are doing this currently.

getId

public long getId()
Description copied from interface: ModuleServiceCall
Get call id.

Specified by:
getId in interface ModuleServiceCall
Returns:
Service call identifying number.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getParentServiceCall

public ModuleServiceCall getParentServiceCall()
Description copied from interface: ModuleServiceCall
Return parent service call if any.

Specified by:
getParentServiceCall in interface ModuleServiceCall
Returns:
Parent service call. Might be null.

getServiceResult

public ModuleServiceResult getServiceResult()
Description copied from interface: ModuleServiceCall
Result of service execution.

Specified by:
getServiceResult in interface ModuleServiceCall
Returns:
Result. Might be null.

getInternalServiceProcess

public InternalServiceJob getInternalServiceProcess()
Description copied from interface: InternalModuleServiceCall
Return service process the call was initiated.

Specified by:
getInternalServiceProcess in interface InternalModuleServiceCall
Returns:
Service process for this call.

setServiceCompleteness

public void setServiceCompleteness(ServiceCompleteness completeness)
Description copied from interface: InternalModuleServiceCall
Set someone who answers completeness questions.

Specified by:
setServiceCompleteness in interface InternalModuleServiceCall
Parameters:
completeness - An answer for completeness questions. Might be null.


Copyright © 2014. All Rights Reserved.