com.ibm.as400.resource
Class RIFSFile

java.lang.Object
  |
  +--com.ibm.as400.resource.Resource
        |
        +--com.ibm.as400.resource.ChangeableResource
              |
              +--com.ibm.as400.resource.RIFSFile
All Implemented Interfaces:
java.io.Serializable

public class RIFSFile
extends ChangeableResource

The RIFSFile class represents a file or directory in the integrated file system on the iSeries or AS/400 server. This class provides function similar to IFSFile and IFSJavaFile except that it is a subclass of Resource. As a result, it can be used directly in conjunction with components written for Resource objects.

The following attribute IDs are supported:

  • ABSOLUTE_PATH
  • CANONICAL_PATH
  • CAN_READ
  • CAN_WRITE
  • CCSID
  • CREATED
  • EXISTS
  • IS_ABSOLUTE
  • IS_DIRECTORY
  • IS_FILE
  • IS_HIDDEN
  • IS_READ_ONLY
  • LAST_ACCESSED
  • LAST_MODIFIED
  • LENGTH
  • NAME
  • PARENT
  • PATH
  • TYPE

    Use any of these attribute IDs with getAttributeValue() and setAttributeValue() to access the attribute values for an RIFSFile.

    // Create an RIFSFile object to refer to a specific file.
    AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    RIFSFile file = new RIFSFile(system, "/home/myuserid/config.txt");
    
    // Determine if the file is read only. boolean readOnly = ((Boolean)file.getAttributeValue(RIFSFile.IS_READ_ONLY)).booleanValue();
    // Set the last modified date to now. file.setAttributeValue(RIFSFile.LAST_MODIFIED, new Date());
    // Commit the attribute change. file.commitAttributeChanges();

    See Also:
    RIFSFileList, Serialized Form

    Field Summary
    static java.lang.String ABSOLUTE_PATH
              Attribute ID for absolute path.
    static java.lang.String CAN_READ
              Attribute ID for can read.
    static java.lang.String CAN_WRITE
              Attribute ID for can write.
    static java.lang.String CANONICAL_PATH
              Attribute ID for canonical path.
    static java.lang.String CCSID
              Attribute ID for CCSID.
    static java.lang.String CREATED
              Attribute ID for created.
    static java.lang.String EXISTS
              Attribute ID for exists.
    static java.lang.String IS_ABSOLUTE
              Attribute ID for is absolute.
    static java.lang.String IS_DIRECTORY
              Attribute ID for is directory.
    static java.lang.String IS_FILE
              Attribute ID for is file.
    static java.lang.String IS_HIDDEN
              Attribute ID for is hidden.
    static java.lang.String IS_READ_ONLY
              Attribute ID for is read only.
    static java.lang.String LAST_ACCESSED
              Attribute ID for last accessed.
    static java.lang.String LAST_MODIFIED
              Attribute ID for last modified.
    static java.lang.String LENGTH
              Attribute ID for length.
    static java.lang.String NAME
              Attribute ID for name.
    static java.lang.String OWNERID
              Attribute ID for owner ID.
    static java.lang.String PARENT
              Attribute ID for parent.
    static java.lang.String PATH
              Attribute ID for path.
    static java.lang.String TYPE
              Attribute ID for type.
    static java.lang.String TYPE_DIRECTORY
              Attribute value indicating that this is a directory.
    static java.lang.String TYPE_FILE
              Attribute value indicating that this is a file.
    static java.lang.String TYPE_UNKNOWN
              Attribute value indicating that the tyype is unknown.
     
    Constructor Summary
    RIFSFile()
              Constructs an RIFSFile object.
    RIFSFile(AS400 system, java.lang.String path)
              Constructs an RIFSFile object.
     
    Method Summary
    protected  void commitAttributeChanges(java.lang.Object[] attributeIDs, java.lang.Object[] values)
              Commits the specified attribute changes.
     void delete()
              Deletes this file or directory.
    protected  void establishConnection()
              Establishes the connection to the server.
    protected  void freezeProperties()
              Freezes any property changes.
     java.lang.Object getAttributeUnchangedValue(java.lang.Object attributeID)
              Returns the unchanged value of an attribute.
     java.lang.String getPath()
              Returns the file path name.
     void refreshAttributeValues()
              Refreshes the values for all attributes.
     void setPath(java.lang.String path)
              Sets the file path name.
     void setSystem(AS400 system)
              Sets the system.
     
    Methods inherited from class com.ibm.as400.resource.ChangeableResource
    cancelAttributeChanges, commitAttributeChanges, commitAttributeChanges, fireAttributeChangesCanceled, fireAttributeChangesCommitted, fireAttributeValueChanged, fireResourceCreated, fireResourceDeleted, getAttributeUnchangedValue, getAttributeValue, getAttributeValue, hasUncommittedAttributeChanges, initializeAttributeValue, setAttributeValue, setAttributeValue
     
    Methods inherited from class com.ibm.as400.resource.Resource
    addActiveStatusListener, addPropertyChangeListener, addResourceListener, addVetoableChangeListener, arePropertiesFrozen, equals, fireAttributeValuesRefreshed, fireBusy, fireIdle, firePropertyChange, fireVetoableChange, getAttributeMetaData, getAttributeMetaData, getPresentation, getResourceKey, getSystem, isBidiEnabled, isConnectionEstablished, removeActiveStatusListener, removePropertyChangeListener, removeResourceListener, removeVetoableChangeListener, setPresentation, setResourceKey, toString
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    ABSOLUTE_PATH

    public static final java.lang.String ABSOLUTE_PATH
    Attribute ID for absolute path. This identifies a read-only String attribute, which represents the absolute path name.

    CANONICAL_PATH

    public static final java.lang.String CANONICAL_PATH
    Attribute ID for canonical path. This identifies a read-only String attribute, which represents the canonical path name.

    CAN_READ

    public static final java.lang.String CAN_READ
    Attribute ID for can read. This identifies a read-only Boolean attribute, which indicates whether this file can be read.

    CAN_WRITE

    public static final java.lang.String CAN_WRITE
    Attribute ID for can write. This identifies a read-only Boolean attribute, which indicates whether this file can be written.

    CCSID

    public static final java.lang.String CCSID
    Attribute ID for CCSID. This identifies a read-only Integer attribute, which represents the coded character set identifier for the file.

    CREATED

    public static final java.lang.String CREATED
    Attribute ID for created. This identifies a read-only Date attribute, which represents the date and time that the file was created.

    EXISTS

    public static final java.lang.String EXISTS
    Attribute ID for exists. This identifies a read-only Boolean attribute, which indicates whether the file exists.

    IS_ABSOLUTE

    public static final java.lang.String IS_ABSOLUTE
    Attribute ID for is absolute. This identifies a read-only Boolean attribute, which indicates whether the path name is absolute.

    IS_DIRECTORY

    public static final java.lang.String IS_DIRECTORY
    Attribute ID for is directory. This identifies a read-only Boolean attribute, which indicates whether this is a directory.

    IS_FILE

    public static final java.lang.String IS_FILE
    Attribute ID for is file. This identifies a read-only Boolean attribute, which indicates whether this is a file.

    IS_HIDDEN

    public static final java.lang.String IS_HIDDEN
    Attribute ID for is hidden. This identifies a Boolean attribute, which indicates whether this file is hidden.

    IS_READ_ONLY

    public static final java.lang.String IS_READ_ONLY
    Attribute ID for is read only. This identifies a Boolean attribute, which indicates whether this file is read only.

    LAST_ACCESSED

    public static final java.lang.String LAST_ACCESSED
    Attribute ID for last accessed. This identifies a read-only Date attribute, which represents the date and time the file was last accessed.

    LAST_MODIFIED

    public static final java.lang.String LAST_MODIFIED
    Attribute ID for last modified. This identifies a Date attribute, which represents the date and time the file was last modified. Setting this to 0 will leave the last modified date unchanged.

    LENGTH

    public static final java.lang.String LENGTH
    Attribute ID for length. This identifies a read-only Long attribute, which represents the length of the file in bytes.

    NAME

    public static final java.lang.String NAME
    Attribute ID for name. This identifies a read-only String attribute, which represents the name of the file.

    OWNERID

    public static final java.lang.String OWNERID
    Attribute ID for owner ID. This identifies a read-only Integer attribute, which represents the owner ID number of the file.

    PARENT

    public static final java.lang.String PARENT
    Attribute ID for parent. This identifies a read-only String attribute, which represents the name of the parent directory.

    PATH

    public static final java.lang.String PATH
    Attribute ID for path. This identifies a read-only String attribute, which represents the path name of the file.

    TYPE

    public static final java.lang.String TYPE
    Attribute ID for type. This identifies a read-only String attribute, which indicates whether this is a directory or a file. Possible values are:

    TYPE_DIRECTORY

    public static final java.lang.String TYPE_DIRECTORY
    Attribute value indicating that this is a directory.
    See Also:
    TYPE

    TYPE_FILE

    public static final java.lang.String TYPE_FILE
    Attribute value indicating that this is a file.
    See Also:
    TYPE

    TYPE_UNKNOWN

    public static final java.lang.String TYPE_UNKNOWN
    Attribute value indicating that the tyype is unknown.
    See Also:
    TYPE
    Constructor Detail

    RIFSFile

    public RIFSFile()
    Constructs an RIFSFile object.

    RIFSFile

    public RIFSFile(AS400 system,
                    java.lang.String path)
    Constructs an RIFSFile object.
    Parameters:
    system - The system.
    path - The file path name.
    Method Detail

    commitAttributeChanges

    protected void commitAttributeChanges(java.lang.Object[] attributeIDs,
                                          java.lang.Object[] values)
                                   throws ResourceException
    Commits the specified attribute changes.
    Overrides:
    commitAttributeChanges in class ChangeableResource
    Throws:
    ResourceException - If an error occurs.

    delete

    public void delete()
                throws ResourceException
    Deletes this file or directory.
    Throws:
    ResourceException - If an error occurs.

    establishConnection

    protected void establishConnection()
                                throws ResourceException
    Establishes the connection to the server.

    The method is called by the resource framework automatically when the connection needs to be established.

    Overrides:
    establishConnection in class Resource
    Throws:
    ResourceException - If an error occurs.

    freezeProperties

    protected void freezeProperties()
                             throws ResourceException
    Freezes any property changes. After this is called, property changes should not be made. Properties are not the same thing as attributes. Properties are basic pieces of information which must be set to make the object usable, such as the system and the name.

    The method is called by the resource framework automatically when the properties need to be frozen.

    Overrides:
    freezeProperties in class Resource
    Throws:
    ResourceException - If an error occurs.

    getAttributeUnchangedValue

    public java.lang.Object getAttributeUnchangedValue(java.lang.Object attributeID)
                                                throws ResourceException
    Returns the unchanged value of an attribute. If the attribute value has an uncommitted change, this returns the unchanged value. If the attribute value does not have an uncommitted change, this returns the same value as getAttributeValue().
    Overrides:
    getAttributeUnchangedValue in class ChangeableResource
    Parameters:
    attributeID - Identifies the attribute.
    Returns:
    The attribute value, or null if the attribute value is not available.
    Throws:
    ResourceException - If an error occurs.

    getPath

    public java.lang.String getPath()
    Returns the file path name.
    Returns:
    The file path name.

    refreshAttributeValues

    public void refreshAttributeValues()
                                throws ResourceException
    Refreshes the values for all attributes. This does not cancel uncommitted changes. This method fires an attributeValuesRefreshed() ResourceEvent.
    Overrides:
    refreshAttributeValues in class ChangeableResource
    Throws:
    ResourceException - If an error occurs.

    setPath

    public void setPath(java.lang.String path)
    Sets the file path name. This does not change the file on the server. Instead, it changes the file to which this object references. This cannot be changed if the object has established a connection to the server.
    Parameters:
    path - The file path name.

    setSystem

    public void setSystem(AS400 system)
                   throws java.beans.PropertyVetoException
    Sets the system. This does not change the job on the server. Instead, it changes the system to which this object references. This cannot be changed if the object has established a connection to the server.
    Overrides:
    setSystem in class Resource
    Parameters:
    system - The system.
    Throws:
    java.beans.PropertyVetoException - If the property change is vetoed.