org.sca4j.introspection.xml
Interface Loader

All Known Subinterfaces:
LoaderRegistry

public interface Loader

System service for loading configuration artifacts from an XML source.

Version:
$Rev: 4301 $ $Date: 2008-05-23 06:33:58 +0100 (Fri, 23 May 2008) $

Method Summary
<OUTPUT> OUTPUT
load(java.net.URL url, java.lang.Class<OUTPUT> type, IntrospectionContext context)
          Load a model object from a specified location.
<OUTPUT> OUTPUT
load(javax.xml.stream.XMLStreamReader reader, java.lang.Class<OUTPUT> type, IntrospectionContext context)
          Parse the supplied XML stream, dispatching to the appropriate registered loader for each element encountered in the stream.
 

Method Detail

load

<OUTPUT> OUTPUT load(javax.xml.stream.XMLStreamReader reader,
                     java.lang.Class<OUTPUT> type,
                     IntrospectionContext context)
            throws javax.xml.stream.XMLStreamException,
                   UnrecognizedElementException
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
type - the type of Java object that should be returned
context - the current loader context
Returns:
the model object obtained by parsing the current element on the stream
Throws:
UnrecognizedElementException - if no loader was found for the element
javax.xml.stream.XMLStreamException - if there was a problem reading the stream
java.lang.ClassCastException - if the XML type cannot be cast to the expected output type

load

<OUTPUT> OUTPUT load(java.net.URL url,
                     java.lang.Class<OUTPUT> type,
                     IntrospectionContext context)
            throws LoaderException
Load a model object from a specified location.

Parameters:
url - the location of an XML document to be loaded
type - the type of Java Object that should be returned
context - the current loader context
Returns:
the model ojbect loaded from the document
Throws:
LoaderException - if there was a problem loading the document
java.lang.ClassCastException - if the XML type cannot be cast to the expected output type


Copyright © 2008-2011 Service Symphony. All Rights Reserved.