Package com.sos.JSHelper.Exceptions

Examples of com.sos.JSHelper.Exceptions.JobSchedulerException


        }
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed", conMethodName), e);
    }
    return objOutputStream;
  }
View Full Code Here


    try {
      lngFileSize = objVFSHandler.getFileSize(strFileName);
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new JobSchedulerException("getFileSize failed", e);
    }
    return lngFileSize;
  }
View Full Code Here

    try {
      flgResult = (this.FileExists() == false);
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed", conMethodName), e);
    }
    return flgResult;
  }
View Full Code Here

    try {
      strT = objVFSHandler.getModificationTime(strFileName);
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed", conMethodName), e);
    }
    return strT;
  }
View Full Code Here

        // e.printStackTrace();
      }
    }
    catch (IOException e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed", conMethodName), e);
    }
    finally {
      objInputStream = null;
    }
  }
View Full Code Here

      if (objO != null) {
        objO.flush();
        objO.close();
        objVFSHandler.CompletePendingCommand();
        if (objVFSHandler.isNegativeCommandCompletion()) {
          throw new JobSchedulerException("..error occurred during transfer on the data-target for file [" + strFileName + "]: "
              + objVFSHandler.getReplyString());
        }
      }
    }
    catch (IOException e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed", conMethodName), e);
    }
    finally {
      objOutputStream = null;
    }
  }
View Full Code Here

    try {
      this.getFileOutputStream().flush();
    }
    catch (IOException e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed", conMethodName), e);
    }
  }
View Full Code Here

        lngBytesRed = objVFSHandler.read(bteBuffer);
      }
    }
    catch (IOException e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed", conMethodName), e);
    }
    return lngBytesRed;
  }
View Full Code Here

    try {
      in = retrieveFileStream(remoteFile);
      // boolean test = retrieveFile(remoteFile, new FileOutputStream( new File(localFile+"test"), append ));

      if (in == null) {
        throw new JobSchedulerException("Could not open stream for " + remoteFile + ". Perhaps the file does not exist. Reply from ftp server: "
            + getReplyString());
      }

      if (isPositiveCommandCompletion() == false) {
        throw new JobSchedulerException("..error occurred in getFile() [retrieveFileStream] on the FTP server for file [" + remoteFile + "]: "
            + getReplyString());
      }

      // TODO Buffersize must be an Option
      byte[] buffer = new byte[4096];
      out = new FileOutputStream(new File(localFile), append);
      // TODO get progress info

      int bytes_read = 0;
      synchronized (this) {
        while ((bytes_read = in.read(buffer)) != -1) {
          out.write(buffer, 0, bytes_read);
          out.flush();
          totalBytes += bytes_read;
        }
      }
      in.close();
      out.close();
      if (!completePendingCommand()) {
        logout();
        disconnect();
        throw (new JobSchedulerException("File transfer failed."));
      }
      if (isNegativeCommandCompletion()) {
        throw new JobSchedulerException("..error occurred in getFile() on the FTP server for file [" + remoteFile + "]: " + getReplyString());
      }
      if (totalBytes > 0)
        return totalBytes;
      else
        return -1L;
View Full Code Here

   */
  @Override
  public long putFile(String localFile, String remoteFile) throws Exception {
    java.io.OutputStream outputStream = storeFileStream(remoteFile);
    if (isNegativeCommandCompletion()) {
      throw new JobSchedulerException("..error occurred in storeFileStream() on the FTP server for file [" + remoteFile + "]: " + getReplyString());
    }
    return putFile(localFile, outputStream);
  } // putFile
View Full Code Here

TOP

Related Classes of com.sos.JSHelper.Exceptions.JobSchedulerException

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.