1 package org.apache.axis2.context; 2 3 20 21 import org.apache.axis2.description.ServiceDescription; 22 import org.apache.axis2.engine.AxisConfiguration; 23 import org.apache.axis2.engine.AxisFault; 24 import org.apache.axis2.storage.AxisStorage; 25 import org.apache.axis2.util.threadpool.ThreadPool; 26 27 import javax.xml.namespace.QName ; 28 import java.util.HashMap ; 29 import java.util.Map ; 30 31 public class ConfigurationContext extends AbstractContext{ 32 33 private AxisConfiguration axisConfiguration; 34 private AxisStorage storage; 35 36 private Map sessionContextMap; 37 private Map moduleContextMap; 38 private ThreadPool threadPool; 39 40 44 private final Map operationContextMap = new HashMap (); 45 46 private final Map serviceContextMap; 47 48 public ConfigurationContext(AxisConfiguration registry) { 49 super(null); 50 this.axisConfiguration = registry; 51 serviceContextMap = new HashMap (); 52 moduleContextMap = new HashMap (); 53 sessionContextMap = new HashMap (); 54 } 55 56 62 63 public void init() throws AxisFault { 64 65 } 66 67 public synchronized void removeService(QName name) { 68 serviceContextMap.remove(name); 69 } 70 71 74 public AxisConfiguration getAxisConfiguration() { 75 return axisConfiguration; 76 } 77 78 81 public void setAxisConfiguration(AxisConfiguration configuration) { 82 axisConfiguration = configuration; 83 } 84 85 public synchronized void registerOperationContext(String messageID, OperationContext mepContext) { 86 this.operationContextMap.put(messageID, mepContext); 87 } 88 89 public OperationContext getOperationContext(String messageID) { 90 return (OperationContext) this.operationContextMap.get(messageID); 91 } 92 93 public Map getOperationContextMap() { 94 return this.operationContextMap; 95 } 96 97 public synchronized void registerServiceContext(String serviceInstanceID, ServiceContext serviceContext) { 98 this.serviceContextMap.put(serviceInstanceID, serviceContext); 99 } 100 101 public ServiceContext getServiceContext(String serviceInstanceID) { 102 return (ServiceContext) this.serviceContextMap.get(serviceInstanceID); 103 } 104 105 public AxisStorage getStorage() { 106 return storage; 107 } 108 109 public void setStorage(AxisStorage storage) { 110 this.storage = storage; 111 } 112 113 public ServiceContext createServiceContext(QName serviceName) throws AxisFault { 114 ServiceDescription service = axisConfiguration.getService(serviceName); 115 if(service != null){ 116 ServiceContext serviceContext = new ServiceContext(service, this); 117 return serviceContext; 118 }else{ 119 throw new AxisFault("Service not found service name = "+serviceName ); 120 } 121 } 122 123 126 public ThreadPool getThreadPool() { 127 if(threadPool == null){ 128 threadPool = new ThreadPool(); 129 } 130 return threadPool; 131 } 132 133 } 134 | Popular Tags |