Package com.sos.JSHelper.Exceptions

Examples of com.sos.JSHelper.Exceptions.JobSchedulerException


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


  @Override
  public void write(byte[] bteBuffer, int intOffset, int intLength) {
    final String conMethodName = conClassName + "::write";
    try {
      if (this.getFileOutputStream() == null) {
        throw new JobSchedulerException(String.format("%1$s failed, can not get OutputStream for file %2$s", conMethodName, strFileName));
      }
      this.getFileOutputStream().write(bteBuffer, intOffset, intLength);
    }
    catch (IOException e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("%1$s failed for file %2$s", conMethodName, strFileName), e);
    }
  }
View Full Code Here

    FileInputStream in = null;
    long totalBytes = 0;
    try {

      if (out == null)
        throw (new JobSchedulerException("output stream has null value."));
      // TODO Buffersize must be an Option
      byte[] buffer = new byte[4096];
      in = new FileInputStream(new File(localFile));
      // TODO get progress info
      int bytesWritten;
      synchronized (this) {
        while ((bytesWritten = in.read(buffer)) != -1) {
          out.write(buffer, 0, bytesWritten);
          totalBytes += bytesWritten;
        }
      }

      in.close();
      out.close();
      if (!completePendingCommand()) {
        logout();
        disconnect();
        throw (new JobSchedulerException("File transfer failed."));
      }
      if (isNegativeCommandCompletion()) {
        throw new JobSchedulerException("..error occurred in putFile() on the FTP server for file [" + localFile + "]: " + getReplyString());
      }
      return totalBytes;
    }
    catch (Exception e) {
      throw e;
View Full Code Here

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

          throw new JSCommandErrorException(objError.getText());
        }
        List<HistoryEntry> objHistoryEntries = objAnswer.getHistory().getHistoryEntry();
        if(objHistoryEntries.size() == 0) {
          logger.error(String.format("no history entry found for %1$s", strJobName));
          throw new JobSchedulerException(String.format("no history entry found for %1$s", strJobName));
        }
        else {
          HistoryEntry objHistoryEntry = objHistoryEntries.get(0);
          String strErrorText = objHistoryEntry.getErrorText();
          String strEndTime = objHistoryEntry.getEndTime();
          Date objDateEndTime = SOSDate.getDate(strEndTime, SOSDate.dateTimeFormat);       
          boolean flgRunSuccessful = isEmpty(strErrorText);
          boolean flgRunTooLate = objDateEndTime.before(objDateStartTime);
         
          if(flgRunTooLate || !flgRunSuccessful ) {
            logger.info(String.format("last run of %1$s on %2$s", strJobName, strEndTime));
            if(!flgRunSuccessful) {
              logger.info(String.format("with error: %1$s", strErrorText));
              logger.error(String.format("%1$s %n%2$s", strMessage, strErrorText));
              throw new JobSchedulerException(String.format("%1$s %n%2$s", strMessage, strErrorText));
            }
            else {
              logger.error(String.format("%1$s", strMessage));
              throw new JobSchedulerException(String.format("%1$s", strMessage));
            }
          }
          else {
            logger.info(String.format("last successfully run of %1$s on %2$s", strJobName, strEndTime));
          }
        }
      }
      else {
        throw new JobSchedulerException("Job Scheduler isn't responding");
      }
    }
    catch (Exception e) {
//      e.printStackTrace(System.err);
      logger.error(String.format(Messages.getMsg("JSJ-I-107"), conMethodName), e);
View Full Code Here

    final String conMethodName = conClassName + "::ascii";

    try {
      boolean flgResult = Client().setFileType(FTP.ASCII_FILE_TYPE);
      if (flgResult == false) {
        throw new JobSchedulerException("setFileType not possible, due to : " + getReplyString());
      }
    }
    catch (IOException e) {
      RaiseException(e, HostID(String.format(objMsg.getMsg(SOSVfs_E_0105), conMethodName)));
    }
View Full Code Here

    final String conMethodName = conClassName + "::binary";

    try {
      boolean flgResult = Client().setFileType(FTP.BINARY_FILE_TYPE);
      if (flgResult == false) {
        throw new JobSchedulerException("setFileType not possible, due to : " + getReplyString());
      }
    }
    catch (IOException e) {
      RaiseException(e, HostID(String.format(objMsg.getMsg(SOSVfs_E_0105), conMethodName)));
    }
View Full Code Here

        }
      }
    }
    catch (Exception e) {
      e.printStackTrace(System.err);
      throw new JobSchedulerException("error in  " + sos.util.SOSClassUtil.getMethodName() + " ,\nreason: " + e);
    }
  }
View Full Code Here

       * \todo
       * TODO File-Handling in der Option-Klasse abhandeln. Return vom Type JSFile einbauen
       */
      File authenticationFile = new File(objAO.getAuth_file().Value());
      if (authenticationFile.exists() == false)
        throw new JobSchedulerException("SOS-SSH-E-010: authentication file does not exist: " + authenticationFile.getCanonicalPath());
      if (authenticationFile.canRead() == false)
        throw new JobSchedulerException("SOS-SSH-E-020: authentication file not accessible: " + authenticationFile.getCanonicalPath());

      isAuthenticated = this.getSshConnection().authenticateWithPublicKey(objAO.getUser().Value(), authenticationFile, objAO.getPassword().Value());
    }
    else
      if (objAO.getAuth_method().isPassword()) {
        isAuthenticated = getSshConnection().authenticateWithPassword(objAO.getUser().Value(), objAO.getPassword().Value());
      }

    if (isAuthenticated == false) {
      throw new JobSchedulerException(String.format("SOS-SSH-E-030: %1$s:  authentication failed %2$s", conMethodName, objAO.toString()));
    }

    logger.info(String.format("SOS-SSH-I-040: user %1$s logged in", objAO.getUser().Value()));
    return this;
  }
View Full Code Here

   */
  public ISOSSession OpenSession(ISOSShellOptions pobjShellOptions) throws Exception {

    this.objSO = pobjShellOptions;
    if (objSO == null) {
      throw new JobSchedulerException("no shell-options specified but mandatory");
    }

    long loginTimeout = objSO.getSimulate_shell_login_timeout().value();
    String strPromptTrigger = objSO.getSimulate_shell_prompt_trigger().Value();

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.