Tuscany Core

org.apache.tuscany.core.loader
Interface StAXLoaderRegistry

All Known Implementing Classes:
StAXLoaderRegistryImpl

public interface StAXLoaderRegistry

Registry for XML loaders that can parse a StAX input stream and return model objects.

Loaders will typically be contributed to the system by any extension that needs to handle extension specific information contained in some XML configuration file. The loader can be contributed as a system component with an autowire reference to this registry which is used during initialization to actually register.

This registry can also be used to parse an input stream, dispatching to the appropriate loader for each element accepted. Loaders can call back to the registry to load sub-elements that they are not able to handle directly.

Version:
$Rev$ $Date$

Method Summary
 org.apache.tuscany.model.assembly.AssemblyContext getContext()
          Deprecated. 
 org.apache.tuscany.model.assembly.AssemblyObject load(javax.xml.stream.XMLStreamReader reader, LoaderContext loaderContext)
          Parse the supplied XML stream dispatching to the appropriate registered loader for each element encountered in the stream.
<T extends org.apache.tuscany.model.assembly.AssemblyObject>
void
registerLoader(javax.xml.namespace.QName element, StAXElementLoader<T> loader)
          Register a loader.
 void setContext(org.apache.tuscany.model.assembly.AssemblyContext context)
          Deprecated. 
<T extends org.apache.tuscany.model.assembly.AssemblyObject>
void
unregisterLoader(javax.xml.namespace.QName element, StAXElementLoader<T> loader)
          Unregister a loader.
 

Method Detail

registerLoader

<T extends org.apache.tuscany.model.assembly.AssemblyObject> void registerLoader(javax.xml.namespace.QName element,
                                                                                 StAXElementLoader<T> loader)
Register a loader. This operation will typically be called by a loader during its initialization.

Parameters:
element - the element that should be delegated to the contibuted loader
loader - a loader that is being contributed to the system

unregisterLoader

<T extends org.apache.tuscany.model.assembly.AssemblyObject> void unregisterLoader(javax.xml.namespace.QName element,
                                                                                   StAXElementLoader<T> loader)
Unregister a loader. This will typically be called by a loader as it is being destroyed.

Parameters:
element - the element that was being delegated to the contibuted loader
loader - a loader that should no longer be used

load

org.apache.tuscany.model.assembly.AssemblyObject load(javax.xml.stream.XMLStreamReader reader,
                                                      LoaderContext loaderContext)
                                                      throws javax.xml.stream.XMLStreamException,
                                                             ConfigurationLoadException
Parse the supplied XML stream dispatching to the appropriate registered loader for each element encountered in the stream.

This method must be called with the XML cursor positioned on a START_ELEMENT event. When this method returns, the stream will be positioned on the corresponding END_ELEMENT event.

Parameters:
reader - the XML stream to parse
loaderContext -
Returns:
the model object obtained by parsing the current element on the stream
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the stream
ConfigurationLoadException

getContext

@Deprecated
org.apache.tuscany.model.assembly.AssemblyContext getContext()
Deprecated. 

Hack to allow loaders to initialize model objects on the fly. Remove when initialization has been moved from the model implementation to the loader.

Returns:
the model context for this load operation

setContext

@Deprecated
void setContext(org.apache.tuscany.model.assembly.AssemblyContext context)
Deprecated. 

Hack to allow loaders to initialize model objects on the fly. Remove when initialization has been moved from the model implementation to the loader.

Parameters:
context - the model context for this load operation

Tuscany Core

-