public class UserCodeProcess extends StandardClient implements ProxyObserver<Job>, Runnable
1. assessStartConditions() 2. start() 3. complete() 4. in case of error/exception execute error transition which is suspend for default statemachine
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
active |
static String |
DEFAULT_ROLE
Defines the default role (value:"UserCode").
|
protected HashMap<String,C2KLocalObject> |
jobs |
static String |
STATE_MACHINE_COMPLETE_TRANSITION
Defines the name of the CRISTAL Property (value:"StateMachine.completeTransition") to override the default mapping for Complete transition.
|
static String |
STATE_MACHINE_ERROR_TRANSITION
Defines the name of the CRISTAL Property (value:"StateMachine.errorTransition") to override the default mapping for Error transition.
|
static String |
STATE_MACHINE_START_TRANSITION
Defines the name of the CRISTAL Property (value:"StateMachine.startTransition") to override the default mapping for Start transition.
|
static String |
USERCODE_IGNORE
Defines the value (value:"USERCODE_IGNORE") to to be used in CRISTAL Property to ignore the Jobs of that Transition
eg: UserCode.StateMachine.resumeTransition = USERCODE_IGNORE
|
agentisServer, MAIN_ARG_CONFIG, MAIN_ARG_CONNECT, MAIN_ARG_LOGFILE, MAIN_ARG_LOGLEVEL, MAIN_ARG_NONEWLOGSTREAM, MAIN_ARG_RESETIOR, MAIN_ARG_SKIPBOOTSTRAP| Constructor and Description |
|---|
UserCodeProcess()
Default constructor set up the user code with default setting
|
UserCodeProcess(String propPrefix)
Constructor set up the user code
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Job job)
Receives job from the AgentProxy.
|
boolean |
assessStartConditions(Job job)
Override this method to implement application specific evaluation of start condition.
|
void |
complete(Job thisJob,
String jobKey)
Method called to handle the Complete transition.
|
void |
control(String control,
String msg) |
protected Job |
getActualJob()
Gets the next possible Job based on the Transitions of the Default StateMachine
|
String |
getDesc() |
static void |
main(String[] args) |
void |
remove(String id)
Job removal notification from the AgentProxy.
|
void |
run() |
void |
runUserCodeLogic(Job job,
Job errorJob)
Override this mehod to implement application specific (business) logic
Default implementation - the agent execute any scripts, query or both defined
|
static void |
shutdown() |
void |
start(Job thisJob,
String jobKey)
Method called to handle the Start transition.
|
getRequiredStateMachine, loginreadC2KArgs, readPropertyFiles, setShutdownHandler, shutdownpublic static final String DEFAULT_ROLE
public static final String STATE_MACHINE_START_TRANSITION
public static final String STATE_MACHINE_COMPLETE_TRANSITION
public static final String STATE_MACHINE_ERROR_TRANSITION
public static final String USERCODE_IGNORE
protected static boolean active
protected final HashMap<String,C2KLocalObject> jobs
public UserCodeProcess()
throws InvalidDataException,
ObjectNotFoundException
InvalidDataException - incorrect configrationObjectNotFoundException - StateMachine to configure the UserCode was not foundpublic UserCodeProcess(String propPrefix) throws InvalidDataException, ObjectNotFoundException
propPrefix - string to be used as prefix for each propertyInvalidDataException - StateMachine does not have the named TransitionObjectNotFoundException - StateMachine was not foundpublic void start(Job thisJob, String jobKey) throws AccessRightsException, InvalidDataException, InvalidTransitionException, ObjectNotFoundException, PersistencyException, ObjectAlreadyExistsException, ScriptErrorException, InvalidCollectionModification
thisJob - the actual Job to be executed.jobKey - the key of the job (i.e. itemPath:stepPat)AccessRightsExceptionInvalidDataExceptionInvalidTransitionExceptionObjectNotFoundExceptionPersistencyExceptionObjectAlreadyExistsExceptionScriptErrorExceptionInvalidCollectionModificationpublic void complete(Job thisJob, String jobKey) throws Exception
thisJob - the actual Job to be executed.jobKey - the key of the job (i.e. itemPath:stepPat)Exceptionpublic boolean assessStartConditions(Job job)
job - the actual Job to be executed.public void runUserCodeLogic(Job job, Job errorJob) throws AccessRightsException, InvalidDataException, InvalidTransitionException, ObjectNotFoundException, PersistencyException, ObjectAlreadyExistsException, InvalidCollectionModification, ScriptErrorException
job - the actual Job to be executed.errorJob - Job to be executed in case of an errorAccessRightsExceptionInvalidDataExceptionInvalidTransitionExceptionObjectNotFoundExceptionPersistencyExceptionObjectAlreadyExistsExceptionInvalidCollectionModificationScriptErrorExceptionprotected Job getActualJob()
public void add(Job job)
add in interface ProxyObserver<Job>public void control(String control, String msg)
control in interface ProxyObserver<Job>public void remove(String id)
remove in interface ProxyObserver<Job>public String getDesc()
public static void shutdown()
public static void main(String[] args)
Copyright © 1997–2020 CRISTAL-iSE. All rights reserved.