Package eu.planets_project.services.datatypes

Examples of eu.planets_project.services.datatypes.ServiceReport


        // 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


  public FixityResult calculateChecksum(DigitalObject digitalObject,
      List<Parameter> parameters) {

    // The returned FixityResult & ServiceReport
    FixityResult retResult = null;
    ServiceReport retReport = null;
    try {
      // Let's get the requested message digest from the params (or default)
      URI requestedAlgId = this.getDigestIdFromParameters(parameters);

      // OK let's try to get the digest algorithm
      MessageDigest messDigest =
        MessageDigest.getInstance(JavaDigestUtils.getJavaAlgorithmName(requestedAlgId));
     
      // Now calc the result, we need the bytes from the object
      // so let's get the stream
      InputStream inStream = digitalObject.getContent().getInputStream();

      // Catch the special case of no data in the file
      if (this.addStreamBytesToDigest(messDigest,
          inStream,
          JavaDigest.DEFAULT_CHUNK_SIZE) < 1) {
        // log it, and create a new service report
        JavaDigest.log.severe(JavaDigest.NO_DATA_MESSAGE);
        retResult = this.createErrorResult(ServiceReport.Status.TOOL_ERROR, JavaDigest.NO_DATA_MESSAGE);

        // Return the result
        return retResult;
      }

      // OK, success so create the result
      retReport = new ServiceReport(ServiceReport.Type.INFO,
          ServiceReport.Status.SUCCESS,
          JavaDigest.SUCCESS_MESSAGE);

      // And wrap it in the result
      retResult = new FixityResult(JavaDigestUtils.getDefaultAlgorithmId().toString(),
View Full Code Here

   * @param status The ServiceReport status to use
   * @param message The String message for the ServiceReport
   * @return a FixityResult that wraps the ServiceReport for return
   */
  private FixityResult createErrorResult(ServiceReport.Status status, String message) {
    ServiceReport retReport = new ServiceReport(ServiceReport.Type.ERROR,
                            status,
                          message);
    // And wrap it in the result
    return new FixityResult(retReport);
  }
View Full Code Here

            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

     * @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

    /**
     * @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

   * @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

   * @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

   
    /*
     * 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

       
        // 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

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.