1 7 8 10 package org.jboss.net.axis; 11 12 import org.jboss.axis.EngineConfiguration; 13 import org.jboss.axis.EngineConfigurationFactory; 14 import org.jboss.axis.client.AxisClient; 15 import org.jboss.axis.client.Service; 16 import org.jboss.axis.configuration.EngineConfigurationFactoryFinder; 17 18 import javax.naming.Context ; 19 import javax.naming.Name ; 20 import javax.naming.Reference ; 21 import javax.naming.spi.ObjectFactory ; 22 import java.util.Hashtable ; 23 24 34 35 public class ServiceFactory implements ObjectFactory 36 { 37 38 42 public Object getObjectInstance(Object refObject, 43 Name name, 44 Context nameCtx, 45 Hashtable environment) 46 throws Exception 47 { 48 Service instance = null; 49 if (refObject instanceof Reference ) 50 { 51 Reference ref = (Reference )refObject; 52 53 Class serviceClass = 54 Thread.currentThread().getContextClassLoader().loadClass(ref.getClassName()); 55 56 EngineConfigurationFactory factory = 57 EngineConfigurationFactoryFinder.newFactory((String )ref 58 .get(Constants.CONFIGURATION_CONTEXT) 59 .getContent()); 60 61 EngineConfiguration engine = null; 62 63 if (factory != null) 64 { 65 engine = factory.getClientEngineConfig(); 66 } 67 68 instance = (Service)serviceClass.newInstance(); 69 70 instance.setEngineConfiguration(engine); 71 instance.setEngine(new AxisClient(engine)); 73 } 74 75 return instance; 76 } 77 78 } 79 | Popular Tags |