IBM Branch Transformation Toolkit Javadoc

com.ibm.dse.services.jxfs
Class JXFSService

java.lang.Object
  extended bycom.ibm.dse.base.DSENotifier
      extended bycom.ibm.dse.base.Service
          extended bycom.ibm.dse.services.jxfs.JXFSService
All Implemented Interfaces:
java.util.EventListener, Externalizable, java.io.Externalizable, com.jxfs.general.IJxfsConst, com.jxfs.events.IJxfsIntermediateListener, com.jxfs.events.IJxfsOperationCompleteListener, com.jxfs.events.IJxfsStatusListener, Notifier, java.io.Serializable
Direct Known Subclasses:
JXFSChk, JXFSPrt

public class JXFSService
extends Service
implements com.jxfs.events.IJxfsOperationCompleteListener, com.jxfs.events.IJxfsStatusListener, com.jxfs.events.IJxfsIntermediateListener, com.jxfs.general.IJxfsConst

This class implements a Service that manages a generic JXFS Device Control.

See Also:
Serialized Form

Field Summary
static boolean AUTOOPEN_NO
           
static boolean AUTOOPEN_YES
           
protected  java.lang.String configKey
          The configuration application key used in the repository.
protected  java.util.Hashtable ids
          The Hashtable for the synchronous pending operations identificationIDs.
protected  Vector idSyncs
          The vector for the synchronous pending operations identificationIDs.
protected  int preOpenTimeout
          The timeout for every function to wait for opening if there is automatic open.
protected  java.lang.String sdmAddparm
          The first parameter of sdm.
protected  java.lang.String sdmName
          The name of specific device manager (sdm).
protected  int syncTimeout
          The timeout in miliseconds used by synchronous utilities.
protected  boolean trace
           
protected static int waitMsgTime
          The poll time in miliseconds used by synchronous utilities.
protected  java.lang.String workstationName
          The workstation name.
 
Fields inherited from class com.ibm.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Fields inherited from interface com.jxfs.events.IJxfsOperationCompleteListener
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.jxfs.events.IJxfsStatusListener
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.jxfs.events.IJxfsIntermediateListener
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.jxfs.general.IJxfsConst
JXFS_ALL, JXFS_ALM_OFFSET, JXFS_CAM_OFFSET, JXFS_CDR_OFFSET, JXFS_CHK_OFFSET, JXFS_COPYRIGHT, JXFS_DEP_OFFSET, JXFS_E_BUSY, JXFS_E_CANCELLED, JXFS_E_CLAIMED, JXFS_E_CLOSED, JXFS_E_DISABLED, JXFS_E_EXISTS, JXFS_E_FAILURE, JXFS_E_FIRMWARE, JXFS_E_HARDWAREERROR, JXFS_E_ILLEGAL, JXFS_E_IO, JXFS_E_NOCONTROL, JXFS_E_NOEXIST, JXFS_E_NOHARDWARE, JXFS_E_NOSERVICE, JXFS_E_NOT_SUPPORTED, JXFS_E_NOTCLAIMED, JXFS_E_NOTREMOTE, JXFS_E_OFFLINE, JXFS_E_OPEN, JXFS_E_PARAMETER_INVALID, JXFS_E_REMOTE, JXFS_E_SYSTEM, JXFS_E_TIMEOUT, JXFS_E_UNREGISTERED, JXFS_FOREVER, JXFS_ISO_OFFSET, JXFS_LEVEL_ACTIVE, JXFS_LEVEL_ALL, JXFS_LEVEL_CONFIGURED, JXFS_LEVEL_WORKSTATION, JXFS_LOG_USEROFFSET, JXFS_MSD_OFFSET, JXFS_O_CLOSE, JXFS_O_OPEN, JXFS_O_UPDATEFIRMWARE, JXFS_PIN_OFFSET, JXFS_PTR_OFFSET, JXFS_RC_SUCCESSFUL, JXFS_RC_UNSUCCESSFUL, JXFS_S_BIN_STATUS, JXFS_S_CLAIMED, JXFS_S_HARDWAREERROR, JXFS_S_MEDIA_STATUS, JXFS_S_POWERSAVEOFF, JXFS_S_POWERSAVEON, JXFS_S_RELEASED, JXFS_S_REMOTEFAILURE, JXFS_S_SERVICE_STARTED, JXFS_S_SERVICE_STOPPED, JXFS_S_SHUTDOWN, JXFS_S_USERACTIONERROR, JXFS_S_WORKING, JXFS_SIU_OFFSET, JXFS_TIO_OFFSET, JXFS_VALID_CONTROLID, JXFS_VERSION_CONTROL, JXFSDEVICE_OFFSET, JXFSDIRECTIO_OFFSET, JXFSERR, JXFSERREXT, NO_MATCH, NO_SOURCE, NO_SUPPORT, OK_EQUAL, OK_NEWER, OK_OLDER, OK_OTHER
 
Constructor Summary
JXFSService()
          This constructor creates a JXFSService object.
JXFSService(java.lang.String aName)
          This constructor creates a JXFSService object.
 
Method Summary
 void cancel(int identificationID)
          Makes a cancel call to the J/XFS Device Control.
 boolean claim(int timeout)
          Makes a claim call to the J/XFS Device Control.
 int closeSync()
          Makes a close call to the J/XFS Device Control and waits for the operation complete event.
protected  void finalize()
          Makes a final clean and closes the device.
 java.lang.String getConfigKey()
          Returns the value of the configKey property.
 com.jxfs.control.JxfsBaseControl getDeviceControl()
          Returns the value of the myDeviceControl property.
 com.jxfs.general.JxfsDeviceManager getDeviceManager()
          Returns the value of the myDeviceControl property.
 java.lang.String getDeviceName()
          Returns the value of the deviceName property.
 java.lang.String getIniConfigFile()
          Returns the value of the iniConfigFile property.
 java.lang.String getSdmAddparm()
          Returns the value of the sdmAddparm property.
 java.lang.String getSdmName()
          Returns the value of the sdmName property.
 com.jxfs.general.JxfsStatus getStatus()
          Makes a getStatus call to the J/XFS Device Control.
 java.lang.String getWorkstationName()
          Returns the value of the workstationName property.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a JXFSService object with the aTag attributes.
 void intermediateOccurred(com.jxfs.events.JxfsIntermediateEvent anEvent)
          Receives the intermediate events.
 boolean isAutoOpen()
          Sets the value of the autoOpen property.
 boolean isOpened()
          Sets the value of the isOpened property.
protected  boolean isValidURL(java.lang.String fileName)
          Checks if the filename is a valid URL.
 int openSync()
          Makes an open call to the J/XFS Device Control and waits for the operation complete event.
 void operationCompleteOccurred(com.jxfs.events.JxfsOperationCompleteEvent anEvent)
          Receives the operation complete event
protected  void registerListener()
          Registers the service as listener of the J/XFS Device Control events.
 boolean release(int timeout)
          Makes a release call to the J/XFS Device Control.
 void setAutoOpen(boolean newValue)
          Sets the value of the autoOpen property.
 void setConfigKey(java.lang.String configKey)
          Sets the value of the configKey property.
 void setDeviceName(java.lang.String newValue)
          Sets the value of the deviceName property.
 void setIniConfigFile(java.lang.String newValue)
          Sets the value of the iniConfigfile property.
 void setPreOpenTimeout(int newValue)
          Sets the value of the preOpenTimeout property.
 void setSdmAddparm(java.lang.String sdmAddparm)
          Sets the value of the sdmAddparm property.
 void setSdmName(java.lang.String sdmName)
          Sets the value of the sdmName property.
 void setSyncTimeout(int newValue)
          Sets the value of the syncTimeout property.
 void setWorkstationName(java.lang.String workstationName)
          Sets the value of the workstationName property.
 void statusOccurred(com.jxfs.events.JxfsStatusEvent anEvent)
          Receives the status events.
 void terminate()
          Performs housekeeping for the service instance when the J/XFS Device Control closes.
 java.lang.String toString()
          Returns a visual representation of the service.
protected  int waitForID(int anID)
          Waits for the arrival of the operation complete event with the specified identification.
 boolean waitOpen(long timeout)
          Waits for the Device to be opened.
 
Methods inherited from class com.ibm.dse.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.dse.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.dse.base.Externalizable
getName, setName
 

Field Detail

AUTOOPEN_YES

public static final boolean AUTOOPEN_YES
See Also:
Constant Field Values

AUTOOPEN_NO

public static final boolean AUTOOPEN_NO
See Also:
Constant Field Values

trace

protected boolean trace

preOpenTimeout

protected int preOpenTimeout
The timeout for every function to wait for opening if there is automatic open.


ids

protected java.util.Hashtable ids
The Hashtable for the synchronous pending operations identificationIDs.


idSyncs

protected Vector idSyncs
The vector for the synchronous pending operations identificationIDs.


waitMsgTime

protected static final int waitMsgTime
The poll time in miliseconds used by synchronous utilities.

See Also:
Constant Field Values

syncTimeout

protected int syncTimeout
The timeout in miliseconds used by synchronous utilities.


workstationName

protected java.lang.String workstationName
The workstation name.


configKey

protected java.lang.String configKey
The configuration application key used in the repository.


sdmName

protected java.lang.String sdmName
The name of specific device manager (sdm).


sdmAddparm

protected java.lang.String sdmAddparm
The first parameter of sdm.

Constructor Detail

JXFSService

public JXFSService()
This constructor creates a JXFSService object.


JXFSService

public JXFSService(java.lang.String aName)
            throws java.io.IOException
This constructor creates a JXFSService object.

Parameters:
aName - java.lang.String Object name
Throws:
java.io.IOException - The object cannot be created.
Method Detail

cancel

public void cancel(int identificationID)
            throws com.jxfs.events.JxfsException
Makes a cancel call to the J/XFS Device Control.

Parameters:
identificationID - int - ID of the function to cancel
Throws:
com.jxfs.events.JxfsException - The device is not opened

claim

public boolean claim(int timeout)
              throws com.jxfs.events.JxfsException
Makes a claim call to the J/XFS Device Control.

Parameters:
timeout - int - time to wait for the function to finish
Returns:
boolean - true if successful, false if the function timed out
Throws:
com.jxfs.events.JxfsException - The device is not opened

closeSync

public int closeSync()
              throws com.jxfs.events.JxfsException
Makes a close call to the J/XFS Device Control and waits for the operation complete event.

Returns:
int - the result of the operation
Throws:
com.jxfs.events.JxfsException - The device is not opened

finalize

protected void finalize()
                 throws com.jxfs.events.JxfsException
Makes a final clean and closes the device.

Throws:
com.jxfs.events.JxfsException - The device cannot be closed
com.jxfs.events.JxfsException - The device is not open

getConfigKey

public java.lang.String getConfigKey()
Returns the value of the configKey property.

Returns:
String - The current value of configKey

getDeviceControl

public com.jxfs.control.JxfsBaseControl getDeviceControl()
Returns the value of the myDeviceControl property.

Returns:
JxfsDocumentPrinter - The current value of myDeviceControl.

getDeviceManager

public com.jxfs.general.JxfsDeviceManager getDeviceManager()
Returns the value of the myDeviceControl property.

Returns:
JxfsDocumentPrinter - The current value of myDeviceControl.

getDeviceName

public java.lang.String getDeviceName()
Returns the value of the deviceName property.

Returns:
String - The current value of deviceName.

getIniConfigFile

public java.lang.String getIniConfigFile()
Returns the value of the iniConfigFile property.

Returns:
String - The current value of iniConfigFile.

getSdmAddparm

public java.lang.String getSdmAddparm()
Returns the value of the sdmAddparm property.

Returns:
String - The current value of sdmAddparm

getSdmName

public java.lang.String getSdmName()
Returns the value of the sdmName property.

Returns:
String - The current value of sdmName

getStatus

public com.jxfs.general.JxfsStatus getStatus()
                                      throws com.jxfs.events.JxfsException
Makes a getStatus call to the J/XFS Device Control.

Returns:
JxfsStatus - the current status of the device
Throws:
com.jxfs.events.JxfsException - The device is not open

getWorkstationName

public java.lang.String getWorkstationName()
Returns the value of the workstationName property.

Returns:
String - The current value of workstationName

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes a JXFSService object with the aTag attributes.

Specified by:
initializeFrom in interface Externalizable
Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.dse.base.Tag - contains the name and attributes of the object to be created.
Returns:
Object - An instance of JXFSService.
Throws:
java.io.IOException - The object cannot be created.
java.io.DSEException - The object cannot be created.
DSEException

intermediateOccurred

public void intermediateOccurred(com.jxfs.events.JxfsIntermediateEvent anEvent)
Receives the intermediate events.

Specified by:
intermediateOccurred in interface com.jxfs.events.IJxfsIntermediateListener
Parameters:
anEvent - com.jxfs.events.IntermediateEvent - the IntermediateEvent event received

isAutoOpen

public boolean isAutoOpen()
Sets the value of the autoOpen property.

Returns:
boolean - The current value of autoOpen.

isOpened

public boolean isOpened()
Sets the value of the isOpened property.

Returns:
boolean - The current value of isOpened.

isValidURL

protected boolean isValidURL(java.lang.String fileName)
Checks if the filename is a valid URL.

Parameters:
fileName - The filename to check
Returns:
boolean - Returns true if the fileName is a valid URL

openSync

public int openSync()
             throws com.jxfs.events.JxfsException
Makes an open call to the J/XFS Device Control and waits for the operation complete event.

Returns:
int - the result of the operation
Throws:
com.jxfs.events.JxfsException - The device could not be opened

operationCompleteOccurred

public void operationCompleteOccurred(com.jxfs.events.JxfsOperationCompleteEvent anEvent)
Receives the operation complete event

Specified by:
operationCompleteOccurred in interface com.jxfs.events.IJxfsOperationCompleteListener
Parameters:
anEvent - com.jxfs.events.OperationCompleteEvent - the OperationCompleteEvent event received

registerListener

protected void registerListener()
Registers the service as listener of the J/XFS Device Control events. It will capture the events and transform them into Branch Transformation Toolkit events


release

public boolean release(int timeout)
                throws com.jxfs.events.JxfsException
Makes a release call to the J/XFS Device Control.

Parameters:
timeout - int - time to wait for the function to finish
Returns:
boolean - true if success, false if timeout expired
Throws:
com.jxfs.events.JxfsException - The device is not opened

setAutoOpen

public void setAutoOpen(boolean newValue)
Sets the value of the autoOpen property.

Parameters:
newValue - boolean - the new value of the property.

setConfigKey

public void setConfigKey(java.lang.String configKey)
Sets the value of the configKey property.

Parameters:
configKey - - the new value of the configKey property

setDeviceName

public void setDeviceName(java.lang.String newValue)
Sets the value of the deviceName property.

Parameters:
newValue - String - the new value of the property.

setIniConfigFile

public void setIniConfigFile(java.lang.String newValue)
Sets the value of the iniConfigfile property.

Parameters:
newValue - String - the new value of the property.

setPreOpenTimeout

public void setPreOpenTimeout(int newValue)
Sets the value of the preOpenTimeout property.

Parameters:
newValue - int - the new value of the property.

setSdmAddparm

public void setSdmAddparm(java.lang.String sdmAddparm)
Sets the value of the sdmAddparm property.

Parameters:
sdmAddparm - - the new value of the sdmAddparm property

setSdmName

public void setSdmName(java.lang.String sdmName)
Sets the value of the sdmName property.

Parameters:
sdmName - - the new value of the sdmName property

setSyncTimeout

public void setSyncTimeout(int newValue)
Sets the value of the syncTimeout property.

Parameters:
newValue - int - the new value of the property.

setWorkstationName

public void setWorkstationName(java.lang.String workstationName)
Sets the value of the workstationName property.

Parameters:
workstationName - - the new value of the workstationName property

statusOccurred

public void statusOccurred(com.jxfs.events.JxfsStatusEvent anEvent)
Receives the status events.

Specified by:
statusOccurred in interface com.jxfs.events.IJxfsStatusListener
Parameters:
anEvent - com.jxfs.events.StatusEvent - the StatusEvent event received

terminate

public void terminate()
               throws DSEException
Performs housekeeping for the service instance when the J/XFS Device Control closes. This is called either from the application or from the context when it is destroyed or unchained.

Specified by:
terminate in interface Notifier
Overrides:
terminate in class Service
Throws:
DSEException - The terminate could not be done

toString

public java.lang.String toString()
Returns a visual representation of the service.

Overrides:
toString in class Service
Returns:
String - the concatenation of the service's values

waitForID

protected int waitForID(int anID)
Waits for the arrival of the operation complete event with the specified identification.

Parameters:
anID - int - the identification of the event operation
Returns:
int - the result of that operation complete event

waitOpen

public boolean waitOpen(long timeout)
Waits for the Device to be opened.

Returns:
boolean true if device is open (sem signaled) or false if the function times out

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005