com.itextpdf.xmp.impl
Class XMPSchemaRegistryImpl

java.lang.Object
  extended by com.itextpdf.xmp.impl.XMPSchemaRegistryImpl
All Implemented Interfaces:
XMPConst, XMPSchemaRegistry

public final class XMPSchemaRegistryImpl
extends Object
implements XMPSchemaRegistry, XMPConst

The schema registry handles the namespaces, aliases and global options for the XMP Toolkit. There is only one single instance used by the toolkit.

Since:
27.01.2006

Field Summary
 
Fields inherited from interface com.itextpdf.xmp.XMPConst
ARRAY_ITEM_NAME, ARRAY_LAST_ITEM, FALSESTR, NS_ADOBESTOCKPHOTO, NS_ASF, NS_BWF, NS_CAMERARAW, NS_CREATOR_ATOM, NS_DC, NS_DC_DEPRECATED, NS_DICOM, NS_DM, NS_EXIF, NS_EXIF_AUX, NS_EXIFX, NS_IPTCCORE, NS_IPTCEXT, NS_IX, NS_JP2K, NS_JPEG, NS_PDF, NS_PDFA_EXTENSION, NS_PDFA_FIELD, NS_PDFA_ID, NS_PDFA_PROPERTY, NS_PDFA_SCHEMA, NS_PDFA_TYPE, NS_PDFX, NS_PDFX_ID, NS_PHOTOSHOP, NS_PLUS, NS_PNG, NS_PSALBUM, NS_RDF, NS_RIFFINFO, NS_SCRIPT, NS_SWF, NS_TIFF, NS_TRANSIENT, NS_TXMP, NS_WAV, NS_X, NS_XML, NS_XMP, NS_XMP_BJ, NS_XMP_MM, NS_XMP_NOTE, NS_XMP_RIGHTS, RDF_TYPE, TAG_XAPMETA, TAG_XMPMETA, TRUESTR, TYPE_DIMENSIONS, TYPE_FONT, TYPE_GRAPHICS, TYPE_IDENTIFIERQUAL, TYPE_IMAGE, TYPE_MANIFESTITEM, TYPE_PAGEDFILE, TYPE_RESOURCEEVENT, TYPE_RESOURCEREF, TYPE_ST_JOB, TYPE_ST_VERSION, TYPE_TEXT, X_DEFAULT, XML_LANG, XMP_PI
 
Constructor Summary
XMPSchemaRegistryImpl()
          Performs the initialisation of the registry with the default namespaces, aliases and global options.
 
Method Summary
 void deleteNamespace(String namespaceURI)
          Deletes a namespace from the registry.
 XMPAliasInfo findAlias(String qname)
          Searches for registered aliases.
 XMPAliasInfo[] findAliases(String aliasNS)
          Collects all aliases that are contained in the provided namespace.
 Map getAliases()
           
 String getNamespacePrefix(String namespaceURI)
          Obtain the prefix for a registered namespace URI.
 Map getNamespaces()
           
 String getNamespaceURI(String namespacePrefix)
          Obtain the URI for a registered namespace prefix.
 Map getPrefixes()
           
 String registerNamespace(String namespaceURI, String suggestedPrefix)
          Register a namespace URI with a suggested prefix.
 XMPAliasInfo resolveAlias(String aliasNS, String aliasProp)
          Determines if a name is an alias, and what it is aliased to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMPSchemaRegistryImpl

public XMPSchemaRegistryImpl()
Performs the initialisation of the registry with the default namespaces, aliases and global options.

Method Detail

registerNamespace

public String registerNamespace(String namespaceURI,
                                String suggestedPrefix)
                         throws XMPException
Description copied from interface: XMPSchemaRegistry
Register a namespace URI with a suggested prefix. It is not an error if the URI is already registered, no matter what the prefix is. If the URI is not registered but the suggested prefix is in use, a unique prefix is created from the suggested one. The actual registeed prefix is always returned. The function result tells if the registered prefix is the suggested one.

Note: No checking is presently done on either the URI or the prefix.

Specified by:
registerNamespace in interface XMPSchemaRegistry
Parameters:
namespaceURI - The URI for the namespace. Must be a valid XML URI.
suggestedPrefix - The suggested prefix to be used if the URI is not yet registered. Must be a valid XML name.
Returns:
Returns the registered prefix for this URI, is equal to the suggestedPrefix if the namespace hasn't been registered before, otherwise the existing prefix.
Throws:
XMPException - If the parameters are not accordingly set
See Also:
XMPSchemaRegistry.registerNamespace(String, String)

deleteNamespace

public void deleteNamespace(String namespaceURI)
Description copied from interface: XMPSchemaRegistry
Deletes a namespace from the registry.

Does nothing if the URI is not registered, or if the namespaceURI parameter is null or the empty string.

Note: Not yet implemented.

Specified by:
deleteNamespace in interface XMPSchemaRegistry
Parameters:
namespaceURI - The URI for the namespace.
See Also:
XMPSchemaRegistry.deleteNamespace(String)

getNamespacePrefix

public String getNamespacePrefix(String namespaceURI)
Description copied from interface: XMPSchemaRegistry
Obtain the prefix for a registered namespace URI.

It is not an error if the namespace URI is not registered.

Specified by:
getNamespacePrefix in interface XMPSchemaRegistry
Parameters:
namespaceURI - The URI for the namespace. Must not be null or the empty string.
Returns:
Returns the prefix registered for this namespace URI or null.
See Also:
XMPSchemaRegistry.getNamespacePrefix(String)

getNamespaceURI

public String getNamespaceURI(String namespacePrefix)
Description copied from interface: XMPSchemaRegistry
Obtain the URI for a registered namespace prefix.

It is not an error if the namespace prefix is not registered.

Specified by:
getNamespaceURI in interface XMPSchemaRegistry
Parameters:
namespacePrefix - The prefix for the namespace. Must not be null or the empty string.
Returns:
Returns the URI registered for this prefix or null.
See Also:
XMPSchemaRegistry.getNamespaceURI(String)

getNamespaces

public Map getNamespaces()
Specified by:
getNamespaces in interface XMPSchemaRegistry
Returns:
Returns the registered prefix/namespace-pairs as map, where the keys are the namespaces and the values are the prefixes.
See Also:
XMPSchemaRegistry.getNamespaces()

getPrefixes

public Map getPrefixes()
Specified by:
getPrefixes in interface XMPSchemaRegistry
Returns:
Returns the registered namespace/prefix-pairs as map, where the keys are the prefixes and the values are the namespaces.
See Also:
XMPSchemaRegistry.getPrefixes()

resolveAlias

public XMPAliasInfo resolveAlias(String aliasNS,
                                 String aliasProp)
Description copied from interface: XMPSchemaRegistry
Determines if a name is an alias, and what it is aliased to.

Specified by:
resolveAlias in interface XMPSchemaRegistry
Parameters:
aliasNS - The namespace URI of the alias. Must not be null or the empty string.
aliasProp - The name of the alias. May be an arbitrary path expression path, must not be null or the empty string.
Returns:
Returns the XMPAliasInfo for the given alias namespace and property or null if there is no such alias.
See Also:
XMPSchemaRegistry.resolveAlias(String, String)

findAlias

public XMPAliasInfo findAlias(String qname)
Description copied from interface: XMPSchemaRegistry
Searches for registered aliases.

Specified by:
findAlias in interface XMPSchemaRegistry
Parameters:
qname - an XML conform qname
Returns:
Returns if an alias definition for the given qname to another schema and property is registered.
See Also:
XMPSchemaRegistry.findAlias(java.lang.String)

findAliases

public XMPAliasInfo[] findAliases(String aliasNS)
Description copied from interface: XMPSchemaRegistry
Collects all aliases that are contained in the provided namespace. If nothing is found, an empty array is returned.

Specified by:
findAliases in interface XMPSchemaRegistry
Parameters:
aliasNS - a schema namespace URI
Returns:
Returns all alias infos from aliases that are contained in the provided namespace.
See Also:
XMPSchemaRegistry.findAliases(String)

getAliases

public Map getAliases()
Specified by:
getAliases in interface XMPSchemaRegistry
Returns:
Returns the registered aliases as map, where the key is the "qname" (prefix and name) and the value an XMPAliasInfo-object.
See Also:
XMPSchemaRegistry.getAliases()


Copyright © 2013. All Rights Reserved.