com.aurorasoftworks.signal.runtime.core.context
Class ContextClassLoader

java.lang.Object
  extended by com.aurorasoftworks.signal.runtime.core.context.ContextClassLoader
All Implemented Interfaces:
IContextLoader

public class ContextClassLoader
extends java.lang.Object
implements IContextLoader

An implementation of the IContextLoader interface that instantiates IContext objects with reflection.

Author:
Marek

Constructor Summary
protected ContextClassLoader()
          Creates an instance of ContextClassLoader.
 
Method Summary
protected  IContext createContextInstance(java.lang.Class contextClassName)
          Creates a context instance.
static IContextLoader getInstance()
          Returns the singleton instance of this class.
 IContext loadContext(java.lang.String contextClass)
          Loads a context by instantiating the specified class.
protected  java.lang.Class loadContextClass(java.lang.String contextClassName)
          Loads the specified context class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextClassLoader

protected ContextClassLoader()
Creates an instance of ContextClassLoader. This constructor is declared as protected rather than private so that this class can be extended if needed.

Method Detail

getInstance

public static IContextLoader getInstance()
Returns the singleton instance of this class.

Returns:
singleton instance

loadContext

public IContext loadContext(java.lang.String contextClass)
                     throws ContextException
Loads a context by instantiating the specified class.

Specified by:
loadContext in interface IContextLoader
Parameters:
contextClass - name of a context class to be instantiated
Returns:
a loaded context
Throws:
ContextException - if an error occurs while loading the context

createContextInstance

protected IContext createContextInstance(java.lang.Class contextClassName)
                                  throws ContextException
Creates a context instance.

Parameters:
contextClassName -
Returns:
a new instance of the provided context class
Throws:
ContextException

loadContextClass

protected java.lang.Class loadContextClass(java.lang.String contextClassName)
                                    throws ContextException
Loads the specified context class.

Parameters:
contextClassName - name of a class to be loaded
Returns:
loaded class
Throws:
ContextException - if the class cannot be loaded


Copyright © 2010. All Rights Reserved.