Package org.apache.padaf.xmpbox

Examples of org.apache.padaf.xmpbox.XMPMetadata


  protected XMPMetadata metadata;

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();
  }
View Full Code Here


    super(property, type, value);
  }

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();
    schema = metadata.createAndAddXMPRightsManagementSchema();
    schemaClass = XMPRightsManagementSchema.class;
  }
View Full Code Here

@RunWith(Parameterized.class)
public class PDFAIdentificationTest extends AbstractXMPSchemaTest {

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();
    schema = metadata.createAndAddPFAIdentificationSchema();
    schemaClass = PDFAIdentificationSchema.class;
  }
View Full Code Here

  protected XMPMetadata metadata;

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();

  }
View Full Code Here

    super(prop, type, val);
  }

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();
    schema = metadata.createAndAddXMPBasicSchema();
    schemaClass = XMPBasicSchema.class;
  }
View Full Code Here

@RunWith(Parameterized.class)
public class DublinCoreTest extends AbstractXMPSchemaTest {

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();
    schema = metadata.createAndAddDublinCoreSchema();
    schemaClass = DublinCoreSchema.class;
  }
View Full Code Here

@RunWith(Parameterized.class)
public class XMPMediaManagementTest extends AbstractXMPSchemaTest {

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();
    schema = metadata.createAndAddXMPMediaManagementSchema();
    schemaClass = XMPMediaManagementSchema.class;
  }
View Full Code Here

  protected XMPMetadata parent;

  @Before
  public void resetDocument() throws Exception {
    parent = new XMPMetadata();
  }
View Full Code Here

      reader.set(factory.createXMLStreamReader(is));

      // expect xpacket processing instruction
      expectNext(XMLStreamReader.PROCESSING_INSTRUCTION,
          "Did not find initial xpacket processing instruction");
      XMPMetadata metadata = parseInitialXpacket(reader.get().getPIData());

      // expect x:xmpmeta
      expectNextTag(XMLStreamReader.START_ELEMENT,
          "Did not find initial x:xmpmeta");
      expectName("adobe:ns:meta/", "xmpmeta");

      // expect rdf:RDF
      expectNextTag(XMLStreamReader.START_ELEMENT,
          "Did not find initial rdf:RDF");
      expectName("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "RDF");

      nsMap.resetComplexBasicTypesDeclarationInEntireXMPLevel();
      // add all namespaces which could declare nsURI of a basicValueType
      // all others declarations are ignored
      int nsCount = reader.get().getNamespaceCount();
      for (int i = 0; i < nsCount; i++) {
        if (nsMap.isComplexBasicTypes(reader.get().getNamespaceURI(i))) {
          nsMap.setComplexBasicTypesDeclarationForLevelXMP(
              reader.get().getNamespaceURI(i),
              reader.get().getNamespacePrefix(i));
        }
      }

      // now work on each rdf:Description
      int type = reader.get().nextTag();
      while (type == XMLStreamReader.START_ELEMENT) {
        parseDescription(metadata);
        type = reader.get().nextTag();
      }

      // all description are finished
      // expect end of rdf:RDF
      expectType(XMLStreamReader.END_ELEMENT,
          "Expected end of descriptions");
      expectName("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "RDF");

      // expect ending xmpmeta
      expectNextTag(XMLStreamReader.END_ELEMENT,
          "Did not find initial x:xmpmeta");
      expectName("adobe:ns:meta/", "xmpmeta");

      // expect final processing instruction
      expectNext(XMLStreamReader.PROCESSING_INSTRUCTION,
          "Did not find final xpacket processing instruction");
      // treats xpacket end
      if (!reader.get().getPITarget().equals("xpacket")) {
        throw new XmpXpacketEndException("Excepted PI xpacket");
      }
      String xpackData = reader.get().getPIData();
      // end attribute must be present and placed in first
      // xmp spec says Other unrecognized attributes can follow, but
      // should be ignored
      if (xpackData.startsWith("end=")) {
        // check value (5 for end='X')
        if (xpackData.charAt(5)!='r' && xpackData.charAt(5)!='w') {
          throw new XmpXpacketEndException(
              "Excepted xpacket 'end' attribute with value 'r' or 'w' ");
        }
      } else {
        // should find end='r/w'
        throw new XmpXpacketEndException(
            "Excepted xpacket 'end' attribute (must be present and placed in first)");
      }

      metadata.setEndXPacket(xpackData);
      // return constructed object
      return metadata;
    } catch (XMLStreamException e) {
      throw new XmpParsingException("An error has occured when processing the underlying XMP source", e);
    } finally {
View Full Code Here

      } else {
        throw new XmpInitialXPacketParsingException(
            "Unknown attribute in xpacket PI : '" + token + "'");
      }
    }
    return new XMPMetadata(begin, id, bytes, encoding);
  }
View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.XMPMetadata

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.