|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.infoengine.object.factory.Task
com.infoengine.SAK.BasicTasklet
This abstract class defines the framework for dynamically compiled tasklets. The dynamic tasklet generator can define tasklets such that they extend this class and override its invoke() method.
Nested Class Summary | |
private class |
BasicTasklet.TaskRunner
Inner class for executing tasks in parallel. |
private class |
BasicTasklet.WebjectRunner
Inner class for executing webjects in parallel. |
Field Summary | |
protected Hashtable |
attributes
|
private static String |
baseLogId
|
protected CheckpointProcessor |
checkpointProcessor
|
private static String |
DELIMITERS
Traverses a vector of String values and returns a delimiter character that does not occur in any of them. |
protected IeMultipartInputStream |
inputStream
|
private static String |
localHostAddress
|
protected String |
logId
|
protected StringBuffer |
outputBuffer
|
protected OutputStream |
outputStream
|
private String |
position
|
private Stack |
positionStack
|
private static long |
sequenceNumber
|
protected IeService |
service
|
protected int |
taskType
|
protected String |
uniqueIdentifier
|
Fields inherited from class com.infoengine.object.factory.Task |
AUTH_MAP, CONTEXT, SOURCE, STATUS, TASKS, VDB, WEBJECTS |
Constructor Summary | |
BasicTasklet()
Constructs an initialized instance of the class. |
Method Summary | |
void |
addAttribute(String name,
Object value)
Adds a tasklet attribute value. |
protected void |
addError(Task task)
Adds status and error messages from a subtask to this task. |
void |
addGroup(Group group)
Adds a group to the task's VDB. |
protected void |
addOutputGroups(Task task)
Adds the output groups produced by a tasklet to the VDB of this task. |
void |
addParam(String name,
Object value)
Adds a tasklet parameter value. |
protected void |
awaitThreads(Vector threads)
Await completion of a set of threads in which webjects and/or tasks are running. |
void |
checkpoint(String position,
boolean isResumable,
Webject webject)
Saves the current state of the tasklet if a checkpoint processor is defined. |
protected void |
executeSubtask(String uri)
Executes a subtask. |
void |
finalize()
Removes any state information that might have been saved for the tasklet. |
String |
generateLogId()
Returns an identifier that can be used by this tasklet instance in writing log messages. |
protected void |
generateSOAPResponse(String returnType,
String returnSubstition)
|
Object |
getAttribute(String name)
Returns the value of a tasklet attribute. |
Object |
getAttribute(String name,
Object deflt)
Returns the value of a tasklet attribute. |
Enumeration |
getAttributeNames()
Returns the names of all tasklet attributes currently defined. |
protected Vector |
getAttributes(String name)
Returns all of the values of an attribute. |
Group |
getGroup(String name)
Returns a group from the task's VDB. |
Object |
getParam(String name)
Returns the value of a tasklet parameter. |
Object |
getParam(String name,
Object deflt)
Returns the value of a tasklet parameter. |
Enumeration |
getParamNames()
Returns the names of all tasklet parameters currently defined. |
Vector |
getParams(String name)
Returns the values of a variable defined in the FORM context group. |
protected String |
getSafeDelimiter(Vector values)
|
Object |
getServerParam(String name)
Returns the value of a SERVER context group variable. |
Object |
getServerParam(String name,
String deflt)
Returns the value of a SERVER context group variable. |
protected Vector |
getServerParams(String name)
Returns the values of a variable defined in the SERVER context group. |
IeService |
getService()
Returns the server context associated with this tasklet. |
IeMultipartInputStream |
getTaskletInputStream()
Returns the input stream from which the tasklet can read BLOB data. |
OutputStream |
getTaskletOutputStream()
Returns the output stream associated with this tasklet. |
int |
getTaskType()
Returns the task type currently associated with this tasklet. |
IeCollection |
getVdb()
Returns the VDB collection associated with this tasklet. |
abstract int |
getVersion()
Returns the version number of the task compiler that compiled the task most recently. |
void |
initialize()
Initializes the tasklet. |
protected BasicTasklet.TaskRunner |
initiateTask(Task task)
Initiates a task in a concurrent thread. |
protected BasicTasklet.WebjectRunner |
initiateWebject(Webject webject)
Initiates a webject in a concurrent thread. |
abstract void |
invoke()
Executes the tasklet. |
void |
invokeByProcessor(Vector processors)
Executes the tasklet in a remote task processor. |
void |
mapCredentials()
Creates the SERVER context group named AUTH_MAP by executing the Map-Credentials webject, passing a task URL and directory pathname as defined by the System properties com.infoengine.credentialsMapper and com.infoengine.credentialsFiles. |
int |
nextPosition()
Returns the next position indicator from recovered position information. |
protected boolean |
processBranching(Webject webject,
Task task)
Processes task branching after a webject is executed. |
void |
pruneVdb(Webject webject)
Replaces the current VDB with one that contains only groups specified in GROUP_OUT parameters of a specified webject. |
void |
pushPosition(int position)
Pushes a position indicator onto the front of the position information such that it will be the next indicator returned by nextPosition(). |
Webject |
recover()
Recovers saved state information and initializes the internal position indicator. |
void |
registerException(Throwable exception)
Registers the class name and message associated with an exception in the SERVER context group. |
void |
removeAttribute(String name)
Removes a tasklet attribute. |
void |
removeGroup(String name)
Removes a group from the task's VDB. |
void |
removeSavedState()
Removes any state information that might have been saved for the tasklet. |
void |
setAttribute(String name,
Object value)
Sets the value of a tasklet attribute. |
void |
setCheckpointProcessor(String uniqueIdentifier,
CheckpointProcessor checkpointProcessor)
Sets the checkpoint processor associated with the tasklet. |
void |
setParam(String name,
Object value)
Sets the value of a tasklet parameter. |
void |
setService(IeService service)
Sets the server context associated with this tasklet. |
void |
setTaskletInputStream(IeMultipartInputStream is)
Sets the input stream from which the tasklet can read BLOB data. |
void |
setTaskletOutputStream(OutputStream os)
Sets the output stream associated with this tasklet. |
void |
setTaskType(int taskType)
Sets the task type context associated with this tasklet. |
void |
setVdb(IeCollection collection)
Sets the VDB associated with this tasklet. |
String |
toString()
Returns a string containing the output currently associated with this tasklet. |
protected Throwable |
unwrapThrowable(Throwable ex)
|
void |
verifyResumable()
Verifies that the tasklet can be resumed successfully after an interruption. |
void |
write(String s)
Writes a string to the output stream associated with this tasklet. |
void |
write(String s,
String encoding)
Writes a string to the output stream associated with this tasklet. |
Methods inherited from class com.infoengine.object.factory.Task |
addContext, addError, addInput, addOutput, addOutput, addVdb, addVdb, bindParams, bindParams, checkWebjects, clearInput, deepClone, getAuthElement, getContext, getContext, getContextGroup, getDesc, getGroupIn, getGroupIn, getGroupOut, getGroupOut, getInput, getInput, getInputGroups, getInputs, getInputStream, getMessage, getMessages, getMimeInputStream, getName, getOutput, getOutput, getOutputGroups, getOutputStream, getPassword, getRequest, getSource, getStatus, getType, getUserName, getVariables, getVdb, getVdbIn, getVdbIn, getWebject, newStructure, printTree, removeInput, removeVdb, setContext, setDesc, setInput, setInputStream, setName, setOutputStream, setPassword, setSource, setType, setUserName, setWebject, subVariables |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.infoengine.SAK.Tasklet |
getContext, setContext |
Field Detail |
protected Hashtable attributes
protected CheckpointProcessor checkpointProcessor
protected IeMultipartInputStream inputStream
protected String logId
protected StringBuffer outputBuffer
protected OutputStream outputStream
protected IeService service
protected int taskType
protected String uniqueIdentifier
private String position
private Stack positionStack
private static String baseLogId
private static String localHostAddress
private static long sequenceNumber
private static final String DELIMITERS
Constructor Detail |
public BasicTasklet()
Method Detail |
public abstract int getVersion()
getVersion
in interface Tasklet
public String generateLogId()
public void initialize() throws IEException
initialize
in interface Tasklet
IEException
- if the tasklet is not initialized successfully.public void setTaskletInputStream(IeMultipartInputStream is)
setTaskletInputStream
in interface Tasklet
is
- The Info*Engine multipart input stream from which the tasklet
can read BLOB data.public IeMultipartInputStream getTaskletInputStream()
getTaskletInputStream
in interface Tasklet
public void setTaskletOutputStream(OutputStream os)
setTaskletOutputStream
in interface Tasklet
os
- The new output stream.public OutputStream getTaskletOutputStream()
getTaskletOutputStream
in interface Tasklet
public void write(String s) throws IOException
write
in interface Tasklet
s
- The string to write.
IOException
- if an I/O error occurs.public void write(String s, String encoding) throws IOException
write
in interface Tasklet
s
- The string to write.encoding
- The character encoding to use.
IOException
- if an I/O error occurs.public String toString()
toString
in interface Tasklet
public int getTaskType()
getTaskType
in interface Tasklet
public void setTaskType(int taskType)
setTaskType
in interface Tasklet
taskType
- The new task type, usually one of Task.TYPE_NORMAL
or Task.TYPE_CREDENTIALS_MAPPERpublic IeService getService()
getService
in interface Tasklet
public void setService(IeService service)
setService
in interface Tasklet
service
- The new server context.public IeCollection getVdb()
getVdb
in interface Tasklet
getVdb
in class Task
public void setVdb(IeCollection collection)
setVdb
in interface Tasklet
setVdb
in class Task
collection
- The new collection of VDB groups.public void setCheckpointProcessor(String uniqueIdentifier, CheckpointProcessor checkpointProcessor)
setCheckpointProcessor
in interface Tasklet
uniqueIdentifier
- The unique identifier assigned to the tasklet
instance. This will be passed to the
checkpoint processor object to aid it in
associating saved state with a specific
tasklet instance over time.checkpointProcessor
- The object that can be called to save
a tasklet's state. If null, state information
will not be saved for the tasklet.public void checkpoint(String position, boolean isResumable, Webject webject) throws IEException
position
- The current position of execution within the tasklet.isResumable
- true if execution can be resumed safely after
interruption at this position, false if an
exception should be thrown in case of task
interruption at this position.webject
- A webject whose GROUP_OUT parameters define the
current output groups of the tasklet.
IEException
- if tasklet state was not saved successfullypublic Webject recover()
public void removeSavedState()
IEException
- if tasklet state was not removed successfullypublic int nextPosition()
public void pushPosition(int position)
position
- The position indicator to push.public void verifyResumable() throws IENotResumableException
IENotResumableException
- if tasklet can not be resumed
successfully.public void setParam(String name, Object value)
setParam
in interface Tasklet
name
- The name of the parameter to set.value
- The value to associate with the name.public void addGroup(Group group)
addGroup
in interface Tasklet
group
- the group to be addedpublic void removeGroup(String name)
name
- the name of the group to be removedpublic Group getGroup(String name)
getGroup
in interface Tasklet
name
- the name of the group to be returned
public void addParam(String name, Object value)
addParam
in interface Tasklet
name
- The name of the parameter to add.value
- The value to associate with the name.public Object getParam(String name)
getParam
in interface Tasklet
name
- The name of the parameter to return.
public Object getParam(String name, Object deflt)
getParam
in interface Tasklet
name
- The name of the parameter to return.deflt
- The default value.
public Vector getParams(String name)
getParams
in interface Tasklet
name
- The name of the form variable.
public Enumeration getParamNames()
getParamNames
in interface Tasklet
public Object getServerParam(String name)
name
- The name of the variable to return.
public Object getServerParam(String name, String deflt)
name
- The name of the variable to return.deflt
- The default value.
protected Vector getServerParams(String name)
name
- The name of the server variable.
public void setAttribute(String name, Object value)
setAttribute
in interface Tasklet
name
- The name of the attribute to set.value
- The value to associate with the name.public void addAttribute(String name, Object value)
addAttribute
in interface Tasklet
name
- The name of the attribute to add.value
- The value to associate with the name.public Object getAttribute(String name)
getAttribute
in interface Tasklet
name
- The name of the attribute to return.
public Object getAttribute(String name, Object deflt)
getAttribute
in interface Tasklet
name
- The name of the attribute to return.deflt
- The default value.
protected Vector getAttributes(String name)
name
- The name of the attribute.
public Enumeration getAttributeNames()
getAttributeNames
in interface Tasklet
public void removeAttribute(String name)
removeAttribute
in interface Tasklet
name
- The name of the attribute to remove.public abstract void invoke() throws IEException, IOException
invoke
in interface Tasklet
IEException
- if an error other than an I/O error occurs
during execution of the tasklet.
IOException
- if an I/O error occurs.public void invokeByProcessor(Vector processors) throws IEException, IOException
IEException
- if an error other than an I/O error occurs
during execution of the tasklet.
IOException
- if an I/O error occurs.public void mapCredentials() throws IEException
IEException
- if credentials can not be mappedpublic void pruneVdb(Webject webject) throws IEException
webject
- The webject whose GROUP_OUT parameters specify
the groups to be kept in the task's VDB.
IEException
public void registerException(Throwable exception)
exception
- The exception to be registeredprotected void executeSubtask(String uri) throws IEException, IOException
uri
- The URI of the task to be executed.
IEException
- if an error other than an I/O error occurs.
IOException
- if an I/O error occurs.protected void addError(Task task)
task
- The subtaskprotected boolean processBranching(Webject webject, Task task)
webject
- The webject that was executed.task
- The task in which the webject is defined.
protected BasicTasklet.WebjectRunner initiateWebject(Webject webject)
webject
- The webject to be executed.
protected BasicTasklet.TaskRunner initiateTask(Task task)
task
- The task to be executed.
protected void awaitThreads(Vector threads)
threads
- The vector of webject threads for which to await
completion.protected void addOutputGroups(Task task)
protected String getSafeDelimiter(Vector values) throws IEException
IEException
public void finalize() throws Throwable
IEException
- if tasklet state was not removed successfully
Throwable
protected Throwable unwrapThrowable(Throwable ex)
protected void generateSOAPResponse(String returnType, String returnSubstition) throws IEException
IEException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |