net.ivoa.registry.search
Class Metadata

java.lang.Object
  extended by net.ivoa.registry.search.Metadata
Direct Known Subclasses:
Capability, VOResource

public class Metadata
extends java.lang.Object

this class provides convenient access to information inside a DOM Node


Field Summary
protected  java.util.HashMap cache
           
protected static java.lang.String XSI_NS
           
 
Constructor Summary
Metadata(org.w3c.dom.Node el)
          wrap a DOM Node
Metadata(org.w3c.dom.Node el, java.lang.String path)
          wrap a DOM element
 
Method Summary
 void clearCache()
          clear the internal parameter cache.
protected  java.util.List findBlocks(java.lang.String path)
          return all metadata blocks that match a given path name as a List
 Metadata[] getBlocks(java.lang.String path)
          return all Metadata blocks that match a given path name.
 org.w3c.dom.Node getDOMNode()
          return the wrapped Node
 java.lang.String getParameter(java.lang.String path)
          return the first value matching the given parameter name
 java.lang.String[] getParameters(java.lang.String path)
          return values of all parameters with a given name
 java.lang.String getPathName()
          return the pathname configured with this element
 java.lang.String getXSIType()
          return the value of the xsi:type attribute if it exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected java.util.HashMap cache

XSI_NS

protected static final java.lang.String XSI_NS
See Also:
Constant Field Values
Constructor Detail

Metadata

public Metadata(org.w3c.dom.Node el)
wrap a DOM Node

Parameters:
el - the node to wrap

Metadata

public Metadata(org.w3c.dom.Node el,
                java.lang.String path)
wrap a DOM element

Parameters:
el - the element to wrap
path - a path name to assume for the element
Method Detail

getDOMNode

public org.w3c.dom.Node getDOMNode()
return the wrapped Node


getPathName

public java.lang.String getPathName()
return the pathname configured with this element


findBlocks

protected java.util.List findBlocks(java.lang.String path)
                             throws java.lang.IllegalArgumentException
return all metadata blocks that match a given path name as a List

Parameters:
path - the path to the desired XML node. This is a slash-delimited string in which each field between slashes is usually an element name. The last field may either be the name of an element or an attribute. If the last field begins with an "at" character (@), only a matching attribute will be returned.
Throws:
java.lang.IllegalArgumentException - if any field except the last one contains an "@" character

getBlocks

public Metadata[] getBlocks(java.lang.String path)
                     throws java.lang.IllegalArgumentException
return all Metadata blocks that match a given path name. Metadata blocks are elements that contain other elements or attributes containing metadata information.

Parameters:
path - the path to the desired XML node. This is a slash-delimited string in which each field between slashes is usually an element name. The last field may either be the name of an element or an attribute. If the last field begins with an "at" character (@), only a matching attribute will be returned.
Throws:
java.lang.IllegalArgumentException - if any field except the last one contains an "@" character

getParameters

public java.lang.String[] getParameters(java.lang.String path)
return values of all parameters with a given name

Parameters:
path - the path to the desired parameter. This is a slash-delimited string in which each field between slashes is usually an element name. The last field may either be the name of an element or an attribute. If the last field begins with an "at" character (@), only a matching attribute will be returned.
Throws:
java.lang.IllegalArgumentException - if any field except the last one contains an "@" character

getParameter

public java.lang.String getParameter(java.lang.String path)
return the first value matching the given parameter name

Parameters:
path - the path to the desired parameter. This is a slash-delimited string in which each field between slashes is usually an element name. The last field may either be the name of an element or an attribute. If the last field begins with an "at" character (@), only a matching attribute will be returned.
Throws:
java.lang.IllegalArgumentException - if any field except the last one contains an "@" character

getXSIType

public java.lang.String getXSIType()
return the value of the xsi:type attribute if it exists.

Returns:
String the xsi:type with the namespace prefix removed

clearCache

public void clearCache()
clear the internal parameter cache. Call this if the underlying DOM model has been updated.