Package eu.planets_project.services.datatypes

Examples of eu.planets_project.services.datatypes.ServiceReport


    private ServiceReport checkMigrateArgs(final DigitalObject digitalObject,
                                  final URI inputFormat, final URI outputFormat,
                                  final ServiceReport report) {

        if (digitalObject == null) {
            return new ServiceReport(Type.ERROR, Status.TOOL_ERROR,
                    "An empty (null) digital object was given");
        } else if (digitalObject.getContent() == null) {
            System.out.println("Content NULL");
            return new ServiceReport(Type.ERROR, Status.TOOL_ERROR,
                    "The content of the digital object " + "is empty (null)");
        }

        if (inputFormat == null) {
            return new ServiceReport(Type.ERROR, Status.TOOL_ERROR,
                    "An empty (null) input object was given");
        }

        if (outputFormat == null) {
            return new ServiceReport(Type.ERROR, Status.TOOL_ERROR,
            "An empty (null) output object was given");
        }
        return report;
    }
View Full Code Here


      URI format = techReg.createExtensionUri(FilenameUtils.getExtension(currentFile.getName()));
     
      ValidateResult vr = validator.validate(testIn, format, null);
     
      assertTrue("ValidateResult should not be NULL!", vr!=null);
      ServiceReport sr = vr.getReport();
      System.out.println(sr);
    }
  }
View Full Code Here

    public IdentifyResult identify(final DigitalObject digitalObject,
            final List<Parameter> parameters) {
        File file = DigitalObjectUtils.toFile(digitalObject);
        List<URI> types = identifyOneBinary(file);
        log.info("JHOVE Identification, got types: " + types);
        ServiceReport report;
        if (types == null || types.size() == 0 || types.contains(null)) {
            report = new ServiceReport(Type.ERROR, Status.TOOL_ERROR,
                    "Could not identify " + file.getAbsolutePath()
                            + " (is the required Jhove module installed?)");
        } else {
            report = new ServiceReport(Type.INFO, Status.SUCCESS, status);
        }
        return new IdentifyResult(types, null, report);
    }
View Full Code Here

            wr.getStages().add( migrateStage );
            executeMigrateStage(wr, migrateStage, dob);
        } catch (Exception e ) {
            // Create a ServiceReport from the exception.
            // URGENT can we distinguish tool and install error here?
            ServiceReport sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, e.toString());
            wr.logReport(sr);
            log.error("Migration failed! "+e);
            e.printStackTrace();
            return wr;
        }
View Full Code Here

        // 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 (identify != null && identify.getReport() != null) {
            String info = identify.getReport().toString();
            sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, info);
        }
        wr.logReport(sr);

        return wr;
    }
View Full Code Here

        FormatRegistry format = FormatRegistryFactory.getFormatRegistry();
        MigrateResult mr = dom.migrate(input, format.createExtensionUri("png"),
                format.createExtensionUri( newExt ), null);

        ServiceReport sr = mr.getReport();
        System.out.println("Got Report: " + sr);

        DigitalObject doOut = mr.getDigitalObject();

        assertTrue("Resulting digital object is null.", doOut != null);
View Full Code Here

            return this.returnWithErrorMessage("Could not write the Image. ",e);
        } catch (IOException e) {
            return this.returnWithErrorMessage("Could not write the Image. ",e);
        }
       
        ServiceReport rep = new ServiceReport(Type.INFO, Status.SUCCESS, "OK", sph.getPerformanceProperties());
        DigitalObject ndo = new DigitalObject.Builder(Content.byValue(bytes)).build();
        return new MigrateResult( ndo, rep );
    }
View Full Code Here

        }
        if( imageInfo == null || imageInfo.getFormat() == null )
            return this.returnWithErrorMessage("Could not understand the image.");
       
        String type = imageInfo.getFormat().extension;
        ServiceReport rep = new ServiceReport(Type.INFO, Status.SUCCESS, "OK");
       
        List<URI> types = new ArrayList<URI>();
        URI typeURI = FormatRegistryFactory.getFormatRegistry().createExtensionUri(type);
        types.add(typeURI);
        return new IdentifyResult(types, IdentifyResult.Method.PARTIAL_PARSE, rep);
View Full Code Here

      MigrateResult migrateResult = migrationService.migrate(
          digoToMigrate, migrateFromURI, migrateToURI, parameterList);

      // document
      wfResultItem.setEndTime(System.currentTimeMillis());
      ServiceReport report = migrateResult.getReport();
      // report service status and type
      wfResultItem.setServiceReport(report);
      if (report.getType() == Type.ERROR) {
        String s = "Service execution failed: " + report.getMessage();
        wfResultItem.addLogInfo(s);
        throw new Exception(s);
      }

      DigitalObject migOutput = migrateResult.getDigitalObject();
View Full Code Here

    Assert.assertNotNull("HTML version is null!", htmlVersion);
    DigitalObject digObj = createDigitalObject(inputFormat);
   
    MigrateResult mr = JTIDY.migrate(digObj, inputFormat, outputFormat, parameters);

    ServiceReport sr = mr.getReport();
   
    if(sr.getType() == Type.ERROR) {
      System.err.println("FAILED: " + sr);
    }
    else {
      System.out.println("SUCCESS! Got Report: " + sr);
       
View Full Code Here

TOP

Related Classes of eu.planets_project.services.datatypes.ServiceReport

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.