com.ibm.commerce.negotiation.commands
Class ProcessToolsControllerCmdImpl

com.ibm.commerce.negotiation.commands.ProcessToolsControllerCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ProcessToolsControllerCmd, Protectable, ToolsControllerCommand

public abstract class ProcessToolsControllerCmdImpl
implements ProcessToolsControllerCmd

Process controller command. Implements common behavior for the bids processing commands.


Field Summary
static java.lang.String COPYRIGHT
           
 
Fields inherited from interface com.ibm.commerce.negotiation.commands.ProcessToolsControllerCmd
NAME
 
Fields inherited from interface com.ibm.commerce.command.ECCommand
defaultCommandClassName
 
Constructor Summary
ProcessToolsControllerCmdImpl()
          Default constructor.
 
Method Summary
 java.util.Hashtable getAllExceptions()
          Get a list of all the exceptions generated by this process.
protected  java.lang.String getErrorTaskName()
          Returns this command's error task name.
protected  java.lang.Class getProcessLock()
          Returns the class object for locking the current process.
protected  void handleException(java.lang.Exception e)
          Formats and saves an ECException based on the input exception value.
 boolean isReadyToCallExecute()
          Verifies that the this command is ready to be executed.
protected  void maintainMaxProcessLimit()
          Ensures that there is no more than the specified maximum number of threads running simultaneously.
protected  void registerProcess(java.lang.Thread thread, ProcessRunner runner)
          Register a new process to be monitered by the controller process.
 void reset()
          Reset current command to its initial state to allow for reuse.
 void setErrorTaskName(java.lang.String errorTaskName)
          Sets this command's error task name
 void setRequestProperties(TypedProperty requestParam)
          Saves the optional command parameter values.
protected  void waitForAll()
          Waits for all the processes controlled by this command to either complete or end abnormally.
protected  void waitForThreads(int count)
          Waits for the specified number of processes controlled by this command to either complete or end abnormally.
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

ProcessToolsControllerCmdImpl

public ProcessToolsControllerCmdImpl()
Default constructor.
Method Detail

getAllExceptions

public java.util.Hashtable getAllExceptions()
Get a list of all the exceptions generated by this process.
Specified by:
getAllExceptions in interface ProcessToolsControllerCmd
Returns:
Hashtable - Exceptions table

getErrorTaskName

protected java.lang.String getErrorTaskName()
Returns this command's error task name.
Returns:
tring - Error task name

getProcessLock

protected java.lang.Class getProcessLock()
Returns the class object for locking the current process.
Returns:
Class - This class object.

handleException

protected void handleException(java.lang.Exception e)
Formats and saves an ECException based on the input exception value.
Parameters:
e - Exception - The exception instance to be formatted.

isReadyToCallExecute

public boolean isReadyToCallExecute()
Verifies that the this command is ready to be executed.
Returns:
boolean =true if command is ready, otherwise false.

maintainMaxProcessLimit

protected void maintainMaxProcessLimit()
Ensures that there is no more than the specified maximum number of threads running simultaneously.

registerProcess

protected void registerProcess(java.lang.Thread thread,
                               ProcessRunner runner)
Register a new process to be monitered by the controller process.
Parameters:
thread - Thread - Thread instance which starts the process
runner - ProcessRunner - The process runner which executes the command

reset

public void reset()
Reset current command to its initial state to allow for reuse.

setErrorTaskName

public void setErrorTaskName(java.lang.String errorTaskName)
Sets this command's error task name
Specified by:
setErrorTaskName in interface ProcessToolsControllerCmd
Parameters:
errorTaskName - java.lang.String

setRequestProperties

public void setRequestProperties(TypedProperty requestParam)
                          throws ECApplicationException
Saves the optional command parameter values.
Specified by:
setRequestProperties in interface ControllerCommand
Parameters:
TypedPropery - requestParam - Request properties
Throws:
ECApplicationException: - An exception is returned if any of the mandatory parameters are missing, or invalid

waitForAll

protected void waitForAll()
Waits for all the processes controlled by this command to either complete or end abnormally.

waitForThreads

protected void waitForThreads(int count)
Waits for the specified number of processes controlled by this command to either complete or end abnormally. Process exceptions will be logged and saved for future references.
Parameters:
count - int - Number of threads to wait for.