com.ibm.as400.resource

Class RIFSFileList

  • All Implemented Interfaces:
    java.io.Serializable

    Deprecated. 
    Use IFSFile instead, as this package may be removed in the future.

    public class RIFSFileList
    extends ResourceList
    The RIFSFileList class represents a list of files and directories in the integrated file system. This class provides function similar to IFSFile and IFSJavaFile except that it is a subclass of ResourceList. As a result, it can be used directly in conjunction with components written for ResourceList objects.

    If the specified directory does not exist, the list will be empty.

    The contents of the list are always loaded sequentially, regardless of the order that you request them. In addition, they are loaded on demand, meaning the entire list is not loaded until the last item is requested. Use the resourceAt() method to request a particular list item. If that list item is not yet loaded, resourceAt() returns null. To ensure that a particular list item is loaded, call waitForResource(). To ensure that the entire list is loaded, call waitForComplete(). Note that both wait methods will block until the requested resource(s) are loaded. The following selection IDs are supported:

    Use one or more of these selection IDs with getSelectionValue() and setSelectionValue() to access the selection values for an RIFSFileList.

    RIFSFileList objects generate RIFSFile objects.

    // Create an RIFSFileList object to represent a list of files.
    AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
    RIFSFileList fileList = new RIFSFileList(system, "/home/myuserid");
    
    // Set the selection so that only Java source files are listed.
    fileList.setSelectionValue(RIFSFileList.PATTERN, "*.java");
    
    // Open the list and get the first 50 items.
    fileList.open();
    fileList.waitForResource(50);
    
    // Read and print the file names and last modified dates
    // for the first 50 items in the list.
    for(long i = 0; i < 50; ++i)
    {
        RIFSFile file = (RIFSFile)fileList.resourceAt(i);
        System.out.println(file.getAttributeValue(RIFSFile.NAME));
        System.out.println(file.getAttributeValue(RIFSFile.LAST_MODIFIED));
        System.out.println();
    }
    
    // Close the list.
    fileList.close();
    
    See Also:
    RIFSFile, Serialized Form
    • Field Detail

      • FILTER

        public static final java.lang.String FILTER
        Deprecated. 
        Selection ID for filter. This identifies an IFSFileFilter selection, which represents the filter used to select which files are included in the list.
        See Also:
        Constant Field Values
      • PATTERN

        public static final java.lang.String PATTERN
        Deprecated. 
        Selection ID for pattern. This identifies a String selection, which represents the pattern used to select which files are included in the list. This value can include wildcards (*) and question marks (?).
        See Also:
        Constant Field Values
    • Constructor Detail

      • RIFSFileList

        public RIFSFileList()
        Deprecated. 
        Constructs an RIFSFileList object.
      • RIFSFileList

        public RIFSFileList(AS400 system,
                    java.lang.String path)
        Deprecated. 
        Constructs an RIFSFileList object.
        Parameters:
        system - The system.
        path - The directory path.
      • RIFSFileList

        public RIFSFileList(RIFSFile file)
        Deprecated. 
        Constructs an RIFSFileList object.
        Parameters:
        file - The directory.
    • Method Detail

      • establishConnection

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

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

        Overrides:
        establishConnection in class ResourceList
        Throws:
        ResourceException - If an error occurs.
      • freezeProperties

        protected void freezeProperties()
                                 throws ResourceException
        Deprecated. 
        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 ResourceList
        Throws:
        ResourceException - If an error occurs.
      • getPath

        public java.lang.String getPath()
        Deprecated. 
        Returns the directory path.
        Returns:
        The directory path.
      • open

        public void open()
                  throws ResourceException
        Deprecated. 
        Opens the list. The list must be open in order to perform most operations. This method has no effect if the list is already opened.
        Overrides:
        open in class ResourceList
        Throws:
        ResourceException - If an error occurs.
      • resourceAt

        public Resource resourceAt(long index)
                            throws ResourceException
        Deprecated. 
        Returns the resource specified by the index.

        This will implicitly open the list if needed.

        Overrides:
        resourceAt in class ResourceList
        Parameters:
        index - The index.
        Returns:
        The resource specified by the index, or null if the resource is not yet available.
        Throws:
        ResourceException - If an error occurs.
      • setPath

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

        public void waitForResource(long index)
                             throws ResourceException
        Deprecated. 
        Waits until the resource is available or the list is complete. This waits until all resources up to and including the specified resource are loaded.

        This will implicitly open the list if needed.

        Overrides:
        waitForResource in class ResourceList
        Parameters:
        index - The index.
        Throws:
        ResourceException - If an error occurs.