Package com.sos.JSHelper.Exceptions

Examples of com.sos.JSHelper.Exceptions.JobSchedulerException


      objXF.comment(String.format("Created by %1$s", conClassName));
      objXF.Write(this.toXML());
      objXF.close();
    }
    catch (Exception e) {
      throw new JobSchedulerException("Exception:", e);
    }
    return objXF;
  } // private JSXMLFile toXMLFile
View Full Code Here


  private SchedulerHotFolderFileList load(ISOSVirtualFile pobjVirtualDir)  {
 
    final String  conMethodName  = conClassName + "::load";
    try {
      if(!pobjVirtualDir.isDirectory()) {
        throw new JobSchedulerException(String.format("%1$s isn't a directory", pobjVirtualDir.getName()));
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      JobSchedulerException objJSException = new JobSchedulerException(conMethodName, e);
      logger.error("", objJSException);
      throw objJSException;
    }
    ISOSVfsFileTransfer objVFSHandler = pobjVirtualDir.getHandler();
    logger.debug("getFilelist from: "+pobjVirtualDir.getName());
    String[] filenames = objVFSHandler.getFilelist(pobjVirtualDir.getName(), ".*", 0, false);
    objHotFolderFileList.setHotFolderSrc(pobjVirtualDir);
    for (String filename : filenames) {
      ISOSVirtualFile objVirtualFile = objVFSHandler.getFileHandle(filename);
      String lowerFilename = filename.toLowerCase();
      try {
        if(objVirtualFile.isDirectory()) {
          logger.debug("load SchedulerHotFolder = " + filename);
          SchedulerHotFolder obj = objFactory.createSchedulerHotFolder(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else if(lowerFilename.endsWith(JSObjJob.fileNameExtension)) {
          logger.debug("load JSObjJob = " + filename);
          JSObjJob obj = objFactory.createJob(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else if(lowerFilename.endsWith(JSObjJobChain.fileNameExtension)) {
          logger.debug("load JSObjJobChain = " + filename);
          JSObjJobChain obj = objFactory.createJobChain(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else if(lowerFilename.endsWith(JSObjOrder.fileNameExtension)) {
          logger.debug("load JSObjOrder = " + filename);
          JSObjOrder obj = objFactory.createOrder(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else if(lowerFilename.endsWith(JSObjLock.fileNameExtension)) {
          logger.debug("load JSObjLock = " + filename);
          JSObjLock obj = objFactory.createLock(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else if(lowerFilename.endsWith(JSObjProcessClass.fileNameExtension)) {
          logger.debug("load JSObjProcessClass = " + filename);
          JSObjProcessClass obj = objFactory.createProcessClass(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else if(lowerFilename.endsWith(JSObjSchedule.fileNameExtension)) {
          logger.debug("load JSObjSchedule = " + filename);
          JSObjSchedule obj = objFactory.createSchedule(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else if(lowerFilename.endsWith(JSObjParams.fileNameExtension)) {
          logger.debug("load JSObjParams = " + filename);
          JSObjParams obj = objFactory.createParams(objVirtualFile);
          objHotFolderFileList.add(obj);
        }
        else {
          continue;
        }
      }
      catch (Exception e) {
        e.printStackTrace();
        logger.error("", new JobSchedulerException(conMethodName, e));
        throw new JobSchedulerException(conMethodName, e);
      }
    }
//    Collections.sort(objHotFolderFileList.getFileList());
    isLoaded  = true;
    logger.debug(String.format("%1$s objects found in %2$s", objHotFolderFileList.getFileList().size(), pobjVirtualDir.getName()));
View Full Code Here

        if (Client().isConnected() == false) {
          objHost = null;
          objPort = null;
          host = "";
          port = -1;
          throw new JobSchedulerException("Connection not possible");
        }
      }
      // TODO find the "Microsoft FTP Server" String from the reply and set the HostType accordingly
      // TODO respect Proxy-Server. implement handling of
    }
    catch (Exception e) {
      e.printStackTrace();
      logger.error("exception occured", e);
      throw new JobSchedulerException("exception occured:", e);
    }
    return this;
  }
View Full Code Here

        this.logger.debug(HostID("..ftp server reply [enterLocalPassiveMode]: " + getReplyString()));
      }
      return i;
    }
    catch (IOException e) {
      throw new JobSchedulerException(HostID("pasv returns exception"), e);
    }
  }
View Full Code Here

  public Vector<String> nList(String pathname, final boolean flgRecurseSubFolder) {
    try {
      return getFilenames(pathname, flgRecurseSubFolder);
    }
    catch (Exception e) {
      throw new JobSchedulerException("getfilenames in nLixt returns an exception", e);
    }
  } // nList
View Full Code Here

  }

  protected void RaiseException(final Exception e, final String pstrM) {
    logger.error(pstrM);
    e.printStackTrace(System.err);
    throw new JobSchedulerException(pstrM, e);
  }
View Full Code Here

    throw new JobSchedulerException(pstrM, e);
  }

  protected void RaiseException(final String pstrM) {
    logger.error(pstrM);
    throw new JobSchedulerException(pstrM);
  }
View Full Code Here

        objOS.flush();
        objOS.close();
      }
    }
    catch (Exception e) {
      throw new JobSchedulerException("putfile reports exception", e);
    }
    finally {
    }
  }
View Full Code Here

    boolean rc = false;
    try {
      out = new FileOutputStream(localFile);
      rc = Client().retrieveFile(remoteFile, out);
      if (rc == false) {
        throw new JobSchedulerException("retrieveFile returns a negative return-code");
      }
    }
    catch (IOException e) {
      throw new JobSchedulerException("get returns an exception", e);
    }
    finally {
      closeObject(out);
    }
  } // get
View Full Code Here

    long totalBytes = 0;
    try {
      // TODO get filesize and report as a message
      in = Client().retrieveFileStream(remoteFile);
      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) {
          // TODO create progress message
          out.write(buffer, 0, bytes_read);
          out.flush();
          totalBytes += bytes_read;
        }
      }
      closeInput(in);
      closeObject(out);
      if (Client().completePendingCommand() == false) {
        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());
      }
      // TODO create completed Message
      if (totalBytes > 0)
        return totalBytes;
      else
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.