public class AddJobCmdImpl extends ControllerCommandImpl implements AddJobCmd
This class adds a job to the WebSphere Commerce Server's scheduler.
The parameters passed to the command are:
pathInfo (required): This is the name of the command that the schedule job should execute.
start (required): This indicates when to start executing the job.
URL (required): This is the URL to which we should be redirected after the command has finished executing.
name (optional): This is the logon id of the job's user identity. The default value is the current user
scheduling the job. Valid values include any existing users that have the access control authority
to create a scheduled job.
queryString (optional): This is an object that represents the parameters specified when executing the job.
This will be in the form of a URL query string. A value of n1=v1 indicates that parameter
n1 will have a value of v1 when the job is executing. The default value is null
which means there will be no parameters specified when the job is executing.
host (optional): This is the scheduler instance that should execute the job. Each scheduler instance
can have a unique instance name (by default it is the WebSphere Commerce Server's web server host name).
A scheduled job can run on a particular scheduler instance if specified. The default value is
null which means that the job will run on any scheduler instance.
interval (optional): This is the time (in seconds) that indicates how often the job
should be re-executed. The default value is 0 which means that the job will only be executed once.
The value of the interval must be greater than or equal to 0.
attempts (optional): This is the number of attempts required to execute the job
successfully. The default value is 0 which means the job will only have one attempt of a successful
execution. The value specified must be greater than or equal to 0. If this parameter is specified, then
the delay parameter should be specified as well.
delay (optional): This is the time (in seconds) that indicates how long to wait before
attempting to run the job again. This parameter must have a value greater than or equal to 0 and if this
parameter is specified, then the attempts parameter must be specified as well.
schedulerPolicy (optional): This is the policy of the job when it fails to be executed.
The default value is 0. A value of 0 indicates that the job will not be retried. A value of 1 means the
job will be retried.
priority (optional): This is the priority of the job. The default value is
java.lang.Thread.NORM_PRIORTY. Valid values must be between the range of
java.lang.Thread.MIN_PRIORITY and java.lang.Thread.MAX_PRIORITY.
applicationType (optional): This is the application type of the job. This is defined
in the scheduler instance configuration. The default application types are default, broadcast, auction
and inventory but others may be added. The default value is null which represents the default application
type. A valid value must be one of the defined application types.
storeId (optional): this is the store identity of the job. The default value is the
current store in the command context. Valid values include stores for which the current user has access
control authority.
checkCmdId (optional): This is the task command used to determine whether the job needs
to be executed or not. The default value is null which means that the job will always be executed. Valid
values include any check command id found in the CHKCMD table.
This command will verify the value specified for the schedule job. If any value is
missing or incorrect, an exception is thrown. If the values are okay, the new schedule
job is added by adding a record to the SCHCONFIG and SCHACTIVE tables.
The information found in the SCHCONFIG table contains the configuration information
for executing the schedule job. The record in the SCHACTIVE record will determine when to
execute the job next.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
defaultCommandClassName, NAME| Constructor and Description |
|---|
AddJobCmdImpl()
This is the default constructor for this class.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getApplicationType()
This method gets the application type for the job to be added.
|
java.lang.Integer |
getAttempts()
This method gets the number of re-attempts when error occurs.
|
java.lang.Integer |
getCheckCommandId()
This method gets the id of the check command.
|
java.lang.Integer |
getDelay()
This method gets the delay time between re-attempts when an error occurs.
|
java.lang.String |
getHost()
This method gets the scheduler instance name that uniquely identifies the scheduler for a JVM of the WebSphere Commerce instance.
|
java.lang.String |
getInterfaceName()
This method gets the interface name of the task command which will determine whether the job needs to be executed.
|
java.lang.Long |
getJobId()
This method gets the job's reference number.
|
java.lang.Long |
getJobInstanceId()
This method gets the job's instance number.
|
AccessVector |
getResources()
This method gets the resources when creating the schedule job.
|
java.lang.Integer |
getStoreId()
This method gets the store for which this schedule job will run.
|
java.lang.Long |
getUserRefNum()
This method gets the user reference number of the user identity of the scheduler job.
|
void |
performExecute()
This method adds a new schedule job to the Commerce's Scheduler.
|
void |
setApplicationType(java.lang.String applicationType)
This method sets the job's application type.
|
void |
setAttempts(java.lang.Integer attempts)
This method sets the number of retry attempts.
|
void |
setCheckCommandId(java.lang.Integer chkCmdId)
This method sets the id of the check command defined in the CHKCMD table.
|
void |
setDelay(java.lang.Integer delay)
This method sets the delay time between re-attempts.
|
void |
setDescription(java.lang.String description) |
void |
setEndTime(java.sql.Timestamp endTime)
This method sets the end time of the job.
|
void |
setErrorUrl(java.lang.String url)
This method sets the URL to be redirected to at the end of the command.
|
void |
setHost(java.lang.String host)
This method sets the name of the scheduler instance that should run the schedule job.
|
void |
setInterfaceName(java.lang.String interfaceName)
This method sets the interface name of the task command which will determine whether the job needs executing or not.
|
void |
setInterval(java.lang.Integer interval)
This method sets the frequency to re-execute the schedule job.
|
void |
setJobId(java.lang.Long newJobId)
This method sets the job id.
|
void |
setJobInfo(TypedProperty property)
This method sets the job information and adds the new schedule job.
|
void |
setName(java.lang.String name)
This method sets the user identity to run the schedule job.
|
void |
setPathInfo(java.lang.String command)
This method sets the name of the command to be added to the scheduler.
|
void |
setPriority(java.lang.Integer priority)
This method sets the priority of the job.
|
void |
setQueryString(java.lang.String parameters)
This method sets the query string associated with the job.
|
void |
setRequestProperties(TypedProperty reqParms)
This method extracts the required parameters from the request properties and
sets it locally in the command.
|
void |
setSequence(java.lang.Integer policy)
This method sets the sequence.
|
void |
setStartTime(java.sql.Timestamp startTime)
This method sets the start time to execute the schedule job.
|
void |
setStoreId(java.lang.Integer storeId)
This method sets the store id of the schedule job.
|
void |
setStringEndTime(java.lang.String endTime)
This method sets the job's end time.
|
void |
setStringStartTime(java.lang.String startTime)
This method sets the job's start time.
|
void |
setUrl(java.lang.String url)
This method sets the URL to be redirected to at the end of the command.
|
void |
setUserRefNum(java.lang.Long refnum)
This method sets the user reference number that represents the job's user identity.
|
void |
validateParameters()
This method checks the validity of the parameters.
|
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputPropertiesaccessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultPropertiesexecuteFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCachegetCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicyequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputPropertiesexecuteFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCachegetCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName, setOutputPropertiesaccessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwnercheckIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultPropertiesfulfills, getOwnerpublic static final java.lang.String COPYRIGHT
public AddJobCmdImpl()
public java.lang.String getApplicationType()
public java.lang.Integer getAttempts()
public java.lang.Integer getCheckCommandId()
CHKCMD table.public java.lang.Integer getDelay()
public java.lang.String getHost()
public java.lang.String getInterfaceName()
public java.lang.Long getJobId()
public java.lang.Long getJobInstanceId()
getJobInstanceId in interface AddJobCmdpublic AccessVector getResources() throws ECException
getResources in interface ECCommandgetResources in class AbstractECTargetableCommandECException - This is thrown if there are any problems obtaining the resources.public java.lang.Integer getStoreId()
getStoreId in interface ECCommandgetStoreId in class AbstractECTargetableCommandpublic java.lang.Long getUserRefNum()
public void performExecute()
throws ECException
This method adds a new schedule job to the Commerce's Scheduler. This is done by adding a record to the SCHCONFIG table and SCHACTIVE table. The entry in the SCHCONFIG table will contain the configuration for executing the job. The record in the SCHACTIVE table will contain the information when to execute the job. After the two records are created, the local Commerce scheduler will be notified that a new job was added. This is done in case it needs to wake up earlier to process the newly added job.
The response properties will contain the required information to redirect to the specified URL.
performExecute in interface ECCommandperformExecute in interface com.ibm.websphere.command.TargetableCommandperformExecute in class AbstractECTargetableCommandECException - If there are any problems adding the records to the scheduler tables or notifying the
scheduler about the newly added job.public void setApplicationType(java.lang.String applicationType)
setApplicationType in interface AddJobCmdapplicationType - The job's application type.public void setAttempts(java.lang.Integer attempts)
setAttempts in interface AddJobCmdattempts - The number of attempts to successfully execute the job.public void setCheckCommandId(java.lang.Integer chkCmdId)
chkCmdId - The id of the check command.public void setDelay(java.lang.Integer delay)
public void setEndTime(java.sql.Timestamp endTime)
endTime - The job's end time.public void setErrorUrl(java.lang.String url)
url - The URL to redirect to.public void setHost(java.lang.String host)
public void setInterfaceName(java.lang.String interfaceName)
interfaceName - The interface name of the check command.public void setInterval(java.lang.Integer interval)
setInterval in interface AddJobCmdinterval - The interval in seconds to wait before re-executing the job. 0 means the job will only be executed once.public void setJobId(java.lang.Long newJobId)
newJobId - The jobs id.public void setJobInfo(TypedProperty property) throws ECException
property - The parameters when calling the AddJob command.ECException - if there is a problem with either the parameters passed to create the
schedule job or with the actual creation of the schedule job.public void setName(java.lang.String name)
public void setPathInfo(java.lang.String command)
setPathInfo in interface AddJobCmdcommand - The command to be executed.public void setPriority(java.lang.Integer priority)
priority - The job's priority.public void setQueryString(java.lang.String parameters)
n1=v1&n2=v2 means two parameters will be
passed to the command, one being n1 with a value of v1 and the other n2
with a value of v2.setQueryString in interface AddJobCmdparameters - The parameters passed to the command when executing.public void setDescription(java.lang.String description)
public void setRequestProperties(TypedProperty reqParms) throws ECException
setRequestProperties in interface ControllerCommandsetRequestProperties in class ControllerCommandImplreqParms - The parameters when executing the command.ECException - if any parameters are missing.public void setSequence(java.lang.Integer policy)
setSequence in interface AddJobCmdpolicy - The job's sequence. This value should either be 0 or 1.public void setStartTime(java.sql.Timestamp startTime)
setStartTime in interface AddJobCmdstartTime - The job's start time.public void setStoreId(java.lang.Integer storeId)
setStoreId in interface AddJobCmdstoreId - The id of the store to whose behalf the job will be executed.public void setStringEndTime(java.lang.String endTime)
endTime - The end time of the job.public void setStringStartTime(java.lang.String startTime)
startTime - The job's start time.public void setUrl(java.lang.String url)
public void setUserRefNum(java.lang.Long refnum)
setUserRefNum in interface AddJobCmdrefnum - The user reference number.public void validateParameters()
throws ECException
validateParameters in interface ECCommandvalidateParameters in class AbstractECTargetableCommandECException - if either a require parameter was not specified or a specified parameter
has an invalid value.