com.ibm.as400.access

Class QSYSObjectPathName

  • java.lang.Object
    • com.ibm.as400.access.QSYSObjectPathName
  • All Implemented Interfaces:
    java.io.Serializable


    public class QSYSObjectPathName
    extends java.lang.Object
    implements java.io.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 Summary

      Constructors 
      Constructor and Description
      QSYSObjectPathName()
      Constructs a QSYSObjectPathName object.
      QSYSObjectPathName(java.lang.String path)
      Constructs a QSYSObjectPathName object.
      QSYSObjectPathName(java.lang.String libraryName, java.lang.String objectName, java.lang.String objectType)
      Constructs a QSYSObjectPathName object.
      QSYSObjectPathName(java.lang.String libraryName, java.lang.String objectName, java.lang.String memberName, java.lang.String objectType)
      Constructs a QSYSObjectPathName object.
      QSYSObjectPathName(java.lang.String aspName, java.lang.String libraryName, java.lang.String objectName, java.lang.String memberName, java.lang.String objectType)
      Constructs a QSYSObjectPathName object.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Adds a listener to be notified when the value of any bound property is changed.
      void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Adds a listener to be notified when the value of any constrained property is changed.
      java.lang.String getAspName()
      Returns the ASP on which the object resides.
      java.lang.String getLibraryName()
      Returns the library in which the object resides.
      java.lang.String getMemberName()
      Returns the name of the member.
      java.lang.String getObjectName()
      Returns the name of the object this path name represents.
      java.lang.String getObjectType()
      Returns type of object this path name represents.
      java.lang.String getPath()
      Returns the fully qualified integrated file system path name.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Removes a listener from the change list.
      void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Removes a listener from the veto list.
      void setAspName(java.lang.String aspName)
      Sets the IASP in which the object resides.
      void setLibraryName(java.lang.String libraryName)
      Sets the library in which the object resides.
      void setMemberName(java.lang.String memberName)
      Sets the name of the member.
      void setObjectName(java.lang.String objectName)
      Sets the name of the object this path name represents.
      void setObjectType(java.lang.String objectType)
      Sets type of object this path name represents.
      void setPath(java.lang.String path)
      Sets the integrated file system path name for this object.
      static java.lang.String toPath(java.lang.String libraryName, java.lang.String objectName, java.lang.String objectType)
      Builds an integrated file system path name to represent the object.
      static java.lang.String toPath(java.lang.String libraryName, java.lang.String objectName, java.lang.String memberName, java.lang.String objectType)
      Builds an integrated file system path name to represent the member.
      static java.lang.String toPath(java.lang.String aspName, java.lang.String libraryName, java.lang.String objectName, java.lang.String memberName, java.lang.String objectType)
      Builds an integrated file system path name to represent the member.
      static java.lang.String toQSYSName(java.lang.String name)
      Utility method for selectively uppercasing the characters in a string, for use as an IBM i *NAME value.
      java.lang.String toQualifiedObjectName()
      Returns a qualified object name, for use in API parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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(java.lang.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(java.lang.String libraryName,
                          java.lang.String objectName,
                          java.lang.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(java.lang.String libraryName,
                          java.lang.String objectName,
                          java.lang.String memberName,
                          java.lang.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(java.lang.String aspName,
                          java.lang.String libraryName,
                          java.lang.String objectName,
                          java.lang.String memberName,
                          java.lang.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(java.beans.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(java.beans.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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(java.beans.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(java.beans.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(java.lang.String aspName)
                        throws java.beans.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:
        java.beans.PropertyVetoException - If the change was vetoed.
      • setLibraryName

        public void setLibraryName(java.lang.String libraryName)
                            throws java.beans.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:
        java.beans.PropertyVetoException - If the change was vetoed.
      • setMemberName

        public void setMemberName(java.lang.String memberName)
                           throws java.beans.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:
        java.beans.PropertyVetoException - If the change was vetoed.
      • setObjectName

        public void setObjectName(java.lang.String objectName)
                           throws java.beans.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:
        java.beans.PropertyVetoException - If the change was vetoed.
      • setObjectType

        public void setObjectType(java.lang.String objectType)
                           throws java.beans.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:
        java.beans.PropertyVetoException - If the change was vetoed.
      • setPath

        public void setPath(java.lang.String path)
                     throws java.beans.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:
        java.beans.PropertyVetoException - If the change was vetoed.
      • toPath

        public static java.lang.String toPath(java.lang.String libraryName,
                              java.lang.String objectName,
                              java.lang.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 java.lang.String toPath(java.lang.String libraryName,
                              java.lang.String objectName,
                              java.lang.String memberName,
                              java.lang.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 java.lang.String toPath(java.lang.String aspName,
                              java.lang.String libraryName,
                              java.lang.String objectName,
                              java.lang.String memberName,
                              java.lang.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 java.lang.String toQSYSName(java.lang.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 java.lang.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