1 23 package com.sun.enterprise.jbi.serviceengine.bridge; 24 import com.sun.enterprise.jbi.serviceengine.ServiceEngineException; 25 import com.sun.enterprise.jbi.serviceengine.core.EndpointRegistry; 26 import com.sun.enterprise.jbi.serviceengine.core.ServiceEngineEndpoint; 27 import java.util.Hashtable ; 28 import java.util.Map ; 29 import javax.xml.namespace.QName ; 30 31 32 33 37 public class RuntimeEndpointInfoRegistryImpl implements 38 RuntimeEndpointInfoRegistry { 39 40 private Hashtable store; 41 private static RuntimeEndpointInfoRegistry registry = new RuntimeEndpointInfoRegistryImpl(); 42 private EndpointRegistry endpointRegistry = null; 43 44 45 private RuntimeEndpointInfoRegistryImpl() { 46 store = new Hashtable (5); 47 endpointRegistry = EndpointRegistry.getInstance(); 48 } 49 50 public static RuntimeEndpointInfoRegistry getInstance() { 51 return registry; 52 } 53 54 public Object getRuntimeEndpointInfo(QName service, String endpoint) 55 throws ServiceEngineException { 56 Object runtimeInfo = null; 57 ServiceEngineEndpoint endpt = null; 58 Map runtimeEndpointInfoTable = null; 59 endpt = endpointRegistry.get(service, endpoint); 60 61 if(endpt != null) { 62 runtimeEndpointInfoTable = (Map )store.get(service); 63 if(runtimeEndpointInfoTable == null) { 64 runtimeEndpointInfoTable = new Hashtable (); 65 store.put(service, runtimeEndpointInfoTable); 66 } 67 68 runtimeInfo = runtimeEndpointInfoTable.get(endpoint); 69 70 if(runtimeInfo == null) { 71 72 if(endpt.isJAXWSEndpoint()) 73 runtimeInfo = JAXWSRuntimeEndpointHelper.populateRuntimeInfo(endpt); 74 else 75 runtimeInfo = JAXRPCRuntimeEndpointHelper.populateRuntimeInfo(endpt); 76 77 78 runtimeEndpointInfoTable.put(endpoint, runtimeInfo); 79 } else { 80 if(endpt.isJAXWSEndpoint()) { 81 if (endpt.isImplementedByEJB()) 82 runtimeInfo = JAXWSRuntimeEndpointHelper.populateRuntimeInfo(endpt); 83 else 84 JAXWSRuntimeEndpointHelper.setMessageContext((com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo)runtimeInfo); 85 } 86 } 87 return runtimeInfo; 88 } 89 throw new ServiceEngineException("Endpoint " + endpoint + "not deployed in JBI"); 90 } 91 92 public void deleteRuntimeEndpointInfo(QName service, String endpoint) { 93 94 if(endpoint != null) { 95 Map runtimeInfoTable = (Map )store.get(service); 96 97 if((runtimeInfoTable != null) && 98 (runtimeInfoTable.get(endpoint) != null)) 99 runtimeInfoTable.remove(endpoint); 100 } 101 } 102 103 public void releaseEndpoint(QName service, String endpointName) { 104 ServiceEngineEndpoint endpt = endpointRegistry.get(service, endpointName); 105 if(endpt!=null && endpt.isImplementedByEJB()) 106 JAXWSRuntimeEndpointHelper.releaseEjbEndpoint(endpt); 107 108 } 109 } 110 | Popular Tags |