Package eu.planets_project.services.identify

Examples of eu.planets_project.services.identify.IdentifyResult


        ServiceReport rep = new ServiceReport(Type.INFO, Status.SUCCESS, "Nothing checked");

        List<URI> types = new ArrayList<URI>();
        types.add(FormatRegistryFactory.getFormatRegistry().createMimeUri(type));

        return new IdentifyResult(types, IdentifyResult.Method.EXTENSION, rep);
    }
View Full Code Here


   
    private IdentifyResult returnWithErrorMessage(String message) {
        ServiceReport rep = new ServiceReport(Type.ERROR, Status.TOOL_ERROR, message);
        List<URI> type = null;
        log.severe(message);
        return new IdentifyResult(type, null, rep);
    }
View Full Code Here

        }else{
          parameterList = new ArrayList<Parameter>();
        }
 
        //now actually execute the identify operation of the service
        IdentifyResult results = identify.identify(digo, parameterList);
       
        //document the end-time and input digital object and the params
        wfResultItem.setEndTime(System.currentTimeMillis());
        wfResultItem.setInputDigitalObject(digo);
        wfResultItem.setServiceParameters(parameterList);
        wfResultItem.setServiceEndpoint(identify.describe().getEndpoint());
       
        //have a look at the service's results
        ServiceReport report = results.getReport();
        List<URI> types = results.getTypes();

        //report service status and type
        wfResultItem.setServiceReport(report);

        if (report.getType() == Type.ERROR) {
View Full Code Here

        Assert.assertTrue("Identification failed for: " + f, b);
    }

    @Test
    public void testUnsupportedBmp() throws MalformedURLException {
        IdentifyResult identify = jhove.identify(new DigitalObject.Builder(
                Content.byReference(new File(TestFile.BMP.getLocation())
                        .toURI().toURL())).build(), null);
        checkUnidentified(identify);
    }
View Full Code Here

        checkUnidentified(identify);
    }

    @Test
    public void testUnsupportedPng() throws MalformedURLException {
        IdentifyResult identify = jhove.identify(new DigitalObject.Builder(
                Content.byReference(new File(TestFile.PNG.getLocation())
                        .toURI().toURL())).build(), null);
        checkUnidentified(identify);
    }
View Full Code Here

   
    @Test
    public void testEmptyFile() throws IOException {
        File emptyTempFile = File.createTempFile("jhove-test", "empty-file");
        emptyTempFile.deleteOnExit();
        IdentifyResult identify = jhove.identify(new DigitalObject.Builder(
                Content.byReference(emptyTempFile)).build(), null);
        checkUnidentified(identify);
    }
View Full Code Here

          parameterList = new ArrayList<Parameter>();
        }
       
        DigitalObject digo = this.getDataRegistry().retrieve(digoRef);
         
        IdentifyResult results = identify1.identify(digo,parameterList);
        ServiceReport report = results.getReport();
        List<URI> types = results.getTypes();
       
        if(report.getType() == Type.ERROR){
          String s = "Service execution failed: " + report.getMessage();
  
          throw new Exception(s);
View Full Code Here

     */

    private String[] runIdentification(DigitalObject digo, WorkflowResult wfresult) throws Exception {
        log.info("STEP 1: Identification...");
        List<Parameter> parameterList = new ArrayList<Parameter>();
        IdentifyResult results = identify.identify(digo, parameterList);
        ServiceReport report = results.getReport();
        List<URI> types = results.getTypes();

        if (report.getType() == Type.ERROR) {
            String s = "Service execution failed: " + report.getMessage();
            log.debug(s);
            throw new Exception(s);
View Full Code Here

                Identify.NAME));
        Identify droid = service.getPort(Identify.class);
        byte[] array = FileUtils.readFileToByteArray(f1);
       
        //invoke the service and extract results
        IdentifyResult identify = droid.identify(new DigitalObject.Builder(Content.byValue(array)).build(), null);
        List<URI> result = identify.getTypes();
        String status = identify.getReport().getMessage();
       
        if(!status.equals("Positive")){
          throw new Exception("Service execution failed");
        }
        if(result.size()<1){
View Full Code Here

   * @return
   * @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);
View Full Code Here

TOP

Related Classes of eu.planets_project.services.identify.IdentifyResult

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.