org.ocap.hn.content
Interface MetadataNode


public interface MetadataNode

Base class for all Metadata. Metadata can be a normal java.lang.String, a java.awt.Image, another MetadataNode for tree like metadata structures or other tbd Objects. One example is given below:

 RootNode
 |
 --- TITLE - String("Best Movie Ever")
 |
 --- CREW  - MetadataNode
                 |
                 --- MAIN_ACTOR - String("Joe Sixpack")
                 |
                 --- MAIN_ACTOR2 - String("Doris Dosenkohl")
 |
 --- SYNOPSIS - String("Don't know - I fell asleep after 5 seconds")
 |
 ---IMAGE    - Image("/home/user/images/BestMovieEver.jpg")
 
It is possible to get Metadata from other MetadataNodes directly by concatenating the different identifiers using # to separate them.
e.g. getMetadata("CREW#MAIN_ACTOR") would return "Joe Sixpack"


Method Summary
 void addMetadata(String key, Object value)
          Adds a new metadata entry to this MetadataNode.
 Enumeration getMetadata()
          Gets an Enumeration of all Metadata objects in this node.
 Object getMetadata(String key)
          Returns the Metadata for the specified key.
 MetadataNode getParentNode()
          Gets the parent node of this MetadataNode.
 String getText()
          Returns a textual representation of the Metadata with non-displayable characters that are not display formatting characters removed.
 

Method Detail

getMetadata

Object getMetadata(String key)
Returns the Metadata for the specified key. The returned object can be a normal String (e.g. for title etc), a java.awt.Image, a Vector containing a list of elements, another MetadataNode for tree like metadata structures or other tbd. Objects. In order to query a Metadata in a hierarchy query strings like
IDENT1#IDENT2#IDENT3 are possible where IDENT1 is a MetadataNode in this node, IDENT2 a MetadataNode in IDENT2 and IDENT3 an object in IDENT2. Performs a local cache search only.

Parameters:
key - The key to search for.
Returns:
The value associated with the key or null if no match found.

addMetadata

void addMetadata(String key,
                 Object value)
Adds a new metadata entry to this MetadataNode.

Parameters:
key - The key e.g. "TITLE".
value - The value associated with the key, e.g. "When Harry Meets Sally" or a more complex Object like another MetadataNode.

getMetadata

Enumeration getMetadata()
Gets an Enumeration of all Metadata objects in this node. The enumeration SHALL contain the top-level MetadataNode objects which MAY contain other MetadataNode objects.

Returns:
Enumeration of top-level MetadataNode objects.

getText

String getText()
Returns a textual representation of the Metadata with non-displayable characters that are not display formatting characters removed.

Returns:
Textual representation of the metadata.

getParentNode

MetadataNode getParentNode()
Gets the parent node of this MetadataNode.

Returns:
Parent of this node.