org.ceryle.plink
Class RdfSerializer

java.lang.Object
  extended by org.ceryle.plink.RdfSerializer
All Implemented Interfaces:
MetaHandler, Constants

public class RdfSerializer
extends Object
implements Constants, MetaHandler

Receives metadata events from a org.ceryle.plink.MetaProcessor to build an output tree. For more extensive documentation see the plink home page.

Since:
JDK1.3
Version:
$Id: RdfSerializer.java,v 3.6 2007-06-15 12:09:28 altheim Exp $
Author:
Murray Altheim

Field Summary
protected  Element description
          Document element for the current metadata block in the generated XML document.
protected  Hashtable descriptions
          Hashtable for description objects.
protected  Document doc
          XML Document used as the generated container of harvested metadata.
protected  String documentSystemId
          A String containing the system identifier (filename) of the Document.
protected  String documentTitle
          A String containing the contents of the <title> Element of the Document.
static String PFX_dcmes
          A String containing the attribute namespace prefix value for DCMES (default "dc").
static String PFX_rdf
          A String containing the attribute namespace prefix value for RDF (default 'rdf').
static String XMLNS_rdf
          A String containing the XML Namespace URI for the Resource Description Framework (RDF).
 
Fields inherited from interface org.ceryle.util.Constants
Amp, AMP, Apos, APOS, APP_NAME, APP_VERSION_NAME, APP_VERSION_NUMBER, AT, BANG, BAR, BIT_dev, BIT_http, BIT_ignoreCom, BIT_merge, BIT_none, BIT_noPreload, BIT_simple, BIT_ui, BIT_unused1, BIT_unused2, BIT_unused3, BIT_validating, BIT_verbose, BIT_xcatalog, BIT_xlink, BIT_xmlnsAware, BIT_xsd, BROKB, BSlash, BSLASH, CERYLE_CREDITS_FILE, CERYLE_DATA_DIR, CERYLE_HIST_FILE, CERYLE_LICENSE_FILE, CERYLE_PREF_FILE, CERYLE_PROP, CERYLE_PROP_BASE, CERYLE_PROP_FILE, CERYLE_RSRC_DIR, CERYLE_THANKS_FILE, CFLEX, Colon, COLON, Comma, COMMA, CR, CRet, Dash, DASH, DEFAULT_DIRECTORY, DEVELOPER, DOLR, Dot, DOT, EIGHT, Ellip, EOF, EqQuot, EQUAL, Equals, False, FALSE, FileProt, Filesep, FileURL, Five, FIVE, FONTSIZES, Four, FOUR, FSchar, GCOL_PROP, GRAPH_PROP, GRAVE, GT, Hash, HASH, HOME_DIRECTORY, HOME_DIRECTORY_PATH, HOME_DIRECTORY_URL, HTML, HttpProt, HttpURL, INDENT, INDENT_0, INDENT_1, INDENT_10, INDENT_2, INDENT_3, INDENT_4, INDENT_5, INDENT_6, INDENT_7, INDENT_8, INDENT_9, INIT, LCURL, LCurly, LF, LFS, Localhost, LPAR, LParen, LS, LSBrkt, LSBrkt2, LSQB, LT, MT, NBSP, NEL, NINE, NL, NL20x, NLchar, No, Null, NULL, NULL_STATE, NumParams, One, ONE, Pathsep, Percent, PERO, PLUS, Prcnt, PS, QMark, QMARK, Quot, QUOT, RCURL, RCurly, RESOURCE_BUNDLE, RPAR, RParen, RSBrkt, RSBrkt2, RSQB, Semi, SEMI, SEVEN, SIX, Slash, SLASH, SP, SPACE, Stago, Star, STAR, Tab, TAB, Tee, Three, THREE, Tilde, TILDE, TM_PROP, True, TRUE, Two, TWO, Under, UNDER, URI, URL, VBar, WIKI_PROP, XNodePfx, XNodeURL, XtmExt, Yes, Zero, ZERO
 
Constructor Summary
RdfSerializer(Services services, String systemId)
          Default Constructor.
 
Method Summary
 void about(String uri)
          Receives a metadata event indicating the beginning of a new metadata node, with the value of the uri reference indicating the resource to which this metadata is associated.
 Document getHarvestDocument()
          This generates the Document by adding necessary document element attributes, and populates it from the enumeration of the Hashtable registry of generated Elements (with no significance to the order).
protected  void indent(Element elt, int level)
          Appends a new line following the Element elt.
 void meta(String name, String value, String schema)
          Receives a metadata event as a name value pair about the object referred to by "uriReference".
protected  void newline(Element elt)
          Appends a new line following the Element elt.
 void schema(String prefix, String uri)
          Receives a metadata event indicating the awareness of a new namespace schema whose prefix String is prefix and URI reference uri.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_rdf

public static final String XMLNS_rdf
A String containing the XML Namespace URI for the Resource Description Framework (RDF).

See Also:
Constant Field Values

PFX_rdf

public static String PFX_rdf
A String containing the attribute namespace prefix value for RDF (default 'rdf').


PFX_dcmes

public static String PFX_dcmes
A String containing the attribute namespace prefix value for DCMES (default "dc").


doc

protected Document doc
XML Document used as the generated container of harvested metadata.


description

protected Element description
Document element for the current metadata block in the generated XML document.


documentTitle

protected String documentTitle
A String containing the contents of the <title> Element of the Document.


documentSystemId

protected String documentSystemId
A String containing the system identifier (filename) of the Document.


descriptions

protected Hashtable descriptions
Hashtable for description objects.

Constructor Detail

RdfSerializer

public RdfSerializer(Services services,
                     String systemId)
              throws ProcessException
Default Constructor. This will initialize the processor with the provided core Services, using default values.

Throws:
ProcessException
Method Detail

getHarvestDocument

public Document getHarvestDocument()
This generates the Document by adding necessary document element attributes, and populates it from the enumeration of the Hashtable registry of generated Elements (with no significance to the order). Returns the Document populated with the harvested metadata. This enumerates the Hashtable registry of generated elements with no significance to the order. This method should never be called more than once, because it is at this point that the actual document build occurs from the Element repository. Note that if events occur following a build(), these will not be reflected in the returned Document, since a build is allowed only once.

Specified by:
getHarvestDocument in interface MetaHandler
Returns:
an XML document

about

public void about(String uri)
Receives a metadata event indicating the beginning of a new metadata node, with the value of the uri reference indicating the resource to which this metadata is associated. This keeps track of previously-declared references to the same resource by maintaining a registry, so that all metadata associated with a specific resource is merged together.

Specified by:
about in interface MetaHandler

schema

public void schema(String prefix,
                   String uri)
Receives a metadata event indicating the awareness of a new namespace schema whose prefix String is prefix and URI reference uri.

Specified by:
schema in interface MetaHandler

meta

public void meta(String name,
                 String value,
                 String schema)
Receives a metadata event as a name value pair about the object referred to by "uriReference". The String schema is a prefix reference to an existing schema namespace. Validation of this should be done by the processor sending this event.

Specified by:
meta in interface MetaHandler

newline

protected void newline(Element elt)
Appends a new line following the Element elt.


indent

protected void indent(Element elt,
                      int level)
Appends a new line following the Element elt.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.