1 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.util.ObjectFactory; 19 import org.mule.util.ObjectPool; 20 21 28 29 public abstract class AbstractProxyFactory implements ObjectFactory 30 { 31 34 protected MuleDescriptor descriptor; 35 protected ObjectPool pool; 36 37 44 public AbstractProxyFactory(MuleDescriptor descriptor) 45 { 46 this.descriptor = descriptor; 47 } 48 49 public Object create() throws UMOException 50 { 51 Object component = ComponentFactory.createComponent(descriptor); 52 afterComponentCreate(component); 53 return createProxy(component); 54 } 55 56 protected Object createProxy(Object component) throws UMOException 57 { 58 return new DefaultMuleProxy(component, descriptor, pool); 59 } 60 61 protected void afterComponentCreate(Object component) throws InitialisationException 62 { 63 } 65 66 public ObjectPool getPool() 67 { 68 return pool; 69 } 70 71 public void setPool(ObjectPool pool) 72 { 73 this.pool = pool; 74 } 75 } 76 | Popular Tags |