Package org.apache.xmpbox
Class XMPMetadata
- java.lang.Object
-
- org.apache.xmpbox.XMPMetadata
-
public class XMPMetadata extends java.lang.ObjectObject 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.- Author:
- a183132
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedXMPMetadata()Constructor of an empty default XMPMetaData.protectedXMPMetadata(java.lang.String xpacketBegin, java.lang.String xpacketId, java.lang.String xpacketBytes, java.lang.String xpacketEncoding)Creates blank XMP doc with specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddSchema(XMPSchema obj)Add a schema to the current structure.voidclearSchemas()Removes all schemas defined.AdobePDFSchemacreateAndAddAdobePDFSchema()Create and add an Adobe PDF schema to this metadata.XMPBasicJobTicketSchemacreateAndAddBasicJobTicketSchema()Create and add a default Basic Job Ticket schema to this metadata.XMPSchemacreateAndAddDefaultSchema(java.lang.String nsPrefix, java.lang.String nsURI)Create and add an unspecified schema.DublinCoreSchemacreateAndAddDublinCoreSchema()Create and add a default Dublin Core schema to this metadata.PDFAExtensionSchemacreateAndAddPDFAExtensionSchemaWithDefaultNS()Create and add a default PDFA Extension schema to this metadata.PDFAExtensionSchemacreateAndAddPDFAExtensionSchemaWithNS(java.util.Map<java.lang.String,java.lang.String> namespaces)Create and add a default PDFA Extension schema to this metadata.PDFAIdentificationSchemacreateAndAddPDFAIdentificationSchema()Create and add a default PDFA Identification schema to this metadata.PDFAIdentificationSchemacreateAndAddPFAIdentificationSchema()Deprecated.PhotoshopSchemacreateAndAddPhotoshopSchema()Create and add Photoshop Schema to this metadata.XMPBasicSchemacreateAndAddXMPBasicSchema()Create and add a XMP Basic schema to this metadata.XMPMediaManagementSchemacreateAndAddXMPMediaManagementSchema()Create and add a XMP Media Management schema to this metadata.XMPRightsManagementSchemacreateAndAddXMPRightsManagementSchema()Create and add a default XMP Rights Management Schema to this metadata.static XMPMetadatacreateXMPMetadata()Creates blank XMP doc with default parameters.static XMPMetadatacreateXMPMetadata(java.lang.String xpacketBegin, java.lang.String xpacketId, java.lang.String xpacketBytes, java.lang.String xpacketEncoding)Creates blank XMP doc with specified parameters.AdobePDFSchemagetAdobePDFSchema()Get the Adobe PDF schema.java.util.List<XMPSchema>getAllSchemas()Get All Schemas declared in this metadata representation.XMPBasicJobTicketSchemagetBasicJobTicketSchema()Get the Basic Job Ticket Schema.DublinCoreSchemagetDublinCoreSchema()Get the Dublin Core schema.java.lang.StringgetEndXPacket()get XPACKET END PI.PDFAExtensionSchemagetPDFExtensionSchema()Get the PDFA Extension schema.PDFAIdentificationSchemagetPDFIdentificationSchema()Get the PDFA Identification schema.PhotoshopSchemagetPhotoshopSchema()Get the Photoshop schema.XMPSchemagetSchema(java.lang.Class<? extends XMPSchema> clz)Get the XMPSchema for the specified Class.XMPSchemagetSchema(java.lang.String nsURI)Get the XMPSchema for the specified namespace.XMPSchemagetSchema(java.lang.String prefix, java.lang.String nsURI)Return the schema corresponding to this nsURI and a prefix.TypeMappinggetTypeMapping()Get TypeMapping.XMPBasicSchemagetXMPBasicSchema()Get the XMP Basic schema.XMPMediaManagementSchemagetXMPMediaManagementSchema()Get the XMP Media Management schema.XMPRightsManagementSchemagetXMPRightsManagementSchema()Get the XMP Rights Management Schema.java.lang.StringgetXpacketBegin()Get xpacket Begin.java.lang.StringgetXpacketBytes()Get xpacketBytes.java.lang.StringgetXpacketEncoding()Get xpacket encoding.java.lang.StringgetXpacketId()Get xpacket Id.voidremoveSchema(XMPSchema schema)Remove a schema.voidsetEndXPacket(java.lang.String data)Set special XPACKET END PI.
-
-
-
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 xpacketBeginxpacketId- Value of xpacketIdxpacketBytes- Value of xpacketBytesxpacketEncoding- 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 xpacketBeginxpacketId- Value of xpacketIdxpacketBytes- Value of xpacketBytesxpacketEncoding- 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 wantednsURI- 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 schemansURI- 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
@Deprecated public PDFAIdentificationSchema createAndAddPFAIdentificationSchema()
Deprecated.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
-
createAndAddPDFAIdentificationSchema
public PDFAIdentificationSchema createAndAddPDFAIdentificationSchema()
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.
-
-