net.dpml.util
Class DecoderFactory

java.lang.Object
  extended by net.dpml.util.DecoderFactory

public final class DecoderFactory
extends Object

Utility class supporting resolution of element decoders.


Constructor Summary
DecoderFactory()
          Creation of a new helper factory using default mappings.
DecoderFactory(Map map)
          Creation of a new decoder factory.
 
Method Summary
 URI getDecoderURI(Element element)
          Resolve the decoder uri from a supplied element.
static URI getDecoderURIFromNamespaceURI(String urn)
          Resolve the part handler given an element namespace.
 Decoder loadDecoder(Element element)
          Get an element helper based on the namespace declared by the supplied element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecoderFactory

public DecoderFactory()
Creation of a new helper factory using default mappings.


DecoderFactory

public DecoderFactory(Map map)
Creation of a new decoder factory. The supplied map contains the mapping of namespace urn to decoder plugin uris. If the "dpml/lang/dpml-part" namespace is not included in the map a special uri will be assigned associating the namespace with this package implementation.

Parameters:
map - the namespace to helper uri map
Method Detail

loadDecoder

public Decoder loadDecoder(Element element)
                    throws Exception
Get an element helper based on the namespace declared by the supplied element. If the element namespace is the dpml/part namespace then a local uri is returned, otherwise evaluation is based on namespace to hanlder mappings supplied to the factory constructor. If a map entry is resolved, a delegating builder is established with the resolved helper uri, otherwise a helper uri is resolved by substituting the namespace uri artifact type for "part" on the assumption that a part implemenation will be available.

Parameters:
element - the DOM element
Returns:
the decoder
Throws:
Exception - if an eror occurs

getDecoderURI

public URI getDecoderURI(Element element)
                  throws Exception
Resolve the decoder uri from a supplied element.

Parameters:
element - the DOM element
Returns:
the decoder uri
Throws:
Exception - if an error occurs

getDecoderURIFromNamespaceURI

public static URI getDecoderURIFromNamespaceURI(String urn)
                                         throws Exception
Resolve the part handler given an element namespace.

Parameters:
urn - the namespace value
Returns:
the decoder uri
Throws:
Exception - if an error occurs