Package eu.scape_project.planning.exception

Examples of eu.scape_project.planning.exception.PlanningException


     * @param steps
     *            All steps of the viewWorkflow
     */
    public void init(final Plan plan, final List<AbstractView> steps) throws PlanningException {
        if (steps == null || steps.isEmpty()) {
            throw new PlanningException("No views defined!");
        }

        this.plan = plan;
        this.steps = steps;

View Full Code Here


        if (currentView != null) {
            currentView.save();
            // the plan instance might have changed
            plan = currentView.getPlan();
        } else {
            throw new PlanningException("Invalid viewWorkflow-state, no current view available.");
        }
    }
View Full Code Here

            // return the current-view-url to recreate the view
            // (populate the view with updated model values - after immediate
            // event changing the underlying model)
            return currentView.getViewUrl();
        } else {
            throw new PlanningException("Invalid viewWorkflow-state, no current view available.");
        }
    }
View Full Code Here

    public String showCurrentView() throws PlanningException {
        if (currentView != null) {
            currentView.init(plan);
            return currentView.getViewUrl();
        } else {
            throw new PlanningException("Invalid viewWorkflow-state, no current view available.");
        }
    }
View Full Code Here

                wf.readMetadata();
                String workflowContent = MyExperimentRESTClient.getWorkflowContent(wf);
                generator.setMigrationComponent(wf, workflowContent, parameters);
            } catch (Exception e) {
                log.warn("An error occured querying myExperiment migration component.", e.getMessage());
                throw new PlanningException("An error occured querying myExperiment migration component", e);
            }
        }

        // Add QA components
        addQaComponents(generator, measures, sourceMimetype, targetMimetype);

        // Create digital object
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputStreamWriter writer = new OutputStreamWriter(out);

        try {
            generator.generate(writer);
        } catch (IOException e) {
            log.warn("An error occured generating the executable plan.", e.getMessage());
            throw new PlanningException("An error occured generating the executable plan.", e);
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    log.warn("An error occured closing the executable plan generator writer.", e.getMessage());
                    throw new PlanningException("An error occured closing the executable plan generator writer.", e);
                }
            }
        }

        byte[] data = out.toByteArray();
View Full Code Here

    public void readProfile(InputStream stream, final String repositoryUser, final String repositoryPassword) throws ParserException, PlanningException {
        log.info("Pre-processing profile information");

        ByteStream bsData = this.convertToByteStream(stream);
        if (bsData == null) {
            throw new PlanningException("An error occurred while storing the profile");
        }

        log.info("Parsing profile information");
        stream = new ByteArrayInputStream(bsData.getData());
        C3POProfileParser parser = new C3POProfileParser();
View Full Code Here

            digitalObjectManager.moveDataToStorage(object);
            collectionProfile.setProfile(object);
            addedBytestreams.add(object.getPid());
        } catch (StorageException e) {
            log.error("An error occurred while storing the profile: {}", e);
            throw new PlanningException("An error occurred while storing the profile");
        }
    }
View Full Code Here

     *             if an error at adding occurs (e.g. want to add an Alternative
     *             with an already existing name).
     */
    public void addAlternative(Alternative alternative) throws PlanningException {
        if (!isAlternativeNameUnique(alternative.getName())) {
            throw new PlanningException("A unique name must be provided for the alternative.");
        }

        if (!isAlternativeNameValid(alternative.getName())) {
            String msg = String.format("The alternative name must not start or end with a whitespace. [%s]", alternative.getName());
            throw new PlanningException(msg);
        }

        alternative.setAlternativesDefinition(this);
        alternatives.add(alternative);
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    public void renameAlternative(Alternative alternative, String newName) throws PlanningException {
        // check if the alternative to change exists
        if (alternativeByName(alternative.getName()) == null) {
            throw new PlanningException("Alternative to rename does not exists.");
        }

        // check if the new-name is unique
        if (!alternative.getName().equals(newName) && !isAlternativeNameUnique(newName)) {
            throw new PlanningException("A unique name must be provided for the alternative.");
        }

        if (!isAlternativeNameValid(newName)) {
            throw new PlanningException("The alternative name must not start or end with a whitespace.");
        }

        // At this stage renaming of the alternative is okay
        alternative.setName(newName);
    }
View Full Code Here

        }
    }
   
    public String characterise(File input) throws PlanningException{
        if (FITS_HOME == null) {
            throw new PlanningException("FITS is not properly configured (FITS_HOME is not defined).");
        }
        CommandExecutor cmdExecutor = new CommandExecutor();
        cmdExecutor.setWorkingDirectory(FITS_HOME);
        String scriptExt;
        if ("Linux".equalsIgnoreCase(System.getProperty("os.name"))){
            scriptExt = "./fits.sh";
        } else {
            scriptExt = "cmd /c %FITS_HOME%/fits";
        }
        File output = new File(OS.getTmpPath() + "fits"+System.nanoTime()+".out");
        try {
            String commandLine = FITS_COMMAND.replace("%FITS_EXEC%", scriptExt)
                .replace("%INPUT%", input.getAbsolutePath())
                .replace("%OUTPUT%", output.getAbsolutePath());
           
            try {
                int exitcode = cmdExecutor.runCommand(commandLine);
                if (exitcode != 0) {
                    String cmdError = cmdExecutor.getCommandError();
                    throw new PlanningException("FITS characterisation for file: " + input + " failed: " + cmdError);
                }
                if (!output.exists()) {
                    throw new PlanningException("FITS characterisation for file: " + input + " failed: no output was written.");
                }
               
                return new String(FileUtils.getBytesFromFile(output));
            } catch (PlanningException e) {
                throw e;
            } catch (Throwable t) {
                throw new PlanningException("FITS characterisation for file: " + input + " failed: " + t.getMessage());           
            }
        } finally {
            output.delete();
        }
    }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.exception.PlanningException

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.