Class XMPMetadata


  • public class XMPMetadata
    extends java.lang.Object
    Object representation of XMPMetaData Be CAREFUL: typically, metadata should contain only one schema for each type (each NSURI). Retrieval of common schemas (like DublinCore) is based on this fact and take the first schema of this type encountered. However, XmpBox allow you to place schemas of same type with different prefix. If you do that, you must retrieve all schemas by yourself with getAllSchemas or with getSchema which use prefix parameter.
    • Field Detail

      • xpacketId

        private java.lang.String xpacketId
      • xpacketBegin

        private java.lang.String xpacketBegin
      • xpacketBytes

        private java.lang.String xpacketBytes
      • xpacketEncoding

        private java.lang.String xpacketEncoding
      • xpacketEndData

        private java.lang.String xpacketEndData
      • schemas

        private java.util.List<XMPSchema> schemas
    • Constructor Detail

      • XMPMetadata

        protected XMPMetadata()
        Constructor of an empty default XMPMetaData.
      • XMPMetadata

        protected XMPMetadata​(java.lang.String xpacketBegin,
                              java.lang.String xpacketId,
                              java.lang.String xpacketBytes,
                              java.lang.String xpacketEncoding)
        Creates blank XMP doc with specified parameters.
        Parameters:
        xpacketBegin - Value of xpacketBegin
        xpacketId - Value of xpacketId
        xpacketBytes - Value of xpacketBytes
        xpacketEncoding - Value of xpacket encoding
    • Method Detail

      • createXMPMetadata

        public static XMPMetadata createXMPMetadata()
        Creates blank XMP doc with default parameters.
        Returns:
        the XMPMetadata created.
      • createXMPMetadata

        public static XMPMetadata createXMPMetadata​(java.lang.String xpacketBegin,
                                                    java.lang.String xpacketId,
                                                    java.lang.String xpacketBytes,
                                                    java.lang.String xpacketEncoding)
        Creates blank XMP doc with specified parameters.
        Parameters:
        xpacketBegin - Value of xpacketBegin
        xpacketId - Value of xpacketId
        xpacketBytes - Value of xpacketBytes
        xpacketEncoding - Value of xpacket encoding
        Returns:
        the XMPMetadata created.
      • getTypeMapping

        public TypeMapping getTypeMapping()
        Get TypeMapping.
        Returns:
        the defined TypeMapping.
      • getXpacketBytes

        public java.lang.String getXpacketBytes()
        Get xpacketBytes.
        Returns:
        value of xpacketBytes field
      • getXpacketEncoding

        public java.lang.String getXpacketEncoding()
        Get xpacket encoding.
        Returns:
        value of xpacket Encoding field
      • getXpacketBegin

        public java.lang.String getXpacketBegin()
        Get xpacket Begin.
        Returns:
        value of xpacket Begin field
      • getXpacketId

        public java.lang.String getXpacketId()
        Get xpacket Id.
        Returns:
        value of xpacket Id field
      • getAllSchemas

        public java.util.List<XMPSchema> getAllSchemas()
        Get All Schemas declared in this metadata representation.
        Returns:
        List of declared schemas
      • setEndXPacket

        public void setEndXPacket​(java.lang.String data)
        Set special XPACKET END PI.
        Parameters:
        data - The XPacket End value
      • getEndXPacket

        public java.lang.String getEndXPacket()
        get XPACKET END PI.
        Returns:
        XPACKET END Value
      • getSchema

        public XMPSchema getSchema​(java.lang.String nsURI)
        Get the XMPSchema for the specified namespace. Return the schema corresponding to this nsURI
        BE CAREFUL: typically, Metadata should contain one schema for each type. This method returns the first schema encountered corresponding to this NSURI.
        Return null if unknown
        Parameters:
        nsURI - The namespace URI corresponding to the schema wanted
        Returns:
        The matching XMP schema representation
      • getSchema

        public XMPSchema getSchema​(java.lang.Class<? extends XMPSchema> clz)
        Get the XMPSchema for the specified Class. Return the schema corresponding to this Class
        BE CAREFUL: typically, Metadata should contain one schema for each type. This method returns the first schema encountered corresponding to this Class.
        Return null if unknown
        Parameters:
        clz - The Class corresponding to the schema wanted
        Returns:
        The matching XMP schema representation
      • getSchema

        public XMPSchema getSchema​(java.lang.String prefix,
                                   java.lang.String nsURI)
        Return the schema corresponding to this nsURI and a prefix. This method is here to treat metadata which embed more than one time the same schema. It permits to retrieve a specific schema with its prefix
        Parameters:
        prefix - The prefix fixed in the schema wanted
        nsURI - The namespace URI corresponding to the schema wanted
        Returns:
        The Class Schema representation
      • createAndAddDefaultSchema

        public XMPSchema createAndAddDefaultSchema​(java.lang.String nsPrefix,
                                                   java.lang.String nsURI)
        Create and add an unspecified schema.
        Parameters:
        nsPrefix - The prefix wanted for the schema
        nsURI - The namespace URI wanted for the schema
        Returns:
        The schema added in order to work on it
      • createAndAddPDFAExtensionSchemaWithDefaultNS

        public PDFAExtensionSchema createAndAddPDFAExtensionSchemaWithDefaultNS()
        Create and add a default PDFA Extension schema to this metadata. This method return the created schema to enter information. This PDFAExtension is created with all default namespaces used in PDFAExtensionSchema.
        Returns:
        PDFAExtension schema added in order to work on it
      • createAndAddPDFAExtensionSchemaWithNS

        public PDFAExtensionSchema createAndAddPDFAExtensionSchemaWithNS​(java.util.Map<java.lang.String,​java.lang.String> namespaces)
                                                                  throws XmpSchemaException
        Create and add a default PDFA Extension schema to this metadata. This method return the created schema to enter information. This PDFAExtension is created with specified list of namespaces.
        Parameters:
        namespaces - Special namespaces list to use
        Returns:
        schema added in order to work on it
        Throws:
        XmpSchemaException - If namespaces list not contains PDF/A Extension namespace URI
      • getPDFExtensionSchema

        public PDFAExtensionSchema getPDFExtensionSchema()
        Get the PDFA Extension schema. This method return null if not found.
        Returns:
        The PDFAExtension schema or null if not declared
      • createAndAddPFAIdentificationSchema

        public PDFAIdentificationSchema createAndAddPFAIdentificationSchema()
        Create and add a default PDFA Identification schema to this metadata. This method return the created schema to enter information.
        Returns:
        schema added in order to work on it
      • getPDFIdentificationSchema

        public PDFAIdentificationSchema getPDFIdentificationSchema()
        Get the PDFA Identification schema. This method return null if not found.
        Returns:
        The PDFAIdentificationSchema schema or null if not declared
      • createAndAddDublinCoreSchema

        public DublinCoreSchema createAndAddDublinCoreSchema()
        Create and add a default Dublin Core schema to this metadata. This method return the created schema to enter information
        Returns:
        schema added in order to work on it
      • getDublinCoreSchema

        public DublinCoreSchema getDublinCoreSchema()
        Get the Dublin Core schema. This method return null if not found
        Returns:
        The DublinCoreSchema schema or null if not declared.
      • createAndAddBasicJobTicketSchema

        public XMPBasicJobTicketSchema createAndAddBasicJobTicketSchema()
        Create and add a default Basic Job Ticket schema to this metadata. This method return the created schema to enter information.
        Returns:
        schema added in order to work on it.
      • getBasicJobTicketSchema

        public XMPBasicJobTicketSchema getBasicJobTicketSchema()
        Get the Basic Job Ticket Schema. This method return null if not found
        Returns:
        The XMPBasicJobTicketSchema schema or null if not declared.
      • createAndAddXMPRightsManagementSchema

        public XMPRightsManagementSchema createAndAddXMPRightsManagementSchema()
        Create and add a default XMP Rights Management Schema to this metadata. This method return the created schema to enter information.
        Returns:
        schema added in order to work on it
      • getXMPRightsManagementSchema

        public XMPRightsManagementSchema getXMPRightsManagementSchema()
        Get the XMP Rights Management Schema. This method return null if not found.
        Returns:
        The XMPRightsManagementSchema schema or null if not declared
      • createAndAddXMPBasicSchema

        public XMPBasicSchema createAndAddXMPBasicSchema()
        Create and add a XMP Basic schema to this metadata. This method return the created schema to enter information
        Returns:
        schema added in order to work on it
      • getXMPBasicSchema

        public XMPBasicSchema getXMPBasicSchema()
        Get the XMP Basic schema. This method return null if not found
        Returns:
        The XMPBasicSchema schema or null if not declared
      • createAndAddXMPMediaManagementSchema

        public XMPMediaManagementSchema createAndAddXMPMediaManagementSchema()
        Create and add a XMP Media Management schema to this metadata. This method return the created schema to enter information
        Returns:
        schema added in order to work on it
      • createAndAddPhotoshopSchema

        public PhotoshopSchema createAndAddPhotoshopSchema()
        Create and add Photoshop Schema to this metadata. This method return the created schema to enter information
        Returns:
        schema added in order to work on it
      • getPhotoshopSchema

        public PhotoshopSchema getPhotoshopSchema()
        Get the Photoshop schema. This method return null if not found
        Returns:
        The PhotoshopSchema schema or null if not declared
      • getXMPMediaManagementSchema

        public XMPMediaManagementSchema getXMPMediaManagementSchema()
        Get the XMP Media Management schema. This method return null if not found
        Returns:
        The XMPMediaManagementSchema schema or null if not declared
      • createAndAddAdobePDFSchema

        public AdobePDFSchema createAndAddAdobePDFSchema()
        Create and add an Adobe PDF schema to this metadata. This method return the created schema to enter information
        Returns:
        schema added in order to work on it
      • getAdobePDFSchema

        public AdobePDFSchema getAdobePDFSchema()
        Get the Adobe PDF schema. This method return null if not found
        Returns:
        The AdobePDFSchema schema or null if not declared
      • addSchema

        public void addSchema​(XMPSchema obj)
        Add a schema to the current structure.
        Parameters:
        obj - the schema to add
      • removeSchema

        public void removeSchema​(XMPSchema schema)
        Remove a schema.
        Parameters:
        schema - The schema to remove
      • clearSchemas

        public void clearSchemas()
        Removes all schemas defined.