/************************************************* * * = PACKAGE * ACE.Connection * * = FILENAME * CreationStrategy.java * *@author Prashant Jain * *************************************************/ package ACE.Connection; /** *
*

SYNOPSIS

*
* Defines the interface for specifying a creation strategy for a * SvcHandler to the * StrategyAcceptor. *
* *

DESCRIPTION
*

* The default behavior is to make a new SvcHandler. However, * subclasses can override this strategy to perform SvcHandler * creation in any way that they like (such as creating subclass * instances of SvcHandler, using a singleton, dynamically * linking the handler, etc.). *
* *@see SvcHandler,StrategyAcceptor,AcceptStrategy,ActivateStrategy */ public class CreationStrategy { /** * Create an instance of Creation Strategy. *@param handlerFactory Svc Handler factory that is used to create * an instance of a Svc Handler */ public CreationStrategy (Class handlerFactory) { this.handlerFactory_ = handlerFactory; } /** * Create a new SvcHandler. Note that subclasses should override * this method to provide a new creation strategy. *@return reference to a new instance of the SvcHandler (or subclass) *@exception InstantiationException Unable to instantiate. *@exception IllegalAccessException No handler factory available. */ public SvcHandler makeSvcHandler () throws InstantiationException, IllegalAccessException { // Create a new Svc_Handler return (SvcHandler) handlerFactory_.newInstance (); } private Class handlerFactory_; }