|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jempbox.xmp.XMPMetadata
public class XMPMetadata
This class represents the top level XMP data structure and gives access to the various schemas that are available as part of the XMP specification.
| Field Summary | |
|---|---|
protected String |
encoding
The encoding of the XMP document. |
static String |
ENCODING_UTF16BE
Supported encoding for persisted XML. |
static String |
ENCODING_UTF16LE
Supported encoding for persisted XML. |
static String |
ENCODING_UTF8
Supported encoding for persisted XML. |
protected Map<String,Class<?>> |
nsMappings
A mapping of namespaces. |
protected Document |
xmpDocument
The DOM representation of the metadata. |
| Constructor Summary | |
|---|---|
XMPMetadata()
Default constructor, creates blank XMP doc. |
|
XMPMetadata(Document doc)
Constructor from an existing XML document. |
|
| Method Summary | |
|---|---|
XMPSchemaBasicJobTicket |
addBasicJobTicketSchema()
Add a new Job Ticket schema. |
XMPSchemaBasic |
addBasicSchema()
Create and add a new Basic Schema to this metadata. |
XMPSchemaDublinCore |
addDublinCoreSchema()
Create and add a new Dublin Core Schema to this metadata. |
XMPSchemaDynamicMedia |
addDynamicMediaSchema()
Add a new Dynamic Media schema. |
XMPSchemaIptc4xmpCore |
addIptc4xmpCoreSchema()
Create and add a new IPTC schema to this metadata. |
XMPSchemaMediaManagement |
addMediaManagementSchema()
Add a new Media Management schema. |
XMPSchemaPagedText |
addPagedTextSchema()
Add a new Paged Text schema. |
XMPSchemaPDF |
addPDFSchema()
Create and add a new PDF Schema to this metadata. |
XMPSchemaPhotoshop |
addPhotoshopSchema()
Create and add a new Photoshop schema to this metadata. |
XMPSchemaRightsManagement |
addRightsManagementSchema()
Add a new Rights Managment schema. |
void |
addSchema(XMPSchema schema)
Add a custom schema to the root rdf. |
void |
addXMLNSMapping(String namespace,
Class<?> xmpSchema)
Will add a XMPSchema to the set of identified schemas. |
byte[] |
asByteArray()
Get the XML document as a byte array. |
protected XMPSchema |
basicAddSchema(XMPSchema schema)
Generic add schema method. |
XMPSchemaBasicJobTicket |
getBasicJobTicketSchema()
Get the Job Ticket Schema. |
XMPSchemaBasic |
getBasicSchema()
Get the Basic Schema. |
XMPSchemaDublinCore |
getDublinCoreSchema()
Get the Dublin Core Schema. |
XMPSchemaDynamicMedia |
getDynamicMediaSchema()
Get the Dynamic Media Schema. |
String |
getEncoding()
Get the current encoding that will be used to write the XML. |
XMPSchemaMediaManagement |
getMediaManagementSchema()
Get the Media Management Schema. |
XMPSchemaPagedText |
getPagedTextSchema()
Get the Paged Text Schema. |
XMPSchemaPDF |
getPDFSchema()
Get the PDF Schema. |
XMPSchemaRightsManagement |
getRightsManagementSchema()
Get the Schema Rights Schema. |
XMPSchema |
getSchemaByClass(Class<?> targetSchema)
Tries to retrieve a schema from this by classname. |
List<XMPSchema> |
getSchemas()
This will get a list of XMPSchema(or subclass) objects. |
List<XMPSchema> |
getSchemasByNamespaceURI(String namespaceURI)
Will return all schemas that fit the given namespaceURI. |
Document |
getXMPDocument()
Get the XML document from this object. |
boolean |
hasUnknownSchema()
This will return true if the XMP contains an unknown schema. |
static XMPMetadata |
load(InputSource is)
Load a schema from an input source. |
static XMPMetadata |
load(InputStream is)
Load metadata from the filesystem. |
static XMPMetadata |
load(String file)
Load metadata from the filesystem. |
static void |
main(String[] args)
Test main program. |
void |
merge(XMPMetadata metadata)
Merge this metadata with the given metadata object. |
void |
save(OutputStream outStream)
Save the XMP document to a stream. |
void |
save(String file)
Save the XMP document to a file. |
void |
setEncoding(String xmlEncoding)
The encoding used to write the XML. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ENCODING_UTF8
public static final String ENCODING_UTF16BE
public static final String ENCODING_UTF16LE
protected Document xmpDocument
protected String encoding
protected Map<String,Class<?>> nsMappings
| Constructor Detail |
|---|
public XMPMetadata()
throws IOException
IOException - If there is an error creating the initial document.public XMPMetadata(Document doc)
doc - The root XMP document.| Method Detail |
|---|
public void addXMLNSMapping(String namespace,
Class<?> xmpSchema)
namespace - The namespace URI of the schmema for instance
http://purl.org/dc/elements/1.1/.xmpSchema - The schema to associated this identifier with.
public XMPSchemaPDF getPDFSchema()
throws IOException
IOException - If there is an error accessing the schema.
public XMPSchemaBasic getBasicSchema()
throws IOException
IOException - If there is an error accessing the schema.
public XMPSchemaDublinCore getDublinCoreSchema()
throws IOException
IOException - If there is an error accessing the schema.
public XMPSchemaMediaManagement getMediaManagementSchema()
throws IOException
IOException - If there is an error accessing the schema.
public XMPSchemaRightsManagement getRightsManagementSchema()
throws IOException
IOException - If there is an error accessing the schema.
public XMPSchemaBasicJobTicket getBasicJobTicketSchema()
throws IOException
IOException - If there is an error accessing the schema.
public XMPSchemaDynamicMedia getDynamicMediaSchema()
throws IOException
IOException - If there is an error accessing the schema.
public XMPSchemaPagedText getPagedTextSchema()
throws IOException
IOException - If there is an error accessing the schema.public XMPSchemaMediaManagement addMediaManagementSchema()
public XMPSchemaRightsManagement addRightsManagementSchema()
public XMPSchemaBasicJobTicket addBasicJobTicketSchema()
public XMPSchemaDynamicMedia addDynamicMediaSchema()
public XMPSchemaPagedText addPagedTextSchema()
public void addSchema(XMPSchema schema)
schema - The schema to add.
public void save(String file)
throws Exception
file - The file to save the XMP document to.
Exception - If there is an error while writing to the stream.
public void save(OutputStream outStream)
throws TransformerException
outStream - The stream to save the XMP document to.
TransformerException - If there is an error while writing to the stream.
public byte[] asByteArray()
throws Exception
Exception - If there is an error creating the stream.public Document getXMPDocument()
protected XMPSchema basicAddSchema(XMPSchema schema)
schema - The schema to add.
public XMPSchemaPDF addPDFSchema()
public XMPSchemaDublinCore addDublinCoreSchema()
public XMPSchemaBasic addBasicSchema()
public XMPSchemaIptc4xmpCore addIptc4xmpCoreSchema()
public XMPSchemaPhotoshop addPhotoshopSchema()
public void setEncoding(String xmlEncoding)
xmlEncoding - The encoding to write the XML as.public String getEncoding()
public static XMPMetadata load(String file)
throws IOException
file - The file to load the metadata from.
IOException - If there is an error reading the data.
public static XMPMetadata load(InputSource is)
throws IOException
is - The input source to load the schema from.
IOException - If there was an error while loading the schema.
public static XMPMetadata load(InputStream is)
throws IOException
is - The stream to load the data from.
IOException - If there is an error reading the data.
public static void main(String[] args)
throws Exception
args - The command line arguments.
Exception - If there is an error.
public List<XMPSchema> getSchemas()
throws IOException
IOException - If there is an error creating a specific schema.
public List<XMPSchema> getSchemasByNamespaceURI(String namespaceURI)
throws IOException
namespaceURI - The namespaceURI to filter for.
IOException - If an operation on the document fails.
public boolean hasUnknownSchema()
throws IOException
IOException - If there is an error
public XMPSchema getSchemaByClass(Class<?> targetSchema)
throws IOException
targetSchema - Class for targetSchema.
IOException - if there was an error creating the schemas of this.
public void merge(XMPMetadata metadata)
throws IOException
metadata - The metadata to merge with this document.
IOException - If there is an error merging the data.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||