1 10 11 package org.picocontainer.gems.adapters; 12 13 import com.thoughtworks.proxy.ProxyFactory; 14 import com.thoughtworks.proxy.factory.StandardProxyFactory; 15 16 import org.picocontainer.ComponentAdapter; 17 import org.picocontainer.Parameter; 18 import org.picocontainer.PicoIntrospectionException; 19 import org.picocontainer.defaults.AssignabilityRegistrationException; 20 import org.picocontainer.defaults.ComponentAdapterFactory; 21 import org.picocontainer.defaults.DecoratingComponentAdapterFactory; 22 import org.picocontainer.defaults.DefaultComponentAdapterFactory; 23 import org.picocontainer.defaults.NotConcreteRegistrationException; 24 25 26 34 public class HotSwappingComponentAdapterFactory extends DecoratingComponentAdapterFactory { 35 private final ProxyFactory proxyFactory; 36 37 public HotSwappingComponentAdapterFactory() { 38 this(new DefaultComponentAdapterFactory()); 39 } 40 41 public HotSwappingComponentAdapterFactory(ComponentAdapterFactory delegate) { 42 this(delegate, new StandardProxyFactory()); 43 } 44 45 public HotSwappingComponentAdapterFactory(ComponentAdapterFactory delegate, ProxyFactory proxyFactory) { 46 super(delegate); 47 this.proxyFactory = proxyFactory; 48 } 49 50 public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters) 51 throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException { 52 ComponentAdapter componentAdapter = super.createComponentAdapter(componentKey, componentImplementation, parameters); 53 return new HotSwappingComponentAdapter(componentAdapter, proxyFactory); 54 } 55 } 56 | Popular Tags |