Package org.apache.xmpbox
Class XMPMetadata
java.lang.Object
org.apache.xmpbox.XMPMetadata
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor of an empty default XMPMetaData.protected
XMPMetadata
(String xpacketBegin, String xpacketId, String xpacketBytes, String xpacketEncoding) Creates blank XMP doc with specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a schema to the current structure.void
Removes all schemas defined.Create and add an Adobe PDF schema to this metadata.Create and add a default Basic Job Ticket schema to this metadata.createAndAddDefaultSchema
(String nsPrefix, String nsURI) Create and add an unspecified schema.Create and add a default Dublin Core schema to this metadata.Create and add a default PDFA Extension schema to this metadata.createAndAddPDFAExtensionSchemaWithNS
(Map<String, String> namespaces) Create and add a default PDFA Extension schema to this metadata.Create and add a default PDFA Identification schema to this metadata.Create and add Photoshop Schema to this metadata.Create and add a XMP Basic schema to this metadata.Create and add a XMP Media Management schema to this metadata.Create and add a default XMP Rights Management Schema to this metadata.static XMPMetadata
Creates blank XMP doc with default parameters.static XMPMetadata
createXMPMetadata
(String xpacketBegin, String xpacketId, String xpacketBytes, String xpacketEncoding) Creates blank XMP doc with specified parameters.Get the Adobe PDF schema.Get All Schemas declared in this metadata representation.Get the Basic Job Ticket Schema.Get the Dublin Core schema.get XPACKET END PI.Get the PDFA Extension schema.Get the PDFA Identification schema.Get the Photoshop schema.Get the XMPSchema for the specified Class.Get the XMPSchema for the specified namespace.Return the schema corresponding to this nsURI and a prefix.Get TypeMapping.Get the XMP Basic schema.Get the XMP Media Management schema.Get the XMP Rights Management Schema.Get xpacket Begin.Get xpacketBytes.Get xpacket encoding.Get xpacket Id.void
removeSchema
(XMPSchema schema) Remove a schema.void
setEndXPacket
(String data) Set special XPACKET END PI.
-
Field Details
-
xpacketId
-
xpacketBegin
-
xpacketBytes
-
xpacketEncoding
-
xpacketEndData
-
schemas
-
typeMapping
-
-
Constructor Details
-
XMPMetadata
protected XMPMetadata()Constructor of an empty default XMPMetaData. -
XMPMetadata
protected XMPMetadata(String xpacketBegin, String xpacketId, String xpacketBytes, String xpacketEncoding) Creates blank XMP doc with specified parameters.- Parameters:
xpacketBegin
- Value of xpacketBeginxpacketId
- Value of xpacketIdxpacketBytes
- Value of xpacketBytesxpacketEncoding
- Value of xpacket encoding
-
-
Method Details
-
createXMPMetadata
Creates blank XMP doc with default parameters.- Returns:
- the XMPMetadata created.
-
createXMPMetadata
public static XMPMetadata createXMPMetadata(String xpacketBegin, String xpacketId, String xpacketBytes, String xpacketEncoding) Creates blank XMP doc with specified parameters.- Parameters:
xpacketBegin
- Value of xpacketBeginxpacketId
- Value of xpacketIdxpacketBytes
- Value of xpacketBytesxpacketEncoding
- Value of xpacket encoding- Returns:
- the XMPMetadata created.
-
getTypeMapping
Get TypeMapping.- Returns:
- the defined TypeMapping.
-
getXpacketBytes
Get xpacketBytes.- Returns:
- value of xpacketBytes field
-
getXpacketEncoding
Get xpacket encoding.- Returns:
- value of xpacket Encoding field
-
getXpacketBegin
Get xpacket Begin.- Returns:
- value of xpacket Begin field
-
getXpacketId
Get xpacket Id.- Returns:
- value of xpacket Id field
-
getAllSchemas
Get All Schemas declared in this metadata representation.- Returns:
- List of declared schemas
-
setEndXPacket
Set special XPACKET END PI.- Parameters:
data
- The XPacket End value
-
getEndXPacket
get XPACKET END PI.- Returns:
- XPACKET END Value
-
getSchema
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
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
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 wantednsURI
- The namespace URI corresponding to the schema wanted- Returns:
- The Class Schema representation
-
createAndAddDefaultSchema
Create and add an unspecified schema.- Parameters:
nsPrefix
- The prefix wanted for the schemansURI
- The namespace URI wanted for the schema- Returns:
- The schema added in order to work on it
-
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(Map<String, String> namespaces) throws XmpSchemaExceptionCreate 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
Get the PDFA Extension schema. This method return null if not found.- Returns:
- The PDFAExtension schema or null if not declared
-
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
Get the PDFA Identification schema. This method return null if not found.- Returns:
- The PDFAIdentificationSchema schema or null if not declared
-
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
Get the Dublin Core schema. This method return null if not found- Returns:
- The DublinCoreSchema schema or null if not declared.
-
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
Get the Basic Job Ticket Schema. This method return null if not found- Returns:
- The XMPBasicJobTicketSchema schema or null if not declared.
-
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
Get the XMP Rights Management Schema. This method return null if not found.- Returns:
- The XMPRightsManagementSchema schema or null if not declared
-
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
Get the XMP Basic schema. This method return null if not found- Returns:
- The XMPBasicSchema schema or null if not declared
-
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
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
Get the Photoshop schema. This method return null if not found- Returns:
- The PhotoshopSchema schema or null if not declared
-
getXMPMediaManagementSchema
Get the XMP Media Management schema. This method return null if not found- Returns:
- The XMPMediaManagementSchema schema or null if not declared
-
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
Get the Adobe PDF schema. This method return null if not found- Returns:
- The AdobePDFSchema schema or null if not declared
-
addSchema
Add a schema to the current structure.- Parameters:
obj
- the schema to add
-
removeSchema
Remove a schema.- Parameters:
schema
- The schema to remove
-
clearSchemas
public void clearSchemas()Removes all schemas defined.
-