com.ibm.as400.access

Class QSYSObjectPathName

  • All Implemented Interfaces:
    Serializable


    public class QSYSObjectPathName
    extends Object
    implements Serializable
    Provides an integrated file system path name that represents an object in the QSYS library file system.

    QSYSObjectPathName objects generate the following events:

    • PropertyChangeEvent
    • VetoableChangeEvent

    This object can be used in two ways:

    • To parse the integrated file system path name to ensure correct syntax and to extract the library, object, member, and object type.
    • To build an integrated file system path name from a library, object, and member or object type.
    IllegalPathNameExceptions are thrown if errors are found.

    Objects in the QSYS file system have integrated file system names with the following format for objects or members in a library other than QSYS:

     /QSYS.LIB/library.LIB/object.type
     /QSYS.LIB/library.LIB/object.FILE/member.MBR
     
    For objects or members that reside in QSYS, this format is used:
     /QSYS.LIB/object.type
     /QSYS.LIB/object.FILE/member.MBR
     
    For example:
     /QSYS.LIB/QGPL.LIB/CRTLIB.CMD
     /QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE/PAYABLE.MBR
     /QSYS.LIB/CRTLIB.CMD
     /QSYS.LIB/ACCOUNTS.FILE/PAYABLE.MBR
     

    In an integrated file system path name, special values, such as *ALL, that begin with an asterisk are not depicted with an asterisk but with leading and trailing percent signs (%ALL%). In the integrated file system, an asterisk is a wildcard character. The following special values are recognized by this class:

     Library name: %ALL%(*ALL), %ALLUSR%(*ALLUSR), %CURLIB%(*CURLIB), %LIBL%(*LIBL), %USRLIBL%(*USRLIBL)
     Object name:  %ALL%(*ALL)
     Member name:  %ALL%(*ALL), %FILE%(*FILE), %FIRST%(*FIRST), %LAST%(*LAST) %NONE%(*NONE)
     

    The path name will be in uppercase. If case needs to be preserved for a library, object, or member name, quotation marks should be used around the names. For example:

     QSYSObjectPathName path = new QSYSObjectPathName("/QSYS.LIB/\"MixedCase\".LIB/\"lowercase\".FILE");
     
    Examples:
    • This code will extract the pieces of an integrated file system name that represents a file:
       QSYSObjectPathName path = new QSYSObjectPathName("/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE");
       System.out.println(path.getLibraryName());  // Will print "QGPL"
       System.out.println(path.getObjectName());   // Will print "ACCOUNTS"
       System.out.println(path.getObjectType());   // Will print "FILE"
       
    • This code will extract the pieces of an integrated file system name that represents a member:
       QSYSObjectPathName path = new QSYSObjectPathName("/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE/PAYABLE.MBR");
       System.out.println(path.getLibraryName());  // Will print "QGPL"
       System.out.println(path.getObjectName());   // Will print "ACCOUNTS"
       System.out.println(path.getMemberName());   // Will print "PAYABLE"
       System.out.println(path.getObjectType());   // Will print "MBR"
       
    • This code will build an integrated file system name for a file:
       QSYSObjectPathName path = new QSYSObjectPathName("QGPL", "ACCOUNTS", "FILE");
       // Will print "/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE"
       System.out.println(path.getPath());
       
    • This code will build an integrated file system name for a member:
       QSYSObjectPathName path = new QSYSObjectPathName("QGPL", "ACCOUNTS", "PAYABLE", "MBR");
       // Will print "/QSYS.LIB/QGPL.LIB/ACCOUNTS.FILE/PAYABLE.MBR"
       System.out.println(path.getPath());
       
    See Also:
    Serialized Form
    • Constructor Detail

      • QSYSObjectPathName

        public QSYSObjectPathName()
        Constructs a QSYSObjectPathName object. It creates an integrated file system path name for an object in the QSYS file system.
      • QSYSObjectPathName

        public QSYSObjectPathName(String path)
        Constructs a QSYSObjectPathName object. It creates an integrated file system path name for an object in the QSYS file system.
        Parameters:
        path - The fully qualified integrated file system name of an object in the QSYS file system.
      • QSYSObjectPathName

        public QSYSObjectPathName(String libraryName,
                          String objectName,
                          String objectType)
        Constructs a QSYSObjectPathName object. It builds an integrated file system path name to represent the object.
             QSYSObjectPathName ifsName = new QSYSObjectPathName("library", "name", "type");
             // This line will print "/QSYS.LIB/LIBRARY.LIB/NAME.TYPE".
             System.out.println(ifsName.getPath());
             
        Parameters:
        libraryName - The library in which the object exists. It must be 1-10 characters.
        objectName - The name of the object. It must be 1-10 characters.
        objectType - The type of the object. It must be 1-6 characters. This is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ.
      • QSYSObjectPathName

        public QSYSObjectPathName(String libraryName,
                          String objectName,
                          String memberName,
                          String objectType)
        Constructs a QSYSObjectPathName object. It builds an integrated file system path name to represent the member.
             QSYSObjectPathName ifsName = new QSYSObjectPathName("library", "name", "member", "MBR");
             // This line will print "/QSYS.LIB/LIBRARY.LIB/NAME.FILE/MEMBER.MBR".
             System.out.println(ifsName.getPath());
             
        Parameters:
        libraryName - The library in which the object exists. It must be 1-10 characters.
        objectName - The name of the object. It must be 1-10 characters.
        memberName - The name of the member. It must be 1-10 characters.
        objectType - The type of the object. This must be "MBR".
      • QSYSObjectPathName

        public QSYSObjectPathName(String aspName,
                          String libraryName,
                          String objectName,
                          String memberName,
                          String objectType)
        Constructs a QSYSObjectPathName object. It builds an integrated file system path name to represent the member.
            QSYSObjectPathName ifsName = new QSYSObjectPathName("iasp1", "library", "name", "member", "MBR");
            // This line will print "/IASP1/QSYS.LIB/LIBRARY.LIB/NAME.FILE/MEMBER.MBR".
            System.out.println(ifsName.getPath());
            
        Parameters:
        aspName - The IASP on which the object exists. It must be 1-10 characters.
        libraryName - The library in which the object exists. It must be 1-10 characters.
        objectName - The name of the object. It must be 1-10 characters.
        memberName - The name of the member. It must be 1-10 characters.
        objectType - The type of the object. This must be "MBR".

    • Method Detail

      • addPropertyChangeListener

        public void addPropertyChangeListener(PropertyChangeListener listener)
        Adds a listener to be notified when the value of any bound property is changed. The propertyChange method will be called.
        Parameters:
        listener - The listener object.
      • addVetoableChangeListener

        public void addVetoableChangeListener(VetoableChangeListener listener)
        Adds a listener to be notified when the value of any constrained property is changed. The vetoableChange method will be called.
        Parameters:
        listener - The listener object.
      • getAspName

        public String getAspName()
        Returns the ASP on which the object resides.
        Returns:
        The name of the ASP. If the ASP name has not been set, an empty string is returned.
      • getLibraryName

        public String getLibraryName()
        Returns the library in which the object resides.
        Returns:
        The name of the library. If the library name has not been set, an empty string is returned.
      • getMemberName

        public String getMemberName()
        Returns the name of the member. If this object does not represent a member, an empty string is returned.
        Returns:
        The name of the member. If the member name has not been set, an empty string is returned.
      • getObjectName

        public String getObjectName()
        Returns the name of the object this path name represents. If this object represents a member, the object name is the name of the file in which the member exists.
        Returns:
        The name of the object. If the object name has not been set, an empty string is returned.
      • getObjectType

        public String getObjectType()
        Returns type of object this path name represents. Type is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ.
        Returns:
        The type of the object. If the object type has not been set, an empty string is returned.
      • getPath

        public String getPath()
        Returns the fully qualified integrated file system path name.
        Returns:
        The fully qualified integrated file system path name. If the path has not been set, an empty string is returned.
      • removePropertyChangeListener

        public void removePropertyChangeListener(PropertyChangeListener listener)
        Removes a listener from the change list. If the listener is not on the list, do nothing.
        Parameters:
        listener - The listener object.
      • removeVetoableChangeListener

        public void removeVetoableChangeListener(VetoableChangeListener listener)
        Removes a listener from the veto list. If the listener is not on the list, do nothing.
        Parameters:
        listener - The listener object.
      • setAspName

        public void setAspName(String aspName)
                        throws PropertyVetoException
        Sets the IASP in which the object resides. This is a bound and constrained property. Note that changes to this property also affect the pathName property.
        Parameters:
        aspName - The IASP in which the object exists. It must be 1-10 characters.
        Throws:
        PropertyVetoException - If the change was vetoed.
      • setLibraryName

        public void setLibraryName(String libraryName)
                            throws PropertyVetoException
        Sets the library in which the object resides. This is a bound and constrained property. Note that changes to this property also affect the pathName property.
        Parameters:
        libraryName - The library in which the object exists. It must be 1-10 characters.
        Throws:
        PropertyVetoException - If the change was vetoed.
      • setMemberName

        public void setMemberName(String memberName)
                           throws PropertyVetoException
        Sets the name of the member. If a value other than an empty String ("") is specified, the object type is set to MBR. This is a bound and constrained property. Note that changes to this property also affect the objectType and pathName properties.
        Parameters:
        memberName - The name of the member. It must be 10 characters or less. An empty String ("") can be passed to indicate this object does not represent a member.
        Throws:
        PropertyVetoException - If the change was vetoed.
      • setObjectName

        public void setObjectName(String objectName)
                           throws PropertyVetoException
        Sets the name of the object this path name represents. If this object represents a member, the object name is the name of the file that the member is in. This is a bound and constrained property. Note that changes to this property also affect the pathName property.
        Parameters:
        objectName - The name of the object. It must be 1-10 characters.
        Throws:
        PropertyVetoException - If the change was vetoed.
      • setObjectType

        public void setObjectType(String objectType)
                           throws PropertyVetoException
        Sets type of object this path name represents. If the type is not MBR, the member name property will be set to an empty string. The value will be uppercased. This is a bound and constrained property. Note that changes to this property also affect the memberName and pathName properties.
        Parameters:
        objectType - The type of the object. It must be 1-6 characters. This is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ.
        Throws:
        PropertyVetoException - If the change was vetoed.
      • setPath

        public void setPath(String path)
                     throws PropertyVetoException
        Sets the integrated file system path name for this object. This is a bound and constrained property. Note that changes to this property also affect the libraryName, memberName, objectName, and objectType properties.
        Parameters:
        path - The fully qualified integrated file system name of an object in the QSYS file system.
        Throws:
        PropertyVetoException - If the change was vetoed.
      • toPath

        public static String toPath(String libraryName,
                    String objectName,
                    String objectType)
        Builds an integrated file system path name to represent the object.
        Parameters:
        libraryName - The library the object is in. It must be 1-10 characters.
        objectName - The name of the object. It must be 1-10 characters.
        objectType - The type of the object. It must be 1-6 characters. This is the IBM i system abbreviation for the type of object, for example, LIB for library, or CMD for command. Types can be found by prompting for the OBJTYPE parameter on commands such as WRKOBJ.
        Returns:
        The integrated file system name for the object.
      • toPath

        public static String toPath(String libraryName,
                    String objectName,
                    String memberName,
                    String objectType)
        Builds an integrated file system path name to represent the member.
        Parameters:
        libraryName - The library the object is in. It must be 1-10 characters.
        objectName - The name of the object. It must be 1-10 characters.
        memberName - The name of the member. It must be 1-10 characters.
        objectType - The type of the object. This must be "MBR".
        Returns:
        The integrated file system name for the object.
      • toPath

        public static String toPath(String aspName,
                    String libraryName,
                    String objectName,
                    String memberName,
                    String objectType)
        Builds an integrated file system path name to represent the member.
        Parameters:
        aspName - The IASP on which the object exists. It must be 1-10 characters.
        libraryName - The library the object is in. It must be 1-10 characters.
        objectName - The name of the object. It must be 1-10 characters.
        memberName - The name of the member. It must be 1-10 characters.
        objectType - The type of the object. This must be "MBR".
        Returns:
        The integrated file system name for the object.
      • toQSYSName

        public static final String toQSYSName(String name)
        Utility method for selectively uppercasing the characters in a string, for use as an IBM i *NAME value. This method is used, for example, when uppercasing object names, library names, and member names. Characters within double-quotes are left as-is.
        Parameters:
        name - The name to be uppercased.
        Returns:
        The *NAME value, selectively uppercased.
      • toQualifiedObjectName

        public String toQualifiedObjectName()
        Returns a qualified object name, for use in API parameters. This is a 20-character blank-filled String, where the first 10 characters represent the object name, and the final 10 characters represent the object library.
        Returns:
        Qualified object name