Package eu.planets_project.services.view

Examples of eu.planets_project.services.view.CreateViewResult


        List<DigitalObject> digitalObjects = new ArrayList<DigitalObject>();
        digitalObjects.add(dob);
       
        CreateView viewService = (CreateView) service.getPort(CreateView.class);
       
        CreateViewResult view = null;
       
        try {
            view = viewService.createView(digitalObjects, null);
           
            ServiceReport report = view.getReport();
           
            if (report.getStatus() != ServiceReport.Status.SUCCESS ) {
                sessionIdentifier = "";
                return false;
            }
           
            sessionIdentifier = view.getViewURL().toExternalForm();
           
            return true;
           
        } catch( Exception e ) {
            PlatoLogger.getLogger(PlanetsEmulationService.class).error(e.getMessage());
View Full Code Here


        digitalObjects.add(dob);

        // Invoke the service, timing it along the way:
        boolean success = true;
        String exceptionReport = "";
        CreateViewResult view = null;
        long msBefore = 0, msAfter = 0;
        msBefore = System.currentTimeMillis();
        try {
            view = viewMaker.createView(digitalObjects, null);
            wr.logReport(view.getReport());
        } catch( Exception e ) {
            success = false;
            exceptionReport = "<p>Service Invocation Failed!<br/>" + e + "</p>";
        }
        msAfter = System.currentTimeMillis();

        // Record this one-stage experiment:
        ExecutionStageRecordImpl idStage = new ExecutionStageRecordImpl(null, STAGE_CREATEVIEW);
        wr.getStages().add( idStage );
       
        // Record the endpoint of the service used for this stage.  FIXME Can this be done more automatically, from above?
        idStage.setEndpoint(serviceEndpoint);
       
        List<MeasurementImpl> recs = idStage.getMeasurements();
        recs.add(new MeasurementImpl(TecRegMockup.PROP_SERVICE_TIME, ""+((msAfter-msBefore)/1000.0) ));
       
        // Now record
        try {
            if( success && view.getViewURL() != null ) {
                recs.add( new MeasurementImpl( TecRegMockup.PROP_SERVICE_EXECUTION_SUCEEDED, "true"));
                collectCreateViewResults(recs, view, dob);
                wr.setMainEndpoint(serviceEndpoint);
                wr.setResult(view);
                wr.setResultType( WorkflowResult.RESULT_CREATEVIEW_RESULT );
                return wr;
            }
        } catch( Exception e ) {
            exceptionReport += "<p>Failed with exception: "+e+"</p>";
        }

        // Build in a 'service failed' property.
        recs.add( new MeasurementImpl( TecRegMockup.PROP_SERVICE_EXECUTION_SUCEEDED, "false"));

        // Create a ServiceReport from the exception.
        // TODO can we distinguish tool and install error here?
        ServiceReport sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR,
                "No info");
        if (view != null && view.getReport() != null) {
            String info = view.getReport().toString();
            sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, info);
        }
        wr.logReport(sr);

        return wr;
View Full Code Here

                // Examine the result:
                if( WorkflowResult.RESULT_DIGITAL_OBJECT.equals(wfr.getResultType())) {
                    rec.setDigitalObjectResult( (DigitalObject) wfr.getResult(), exp );
                   
                } else if(WorkflowResult.RESULT_CREATEVIEW_RESULT.equals(wfr.getResultType()) ) {
                    CreateViewResult cvr = (CreateViewResult) wfr.getResult( );
                    Properties vp = new Properties();
                    vp.setProperty(ExecutionRecordImpl.RESULT_PROPERTY_CREATEVIEW_SESSION_ID, cvr.getSessionIdentifier());
                    vp.setProperty(ExecutionRecordImpl.RESULT_PROPERTY_CREATEVIEW_VIEW_URL, cvr.getViewURL().toString());
                    vp.setProperty(ExecutionRecordImpl.RESULT_PROPERTY_CREATEVIEW_ENDPOINT_URL, wfr.getMainEndpoint().toString() );
                    rec.setPropertiesListResult(vp);
                   
                } else {
                    rec.setResultType(ExecutionRecordImpl.RESULT_MEASUREMENTS_ONLY);
View Full Code Here

TOP

Related Classes of eu.planets_project.services.view.CreateViewResult

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.