org.eclipse.actf.validation.validators
Class DefaultValidationContextFactory

java.lang.Object
  extended by org.eclipse.actf.validation.validators.DefaultValidationContextFactory
All Implemented Interfaces:
IValidationContextFactory

public class DefaultValidationContextFactory
extends Object
implements IValidationContextFactory

The IValidationContext factory.

Note: All process-validator mappings are currently hard-coded in this implementation. Future work will include allowing these mappings to be specified in a rulebase.

Author:
John Buslawski

Field Summary
protected static Map namesToContexts
           
protected static Map processToContexts
           
 
Constructor Summary
protected DefaultValidationContextFactory()
           
 
Method Summary
 IValidationContext getContextByProcessName(String procName)
          creates and initialized a validation context for the given validation process name.
 IValidationContext getContextInstance(String name)
          gets an instance of the validation context for the given name.
static DefaultValidationContextFactory getInstance()
           
 void registerContextByProcessName(String processName, String contextClassName)
          registers a validation context for the validation process type
 void registerContextClassName(String name, String contextClassName)
          registers a validation context for the given type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namesToContexts

protected static final Map namesToContexts

processToContexts

protected static final Map processToContexts
Constructor Detail

DefaultValidationContextFactory

protected DefaultValidationContextFactory()
Method Detail

getInstance

public static DefaultValidationContextFactory getInstance()
Returns:
The unique instance of this class.

registerContextClassName

public void registerContextClassName(String name,
                                     String contextClassName)
registers a validation context for the given type

Specified by:
registerContextClassName in interface IValidationContextFactory
Parameters:
name - - name under which the context is being registered
contextClassName - - the class name of the context implementation

registerContextByProcessName

public void registerContextByProcessName(String processName,
                                         String contextClassName)
registers a validation context for the validation process type

Specified by:
registerContextByProcessName in interface IValidationContextFactory
Parameters:
processName - - validation process name under which the context is being registered
contextClassName - - the class name of the context implementation

getContextInstance

public IValidationContext getContextInstance(String name)
gets an instance of the validation context for the given name. The context must have been previously registered via the registerContextClassName method.

Specified by:
getContextInstance in interface IValidationContextFactory
Parameters:
name - - name of the validation context
Returns:
the registered conetxt for the given name or null if there was no context registered under that name

getContextByProcessName

public IValidationContext getContextByProcessName(String procName)
creates and initialized a validation context for the given validation process name. The context must have been previously registered via the registerContextClassName method.

Specified by:
getContextByProcessName in interface IValidationContextFactory
Parameters:
procName - - name of the validation process
Returns:
the registered validation context for the given process name or null if there was no conext registered under that name