blob: f4828d5bff5f59e0a609c1c8bc86784276024435 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*************************************************
*
* = PACKAGE
* JACE.Connection
*
* = FILENAME
* CreationStrategy.java
*
*@author Prashant Jain
*
*************************************************/
package JACE.Connection;
/**
* Defines the interface for specifying a creation strategy for a
* <a href="ACE.Connection.SvcHandler.html#_top_"><tt>SvcHandler</tt></a> to the
* <a href="ACE.Connection.StrategyAcceptor.html#_top_"><tt>StrategyAcceptor</tt></a>.
* <P>
* 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
*@see StrategyAcceptor
*@see AcceptStrategy
*@see 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_;
}
|