thinkmap.xmlconfig
Class XMLConfigBuilder

java.lang.Object
  extended by thinkmap.xmlconfig.XMLConfigBuilder
All Implemented Interfaces:
ConfigBuilder

public class XMLConfigBuilder
extends Object
implements ConfigBuilder


Nested Class Summary
protected  class XMLConfigBuilder.ConfigInjection
           
protected  class XMLConfigBuilder.ContextInjection
           
protected static class XMLConfigBuilder.ContextNotification
           
protected  class XMLConfigBuilder.Injection
           
protected  class XMLConfigBuilder.RegisteredInjection
           
 
Field Summary
protected  ClassLoader cl
           
static String CONFIG_NS_URI
           
static String CONFIG_NS29_URI
           
protected  IThinkmapContext context
           
protected  Map<Class<? extends Annotation>,AnnotationHandler<?>> handlers
           
protected  List<XMLConfigBuilder.Injection> injections
           
protected  List<thinkmap.xmlconfig.Assembler.ConfigurationListener> postConfigureListeners
           
protected  List<thinkmap.xmlconfig.Assembler.ConfigurationListener> preConfigureListeners
           
 
Constructor Summary
  XMLConfigBuilder()
           
  XMLConfigBuilder(IThinkmapContext context)
           
protected XMLConfigBuilder(XMLConfigBuilder parent)
           
 
Method Summary
protected  void addDefaultNamespaces()
           
 void addNamespace(Namespace ns)
           
protected  XObject build(Assembler assembler, ConfigElement rootElement, Object root)
           
 Object build(ThinkmapConfig config)
           
protected  Assembler createAssembler()
           
 Assembler createAssembler(Method m)
           
 File createFile(String arg)
           
 Namespace createNamespace()
           
 XObject createSubBuilder(Assembler assembler, URL url)
           
 URL createURL(String arg)
           
 ClassLoader getClassLoader()
           
 ThinkmapConfig getConfig()
           
 URL getConfigFileURL()
           
protected static Method getConfigMethod(Class<?> cType, String name)
           
 IThinkmapContext getContext()
           
 XMLException getErrors()
           
 Namespace getNamespaceByURI(String uri)
           
 Namespace[] getNamespaces()
           
protected  List<XMLConfigBuilder.ContextNotification> getNotifications()
           
 XObject getRoot()
           
 boolean isFailOnErrors()
           
 void loadNamespace(URL url)
           
protected  XMLConfigBuilder.ContextNotification newContextNotification(XObject target, Class<? extends Annotation> when, Method method, ConfigElement currentElement)
           
protected  ConfigElement parseXML(String docURI, InputStream stream)
           
protected  void processInjections(Assembler assembler)
           
protected
<T extends Annotation>
void
registerAnnotationHandler(Class<T> ann, AnnotationHandler<T> handler)
           
 void registerNSResource(String uri, String resource)
           
 void registerNSURL(String uri, URL resource)
           
 void reportError(ConfigElement ce, Throwable ex)
           
 void setClassLoader(ClassLoader cl)
           
protected  void setConfig(ThinkmapConfig config)
           
 void setConfigFileURL(URL url)
           
 void setContext(IThinkmapContext context)
           
 void setFailOnErrors(boolean failOnErrors)
           
protected  void setupHandlers(Assembler assembler)
           
static XMLException wrapError(ConfigElement ce, Throwable ex)
           
protected  void wrapUp(Assembler assembler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_NS29_URI

public static final String CONFIG_NS29_URI
See Also:
Constant Field Values

CONFIG_NS_URI

public static final String CONFIG_NS_URI
See Also:
Constant Field Values

injections

protected List<XMLConfigBuilder.Injection> injections

handlers

protected Map<Class<? extends Annotation>,AnnotationHandler<?>> handlers

postConfigureListeners

protected List<thinkmap.xmlconfig.Assembler.ConfigurationListener> postConfigureListeners

preConfigureListeners

protected List<thinkmap.xmlconfig.Assembler.ConfigurationListener> preConfigureListeners

context

protected IThinkmapContext context

cl

protected ClassLoader cl
Constructor Detail

XMLConfigBuilder

public XMLConfigBuilder()

XMLConfigBuilder

public XMLConfigBuilder(IThinkmapContext context)

XMLConfigBuilder

protected XMLConfigBuilder(XMLConfigBuilder parent)
Method Detail

setConfigFileURL

public void setConfigFileURL(URL url)

getConfigFileURL

public URL getConfigFileURL()

addDefaultNamespaces

protected void addDefaultNamespaces()
                             throws XMLException
Throws:
XMLException

createSubBuilder

public XObject createSubBuilder(Assembler assembler,
                                URL url)

setupHandlers

protected void setupHandlers(Assembler assembler)

getNotifications

protected List<XMLConfigBuilder.ContextNotification> getNotifications()

newContextNotification

protected XMLConfigBuilder.ContextNotification newContextNotification(XObject target,
                                                                      Class<? extends Annotation> when,
                                                                      Method method,
                                                                      ConfigElement currentElement)

setContext

public void setContext(IThinkmapContext context)

getContext

public IThinkmapContext getContext()

setConfig

protected void setConfig(ThinkmapConfig config)

build

public Object build(ThinkmapConfig config)
             throws XMLException,
                    IOException
Specified by:
build in interface ConfigBuilder
Throws:
XMLException
IOException

build

protected XObject build(Assembler assembler,
                        ConfigElement rootElement,
                        Object root)
                 throws XMLException
Throws:
XMLException

wrapUp

protected void wrapUp(Assembler assembler)
               throws Exception
Throws:
Exception

processInjections

protected void processInjections(Assembler assembler)
                          throws XMLException
Throws:
XMLException

getRoot

public XObject getRoot()

getConfig

public ThinkmapConfig getConfig()

createAssembler

protected Assembler createAssembler()

createAssembler

public Assembler createAssembler(Method m)

setFailOnErrors

public void setFailOnErrors(boolean failOnErrors)

isFailOnErrors

public boolean isFailOnErrors()

registerAnnotationHandler

protected <T extends Annotation> void registerAnnotationHandler(Class<T> ann,
                                                                AnnotationHandler<T> handler)

reportError

public void reportError(ConfigElement ce,
                        Throwable ex)
                 throws XMLException
Throws:
XMLException

wrapError

public static XMLException wrapError(ConfigElement ce,
                                     Throwable ex)

getErrors

public XMLException getErrors()

setClassLoader

public void setClassLoader(ClassLoader cl)

getClassLoader

public ClassLoader getClassLoader()

createNamespace

public Namespace createNamespace()

addNamespace

public void addNamespace(Namespace ns)

registerNSResource

public void registerNSResource(String uri,
                               String resource)

registerNSURL

public void registerNSURL(String uri,
                          URL resource)

getNamespaces

public Namespace[] getNamespaces()

getNamespaceByURI

public Namespace getNamespaceByURI(String uri)
                            throws XMLException
Throws:
XMLException

loadNamespace

public void loadNamespace(URL url)
                   throws XMLException
Throws:
XMLException

parseXML

protected ConfigElement parseXML(String docURI,
                                 InputStream stream)
                          throws XMLException,
                                 IOException
Throws:
XMLException
IOException

createFile

public File createFile(String arg)

createURL

public URL createURL(String arg)
              throws MalformedURLException
Throws:
MalformedURLException

getConfigMethod

protected static Method getConfigMethod(Class<?> cType,
                                        String name)


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.