Package org.apache.airavata.core.gfac.exception

Examples of org.apache.airavata.core.gfac.exception.ProviderException


                    .append(String.valueOf(returnValue));

            log.info(buf.toString());

        } catch (IOException io) {
            throw new ProviderException(io.getMessage(), io);
        } catch (InterruptedException e) {
            throw new ProviderException(e.getMessage(), e);
        }
    }
View Full Code Here


            String stdOutStr = GfacUtils.readFileToString(app.getStandardOutput());

            // set to context
            return OutputUtils.fillOutputFromStdout(context.<ActualParameter> getOutput(), stdOutStr);
        } catch (XmlException e) {
            throw new ProviderException("Cannot read output:" + e.getMessage(), e);
        } catch (IOException io) {
            throw new ProviderException(io.getMessage(), io);
        }
    }
View Full Code Here

            if (hostgridFTP == null || hostgridFTP.length == 0) {
                hostgridFTP = new String[] { host.getHostAddress() };
            }

            boolean success = false;
            ProviderException pe = new ProviderException("");

            for (String endpoint : host.getGridFTPEndPointArray()) {
                try {

                    URI tmpdirURI = GfacUtils.createGsiftpURI(endpoint, app.getScratchWorkingDirectory());
                    URI workingDirURI = GfacUtils.createGsiftpURI(endpoint, app.getStaticWorkingDirectory());
                    URI inputURI = GfacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
                    URI outputURI = GfacUtils.createGsiftpURI(endpoint, app.getOutputDataDirectory());

                    log.info("Host FTP = " + hostgridFTP);
                    log.info("temp directory = " + tmpdirURI);
                    log.info("Working directory = " + workingDirURI);
                    log.info("Input directory = " + inputURI);
                    log.info("Output directory = " + outputURI);

                    ftp.makeDir(tmpdirURI, gssCred);
                    ftp.makeDir(workingDirURI, gssCred);
                    ftp.makeDir(inputURI, gssCred);
                    success = true;
                    break;
                } catch (URISyntaxException e) {
                    pe = new ProviderException("URI is malformatted:" + e.getMessage(), e);

                } catch (ToolsException e) {
                    pe = new ProviderException(e.getMessage(), e);
                }
            }
            if (success == false) {
                throw pe;
            }
        } catch (SecurityException e) {
            throw new ProviderException(e.getMessage(), e);
        }
    }
View Full Code Here

            job = new GramJob(rsl);
            listener = new JobSubmissionListener(job, invocationContext);
            job.addListener(listener);

        } catch (ToolsException te) {
            throw new ProviderException(te.getMessage(), te);
        }

    }
View Full Code Here

            } else {
                error.setReason(JobSubmissionFault.JOB_FAILED);
            }
            throw error;
        } catch (GSSException e) {
            throw new ProviderException(e.getMessage(), e);
        } catch (InterruptedException e) {
            throw new ProviderException("Thread", e);
        } catch (SecurityException e) {
            throw new ProviderException(e.getMessage(), e);
        } finally {
            if (job != null) {
                try {
                    job.cancel();
                } catch (Exception e) {
View Full Code Here

            if (hostgridFTP == null || hostgridFTP.length == 0) {
                hostgridFTP = new String[] { host.getHostAddress() };
            }

            boolean success = false;
            ProviderException pe = new ProviderException("");

            for (String endpoint : host.getGridFTPEndPointArray()) {

                try {

                    /*
                     * Stdout and Stderror
                     */

                    URI stdoutURI = GfacUtils.createGsiftpURI(endpoint, app.getStandardOutput());
                    URI stderrURI = GfacUtils.createGsiftpURI(endpoint, app.getStandardError());

                    log.info("STDOUT:" + stdoutURI.toString());
                    log.info("STDERR:" + stderrURI.toString());

                    File logDir = new File("./service_logs");
                    if (!logDir.exists()) {
                        logDir.mkdir();
                    }

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

                    String stdout = ftp.readRemoteFile(stdoutURI, gssCred, localStdOutFile);
                    String stderr = ftp.readRemoteFile(stderrURI, gssCred, localStdErrFile);

                    return OutputUtils.fillOutputFromStdout(invocationContext.<ActualParameter> getOutput(), stdout);
                } catch (ToolsException e) {
                    throw new ProviderException(e.getMessage(), e);
                } catch (URISyntaxException e) {
                    throw new ProviderException("URI is malformatted:" + e.getMessage(), e);
                }
            }
           
            /*
             * If the execution reach here, all GridFTP Endpoint is failed.
             */
            throw pe;

        } catch (XmlException e) {
            throw new ProviderException("Cannot read output:" + e.getMessage(), e);
        } catch (IOException e) {
            throw new ProviderException(e.getMessage(), e);
        } catch (SecurityException e) {
            throw new ProviderException(e.getMessage(), e);
        }

    }
View Full Code Here

    private void makeFileSystemDir(String dir) throws ProviderException {
        File f = new File(dir);
        if (f.isDirectory() && f.exists()) {
            return;
        } else if (!new File(dir).mkdir()) {
            throw new ProviderException("Cannot make directory");
        }
    }
View Full Code Here

                    .append(String.valueOf(returnValue));

            log.info(buf.toString());

        } catch (IOException io) {
            throw new ProviderException(io.getMessage(), io);
        } catch (InterruptedException e) {
            throw new ProviderException(e.getMessage(), e);
        }
    }
View Full Code Here

            String stdOutStr = GfacUtils.readFileToString(app.getStandardOutput());

            // set to context
            return OutputUtils.fillOutputFromStdout(context.<ActualParameter> getOutput(), stdOutStr);
        } catch (XmlException e) {
            throw new ProviderException("Cannot read output:" + e.getMessage(), e);
        } catch (IOException io) {
            throw new ProviderException(io.getMessage(), io);
        }
    }
View Full Code Here

            commandString.append(app.getOutputDataDirectory());

            Command cmd = session.exec(commandString.toString());
            cmd.join(COMMAND_EXECUTION_TIMEOUT, TimeUnit.SECONDS);
        } catch (ConnectionException e) {
            throw new ProviderException(e.getMessage(), e);
        } catch (TransportException e) {
            throw new ProviderException(e.getMessage(), e);
        } catch (IOException e) {
            throw new ProviderException(e.getMessage(), e);
        } finally {
            closeSession(session);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.core.gfac.exception.ProviderException

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.