Package eu.planets_project.services.datatypes

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


    try {
      URI drManagerID = DataRegistryFactory.createDataRegistryIdFromName("/experiment-files/testbed/users/"+userName).normalize();
      URI storageURI =new URI(drManagerID.getScheme(),drManagerID.getAuthority(),drManagerID.getPath()+"/config/userproperties.xml",null,null).normalize();
     
      //retrieve the user specific properties xml file from his storage space
      DigitalObject digoUserProps = dataRegistry.getDigitalObjectManager(drManagerID).retrieve(storageURI);
   
      //parse the XML and extract the Properties
      DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = dbfactory.newDocumentBuilder();
      java.io.InputStream userDefinedPropsXML = digoUserProps.getContent().getInputStream();
      Document doc = builder.parse(userDefinedPropsXML);
      Element root = doc.getDocumentElement();
     
      //read the properties from the xml-file
      ret = parseManualPropertiesXML(root,true);
View Full Code Here


   
   
    private XcdlDescription extract(String fullname, byte[] data) {
       

        DigitalObject dIn = new DigitalObject.Builder( Content.byValue(data) ).title(fullname).build();
       
        CoreExtractor extractor = new CoreExtractor("PlatoXcdlExtractor");
       
       
        File xcdlFile = extractor.extractXCDL(dIn, null, null, null);
View Full Code Here

    URI storageURI =new URI(drManagerID.getScheme(),drManagerID.getAuthority(),drManagerID.getPath()+"/config/userproperties.xml",null,null).normalize();
   
    //Create temp file.
    File temp = File.createTempFile("userproperties", ".xml");
    //create and store the digital object
    DigitalObject userpropertiesXML = new DigitalObject.Builder(Content.byValue(temp)).title("userproperties").build();
    URI uriStored = dataRegistry.getDigitalObjectManager(drManagerID).storeAsNew(storageURI,userpropertiesXML);
    temp.delete();
    log.info("created storage space for user defined manual properties");
    return uriStored;
  }
View Full Code Here

    }
    writer.write("</userDefinedProperties>");
    writer.close();
   
    //build a digital object
    DigitalObject digoManualProps = new DigitalObject.Builder(Content.byValue(temp)).title("userproperties").build();
    //call update on the digital object manager
    dataRegistry.getDigitalObjectManager(drManagerID).updateExisting(storageURI, digoManualProps);
    temp.delete();
    log.info("updated storage space for user defined manual properties");
  }
View Full Code Here

  private WorkflowResult fetchWFResultFromDR(String job_key) throws Exception{
    //2. get the data registry manager and fetch the digital object containing the wfResult
    URI drManagerID = DataRegistryFactory.createDataRegistryIdFromName("/experiment-files/executions/").normalize();
    DigitalObjectManager drExpResults = DataRegistryFactory.getDataRegistry().getDigitalObjectManager(drManagerID);
    URI wfResultstorageURI =new URI(drManagerID.getScheme(),drManagerID.getAuthority(),drManagerID.getPath()+"/"+job_key+"/wfResult-id-"+job_key+".xml",null,null).normalize();
    DigitalObject doWFResult = drExpResults.retrieve(wfResultstorageURI);
    if(doWFResult.getContent()==null){
      throw new Exception("No workflow xml content available.");
    }
    //3. now read the stream into a String and unmarshall the WorkflwoResult object         
        StringBuilder sb = new StringBuilder();
        String line;

        InputStream fis = doWFResult.getContent().getInputStream();
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                fis , "UTF-8"));
           
            while ((line = reader.readLine()) != null) {
View Full Code Here

    public void migrateTo( String newExt ) throws IOException {
        /*
         * 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(
                        AllJavaSEServiceTestsuite.TEST_FILE_LOCATION+"PlanetsLogo.png")
                .toURI().toURL())).build();
        System.out.println("Input: " + input);

        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);

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

        File out = new File("src/test/results/test."+newExt);

        FileOutputStream fo = new FileOutputStream(out);
        IOUtils.copyLarge( doOut.getContent().getInputStream(), fo);
        fo.close();

        System.out.println("Recieved service report: " + mr.getReport() );
        System.out.println("Recieved service properties: " );
        ServiceProperties.printProperties(System.out, mr.getReport().getProperties());
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

        // Got a URI, is it owned?
        if( this.dataReg.hasDigitalObjectManager(domUri)) {
            try {
              //get the digital object with it's original content
              this.log.info("Retrieving Digital Object at " + domUri);
                DigitalObject digitalObject = this.dataReg.retrieve(domUri);
                // FIXME This is a duplicate of some PDURI logic, but there are two PDURI classes, oddly!
                String leafname = domUri.getPath();
                // Strip any trailing slash:
                if( leafname.endsWith("/") ) {
                    leafname = leafname.substring(0, leafname.length()-1);
View Full Code Here

      //use the flag to indicate that we want to return a digital object content by reference (link to contentResolver)
        // DataRegistry digoManager = new DataRegistryImpl();
        try {
          URI uriRef = new URI(fileRef);
          this.log.info("Retrieving Digital Object at " + uriRef);
        DigitalObject refByValueDigo =
          DataRegistryFactory.retrieveAsTbReference(dataReg, new URI(fileRef));
        ret.add(refByValueDigo);
        } catch (DigitalObjectNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
View Full Code Here

     
      DigitalObjectRefBean digoRef = dh.get(id);
      if(digoRef==null) throw new DigitalObjectNotFoundException("digital object "+id+" not found");
     
      // set the metadata if it's contained within the digital object
      DigitalObject object = digoRef.getDigitalObject();
      for(Metadata md : object.getMetadata()) {
        if(md.getName().equals(MIME_TYPE_METADATA_NAME))
          response.setContentType(md.getContent());
      }
     
      is = digoRef.getContentAsStream();
View Full Code Here

TOP

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

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.