com.ibm.dse.services.jxfs
Class JXFSService

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.services.jxfs.JXFSService
Direct Known Subclasses:
JXFSMsd, JXFSPrt

public class JXFSService
extends Service
implements com.jxfs.events.OperationCompleteListener, com.jxfs.events.StatusListener, com.jxfs.events.IntermediateListener, com.jxfs.general.JxfsConst

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.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 static 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
 
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.OperationCompleteListener
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.jxfs.events.StatusListener
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.jxfs.events.IntermediateListener
JXFS_COPYRIGHT, JXFS_VERSION_CONTROL
 
Fields inherited from interface com.jxfs.general.JxfsConst
JXFS_ALL, JXFS_ALM_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_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_LEVEL_ACTIVE, JXFS_LEVEL_ALL, JXFS_LEVEL_CONFIGURED, JXFS_LEVEL_WORKSTATION, 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_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 jxfs device control
 boolean claim(int timeout)
          Makes a claim call to the jxfs device control
 int closeSync()
          Makes a close call to the jxfs device control and waits for the operation complete event
protected  void finalize()
          Makes final clean, closing the device
 com.jxfs.control.JxfsBaseControl getDeviceControl()
          Returns the value of the myDeviceManager property.
 java.lang.String getDeviceName()
          Returns the value of the deviceName property.
 java.lang.String getIniConfigFile()
          Returns the value of the iniConfigFile property.
 com.jxfs.general.JxfsStatus getStatus()
          Makes a getStatus call to the jxfs device control
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a JXFSService object with the aTag attributes.
 void intermediateOccurred(com.jxfs.events.IntermediateEvent anEvent)
          Receives the intermediate events
 boolean isAutoOpen()
          Sets the value of the autoOpen property.
 boolean isOpened()
          Sets the value of the isOpened property.
 int openSync()
          Makes an open call to the jxfs device control and waits for the operation complete event
 void operationCompleteOccurred(com.jxfs.events.OperationCompleteEvent anEvent)
          Receives the operation complete events Manages the particular situation of automatic open
protected  void registerListener()
          Registers the service as listener of the JXFS device control events It will capture the events and transform to WSCB events
 boolean release(int timeout)
          Makes a release call to the jxfs device control
 void setAutoOpen(boolean newValue)
          Sets the value of the autoOpen 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 statusOccurred(com.jxfs.events.StatusEvent anEvent)
          Receives the status events
 void terminate()
          Housekeeping process for the service instance.
 java.lang.String toString()
          Returns a visual representation of the service
protected  int waitForID(int anID)
          Waits for the arriving of the operation complete event for that identification ID
 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
 

Field Detail

AUTOOPEN_YES

public static final boolean AUTOOPEN_YES

AUTOOPEN_NO

public static final boolean AUTOOPEN_NO

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

syncTimeout

protected static final int syncTimeout
The timeout in miliseconds used by synchronous utilities
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 jxfs 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 jxfs 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

closeSync

public int closeSync()
              throws com.jxfs.events.JxfsException
Makes a close call to the jxfs device control and waits for the operation complete event
Returns:
int - the jxfs result of the operation
Throws:
com.jxfs.events.JxfsException - The device is not opened

finalize

protected void finalize()
                 throws com.jxfs.events.JxfsException
Makes final clean, closing the device
Overrides:
finalize in class java.lang.Object
Throws:
JxfsException. - Cannot do closing
com.jxfs.events.JxfsException - The device is not opened

getDeviceControl

public com.jxfs.control.JxfsBaseControl getDeviceControl()
Returns the value of the myDeviceManager property.
Returns:
JxfsDocumentPrinter - The current value of myDeviceManager.

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.

getStatus

public com.jxfs.general.JxfsStatus getStatus()
                                      throws com.jxfs.events.JxfsException
Makes a getStatus call to the jxfs device control
Returns:
JxfsStatus - the current status of the jxfs device
Throws:
com.jxfs.events.JxfsException - The device is not opened

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes a JXFSService object with the aTag attributes.
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 can not be created.
java.io.DSEException - The object can not be created.

intermediateOccurred

public void intermediateOccurred(com.jxfs.events.IntermediateEvent anEvent)
Receives the intermediate events
Specified by:
intermediateOccurred in interface com.jxfs.events.IntermediateListener
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.

openSync

public int openSync()
             throws com.jxfs.events.JxfsException
Makes an open call to the jxfs device control and waits for the operation complete event
Returns:
int - the jxfs result of the operation
Throws:
com.jxfs.events.JxfsException - The device could not be opened

operationCompleteOccurred

public void operationCompleteOccurred(com.jxfs.events.OperationCompleteEvent anEvent)
Receives the operation complete events Manages the particular situation of automatic open
Specified by:
operationCompleteOccurred in interface com.jxfs.events.OperationCompleteListener
Parameters:
anEvent - com.jxfs.events.OperationCompleteEvent The OperationCompleteEvent event received

registerListener

protected void registerListener()
Registers the service as listener of the JXFS device control events It will capture the events and transform to WSCB events

release

public boolean release(int timeout)
                throws com.jxfs.events.JxfsException
Makes a release call to the jxfs 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.

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.

statusOccurred

public void statusOccurred(com.jxfs.events.StatusEvent anEvent)
Receives the status events
Specified by:
statusOccurred in interface com.jxfs.events.StatusListener
Parameters:
anEvent - com.jxfs.events.StatusEvent The StatusEvent event received

terminate

public void terminate()
               throws DSEException
Housekeeping process for the service instance. This is called either from the application or from the context when it is destroyed or unchained. So the Jxfs DevcieControl is closed
Overrides:
terminate in class Service
Throws:
DSEException - 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 parameters values concatenation

waitForID

protected int waitForID(int anID)
Waits for the arriving of the operation complete event for that identification ID
Parameters:
anID - int the identificationID of the event operation to wait
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 opened (sem signaled) or false if timeout