Oracle Fusion Middleware Java API Reference for Oracle ADF Share
11g Release 1 (11.1.1.4.0)

E10686-05

oracle.adf.share.common.rc.util
Class MetadataRegistry

java.lang.Object
  extended by oracle.adf.share.common.rc.util.MetadataRegistry
Direct Known Subclasses:
MetadataRegistryImpl

public abstract class MetadataRegistry
extends java.lang.Object


Nested Class Summary
static interface MetadataRegistry.PathVisitor
          Deprecated. see PathVisitor2
static interface MetadataRegistry.PathVisitor2
          Pass an instance of this interface to the visitRegistryPaths method.
 
Field Summary
static java.lang.String ADFMXML_SIG
           
static int ADFMXML_SIG_LEN
           
static java.lang.String BC4JCONFIGNS
           
static java.lang.String BC4JNS
           
static java.lang.String CPXREGISTRY
           
static java.lang.String DCXREGISTRY
           
static java.lang.String JPXREGISTRY
           
static java.lang.String PATH_ATTR
           
static java.lang.String XCFGREGISTRY
           
static java.lang.String XMLNS_METAINF
           
static java.lang.String XMLNS_SCHEMA
           
 
Constructor Summary
MetadataRegistry()
           
 
Method Summary
abstract  java.util.Iterator<java.lang.String> getAttributeIterator(java.net.URL xmlUrl, java.lang.String elemNS, java.lang.String elemName, java.lang.String attrName)
          Return an iterator with the values of the attribute, for the element, within the XML document at the location specified in the xmlUrl.
abstract  java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> getAttributeMaps(java.net.URL xmlURL, java.lang.String elemNS, java.lang.String elemName)
          Return a collection of attribute maps for the items matching the element, within the XML document at the location specified in the xmlUrl.
abstract  org.w3c.dom.Document getDomDocument(java.net.URL url)
          Parse and return the DOM document located at the URL.
abstract  java.util.Iterator<java.lang.String> getRegistryPaths(java.net.URL adfmXmlUrl, java.lang.String[] registryNSs, java.lang.String[] registryNames)
          Takes a URL of an adfm.xml file and returns an iterator to all the RegistryType paths contained within it (as relative paths).
abstract  java.util.Iterator<java.lang.String> getRegistryPaths(java.net.URL adfmXmlUrl, java.lang.String registryNS, java.lang.String registryName)
          Takes a URL of an adfm.xml file and returns an iterator to all the RegistryType paths contained within it (as relative paths).
abstract  java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getSubtreeList(org.w3c.dom.Document xmlDocument, java.net.URL xmlUrl, java.lang.String elemNS, java.lang.String elemName, java.lang.String nvpChildName)
          This is used to simplify data extraction from the jbo dt files, the prime example being the JboProject file, see jbo_03_01.dtd.
abstract  java.net.URL[] listFiles(java.net.URL url)
           
static MetadataRegistry newInstance()
           
abstract  void saveDocumentTo(org.w3c.dom.Document doc, java.net.URL saveTo)
          Causes the document passed in to be saved to the URL passed in.
abstract  java.net.URL setBaseURL(java.net.URL newBaseURL)
           
abstract  void setPreserveWhitespace(java.lang.Boolean preserve)
          Sets the whitespace preservation to use when parsing documents.
abstract  void setValidationMode(java.lang.Integer mode)
          Sets the validation mode to use when parsing documents.
abstract  boolean updateElementsInMetadataRegistry(java.util.Collection<java.lang.String> relativePaths, java.util.Map<java.lang.String,java.lang.String> elementXref, java.net.URL adfmXmlUrl)
          See updateElementsInMetadataRegistryEx
abstract  boolean updateElementsInMetadataRegistryEx(java.util.Collection<java.lang.String> relativePaths, java.util.Collection<java.lang.String> removalPaths, java.util.Map<java.lang.String,java.lang.String> elementXref, java.net.URL adfmXmlUrl, int[] remaining)
          Process all elements in the list of relativePaths referring to elementXref to get the elementNames corresponding to the extensions encountered.
abstract  boolean updateRegistryElement(java.lang.String relativePath, java.lang.String elementNS, java.lang.String elementName, org.w3c.dom.Document doc)
          Update a single path attribute in the metadata registry passed as the doc param, and the elementName and elementNS are the specifics of the item to make the change on.
abstract  void visitRegistryPaths(java.lang.ClassLoader loader, java.lang.String[] regNSs, java.lang.String[] regNames, MetadataRegistry.PathVisitor visitor)
          Within the list of metadata registries (META-INF/adfm.xml) in the class loader, find all registries within each matching the namespace and element name.
abstract  void visitRegistryPaths(java.lang.ClassLoader loader, java.lang.String regNS, java.lang.String regName, MetadataRegistry.PathVisitor visitor)
          Within the list of metadata registries (META-INF/adfm.xml) in the class loader, find all registries within each matching the namespace and element name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CPXREGISTRY

public static final java.lang.String CPXREGISTRY
See Also:
Constant Field Values

DCXREGISTRY

public static final java.lang.String DCXREGISTRY
See Also:
Constant Field Values

JPXREGISTRY

public static final java.lang.String JPXREGISTRY
See Also:
Constant Field Values

XCFGREGISTRY

public static final java.lang.String XCFGREGISTRY
See Also:
Constant Field Values

ADFMXML_SIG

public static final java.lang.String ADFMXML_SIG
See Also:
Constant Field Values

ADFMXML_SIG_LEN

public static final int ADFMXML_SIG_LEN

XMLNS_METAINF

public static final java.lang.String XMLNS_METAINF
See Also:
Constant Field Values

XMLNS_SCHEMA

public static final java.lang.String XMLNS_SCHEMA
See Also:
Constant Field Values

PATH_ATTR

public static final java.lang.String PATH_ATTR
See Also:
Constant Field Values

BC4JNS

public static final java.lang.String BC4JNS
See Also:
Constant Field Values

BC4JCONFIGNS

public static final java.lang.String BC4JCONFIGNS
See Also:
Constant Field Values
Constructor Detail

MetadataRegistry

public MetadataRegistry()
Method Detail

setBaseURL

public abstract java.net.URL setBaseURL(java.net.URL newBaseURL)
Parameters:
newBaseURL - the baseUrl the DOMParser will use to getDomDocument.
Returns:
the existing baseUrl

setValidationMode

public abstract void setValidationMode(java.lang.Integer mode)
Sets the validation mode to use when parsing documents.

Parameters:
mode - must be a valid mode from DOMParser. If this method isn't called then the parser method won't be called.

setPreserveWhitespace

public abstract void setPreserveWhitespace(java.lang.Boolean preserve)
Sets the whitespace preservation to use when parsing documents. The default is true.

Parameters:
preserve - the value to use when calling setPreserveWhitespace.

visitRegistryPaths

public abstract void visitRegistryPaths(java.lang.ClassLoader loader,
                                        java.lang.String regNS,
                                        java.lang.String regName,
                                        MetadataRegistry.PathVisitor visitor)
                                 throws java.io.IOException,
                                        org.xml.sax.SAXException,
                                        javax.xml.parsers.ParserConfigurationException,
                                        java.net.MalformedURLException
Within the list of metadata registries (META-INF/adfm.xml) in the class loader, find all registries within each matching the namespace and element name. And for each of those dispatch to the visitor with the url of the entry path.

Parameters:
loader -
regNS -
regName -
visitor -
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.net.MalformedURLException
See Also:
MetadataRegistry.PathVisitor2

visitRegistryPaths

public abstract void visitRegistryPaths(java.lang.ClassLoader loader,
                                        java.lang.String[] regNSs,
                                        java.lang.String[] regNames,
                                        MetadataRegistry.PathVisitor visitor)
                                 throws java.io.IOException,
                                        org.xml.sax.SAXException,
                                        javax.xml.parsers.ParserConfigurationException,
                                        java.net.MalformedURLException
Within the list of metadata registries (META-INF/adfm.xml) in the class loader, find all registries within each matching the namespace and element name. And for each of those dispatch to the visitor with the url of the entry path.

Parameters:
loader -
regNSs - array of namespace, length must match regNames length
regNames - array of registry names, length must match regNSs length
visitor -
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.net.MalformedURLException
See Also:
MetadataRegistry.PathVisitor2

getSubtreeList

public abstract java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getSubtreeList(org.w3c.dom.Document xmlDocument,
                                                                                                java.net.URL xmlUrl,
                                                                                                java.lang.String elemNS,
                                                                                                java.lang.String elemName,
                                                                                                java.lang.String nvpChildName)
                                                                                         throws javax.xml.parsers.ParserConfigurationException,
                                                                                                org.xml.sax.SAXException,
                                                                                                java.io.IOException
This is used to simplify data extraction from the jbo dt files, the prime example being the JboProject file, see jbo_03_01.dtd.

Parameters:
xmlDocument - pre-loaded document to avoid loading
xmlUrl - the location of the metadata file
elemNS - XML namespace (null defaults to bc4j URI)
elemName - name of element (could be 0-n). Ex: "Containee"
nvpChildName - name of direct child of elemName containing "Name", "Value" attribute pairs. Ex: "DesignTime"
Returns:
a list of elemName maps, each one with the attribute pairs, and a secondary map keyed by nvpChildName containing the nv pairs.
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

getAttributeIterator

public abstract java.util.Iterator<java.lang.String> getAttributeIterator(java.net.URL xmlUrl,
                                                                          java.lang.String elemNS,
                                                                          java.lang.String elemName,
                                                                          java.lang.String attrName)
                                                                   throws java.io.IOException,
                                                                          org.xml.sax.SAXException,
                                                                          javax.xml.parsers.ParserConfigurationException
Return an iterator with the values of the attribute, for the element, within the XML document at the location specified in the xmlUrl.

Parameters:
xmlUrl -
elemNS -
elemName -
attrName -
Returns:
the iterator of attribute values
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

getAttributeMaps

public abstract java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> getAttributeMaps(java.net.URL xmlURL,
                                                                                                        java.lang.String elemNS,
                                                                                                        java.lang.String elemName)
                                                                                                 throws java.io.IOException,
                                                                                                        org.xml.sax.SAXException,
                                                                                                        javax.xml.parsers.ParserConfigurationException
Return a collection of attribute maps for the items matching the element, within the XML document at the location specified in the xmlUrl.

Parameters:
xmlURL -
elemNS - default is BC4JCONFIGNS, the bc4j/configuration (xcfg files)
elemName - (Most likely something like, AppModuleConfig)
Returns:
the collection, one per matching element. Each map represents the attributes of a matching element.
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

getRegistryPaths

public abstract java.util.Iterator<java.lang.String> getRegistryPaths(java.net.URL adfmXmlUrl,
                                                                      java.lang.String registryNS,
                                                                      java.lang.String registryName)
                                                               throws java.io.IOException,
                                                                      org.xml.sax.SAXException,
                                                                      javax.xml.parsers.ParserConfigurationException
Takes a URL of an adfm.xml file and returns an iterator to all the RegistryType paths contained within it (as relative paths).

Parameters:
adfmXmlUrl - the full URL of a single adfm.xml.
registryNS - is the schema type namespace to request. If null then the document namespace is assumed. The wildcard "*" is accepted.
registryName - is the schema type local name to request. The wildcard "*" is accepted.
Returns:
an iterator of all the RegistryType path attributes as relative paths as they're represented in the registry path attribute.
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

getRegistryPaths

public abstract java.util.Iterator<java.lang.String> getRegistryPaths(java.net.URL adfmXmlUrl,
                                                                      java.lang.String[] registryNSs,
                                                                      java.lang.String[] registryNames)
                                                               throws java.io.IOException,
                                                                      org.xml.sax.SAXException,
                                                                      javax.xml.parsers.ParserConfigurationException
Takes a URL of an adfm.xml file and returns an iterator to all the RegistryType paths contained within it (as relative paths).

Parameters:
adfmXmlUrl - the full URL of a single adfm.xml.
registryNS - is the schema type namespace to request. If null then the document namespace is assumed. The wildcard "*" is accepted.
registryName - is the schema type local name to request. The wildcard "*" is accepted.
Returns:
an iterator of all the RegistryType path attributes as relative paths as they're represented in the registry path attribute.
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

updateElementsInMetadataRegistryEx

public abstract boolean updateElementsInMetadataRegistryEx(java.util.Collection<java.lang.String> relativePaths,
                                                           java.util.Collection<java.lang.String> removalPaths,
                                                           java.util.Map<java.lang.String,java.lang.String> elementXref,
                                                           java.net.URL adfmXmlUrl,
                                                           int[] remaining)
                                                    throws java.io.IOException,
                                                           org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           javax.xml.transform.TransformerConfigurationException,
                                                           javax.xml.transform.TransformerException
Process all elements in the list of relativePaths referring to elementXref to get the elementNames corresponding to the extensions encountered. When the entries are processed and it's determined that the document has been dirtied, then the new xml is written back to the adfmXmlUrl.

Parameters:
relativePaths - The paths to ensure added in the metadata directory
removalPaths - The paths to remove from the metadata directory. The assumption is that only one type will be responsible for a path at any given time. So it can be removed without reference to the type.
elementXref - The extension to elementName cross reference for constituent files of the metadata registry, null assumes adfm entries.
adfmXmlUrl - The output file to update if needed
remaining - pass a non-null and the [0] element will contain how many remain in the doc when method completes (from a wildcard)
Returns:
Whether the document has been dirtied by the processing
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException

updateElementsInMetadataRegistry

public abstract boolean updateElementsInMetadataRegistry(java.util.Collection<java.lang.String> relativePaths,
                                                         java.util.Map<java.lang.String,java.lang.String> elementXref,
                                                         java.net.URL adfmXmlUrl)
                                                  throws java.io.IOException,
                                                         org.xml.sax.SAXException,
                                                         javax.xml.parsers.ParserConfigurationException,
                                                         javax.xml.transform.TransformerConfigurationException,
                                                         javax.xml.transform.TransformerException
See updateElementsInMetadataRegistryEx

Parameters:
relativePaths -
elementXref -
adfmXmlUrl -
Returns:
Throws:
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException

updateRegistryElement

public abstract boolean updateRegistryElement(java.lang.String relativePath,
                                              java.lang.String elementNS,
                                              java.lang.String elementName,
                                              org.w3c.dom.Document doc)
Update a single path attribute in the metadata registry passed as the doc param, and the elementName and elementNS are the specifics of the item to make the change on. The registry document assumes that paths are unique within a particular name and NS. For example, the DCXREGISTRY only has one element where the path is "view/DataControls.dcx".

Parameters:
relativePath - The path attribute value to insert, or ignore
elementNS - The namespace of the elementName
elementName - The registry name
doc - The metadata document
Returns:
Whether the document has been dirtied by the processing

getDomDocument

public abstract org.w3c.dom.Document getDomDocument(java.net.URL url)
                                             throws javax.xml.parsers.ParserConfigurationException,
                                                    org.xml.sax.SAXException,
                                                    java.io.IOException
Parse and return the DOM document located at the URL.

Parameters:
url - the document location
Returns:
the parsed document represented by the url
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

saveDocumentTo

public abstract void saveDocumentTo(org.w3c.dom.Document doc,
                                    java.net.URL saveTo)
                             throws javax.xml.transform.TransformerConfigurationException,
                                    javax.xml.transform.TransformerException,
                                    java.io.IOException
Causes the document passed in to be saved to the URL passed in.

Parameters:
doc - The document desired to saved
saveTo - Where to save the document to
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

listFiles

public abstract java.net.URL[] listFiles(java.net.URL url)
Parameters:
url - The directory, jar, etc to use to get the return values. Note: implementations exist for file: and jar: unless you use the javatools-nodeps.jar in your classpath (default within ide).
Returns:
an array of URL's (files and directories) in the url param. Returns null if the URL does not represent a directory or if an I/O error occurs.

newInstance

public static MetadataRegistry newInstance()

Oracle Fusion Middleware Java API Reference for Oracle ADF Share
11g Release 1 (11.1.1.4.0)

E10686-05

Copyright © 1997, 2011, Oracle. All rights reserved.