1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.config.pool; |
12 | |
|
13 | |
import org.mule.impl.MuleDescriptor; |
14 | |
import org.mule.impl.model.ComponentFactory; |
15 | |
import org.mule.impl.model.DefaultMuleProxy; |
16 | |
import org.mule.umo.UMOException; |
17 | |
import org.mule.umo.lifecycle.InitialisationException; |
18 | |
import org.mule.umo.model.UMOModel; |
19 | |
import org.mule.util.ObjectFactory; |
20 | |
import org.mule.util.ObjectPool; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public abstract class AbstractProxyFactory implements ObjectFactory |
28 | |
{ |
29 | |
|
30 | |
|
31 | |
|
32 | |
protected MuleDescriptor descriptor; |
33 | |
protected UMOModel model; |
34 | |
protected ObjectPool pool; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
public AbstractProxyFactory(MuleDescriptor descriptor, UMOModel model) |
44 | 0 | { |
45 | 0 | this.descriptor = descriptor; |
46 | 0 | this.model = model; |
47 | 0 | } |
48 | |
|
49 | |
public Object create() throws UMOException |
50 | |
{ |
51 | 0 | Object component = ComponentFactory.createComponent(descriptor); |
52 | 0 | afterComponentCreate(component); |
53 | 0 | return createProxy(component); |
54 | |
} |
55 | |
|
56 | |
protected Object createProxy(Object component) throws UMOException |
57 | |
{ |
58 | 0 | return new DefaultMuleProxy(component, descriptor, model, pool); |
59 | |
} |
60 | |
|
61 | |
protected void afterComponentCreate(Object component) throws InitialisationException |
62 | |
{ |
63 | |
|
64 | 0 | } |
65 | |
|
66 | |
public ObjectPool getPool() |
67 | |
{ |
68 | 0 | return pool; |
69 | |
} |
70 | |
|
71 | |
public void setPool(ObjectPool pool) |
72 | |
{ |
73 | 0 | this.pool = pool; |
74 | 0 | } |
75 | |
} |