Examples of DigitalObjectContent


Examples of eu.planets_project.services.datatypes.DigitalObjectContent

    // OK we can create an Digital Object from the test resource data, we need a URL
    System.out.println("Testing storage of Digital Object");
    URI purl = new File(AllStorageSuite.TEST_DATA_BASE, FILE).toURI();
        /* Create the content: */
    System.out.println("Creating DigitalObjectContent c1");
        DigitalObjectContent c1 = Content.byReference(purl.toURL().openStream());
    System.out.println("Creating DigitalObject object");
        /* Given these, we can instantiate our object: */
        DigitalObject object = new DigitalObject.Builder(c1).permanentUri(purl).title(purl.toString()).build();
      // Check digital object. Title should not be null
    System.out.println("Setting store flag to true");
        boolean storeFlag = true;
        // Now store it
        URI pdURI = null;
        try {
        System.out.println("calling this.dom.storeAsNew(object)");
            pdURI = DigitalObjectManagerTests.dom.storeAsNew(object);
            System.out.println("StoreAsNew returned the URI:" + pdURI);
        } catch (Exception e) {
        System.out.println("Caught an exception in storeAsNew, here's the details");
          e.printStackTrace();
        System.out.println("Asserting it's a not stored exception");
          assertTrue("Expecting exception to be DigitalObjectNotStoredException", e.getClass().equals(DigitalObjectNotStoredException.class));
        System.out.println("Setting storeFlag to false");
          storeFlag = false;
        } catch (Throwable t) {
        System.out.println("Caught a throwable in storeAsNew, here's the details");
          t.printStackTrace();
        System.out.println("Setting storeFlag to false");
          storeFlag = false;
        }
       
    System.out.println("Creating new version of object");
        object = new DigitalObject.Builder(object.getContent()).title("mytitle").build();
    System.out.println("asserting the title is not null");
        assertNotNull("NOT expecting object.getTitle() to be null", object.getTitle());
       
        if (storeFlag)
        {
          DigitalObject retObject = null;
      // Then retrieve it and check it's the same
        System.out.println("now retrieving object to test (ret object)");
      System.out.println("Retrieving the test object using URI:" + pdURI);
      try {
        retObject = DigitalObjectManagerTests.dom.retrieve(pdURI);
      } catch (DigitalObjectNotFoundException e) {
        e.printStackTrace();
        throw e;
      } catch (Exception e) {
        System.out.println("Caught unexpected exception calling retrieve()");
        e.printStackTrace();
        fail("this.dom.retrive failed with an unexpected exception");
      }
      System.out.println("Creating new Purl");
      URI newPurl = new File(AllStorageSuite.TEST_DATA_BASE, FILE).toURI();
      System.out.println("Creating digital object c2");
      DigitalObjectContent c2 = Content.byReference(newPurl.toURL().openStream());
      System.out.println("Creating new Expected object");
      DigitalObject expectedObject = new DigitalObject.Builder(c2).build();
     
      // Check that retObject is not null
      assertNotNull("Not expecting returned object to be null", retObject);
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

        }
        out.close();
       
        //3. build the digo by reference
        URI httpRef = this.getHttpFileRef(fOut);
        DigitalObjectContent content = Content.byReference(httpRef.toURL());
        DigitalObject ret = new DigitalObject.Builder(digo).content(content).permanentUri(digo.getPermanentUri()).build();
        return ret;
    }
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

     * @throws MalformedURLException
     */
    private void testCompareThis( File purl1, File purl2, boolean same ) throws MalformedURLException {
        System.out.println("Comparing "+purl1.getName()+" against "+purl2.getName());
        // Construct digital objects
        DigitalObjectContent c1 = Content.byReference(purl1.toURL());
        DigitalObject o1 = new DigitalObject.Builder(c1).permanentUri(purl1.toURI()).build();
       
        DigitalObjectContent c2 = Content.byReference(purl2.toURL());
        DigitalObject o2 = new DigitalObject.Builder(c2).permanentUri(purl2.toURI()).build();
       
        /* Now pass this to the service */
        CompareResult ir = ids.compare( o1, o2, null);
       
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

    }
        try {
            // Look for the file:
            URL binUrl = f.toURI().toURL();
           
            DigitalObjectContent c = Content.byReference(binUrl);
           
            // Build a bare DOB:
            DigitalObject.Builder dob = new DigitalObject.Builder(c);
           
            // Attempt to patch in metadata:
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

          if( ! binFile.exists() ) {
            log.info("binFile doesn't exist, throwing Not Found exception");
            log.info("looking for file:" + binFile.getAbsolutePath());
              throw new DigitalObjectNotFoundException("The DigitalObject was not found!");
          }
          DigitalObjectContent c = Content.byReference( binFile );
           
            // Look for the XML:
      PDURI parsedURI = new PDURI(pdURI);
      parsedURI.replaceDecodedPath(parsedURI.getDataRegistryPath() + FilesystemDigitalObjectManagerImpl.DO_EXTENSION);
      String fullPath = this._root.getCanonicalPath() + File.separator + parsedURI.getDataRegistryPath();
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

     
      // Now write the Digital Object metadata to the file
      // First we need to update the purl and the content object reference
      URI purl = doBinary.toURI();
          /* Create the content: */
          DigitalObjectContent c1 = Content.byReference(purl.toURL());
          /* Given these, we can instantiate our object: */
          DigitalObject object = new DigitalObject.Builder(digitalObject).permanentUri(pdURI).content(c1).build();
      OutputStream outStream = new FileOutputStream(doMetadata);
      outStream.write(object.toXml().getBytes());
      outStream.close();
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

        // URI migrateFromURI = new URI(migrateFrom);

        InputStream streamContent = digO.getContent().getInputStream();
        byte[] byteContent = FileUtils.writeInputStreamToBinary(streamContent);
        //ImmutableContent content = new ImmutableContent(byteContent);
        DigitalObjectContent content = Content.byValue(byteContent);
        digO = (new DigitalObject.Builder(digO)).content(content).build();

        URI migrateToURI = this.getServiceCallConfigs(this.migrate).getPropertyAsURI(SER_PARAM_MIGRATE_TO);
       
        // Create service parameter list
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

     * @throws MalformedURLException
     */
    public DigitalObjectContent evaluateContentByReference(String permanentUri)
          throws MalformedURLException
    {
       DigitalObjectContent resultContent = null;
     
        _log.log(Level.INFO, "Create DO with content by reference");             
     URI contentResolverUri = URI.create(getResolverPath() + permanentUri);
     resultContent = Content.byReference(contentResolverUri.toURL());

View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

     */
    public DigitalObjectContent evaluateContent(Node node, boolean includeContent, String permanentUri)
       throws ItemNotFoundException, RepositoryException, DigitalObjectNotFoundException,
              MalformedURLException, DigitalObjectTooLargeException
    {
       DigitalObjectContent resultContent = null;
    
      if (includeContent)
     {
          _log.log(Level.INFO, "evaluateContent() retrieve content.");
          dumpNode(node);
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

        String _manifestationOf = getStrProperty(node, DOJCRConstants.DOJCR_MANIFESTATION_OF);
         List<Metadata> metadataResList = retrieveMetadataList(node);
         Metadata[] metaList = (Metadata[]) metadataResList.toArray(new Metadata[0])
         List<Event> eventResList = retrieveEventList(node);
         Event[] eventList = (Event[]) eventResList.toArray(new Event[0]);     
         DigitalObjectContent content = evaluateContent(node, includeContent, _permanentUri);
 
         if (newObject.getTitle() != null)
             if (!newObject.getTitle().equals(_title))
                storeStringValue( node
                            , newObject.getTitle()
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.