Package eu.scape_project.planning.services.myexperiment.domain

Examples of eu.scape_project.planning.services.myexperiment.domain.WorkflowDescription


        customMyExperimentServiceInfo.setDescriptor(customMyExperimentServiceUri);
        customMyExperimentServiceInfo.setUrl(customMyExperimentServiceUri);
        customMyExperimentServiceInfo.setShortname(customMyExperimentServiceUri);
        customMyExperimentServiceInfo.setInfo(customMyExperimentServiceUri);

        WorkflowDescription wf = myExperimentServices.getWorkflowDescription(customMyExperimentServiceInfo);
        if (wf != null) {
            customMyExperimentServiceInfo.setUrl(wf.getContentUri());
            customMyExperimentServiceInfo.setShortname(wf.getName());
            customMyExperimentServiceInfo.setInfo(wf.getDescription());
            customMyExperimentServiceInfo.setDescriptor(wf.getDescriptor());
            customMyExperimentServiceInfo.setContentType(wf.getContentType());
            myExperimentServices.load(customMyExperimentServiceInfo);
        } else {
            customMyExperimentServiceInfo = null;
        }
    }
View Full Code Here


     *
     * @param serviceInfo
     *            the action info
     */
    public void addPreservationAction(MyExperimentActionInfo serviceInfo) {
        WorkflowDescription wf = myExperimentServices.getWorkflowDescription(serviceInfo);
        if (wf == null) {
            facesMessages.addError("Could not retrieve workflow description from myExeriment.");
            return;
        }

        try {
            PreservationActionDefinition actionDefinition = new PreservationActionDefinition();
            actionDefinition.setActionIdentifier(serviceInfo.getServiceIdentifier());
            actionDefinition.setShortname(serviceInfo.getShortname());
            actionDefinition.setDescriptor(serviceInfo.getDescriptor());
            actionDefinition.setUrl(serviceInfo.getUrl());
            actionDefinition.setInfo(serviceInfo.getInfo());

            for (Port p : wf.getInputPorts()) {
                if (p.isParameterPort()) {
                    actionDefinition.getParams().add(new Parameter(p.getName(), ""));
                }
            }

View Full Code Here

     *             if an error occurred while setting the migration action
     */
    public void setMigrationAction(IServiceInfo migrationAction, Map<String, String> parameters)
        throws PlanningException {
        try {
            WorkflowDescription wf = MyExperimentRESTClient.getWorkflow(migrationAction.getDescriptor());
            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 occurred querying myExperiment migration component", e);
View Full Code Here

     */
    public static RecommendedComponent recommendComponent(IServiceInfo component, List<String> measures,
        String targetMimetype) {
        RecommendedComponent recommendedComponent = null;

        WorkflowDescription wfd = MyExperimentRESTClient.getWorkflow(component.getDescriptor());
        wfd.readMetadata();
        List<Port> outputPorts = wfd.getOutputPorts();

        List<String> leftMeasures = new ArrayList<String>();
        List<String> rightMeasures = new ArrayList<String>();

        for (Port port : outputPorts) {
            if (measures.contains(port.getValue())) {
                if (port.getRelatedObject() == null) {
                    leftMeasures.add(port.getValue());
                    rightMeasures.add(port.getValue());
                } else if (ComponentConstants.VALUE_LEFT_OBJECT.equals(port.getRelatedObject())) {
                    leftMeasures.add(port.getValue());
                } else if (ComponentConstants.VALUE_RIGHT_OBJECT.equals(port.getRelatedObject())) {
                    rightMeasures.add(port.getValue());
                }
            }
        }

        boolean acceptsLeftMimetype = wfd.acceptsLeftMimetype(targetMimetype);
        boolean acceptsRightMimetype = wfd.acceptsRightMimetype(targetMimetype);
        if (acceptsLeftMimetype && acceptsRightMimetype) {
            if (leftMeasures.size() > rightMeasures.size()) {
                recommendedComponent = new RecommendedComponent(wfd, leftMeasures, InputSource.TARGET_OBJECT,
                    InputSource.SOURCE_OBJECT, RelatedObject.LEFT_OBJECT);
            } else {
View Full Code Here

        tavernaExecutor.init();

        HashMap<String, Value> results = new HashMap<String, Value>();

        // Get description
        WorkflowDescription workflowDescription = MyExperimentRESTClient.getWorkflow(service.getDescriptor());
        workflowDescription.readMetadata();

        if (!workflowDescription.getProfile().equals("http://purl.org/DP/components#Characterisation")
            && !workflowDescription.getProfile().equals("http://purl.org/DP/components#QAObjectComparison")) {
            LOG.warn("The workflow {} is no CC or QA component.", service.getDescriptor());
            throw new EvaluatorException("The workflow " + service.getDescriptor() + " is no CC or QA component.");
        }

        // Input
        if (workflowDescription.getProfile().equals("http://purl.org/DP/components#Characterisation")) {
            setCCInputData(workflowDescription, result, tavernaExecutor);
        } else {
            setQAInputData(workflowDescription, sample, result, tavernaExecutor);
        }

        // Workflow
        tavernaExecutor.setWorkflow(service.getContentUri());

        // Output ports to receive
        List<Port> outputPorts = workflowDescription.getOutputPorts();
        Set<String> outputPortNames = new HashSet<String>(outputPorts.size());
        for (Port p : outputPorts) {
            outputPortNames.add(p.getName());
        }
        tavernaExecutor.setOutputPorts(outputPortNames);
View Full Code Here

        if (futureWorkflowDescription == null) {
            load(serviceInfo);
            futureWorkflowDescription = workflowDescriptions.get(serviceInfo.getDescriptor());
        }
        try {
            WorkflowDescription wf = futureWorkflowDescription.get();
            if (wf == null) {
                log.debug("Service [{}] not found.", serviceInfo.getUrl());
                facesMessages.addWarning("Service " + serviceInfo.getUrl() + " not found.");
            }
            return wf;
View Full Code Here

        MigrationResult result = new MigrationResult();

        HashMap<String, Object> inputData = new HashMap<String, Object>();

        WorkflowDescription workflowDescription = MyExperimentRESTClient.getWorkflow(action.getDescriptor());
        workflowDescription.readMetadata();
        if (!workflowDescription.getProfile().equals("http://purl.org/DP/components#MigrationAction")) {
            result.setSuccessful(false);
            result.setReport("The workflow " + action.getUrl() + " is no MigrationAction.");
            return result;
        }

        List<Port> inputPorts = workflowDescription.getInputPorts();

        for (Port p : inputPorts) {
            if (ComponentConstants.VALUE_SOURCE_OBJECT.equals(p.getValue())) {
                inputData.put(p.getName(),
                    tavernaExecutor.new ByteArraySourceFile(FileUtils.makeFilename(digitalObject.getFullname()),
                        digitalObject.getData().getData()));
            } else if (ComponentConstants.VALUE_PARAMETER.equals(p.getValue()) || p.getValue() == null) {
                String value = action.getParamByName(p.getName());
                if (value == null) {
                    value = "";
                }
                inputData.put(p.getName(), value);
            } else {
                result.setSuccessful(false);
                result.setReport("The workflow " + action.getUrl() + " has unsupported port " + p.getName()
                    + " that accepts " + p.getValue());
                return result;
            }
        }
        tavernaExecutor.setInputData(inputData);

        // Workflow
        tavernaExecutor.setWorkflow(action.getUrl());

        // Output ports to receive
        List<Port> outputPorts = workflowDescription.getOutputPorts();
        Set<String> outputPortNames = new HashSet<String>(outputPorts.size());
        String targetPathPort = null;
        for (Port p : outputPorts) {
            outputPortNames.add(p.getName());
View Full Code Here

        // Migration action
        PreservationActionDefinition action = alternative.getAction();
        if (action != null) {
            try {
                WorkflowDescription wf = MyExperimentRESTClient.getWorkflow(action.getDescriptor());
                HashMap<String, String> parameters = new HashMap<String, String>();
                for (Parameter p : action.getParams()) {
                    parameters.put(p.getName(), p.getValue());
                }
                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);
View Full Code Here

                if (!processedMeasures.contains(measure)) {
                    List<IServiceInfo> qaWfs = queryQaComponents(measure, sourceMimetype, targetMimetype);
                    Iterator<IServiceInfo> qaIt = qaWfs.iterator();
                    if (qaIt.hasNext()) {
                        IServiceInfo wfi = qaIt.next();
                        WorkflowDescription wfd = MyExperimentRESTClient.getWorkflow(wfi.getDescriptor());
                        wfd.readMetadata();
                        List<Port> outputPorts = wfd.getOutputPorts();

                        List<String> leftMeasures = new ArrayList<String>();
                        List<String> rightMeasures = new ArrayList<String>();

                        for (Port port : outputPorts) {
                            if (measures.contains(port.getValue())) {
                                if (port.getRelatedObject() == null) {
                                    leftMeasures.add(port.getValue());
                                    rightMeasures.add(port.getValue());
                                } else if (ComponentConstants.VALUE_LEFT_OBJECT.equals(port.getRelatedObject())) {
                                    leftMeasures.add(port.getValue());
                                } else if (ComponentConstants.VALUE_RIGHT_OBJECT.equals(port.getRelatedObject())) {
                                    rightMeasures.add(port.getValue());
                                }
                            }
                        }
                        boolean acceptsLeftMimetype = wfd.acceptsLeftMimetype(targetMimetype);
                        boolean acceptsRightMimetype = wfd.acceptsRightMimetype(targetMimetype);
                        if (acceptsLeftMimetype && acceptsRightMimetype) {
                            if (leftMeasures.size() > rightMeasures.size()) {
                                processedMeasures.addAll(leftMeasures);
                                recommendedComponents.add(new RecommendedComponent(wfd, leftMeasures,
                                    InputSource.TARGET_OBJECT, InputSource.SOURCE_OBJECT, RelatedObject.LEFT_OBJECT));
View Full Code Here

        final List<String> measures, final String measure, final String targetMimetype) throws PlanningServiceException {
        List<IServiceInfo> ccWfs = queryCcComponents(measure, targetMimetype);
        Iterator<IServiceInfo> ccIt = ccWfs.iterator();
        if (ccIt.hasNext()) {
            IServiceInfo wfi = ccIt.next();
            WorkflowDescription wfd = MyExperimentRESTClient.getWorkflow(wfi.getDescriptor());
            wfd.readMetadata();
            List<Port> outputPorts = wfd.getOutputPorts();
            List<String> ccMeasures = new ArrayList<String>();
            for (Port port : outputPorts) {
                if (measures.contains(port.getValue())) {
                    ccMeasures.add(port.getValue());
                }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.services.myexperiment.domain.WorkflowDescription

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.