org.apache.aries.blueprint.container
Class ParserContextImpl

java.lang.Object
  extended by org.apache.aries.blueprint.container.ParserContextImpl
All Implemented Interfaces:
ParserContext

public class ParserContextImpl
extends java.lang.Object
implements ParserContext

A simple ParserContext implementation. This class is supposed to be short lived and only used for calling a given namespace handler.

Version:
$Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $

Constructor Summary
ParserContextImpl(Parser parser, ComponentDefinitionRegistry componentDefinitionRegistry, ComponentMetadata enclosingComponent, org.w3c.dom.Node sourceNode)
           
 
Method Summary
<T extends Metadata>
T
createMetadata(java.lang.Class<T> type)
          Create a new metadata instance of the given type.
 java.lang.String generateId()
          Generate a unique id following the same scheme that the blueprint container uses internally
 ComponentDefinitionRegistry getComponentDefinitionRegistry()
           
 java.lang.String getDefaultActivation()
          Get the default activation setting for the current blueprint file
 java.lang.String getDefaultAvailability()
          Get the default availability setting for the current blueprint file
 java.lang.String getDefaultTimeout()
          Get the default timeout setting for the current blueprint file
 ComponentMetadata getEnclosingComponent()
          Retrieve the ComponentMetadata of the component that encloses the current Node that is to be parsed by a namespace handler.
 Parser getParser()
           
 org.w3c.dom.Node getSourceNode()
          Returns the DOM Node that was passed to the NamespaceHandler call for which this ParserContext instance was created.
<T> T
parseElement(java.lang.Class<T> type, ComponentMetadata enclosingComponent, org.w3c.dom.Element element)
          Invoke the blueprint parser to parse a DOM element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserContextImpl

public ParserContextImpl(Parser parser,
                         ComponentDefinitionRegistry componentDefinitionRegistry,
                         ComponentMetadata enclosingComponent,
                         org.w3c.dom.Node sourceNode)
Method Detail

getComponentDefinitionRegistry

public ComponentDefinitionRegistry getComponentDefinitionRegistry()
Specified by:
getComponentDefinitionRegistry in interface ParserContext

getEnclosingComponent

public ComponentMetadata getEnclosingComponent()
Description copied from interface: ParserContext
Retrieve the ComponentMetadata of the component that encloses the current Node that is to be parsed by a namespace handler. In case of top-level components this method will return null.

Specified by:
getEnclosingComponent in interface ParserContext

getSourceNode

public org.w3c.dom.Node getSourceNode()
Description copied from interface: ParserContext
Returns the DOM Node that was passed to the NamespaceHandler call for which this ParserContext instance was created.

Specified by:
getSourceNode in interface ParserContext

createMetadata

public <T extends Metadata> T createMetadata(java.lang.Class<T> type)
Description copied from interface: ParserContext
Create a new metadata instance of the given type. The returned object will also implement the appropriate MutableComponentMetadata interface, so as to allow the caller to set the properties of the metadata. Note that the returned object may not be initialised, so callers should take care to assure every property needed by the blueprint extender is set.

Specified by:
createMetadata in interface ParserContext
Type Parameters:
T - The expected Metadata type to be created
Parameters:
type - the class of the Metadata object to create
Returns:
a new instance

parseElement

public <T> T parseElement(java.lang.Class<T> type,
                          ComponentMetadata enclosingComponent,
                          org.w3c.dom.Element element)
Description copied from interface: ParserContext
Invoke the blueprint parser to parse a DOM element.

Specified by:
parseElement in interface ParserContext
Type Parameters:
T - The expected metadata type to be parsed
Parameters:
type - the class of the Metadata type to be parsed
enclosingComponent - The component metadata that contains the Element to be parsed
element - The DOM element that is to be parsed

getParser

public Parser getParser()

generateId

public java.lang.String generateId()
Description copied from interface: ParserContext
Generate a unique id following the same scheme that the blueprint container uses internally

Specified by:
generateId in interface ParserContext

getDefaultActivation

public java.lang.String getDefaultActivation()
Description copied from interface: ParserContext
Get the default activation setting for the current blueprint file

Specified by:
getDefaultActivation in interface ParserContext

getDefaultAvailability

public java.lang.String getDefaultAvailability()
Description copied from interface: ParserContext
Get the default availability setting for the current blueprint file

Specified by:
getDefaultAvailability in interface ParserContext

getDefaultTimeout

public java.lang.String getDefaultTimeout()
Description copied from interface: ParserContext
Get the default timeout setting for the current blueprint file

Specified by:
getDefaultTimeout in interface ParserContext


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.