com.ibm.as400.access

Class AS400FileRecordDescription

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


    public class AS400FileRecordDescription
    extends java.lang.Object
    implements java.io.Serializable
    The AS400FileRecordDescription class represents the record descriptions of a physical or logical file on the system. This class is used to retrieve the file field description of a physical or logical file, and to create Java source code for a class extending from RecordFormat that can then be compiled and used as input to the AS400File.setRecordFormat() method. This allows the record format to be created statically during development time and then reused when needed. The class also provides a method for returning RecordFormat objects that can be used as input to the AS400File.setRecordFormat() method. This method can be used to create the record format dynamically.

    The output from the createRecordFormatSource() and retrieveRecordFormat() methods contains enough information to use to describe the record format of the existing file from which it was generated. The record formats generated are not meant for creating files with the same format as the file from which they are retrieved. Use the Copy File (CPYF) command to create a file with the same format as an existing file.
    AS400FileRecordDescription objects generate the following events:

    See Also:
    Serialized Form
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addAS400FileRecordDescriptionListener(AS400FileRecordDescriptionListener listener)
      Adds a listener to be notified when an AS400FileRecordDescriptionEvent is fired.
      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.
      void createRecordFormatSource(java.lang.String filePath, java.lang.String packageName)
      Retrieves the file description for the file, and creates a file containing the Java source for a class extending from RecordFormat that represents the record format for the file.
      java.lang.String getFileName()
      Returns the file name.
      java.lang.String getMemberName()
      Returns the member name.
      java.lang.String getPath()
      Returns the integrated file system path name for the file as specified on the constructor or the setPath() method.
      AS400 getSystem()
      Returns the system object for this object.
      void removeAS400FileRecordDescriptionListener(AS400FileRecordDescriptionListener listener)
      Removes a listener from the AS400FileRecordDescription listeners list.
      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 change listeners list.
      RecordFormat[] retrieveRecordFormat()
      Retrieves the file description for the file, and creates a RecordFormat object for each record format, which can be used as input to the AS400File.setRecordFormat() method.
      void setPath(java.lang.String name)
      Sets the integrated file system path name for the file.
      void setSystem(AS400 system)
      Sets the system to which to connect.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AS400FileRecordDescription

        public AS400FileRecordDescription()
        Constructs an AS400FileRecordDescription object. The system on which the file resides and the name of the file must be set prior to invoking any other method in the class.
        See Also:
        setSystem(com.ibm.as400.access.AS400), setPath(java.lang.String)
      • AS400FileRecordDescription

        public AS400FileRecordDescription(AS400 system,
                                  java.lang.String name)
        Constructs an AS400FileRecordDescription object. It uses the specified system on which the file resides and the integrated file system path name of the file.
        Parameters:
        system - The system on which the file resides.
        name - The integrated file system path name of the file. If a member is not specified in name, the first member of the file is used.
    • 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 be called.
        Parameters:
        listener - The PropertyChangeListener.
        See Also:
        removePropertyChangeListener(java.beans.PropertyChangeListener)
      • 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 VetoableChangeListener.
        See Also:
        removeVetoableChangeListener(java.beans.VetoableChangeListener)
      • createRecordFormatSource

        public void createRecordFormatSource(java.lang.String filePath,
                                    java.lang.String packageName)
                                      throws AS400Exception,
                                             AS400SecurityException,
                                             java.io.IOException,
                                             java.lang.InterruptedException
        Retrieves the file description for the file, and creates a file containing the Java source for a class extending from RecordFormat that represents the record format for the file. If the file contains more than one record format (for example, is a multiple format logical file), a Java source file for each record format in the file is created; each file will contain the class definition for a single record format.
        The name of the class is the name of the record format retrieved with the string "Format" appended to it. The name of the file is the name of the class with the extension .java.
        The source files generated can be compiled and used as input to the AS400File.setRecordFormat() method.
        The system to which to connect and the integrated file system pathname for the file must be set prior to invoking this method.
        Parameters:
        filePath - The path of the directory in which to create the file. If filePath is null, the file is created in the current working directory.
        packageName - The name of the package in which the class belongs. The packageName is used to specify the package statement in the source code for the class. If this value is null, no package statement is specified in the source code for the class.
        Throws:
        AS400Exception - If the system returns an error message.
        AS400SecurityException - If a security or authority error occurs.
        ConnectionDroppedException - If the connection is dropped unexpectedly.
        java.io.IOException - If an error occurs while communicating with the system.
        java.lang.InterruptedException - If this thread is interrupted.
        ServerStartupException - If the host server cannot be started.
        java.net.UnknownHostException - If the system cannot be located.
        See Also:
        AS400FileRecordDescription(com.ibm.as400.access.AS400, java.lang.String), setPath(java.lang.String), setSystem(com.ibm.as400.access.AS400)
      • getFileName

        public java.lang.String getFileName()
        Returns the file name.
        Returns:
        The file name. If the integrated file system pathname has not been set for the object, an empty string is returned.
      • getMemberName

        public java.lang.String getMemberName()
        Returns the member name.
        Returns:
        The member name. If the integrated file system pathname has not been set for the object, an empty string is returned.
      • setPath

        public void setPath(java.lang.String name)
                     throws java.beans.PropertyVetoException
        Sets the integrated file system path name for the file.
        Parameters:
        name - The integrated file system path name of the file. If a member is not specified in name, the first member of the file is used.
        Throws:
        java.beans.PropertyVetoException - If a change is vetoed.
      • setSystem

        public void setSystem(AS400 system)
                       throws java.beans.PropertyVetoException
        Sets the system to which to connect.
        Parameters:
        system - The system to which to conenct.
        Throws:
        java.beans.PropertyVetoException - If a change is vetoed.