Package eu.planets_project.services.datatypes

Examples of eu.planets_project.services.datatypes.DigitalObject$Adapter


            parameterList.add(pCompressionQuality);
        }

        MigrateResult migrateResult = this.migrate.migrate(digO, migrateFromURI, migrateToURI, parameterList);
       
        DigitalObject dgoOut = migrateResult.getDigitalObject();
       
        //put filename without extenstion if empty
        if(dgoOut.getTitle() == null) {
          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();
        }
View Full Code Here


            wfResultItem.addLogInfo("****** digital object before store.");
          dgo = dodm.store(PERMANENT_URI_PATH, dgo, true);
          wfResultItem.addLogInfo("****** digital object after store: " + dgo.toString());
          URI permanentUri = dgo.getPermanentUri();
            wfResultItem.addLogInfo("Store DO in JCR res: " + permanentUri.toString());
          DigitalObject tmpDO = dodm.retrieve(permanentUri, true);
            wfResultItem.addLogInfo("result DO from JCR content length: " + tmpDO.getContent().length());
            wfResultItem.addLogInfo("result DO from JCR after retrieve: " + tmpDO.toString());
            wfResultItem.setEndTime(System.currentTimeMillis());

    } catch (Exception e) {
      wfResultItem.addLogInfo("exception: "+e.toString()+" for DO: "+dgo.toString());
      wfResultItem.setEndTime(System.currentTimeMillis());
View Full Code Here

        }
       
        Migrate m = (Migrate) service.getPort(Migrate.class);
       
        // create digital object that contains our sample object
        DigitalObject dob = new DigitalObject.Builder( Content.byValue(sampleObject.getData().getData()) ).title("data").build();

        FormatRegistry formatRegistry = FormatRegistryFactory.getFormatRegistry();

        // create Planets URI from extension
        URI sourceFormat = formatRegistry.createExtensionUri(sampleObject.getFormatInfo().getDefaultExtension());
View Full Code Here

        try {
            /*
             * To test usability of the digital object instance in web services,
             * we simply pass one into the service and expect one back:
             */
            DigitalObject input = new DigitalObject.Builder(
                    Content
                            .byReference(new File(
                                    "PA/sanselan/test/resources/PlanetsLogo-lowq-png.test")
                                    .toURI().toURL())).permanentUri(
                    URI.create("http://some")).build();
            System.out.println("Input: " + input);

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

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

            DigitalObject doOut = mr.getDigitalObject();

            assertTrue("Resulting digital object is null.", doOut != null);

            System.out.println("Output: " + doOut);
            System.out.println("Output.content: " + doOut.getContent());

            File out = new File("PA/sanselan/test/results/test.gif");
            DigitalObjectUtils.toFile(doOut, out);
        } catch (MalformedURLException e) {
            e.printStackTrace();
View Full Code Here

     */
    private void testIdentifyThis( URI purl, URI type ) throws MalformedURLException {
        /* Create the content: */
        DigitalObjectContent c1 = Content.byReference(purl.toURL());
        /* Given these, we can instantiate our object: */
        DigitalObject object = new DigitalObject.Builder(c1).permanentUri(purl).build();
       
        /* Now pass this to the service */
        IdentifyResult ir = ids.identify(object, null);
       
        /* Check the result */
 
View Full Code Here

     * @return the size of the object.
     */
    public long getSize() {
        if( dataReg == null ) return -1;

        DigitalObject dob = this.getDob();
        if( dob == null ) return -1;
        if( dob.getContent() == null ) return -1;
        return dob.getContent().length();
    }
View Full Code Here

        } catch (Exception e) {
            log.log(Level.SEVERE, "Could not return content by reference. ", e);
        }
        */
        ServiceReport rep = new ServiceReport(Type.INFO, Status.SUCCESS, "OK", sph.getPerformanceProperties() );
        DigitalObject ndo = new DigitalObject.Builder(Content.byReference(outfile)).build();
        return new MigrateResult(ndo, rep);
    }
View Full Code Here

     */
    private String helperReadDigoToString(String fileRef) throws IOException, DigitalObjectNotFoundException, URISyntaxException{
      DataRegistry digoManager = DataRegistryFactory.getDataRegistry();
      URI uriRef = new URI(fileRef);
      this.log.info("Retrieving Digital Object at " + uriRef);
    DigitalObject xmlTemplateDigo = digoManager.retrieve(new URI(fileRef));
      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(xmlTemplateDigo.getContent().getInputStream()));
        StringBuilder stringBuilder = new StringBuilder();
        String line = null;

        while ((line = bufferedReader.readLine()) != null) {
        stringBuilder.append(line + "\n");
View Full Code Here

       
        /* Create the content: */
        DigitalObjectContent c1 = Content.byValue(binary);
       
        /* Given these, we can instantiate our object: */
        DigitalObject object = new DigitalObject.Builder(c1).build();

        /* Now run the service */
        testSizing(object, binary.length);
       
    }
View Full Code Here

       
        /* Create the content: */
        DigitalObjectContent c1 = Content.byReference(file.toURI().toURL());
       
        /* Given these, we can instantiate our object: */
        DigitalObject object = new DigitalObject.Builder(c1).build();

        /* Now run the service */
        testSizing(object, binary.length);
       
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.services.datatypes.DigitalObject$Adapter

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.