Verastream Transaction Integrator 4.0

com.attachmate.transaction.runtime.common.taskbean
Class BaseTaskBean

java.lang.Object
  extended by com.attachmate.transaction.runtime.common.taskbean.BaseTaskBean
All Implemented Interfaces:
ITask, java.io.Serializable
Direct Known Subclasses:
BaseTxBean

public abstract class BaseTaskBean
extends java.lang.Object
implements ITask, java.io.Serializable

Implements the ITask interface and is to be used as the super class for all generated task beans. Responsible for implementing all details common to all client operation task beans

See Also:
ITask, Serialized Form

Field Summary
 
Fields inherited from interface com.attachmate.tasks.ITask
PRESERVE_ALWAYS, PRESERVE_NEVER, PRESERVE_ON_ERROR
 
Constructor Summary
BaseTaskBean()
          Zero-arg constructor for use with scripting engines and other containers
 
Method Summary
 void addTaskListener(ITaskListener listener)
          Adds a new task listener to this bean.
 void cancel()
          Cancels the currently executing client operation.
 void clearContext()
          Note: this product does not currently participate in Context management as described in the documentation for ITask.
 void copyContext(ITask source)
          Note: this product does not currently participate in Context management as described in the documentation for ITask.
 void executeAsync()
          Asynchronously executes the client operation using the current property settings.
 void executeSync()
          Synchronously executes the client operation using the current property settings.
 java.lang.String getInstanceName()
          Note: This property is only passed through - this product does not currently act upon the supplied value.
 java.lang.String getJobName()
          Note: This property is only passed through - this product does not currently act upon the supplied value.
 java.util.Locale getLocale()
          Note: The Locale property is only passed through - this product does not currently act upon the supplied value.
 int getPreserveContext()
          Note: this product does not currently participate in Context management as described in the documentation for ITask.
 java.lang.String getResourceName()
          Retrieves the name of the resource configuration in use by this bean Note: This property is only passed through - this product does not currently act upon the supplied value.
 TaskStatusChangeEvent getStatus()
          Returns the current client operation execution status.
 long getTimeout()
          Retrieves the current client operation timeout in milliseconds.
 ITaskTransaction getTransaction()
          Note: this product does not currently support Transaction management
 java.lang.String getVersion()
          Retrieves the version of the Attachmate tool used to generate this bean.
 void removeTaskListener(ITaskListener listener)
          Removes the specified task listener from this bean.
 void setInstanceName(java.lang.String name)
          Note: This property is only passed through - this product does not currently act upon the supplied value.
 void setJobName(java.lang.String name)
          Note: This property is only passed through - this product does not currently act upon the supplied value.
 void setLocale(java.util.Locale tlocale)
          Note: This property is only passed through - this product does not currently act upon the supplied value.
 void setPreserveContext(int mode)
          Note: this product does not currently participate in Context management as described in the documentation for ITask.
 void setRemoteServer(java.lang.String server)
          Note: This product does not currently act upon the supplied server value.
 void setResourceName(java.lang.String name)
          Sets the name of the resource to use with this bean.
 void setTimeout(long milliseconds)
          Sets the client operation timeout in milliseconds.
 void transferContext(ITask source)
          Note: this product does not currently participate in Context management as described in the documentation for ITask.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseTaskBean

public BaseTaskBean()
Zero-arg constructor for use with scripting engines and other containers

Method Detail

setPreserveContext

public void setPreserveContext(int mode)
                        throws java.lang.IllegalArgumentException
Note: this product does not currently participate in Context management as described in the documentation for ITask. Sets the preserve context mode.

Specified by:
setPreserveContext in interface ITask
Parameters:
mode - one of the preserve context mode constants.
  • PRESERVE_NEVER -- Do not preserve context after client operation execution (default)
  • PRESERVE_ON_ERROR -- Preserve context on client operation execution errors only
  • PRESERVE_ALWAYS -- Always preserve context after client operation execution
Throws:
java.lang.IllegalArgumentException - if mode is out of range
See Also:
getPreserveContext( ), transferContext( ITask ), copyContext( ITask ), clearContext( )

getPreserveContext

public int getPreserveContext()
Note: this product does not currently participate in Context management as described in the documentation for ITask. Retrieves the current preserve context mode.

Specified by:
getPreserveContext in interface ITask
Returns:
the current preserve context mode or PRESERVE_NEVER if not set.
See Also:
setPreserveContext( int ), transferContext( ITask ), copyContext( ITask ), clearContext( )

transferContext

public void transferContext(ITask source)
                     throws ResourceInUseException
Note: this product does not currently participate in Context management as described in the documentation for ITask. Sets the context for this bean.

Specified by:
transferContext in interface ITask
Parameters:
source - the bean to transfer the context from
Throws:
ResourceInUseException - if another client operation is using the context
See Also:
copyContext( ITask ), setPreserveContext( int ), clearContext( )

copyContext

public void copyContext(ITask source)
                 throws UnsupportedOperationException
Note: this product does not currently participate in Context management as described in the documentation for ITask. Copies a context from one bean to another.

Specified by:
copyContext in interface ITask
Parameters:
source - the bean to copy the context from
Throws:
UnsupportedOperationException - if the implementation does not support this method.
See Also:
transferContext( ITask ), setPreserveContext( int ), clearContext( )

clearContext

public void clearContext()
                  throws ResourceInUseException
Note: this product does not currently participate in Context management as described in the documentation for ITask. Any Context previously supplied will be cleared with this method.

Specified by:
clearContext in interface ITask
Throws:
ResourceInUseException - if the client operation is using the context
See Also:
transferContext( ITask ), copyContext( ITask ), setPreserveContext( int )

getTransaction

public ITaskTransaction getTransaction()
                                throws UnsupportedOperationException
Note: this product does not currently support Transaction management

Returns:
ITaskTransaction implementation
Throws:
UnsupportedOperationException

getStatus

public TaskStatusChangeEvent getStatus()
Returns the current client operation execution status. The event object contains the following client operation status information:

Specified by:
getStatus in interface ITask
Returns:
the last status change event that was fired or null if the client operation has never been executed.

setTimeout

public void setTimeout(long milliseconds)
Sets the client operation timeout in milliseconds. Controls the length of time a client operation can execute before firing a task status change event with a TASK_TIMEOUT completion status.

Specified by:
setTimeout in interface ITask
Parameters:
milliseconds - the maximum time to wait for client operation execution to complete. Default is Long.MAX_VALUE.
See Also:
getTimeout( ), ITaskListener, TaskStatusChangeEvent

getTimeout

public long getTimeout()
Retrieves the current client operation timeout in milliseconds.

Specified by:
getTimeout in interface ITask
Returns:
the maximum time in milliseconds to wait for client operation execution to complete. Default is Long.MAX_VALUE.
See Also:
setTimeout( long ), ITaskListener, TaskStatusChangeEvent

executeSync

public void executeSync()
                 throws ResourceInUseException,
                        HostResponseFormatException
Synchronously executes the client operation using the current property settings. Fires task status change events to track the client operation execution progress. Does not return until the client operation completes, times out or is canceled. Uses the currently owned context, or creates one if none has been set.

Specified by:
executeSync in interface ITask
Throws:
ResourceInUseException - if no resource can be obtained for execution
ResourceInUseException - if client operation is already executing
HostResponseFormatException - if client operation execution response from the Host contains content that cannot be successfully parsed using the copybook format specified as expected client operation output when the client operation was designed.
See Also:
executeAsync( ), cancel( ), ITaskListener, TaskStatusChangeEvent

executeAsync

public void executeAsync()
                  throws ResourceInUseException,
                         HostResponseFormatException
Asynchronously executes the client operation using the current property settings. Starts a thread that calls executeSync. This method returns without waiting for the client operation to complete. Listeners will be notified of client operation progress and completion status via the client operation status change events. Uses the currently owned context, or creates one if none has been set.

Specified by:
executeAsync in interface ITask
Throws:
ResourceInUseException - if no resource can be obtained for execution
ResourceInUseException - if client operation is already executing
HostResponseFormatException - if client operation execution response from the Host contains content that cannot be successfully parsed using the copybook format specified as expected client operation output when the client operation was designed.
See Also:
executeSync( ), cancel( ), ITaskListener, TaskStatusChangeEvent

cancel

public void cancel()
Cancels the currently executing client operation. Releases a waiting executeSync which subsequently fires a task status change event with a TASK_CANCELED completion status.

Issues/Limitations:

  1. To be at all useful, cancel must be able to interrupt executeSync.
  2. Since executeSync blocks, cancel must be capable of being called from a separate thread.
  3. cancel may have far-reaching design implications, if underlying objects must be made interruptable.

Specified by:
cancel in interface ITask
See Also:
executeSync( ), executeAsync( ), ITaskListener, TaskStatusChangeEvent

addTaskListener

public void addTaskListener(ITaskListener listener)
Adds a new task listener to this bean.

Specified by:
addTaskListener in interface ITask
Parameters:
listener - the new listener to add

removeTaskListener

public void removeTaskListener(ITaskListener listener)
Removes the specified task listener from this bean.

Specified by:
removeTaskListener in interface ITask
Parameters:
listener - the new listener to remove

getVersion

public java.lang.String getVersion()
Retrieves the version of the Attachmate tool used to generate this bean. This information is either a bean generator input parameter or else it is contained in the input client operation data.

Specified by:
getVersion in interface ITask
Returns:
version number

setInstanceName

public void setInstanceName(java.lang.String name)
Note: This property is only passed through - this product does not currently act upon the supplied value. Sets a user-defined instance name, such as an identifier for the bean on a web page or other bean container. This name need not be unique.

Issues/Limitations:

  1. The Management Control Server monitor could display this string if lower level objects will pass it on through.

Specified by:
setInstanceName in interface ITask
Parameters:
name - optional instance name
See Also:
getInstanceName( ), setResourceName( String ), setJobName( String )

getInstanceName

public java.lang.String getInstanceName()
Note: This property is only passed through - this product does not currently act upon the supplied value. Retrieves a user-defined instance name, such as an identifier for the bean on a web page or other bean container. This name may not be unique.

Specified by:
getInstanceName in interface ITask
Returns:
instance name or a blank string if not set
See Also:
setInstanceName( String ), getResourceName( ), getJobName( )

setResourceName

public void setResourceName(java.lang.String name)
Sets the name of the resource to use with this bean. This name refers to the resource or resource configuration to be used with this client operation. Note: This property is only passed through - this product does not currently act upon the supplied value.

Issues/Limitations:

  1. This property may be used by the system to look up a mapping to a resource, such as a server address, data source name, etc.
  2. The Management Control Server monitor could display this string if lower level objects will pass it on through.

Specified by:
setResourceName in interface ITask
Parameters:
name - the name of the resource to use
See Also:
getResourceName( ), setInstanceName( String ), setJobName( String )

getResourceName

public java.lang.String getResourceName()
Retrieves the name of the resource configuration in use by this bean Note: This property is only passed through - this product does not currently act upon the supplied value.

Specified by:
getResourceName in interface ITask
Returns:
resource name or fully qualified class name if not set
See Also:
setResourceName( String ), getInstanceName( ), getJobName( )

setJobName

public void setJobName(java.lang.String name)
Note: This property is only passed through - this product does not currently act upon the supplied value. Sets a user-defined job name, such as a JSP web path. This name need not be unique.

Specified by:
setJobName in interface ITask
Parameters:
name - user-defined job name
See Also:
getJobName( ), setInstanceName( String ), setResourceName( String )

getJobName

public java.lang.String getJobName()
Note: This property is only passed through - this product does not currently act upon the supplied value. Retrieves user-defined job name, such as a JSP web path. This name may not be unique.

Specified by:
getJobName in interface ITask
Returns:
job name or a blank string if not set
See Also:
setJobName( String ), getInstanceName( ), getResourceName( )

setLocale

public void setLocale(java.util.Locale tlocale)
Note: This property is only passed through - this product does not currently act upon the supplied value.

Specified by:
setLocale in interface ITask
Parameters:
tlocale - the locale to be used by this bean
See Also:
getLocale( )

getLocale

public java.util.Locale getLocale()
Note: The Locale property is only passed through - this product does not currently act upon the supplied value.

Specified by:
getLocale in interface ITask
Returns:
any Locale property if it has been set
See Also:
setLocale(java.util.Locale)

setRemoteServer

public void setRemoteServer(java.lang.String server)
Note: This product does not currently act upon the supplied server value.

Parameters:
server - the name of the server to use for client operation execution

Verastream Transaction Integrator 4.0