Package net.schmizz.sshj.xfer.scp

Examples of net.schmizz.sshj.xfer.scp.SCPFileTransfer


      // Get the Stdouts and StdErrs
      String timeStampedServiceName = GFacUtils.createUniqueNameForService(jobExecutionContext.getServiceName());
      File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
      File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");

      SCPFileTransfer fileTransfer = securityContext.getSSHClient().newSCPFileTransfer();
      fileTransfer.download(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
      fileTransfer.download(app.getStandardError(), localStdErrFile.getAbsolutePath());

      String stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
      String stdErrStr = GFacUtils.readFileToString(localStdErrFile.getAbsolutePath());
      Map<String, ActualParameter> stringMap = new HashMap<String, ActualParameter>();
      Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters();
View Full Code Here


    String remoteFile = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
    saveApplicationJob(jobExecutionContext, remoteFile);
    log.info(remoteFile);
    try {
      File runscript = createShellScript(jobExecutionContext);
      SCPFileTransfer fileTransfer = securityContext.getSSHClient().newSCPFileTransfer();
      GFacUtils.updateApplicationJobStatus(jobExecutionContext, jobID, ApplicationJobStatus.STAGING);
      fileTransfer.upload(runscript.getAbsolutePath(), remoteFile);
    } catch (IOException e) {
      throw new GFacProviderException(e.getLocalizedMessage(), e);
    }
  }
View Full Code Here

            // Get the Stdouts and StdErrs
            String timeStampedServiceName = GfacUtils.createUniqueNameForService(context.getServiceName());
            File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
            File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");

            SCPFileTransfer fileTransfer = ssh.newSCPFileTransfer();
            fileTransfer.download(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
            fileTransfer.download(app.getStandardError(), localStdErrFile.getAbsolutePath());

            String stdOutStr = GfacUtils.readFileToString(localStdOutFile.getAbsolutePath());
            String stdErrStr = GfacUtils.readFileToString(localStdErrFile.getAbsolutePath());

            return OutputUtils.fillOutputFromStdout(context.<ActualParameter> getOutput(), stdOutStr,stdErrStr);
View Full Code Here

            // Get the Stdouts and StdErrs
            String timeStampedServiceName = GfacUtils.createUniqueNameForService(context.getServiceName());
            File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
            File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");

            SCPFileTransfer fileTransfer = ssh.newSCPFileTransfer();
            fileTransfer.download(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
            fileTransfer.download(app.getStandardError(), localStdErrFile.getAbsolutePath());

            String stdOutStr = GfacUtils.readFileToString(localStdOutFile.getAbsolutePath());
            String stdErrStr = GfacUtils.readFileToString(localStdErrFile.getAbsolutePath());

            return OutputUtils.fillOutputFromStdout(context.<ActualParameter> getOutput(), stdOutStr);
View Full Code Here

            // Get the Stdouts and StdErrs
            String timeStampedServiceName = GfacUtils.createUniqueNameForService(context.getServiceName());
            File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
            File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");

            SCPFileTransfer fileTransfer = ssh.newSCPFileTransfer();
            fileTransfer.download(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
            fileTransfer.download(app.getStandardError(), localStdErrFile.getAbsolutePath());

            String stdOutStr = GfacUtils.readFileToString(localStdOutFile.getAbsolutePath());
            String stdErrStr = GfacUtils.readFileToString(localStdErrFile.getAbsolutePath());

            return OutputUtils.fillOutputFromStdout(context.<ActualParameter> getOutput(), stdOutStr);
View Full Code Here

            String remoteFile = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
            saveApplicationJob(jobExecutionContext, remoteFile);
            log.info(remoteFile);
            try {
                File runscript = createShellScript(jobExecutionContext);
                SCPFileTransfer fileTransfer = securityContext.getSSHClient().newSCPFileTransfer();
                GFacUtils.updateApplicationJobStatus(jobExecutionContext, jobID, ApplicationJobStatus.STAGING);
                fileTransfer.upload(runscript.getAbsolutePath(), remoteFile);
            } catch (IOException e) {
                throw new GFacProviderException(e.getLocalizedMessage(), e);
            }
        }else{
           gsiSshProvider = new GSISSHProvider();
View Full Code Here

    /** @return Instantiated {@link SCPFileTransfer} implementation. */
    public SCPFileTransfer newSCPFileTransfer() {
        checkConnected();
        checkAuthenticated();
        return new SCPFileTransfer(this);
    }
View Full Code Here

    public Result upload(String dest, File... files) {
        logger.info("uploading {} files to {}", files.length, dest);

        checkConnection();

        final SCPFileTransfer transfer = sshSession.getSsh().newSCPFileTransfer();

        try {

            if (files.length == 1) {
                logger.info("transferring {} to {}", files[0], dest);

                transfer.upload(new FileSystemFile(files[0]), dest);
            } else {
                for (File file : files) {
                    logger.info("transferring {} to {}", file, dest);

                    transfer.upload(new FileSystemFile(file), dest + "/" + file.getName());
                }
            }

            return Result.OK;
        } catch (IOException e) {
View Full Code Here

TOP

Related Classes of net.schmizz.sshj.xfer.scp.SCPFileTransfer

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.