Examples of ServiceReport


Examples of eu.planets_project.services.datatypes.ServiceReport

            error += "\n" + e.toString();
        /*
         * This weird usage of the enum is temporary (the int param and probably this whole method should probably be
         * replaced with enum usage)
         */
        ServiceReport sr = new ServiceReport(Type.ERROR, Status.values()[errorType], error);
        return sr;
    }
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

     * @param message The message
     * @param e The exception
     * @return service report from exception and message
     */
    public static ServiceReport createExceptionErrorReport(String message, Exception e) {
        return new ServiceReport(Type.ERROR, Status.TOOL_ERROR, message + "\n" + e.toString());
    }
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

    /**
     * @param message The message
     * @return service report from message
     */
    public static ServiceReport createErrorReport(String message) {
        return new ServiceReport(Type.ERROR, Status.TOOL_ERROR, message);
    }
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

   * @throws Exception
   */
  private String[] runIdentification1(DigitalObject digo, WorkflowResult wfresult) throws Exception{
    
        IdentifyResult results = identify1.identify(digo);
        ServiceReport status = results.getReport();
        List<URI> types = results.getTypes();
       
        if(status.equals(status.error)){
          String s = "Service execution failed";
           log.debug(s);
          throw new Exception(s);
        }
        if(types.size()<1){
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

   * @return
   * @throws Exception
   */
  private String[] runIdentification2(DigitalObject digo,WorkflowResult wfresult) throws Exception{
        IdentifyResult results = identify2.identify(digo);
        ServiceReport status = results.getReport();
        List<URI> types = results.getTypes();
       
        if(status.equals(status.error)){
          String s = "Service execution failed";
           log.debug(s);
          throw new Exception(s);
        }
        if(types.size()<1){
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

   
    /*
     * Now call the migration service
     */
    MigrateResult migrateResult = this.migrate1.migrate(digO, migrateFromURI, migrateToURI, parameters);
    ServiceReport status = migrateResult.getReport();
   
    if(status.equals(status.error)){
      String s = "Service execution failed";
       log.debug(s);
          throw new Exception(s);
        }
   
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

       
        // Create a new Digital Object, based on the old one:
        DigitalObject newDO = new DigitalObject.Builder(digitalObject).content(Content.byReference(tmpFile)).build();
       
        boolean success = newDO != null;
        ServiceReport report;
        if (success) {
            report = new ServiceReport(ServiceReport.Type.INFO, ServiceReport.Status.SUCCESS,
                    "Passed through");
            System.out.println("Passing back: " + newDO.getContent().length() + " bytes");
        } else {
            report = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, "Null result");
        }
        MigrateResult migrateResult = new MigrateResult(newDO, report);
        System.out.println("Pass-through migration: " + migrateResult);
        return migrateResult;
    }
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

                        outputFormat)
                        .permanentUri(
                                URI.create(PlanetsServices.SERVICES_NS
                                        + "/pserv-pa-jtidy")).build();

            ServiceReport sr;

            String message = createStringFromLogFile(logFile, true);
            if (tidy.getParseErrors() > 0) {
                sr = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, message);
            } else {
                sr = new ServiceReport(Type.INFO, Status.SUCCESS, message);
            }

            MigrateResult mr = new MigrateResult(result, sr);

            return mr;
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

     * @see eu.planets_project.services.validate.Validate#validate(eu.planets_project.services.datatypes.DigitalObject, java.net.URI, java.util.List)
     */
    public ValidateResult validate(DigitalObject dob, URI format,
            List<Parameter> parameters) {
        String message = "This service always says yes, unless the digital object is null.";
        ServiceReport sr = new ServiceReport(Type.INFO, Status.SUCCESS, message);
        log.info(message);
        if (dob == null) {
            return new ValidateResult.Builder(format, sr).build();
        } else {
            ValidateResult result = new ValidateResult.Builder(format, sr)
View Full Code Here

Examples of eu.planets_project.services.datatypes.ServiceReport

          String title_ = digO.getTitle().substring(0,digO.getTitle().lastIndexOf('.'));
          if(migrateToURI.toString().toLowerCase().lastIndexOf("siard") > 0) title_ = title_ + ".siard";
          dgoOut = (new DigitalObject.Builder(dgoOut)).title(title_).build();
        }

        ServiceReport report = migrateResult.getReport();

        if (report.getType() == Type.ERROR) {
            String s = "Service execution failed: " + report.getMessage();
            log.debug(s);
            throw new Exception(s);
        }
        return dgoOut;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.