Examples of IFSFile


Examples of com.ibm.as400.access.IFSFile

  {
    try
    {
      // Write file ONLY if file exist because the format of the file is
      // needed!
      if (new IFSFile(mAS400System, mQSYSobjPathname.getPath()).exists())
      {
        // initiate the SequentialFile object
        mOriginFile = new SequentialFile(mAS400System, mQSYSobjPathname
            .getPath());
View Full Code Here

Examples of com.ibm.as400.access.IFSFile

   *                server.
   */
  protected void renameFile(AS400 as400System, String sourceFilename,
      String destFilename) throws XException
  {
    IFSFile srcFile = new IFSFile(as400System, sourceFilename);
    IFSFile destFile = new IFSFile(as400System, destFilename);

    // construct temp name and temp member for destination file
    String tempName = new StringBuffer(destFile.getParent()).append(
        Constants.FILE_SEPERATOR).append("xbusTemp.MBR").toString();
    IFSFile tempFile = null;
    try
    {
      // 1. rename destination file to temp one if it exists
      if (destFile.exists())
      {
        tempFile = new IFSFile(as400System, tempName);
        if (tempFile.exists())
          if (!tempFile.delete())
          {
            throw new XException(Constants.LOCATION_EXTERN,
                Constants.LAYER_TECHNICAL,
                Constants.PACKAGE_TECHNICAL_AS400, "7",
                (List) null);
          }
        if (!destFile.renameTo(tempFile))
        {
          throw new XException(Constants.LOCATION_EXTERN,
              Constants.LAYER_TECHNICAL,
              Constants.PACKAGE_TECHNICAL_AS400, "8", (List) null);
        }
        // Reinitialize to check existance of the renamed member
        // Return value of renameTo is not reliable. It may be <true>
        // even if
        // the renaming was not successful.
        tempFile = new IFSFile(as400System, tempName);
        // Make sure that renaming was successful.
        if (!tempFile.exists())
        {
          throw new XException(Constants.LOCATION_EXTERN,
              Constants.LAYER_TECHNICAL,
              Constants.PACKAGE_TECHNICAL_AS400, "8", (List) null);
        }
        // Reinitialise to allow further renaming
        destFile = new IFSFile(as400System, destFilename);
      } // if (destFile.exists())

      boolean renameBackTempFile = false;
      // Should the renaming of the destination member be reversed?

      // 2. rename source file to dest file
      if (srcFile.renameTo(destFile))
      {
        // Reinitialise to check existance of the destination file
        // Return value of renameTo is not reliable. It may be <true>
        // even if
        // the renaming was not successful.
        destFile = new IFSFile(as400System, destFilename);
        // Make sure that renaming was successful.
        if (!destFile.exists())
          renameBackTempFile = true;
        // delete temp member
        if (tempFile != null && tempFile.exists())
          deleteMember(as400System, tempName);
      } // if (srcFile.renameTo(destFile))
      else
        // Reverse initial renaming of the destination file member
        renameBackTempFile = true;

      // 3. Rename the destination file member bach to its original name
      // if
      // any error prevented the renaming of the source file.
      // Only necessary if the destination filemember existed before and
      // was
      // renamed to a temporyry member name.
      if (tempFile != null && renameBackTempFile)
      { // Reverse initial renaming of the destination file member
        // Reinitialise to allow backwards renaming
        destFile = new IFSFile(as400System, destFilename);
        // rename back temp member to destination member
        tempFile.renameTo(destFile);

        List params = new Vector();
        params.add(sourceFilename);
        params.add(destFilename);
        throw new XException(Constants.LOCATION_EXTERN,
View Full Code Here

Examples of com.ibm.as400.access.IFSFile

    {
      // Open the source file for exclusive access.
      source = new IFSFileInputStream(as400System, sourceName,
          IFSFileInputStream.SHARE_NONE);

      IFSFile targetFile = new IFSFile(as400System, targetName);
      if (!targetFile.exists())
      {
        targetFile.createNewFile();
      } // if (!targetFile.exists())

      // Open the target file for exclusive access.
      target = new IFSFileOutputStream(as400System, targetName,
          IFSFileOutputStream.SHARE_NONE, false);
View Full Code Here

Examples of com.ibm.as400.access.IFSFile

      // Create an object in the integrated file system for the file name.
      // It is used to parse an integrated file system name into its
      // components.
      mQSYSObject = new QSYSObjectPathName(xbusSystem
          .replaceAllMarkers(mConfigFilename)[0]);
      IFSFile ifsFile = new IFSFile(mAS400System, mQSYSObject.getPath());

      // only if the file exist and it is accessible.
      if (ifsFile.exists())
      {
        Trace.info("Receiving data from "
            + xbusSystem.replaceAllMarkers(mConfigFilename)[0]);

        // initiate the SequentialFile object
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.