Examples of DigitalObjectContent


Examples of eu.planets_project.services.datatypes.DigitalObjectContent

     * @param type
     * @throws MalformedURLException
     */
    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);
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

    try {
      // let's get the digital object
      DigitalObject digitalObj = this.getDigitalObjectManager(pdURI).retrieve(pdURI.normalize());
     
      // And a content object that's by Refernce
      DigitalObjectContent content = DataRegistryImpl.getObjectContentByRef(pdURI);

      // Buld the new DO, using the reference content
      log.info("The permanent URI of this object will be " + digitalObj.getPermanentUri());
      finalObj = new DigitalObject.Builder(content)
          .title(digitalObj.getTitle())
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

  }

  // Part of the TB hack
  private static DigitalObjectContent getObjectContentByRef(URI uri)
    throws MalformedURLException {
    DigitalObjectContent content = null;
    URI resolverURI = URI.create(TBContentResolver.getResolverPath() + uri).normalize();
    content = Content.byReference(resolverURI.toURL());
    return content;
  }
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

    DigitalObject retObjectWithoutContent =
      dom.retrieve(resContentByValueObject.getPermanentUri(), false);

    // this is a content resolver link
    System.out.println("Creating resolver link");
    DigitalObjectContent resolverLink = Content.byReference(
        URI.create((DOJCRManager.getResolverPath() + resContentByValueObject.getPermanentUri()))
        .toURL());

    // the content of the resContentByValueObject after store method should be
    // a content resolver link
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

  throws MalformedURLException, DigitalObjectNotStoredException,
  URISyntaxException, DigitalObjectNotFoundException,
  ItemNotFoundException, RepositoryException {

    URI purl = new File(TEST_CONTENT).toURI();
    DigitalObjectContent cRef = Content.byReference(purl.toURL());
    DigitalObject contentByRefObject = new DigitalObject.Builder(cRef).build();

    // store object with content
    DigitalObject resContentByRefObject =
      dom.store(PERMANENT_URI_PATH, contentByRefObject, true);   
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

    // store and retrieve content
    DigitalObject resDo = dom.store(PERMANENT_URI_PATH, object, true);

    // this is a content resolver link
    DigitalObjectContent resolverLink = Content.byReference(
        URI.create((DOJCRManager.getResolverPath() + resDo.getPermanentUri()))
        .toURL());

    // the content of the resContentByValueObject after store method should be
    // a content resolver link
    assertEquals(resDo.getContent(), resolverLink);

    // this is a digital object we expect after store method.
    // we have to add the permanent URI and content after store method to
    // check for equality
    DigitalObject expectedStoreDigitalObject = new DigitalObject.Builder(object)
            .content(resolverLink).permanentUri(resDo.getPermanentUri()).build();

    // check if resDo has an ingest event
    assertTrue(DigitalObjectUtils.hasEvent(resDo, JcrDigitalObjectManagerImpl.INGEST_EVENT));
    // add an ingest event from resDo to the expectedStoreDigitalObject
    Event ingestEvent = DigitalObjectUtils.getEventBySummary(
        resDo, JcrDigitalObjectManagerImpl.INGEST_EVENT);   
    expectedStoreDigitalObject = DigitalObjectUtils.addEvent(expectedStoreDigitalObject, ingestEvent);

    // except content and permanent URI resDo and expectedStoreDigitalObject
    // should be equal
    assertEquals(resDo, expectedStoreDigitalObject);

    DigitalObject retObject =
      dom.retrieve(resDo.getPermanentUri(), true);

    // this is a digital object we expect after retrieve method with includeContent = true.
    // we need an injection of the generated permanent URI in object to
    // correctly process assertEquals method.
    DigitalObject expectedRetrieveTrueDigitalObject =
      new DigitalObject.Builder(object).permanentUri(resDo.getPermanentUri()).build();

    // contents of retObjectWithContent and expectedRetrieveTrueDigitalObject should be equal
    // after retrieve method called with includeContent = true
    assertEquals(retObject.getContent(), expectedRetrieveTrueDigitalObject.getContent());
    // the content of the retObjectWithContent after retrieve method with includeContent = true
    // should be a content stored in JCR
    assertEquals(retObject.getContent(), c1);

    // add an ingest event from resContentByValueObject to the expectedRetrieveTrueDigitalObject
    expectedRetrieveTrueDigitalObject =
      DigitalObjectUtils.addEvent(expectedRetrieveTrueDigitalObject, ingestEvent);

    // except permanent URI retObjectWithContent and expectedRetrieveTrueDigitalObject
    // should be equal   
    assertEquals(retObject, expectedRetrieveTrueDigitalObject)

    DigitalObjectContent c2 = dom.retrieveContent(resDo.getPermanentUri());
    assertTrue(c2.length()>0);   
    assertEquals(c1, c2)

    InputStream contentStream=dom.retrieveContentAsStream(resDo.getPermanentUri());   
    try {
      assertNotNull(contentStream);
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

      object = new DigitalObject.Builder(object).title("mytitle_" + i).build();
      // store digital object in JCR repository
      DigitalObject resDigitalObject = dom.store(PERMANENT_URI_PATH, object, true);

      // this is a content resolver link
      DigitalObjectContent resolverLink = Content.byReference(
          URI.create((DOJCRManager.getResolverPath() + resDigitalObject.getPermanentUri()))
          .toURL());

      // the content of the resContentByValueObject after store method should be
      // a content resolver link
      assertEquals(resDigitalObject.getContent(), resolverLink);

      digitalObjectList.add(resDigitalObject);
    }

    for (int i = 0; i < MAX_COUNT; i++)
    {
      //  retrieve digital object from JCR repository
      DigitalObject retObject = dom.retrieve(digitalObjectList.get(i).getPermanentUri(), true);

      // the content of the retObject object after retrieve method should be
      // an initial content c1
      assertEquals(retObject.getContent(), c1);

      // this is a content resolver link
      DigitalObjectContent resolverLink = Content.byReference(
          URI.create((DOJCRManager.getResolverPath() + retObject.getPermanentUri()))
          .toURL());

      // the content of the digitalObjectList object should be
      // a content resolver link
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

      try {
        File testFile = new File(file.getLocation());
        URI purl = testFile.toURI();
        String name = testFile.getName();
        System.out.println("PURL is " + file.getLocation());
        DigitalObjectContent content = Content.byReference(purl.toURL().openStream());
        System.out.println("created content " + content);
        DigitalObject object =
          new DigitalObject.Builder(content).permanentUri(purl).title(purl.toString()).build();
        System.out.println("created object " + object);
        URI theLoc = null;
        if (uri != null)
          theLoc = DataRegistryTests.dataReg.storeAsNew(new URI(uri.toString() + "/" + name), object);
        else
          theLoc = DataRegistryTests.dataReg.storeAsNew(object);
        System.out.println("got theLoc = " + theLoc);
        DigitalObjectContent expectCont = Content.byReference(purl.toURL().openStream());
        DigitalObject expectObj =
          new DigitalObject.Builder(expectCont).build();
        DigitalObject retObject = dom.retrieve(theLoc);
              assertEquals("Retrieve Digital Object content doesn't match that stored",
                     expectObj.getContent(),
View Full Code Here

Examples of eu.planets_project.services.datatypes.DigitalObjectContent

                            try {
                                byteContent = IOUtils.toByteArray(streamContent);
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
              DigitalObjectContent content = Content.byValue(byteContent);
              o = (new DigitalObject.Builder(o)).content(content)
                  .title(dor.getLeafname()).permanentUri(
                      dobURI).build();
            }
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.