Package net.sf.xbus.base.core

Examples of net.sf.xbus.base.core.XException


      } // try
      catch (Exception ex)
      {
        List params = new Vector();
        params.add(lockFilename);
        throw new XException(Constants.LOCATION_EXTERN,
            Constants.LAYER_TECHNICAL,
            Constants.PACKAGE_TECHNICAL_AS400, "6", params);
      } // catch
    } // if (lockFile.getExplicitLocks().length > 0)
  } // releaseLock(AS400 as400System, String lockFilename)
View Full Code Here


      {
        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,
            Constants.LAYER_TECHNICAL,
            Constants.PACKAGE_TECHNICAL_AS400, "10", params);
      } // if (tempFile!=null && renameBackTempFile)
    } // try
    catch (Exception ex)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", ex);
    } // catch
  } // renameFile(AS400 as400System,String sourceFilename,String
View Full Code Here

    catch (Exception e)
    {
      // If any of the above operations failed trace error
      // and output the exception.
      Trace.error("Copy failed");
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", e);
    } // catch
  } // copyFile(AS400 as400System,String sourceName,String targetName)
View Full Code Here

    {
      file.delete();
    } // try
    catch (Exception ex)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", ex);
    } // catch
  } // deleteFile(AS400 mAS400System, String fileName)
View Full Code Here

    {
      srcFile.deleteMember();
    } // try
    catch (Exception ex)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", ex);
    } // catch
  } // deleteMember(AS400 as400System, String fileName)
View Full Code Here

    {
      tc.call();
    }
    catch (Exception e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", e);
    }
  } // callAS400Program(AS400 as400,String programName,ProgramParameter[]
View Full Code Here

      buffOut.close();
    }
    catch (Exception e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_FILE, "0", e);
    }
    return null;
  }
View Full Code Here

    } // try
    catch (Exception e)
    {
      List params = new Vector(1);
      params.add(cmdarray[0]);
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_MISC, "6", e, params);
    } // catch (Exception e)

    InputStreamReader reader = new InputStreamReader(proc.getInputStream());
    int character = 0;
    byte[] ba = new byte[1];
    String oneChar = null;
    StringBuffer buffer = new StringBuffer();

    try
    {
      while ((character = reader.read()) >= 0)
      {
        ba[0] = new Integer(character).byteValue();
        oneChar = new String(ba);
        buffer.append(oneChar);
        System.out.print(oneChar);
      } // while ((character = reader.read()) >= 0)
    } // try
    catch (IOException e)
    {
      List params = new Vector(1);
      params.add(cmdarray[0]);
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_MISC, "7", e, params);
    } // catch (IOException e)
    finally
    {
      if (reader != null)
      {
        try
        {
          reader.close();
        }
        catch (IOException e1)
        {
          // do nothing
        }
      }
    }

    try
    {
      proc.waitFor();
    } // try
    catch (InterruptedException e)
    {
      List params = new Vector(1);
      params.add(cmdarray[0]);
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_MISC, "7", e, params);
    } // catch (InterruptedException e)

    return buffer.toString();
View Full Code Here

    long fileLengthLong = sourceFile.length();
    if (fileLengthLong > Integer.MAX_VALUE)
    {
      List params = new Vector();
      params.add(mCopyname);
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_FILE, "5", params);
    }
    else
    {
      fileLength = new Long(fileLengthLong).intValue();
    }

    if (fileLength < 1)
    {
      return new ByteArrayList();
    }

    /**
     * 2. Read the complete file
     */
    byte[] byteBuffer = new byte[fileLength];

    try
    {
      BufferedInputStream buffStream = new BufferedInputStream(
          new FileInputStream(sourceFile));
      if (buffStream.read(byteBuffer) == -1)
      {
        List params = new Vector();
        params.add(mCopyname);
        throw new XException(Constants.LOCATION_EXTERN,
            Constants.LAYER_TECHNICAL,
            Constants.PACKAGE_TECHNICAL_FILE, "7", params);
      }
      buffStream.close();
    }
    catch (IOException e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_FILE, "0", e);
    }

    /**
 
View Full Code Here

          buf.append(msgList[i].getText());
        } // for (int i = 1; i < msgList.length; i++)

        List params = new Vector();
        params.add(buf);
        throw new XException(Constants.LOCATION_EXTERN,
            Constants.LAYER_TECHNICAL,
            Constants.PACKAGE_TECHNICAL_AS400, "36", params);
      } // if (!programCall.run())
      Trace.info("Program " + mProgramName + " returned");
    } // try
    catch (Exception e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", e);
    } // catch
    finally
    {
View Full Code Here

TOP

Related Classes of net.sf.xbus.base.core.XException

Copyright © 2018 www.massapicom. 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.