geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1132647 - in /geronimo/server/trunk/plugins: axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/ axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/p...
Date Mon, 06 Jun 2011 13:58:22 GMT
Author: xuhaihong
Date: Mon Jun  6 13:58:21 2011
New Revision: 1132647

URL: http://svn.apache.org/viewvc?rev=1132647&view=rev
Log:
GERONIMO-5990 A JAXWSApplicationContext GBean is added to hold all the available port info in the current web or ejb module
I hope that in the future, we could have a way to avoid create each factory gbean for each web service endpoint, and there will be a method like getWebServiceContainer method in this gbean

Added:
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSApplicationContext.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSEJBApplicationContext.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSWebApplicationContext.java
Modified:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainerFactoryGBean.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/WSDLUtils.java

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java (original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java Mon Jun  6 13:58:21 2011
@@ -17,6 +17,9 @@
 
 package org.apache.geronimo.axis2.ejb;
 
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -29,6 +32,7 @@ import org.apache.geronimo.axis2.AxisSer
 import org.apache.geronimo.axis2.GeronimoFactoryRegistry;
 import org.apache.geronimo.axis2.osgi.Axis2ModuleRegistry;
 import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
+import org.apache.geronimo.jaxws.JAXWSEJBApplicationContext;
 import org.apache.geronimo.jaxws.JAXWSUtils;
 import org.apache.geronimo.jaxws.JNDIResolver;
 import org.apache.geronimo.jaxws.PortInfo;
@@ -47,8 +51,9 @@ public class EJBWebServiceContainer exte
                                   Bundle bundle,
                                   Context context,
                                   Axis2ModuleRegistry axis2ModuleRegistry,
-                                  BeanContext deploymnetInfo) {
-        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry);
+                                  BeanContext deploymnetInfo,
+                                  String ejbModuleName) {
+        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, ejbModuleName);
         this.deploymnetInfo = deploymnetInfo;
     }
 
@@ -85,6 +90,12 @@ public class EJBWebServiceContainer exte
     }
 
     @Override
+    protected Collection<PortInfo> getPortInfos(Bundle bundle) {
+        JAXWSEJBApplicationContext jaxwsEJBApplicationContext = JAXWSEJBApplicationContext.get(moduleName);
+        return jaxwsEJBApplicationContext == null ? Collections.<PortInfo>emptyList() : jaxwsEJBApplicationContext.getPortInfos();
+    }
+
+    @Override
     protected AxisServiceGenerator createServiceGenerator() {
         AxisServiceGenerator serviceGenerator = super.createServiceGenerator();
         serviceGenerator.setCatalogName(JAXWSUtils.DEFAULT_CATALOG_EJB);

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java (original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java Mon Jun  6 13:58:21 2011
@@ -23,6 +23,7 @@ import java.util.Properties;
 import javax.naming.Context;
 
 import org.apache.geronimo.axis2.osgi.Axis2ModuleRegistry;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
@@ -54,6 +55,7 @@ public class EJBWebServiceGBean implemen
                               @ParamAttribute(name="portInfo")PortInfo portInfo,
                               @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel,
                               @ParamSpecial(type = SpecialAttributeType.bundle)Bundle bundle,
+                              @ParamSpecial(type = SpecialAttributeType.abstractName)AbstractName abName,
                               @ParamReference(name="WebServiceContainer")Collection<SoapHandler> webContainers,
                               @ParamAttribute(name="policyContextID")String policyContextID,
                               @ParamReference(name="ConfigurationFactory")ConfigurationFactory configurationFactory,
@@ -76,7 +78,7 @@ public class EJBWebServiceGBean implemen
         BeanContext deploymnetInfo = ejbDeploymentContext.getDeploymentInfo();
         Context context = deploymnetInfo.getJndiEnc();
 
-        this.container = new EJBWebServiceContainer(portInfo, beanClassName, bundle, context, axis2ModuleRegistry, deploymnetInfo);
+        this.container = new EJBWebServiceContainer(portInfo, beanClassName, bundle, context, axis2ModuleRegistry, deploymnetInfo, abName.getNameProperty(NameFactory.EJB_MODULE));
         this.container.init();
 
         soapHandler.addWebService(this.location,

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java (original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java Mon Jun  6 13:58:21 2011
@@ -21,6 +21,8 @@ import java.io.PrintWriter;
 import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -76,6 +78,7 @@ import org.apache.geronimo.axis2.client.
 import org.apache.geronimo.axis2.osgi.Axis2ModuleRegistry;
 import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
 import org.apache.geronimo.jaxws.JAXWSUtils;
+import org.apache.geronimo.jaxws.JAXWSWebApplicationContext;
 import org.apache.geronimo.jaxws.JNDIResolver;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.ServerJNDIResolver;
@@ -131,13 +134,16 @@ public abstract class Axis2WebServiceCon
 
     protected Axis2ModuleRegistry axis2ModuleRegistry;
 
-    public Axis2WebServiceContainer(PortInfo portInfo, String endpointClassName, Bundle bundle, Context context, Axis2ModuleRegistry axis2ModuleRegistry) {
+    protected String moduleName;
+
+    public Axis2WebServiceContainer(PortInfo portInfo, String endpointClassName, Bundle bundle, Context context, Axis2ModuleRegistry axis2ModuleRegistry, String moduleName) {
         this.endpointClassName = endpointClassName;
         this.portInfo = portInfo;
         this.bundle = bundle;
         this.context = context;
         this.jndiResolver = new ServerJNDIResolver(context);
         this.axis2ModuleRegistry = axis2ModuleRegistry;
+        this.moduleName = moduleName;
     }
 
     public void init() throws Exception {
@@ -172,7 +178,7 @@ public abstract class Axis2WebServiceCon
         service.setScope(Constants.SCOPE_APPLICATION);
         configurationContext.getAxisConfiguration().addService(service);
 
-        this.wsdlQueryHandler = new WSDLQueryHandler(this.service);
+        this.wsdlQueryHandler = new WSDLQueryHandler(this.service, portInfo, getPortInfos(bundle));
 
         /*
          * This replaces HandlerLifecycleManagerFactory for all web services.
@@ -189,6 +195,11 @@ public abstract class Axis2WebServiceCon
         this.service.addParameter(new Parameter(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER, new BundleClassLoader(bundle)));
     }
 
+    protected Collection<PortInfo> getPortInfos(Bundle bundle) {
+        JAXWSWebApplicationContext jaxwsWebApplicationContext = JAXWSWebApplicationContext.get(moduleName);
+        return jaxwsWebApplicationContext == null ? Collections.<PortInfo>emptyList() : jaxwsWebApplicationContext.getPortInfos();
+    }
+
     static String getBaseUri(URI request) {
         return request.getScheme() + "://" + request.getHost() + ":" + request.getPort() + request.getPath();
     }
@@ -490,7 +501,7 @@ public abstract class Axis2WebServiceCon
      */
     protected void configureHandlers() throws Exception {
         EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(this.service);
-        
+
         if(portInfo.getHandlerChainsInfo() != null) {
             desc.setHandlerChain(toAxis2HandlerChainsType(portInfo.getHandlerChainsInfo()));
         }
@@ -503,7 +514,7 @@ public abstract class Axis2WebServiceCon
 
         DescriptionUtils.registerHandlerHeaders(desc.getAxisService(), this.binding.getHandlerChain());
     }
-    
+
     private HandlerChainsType toAxis2HandlerChainsType(HandlerChainsInfo handlerChainsInfo) {
         HandlerChainsType handlerChains = new HandlerChainsType();
         for (HandlerChainInfo handlerChainInfo : handlerChainsInfo.handleChains) {
@@ -525,7 +536,7 @@ public abstract class Axis2WebServiceCon
         }
         return handlerChains;
     }
-    
+
     private void logHandlers(HandlerChainsType handlerChains) {
         if (handlerChains == null || handlerChains.getHandlerChain() == null || handlerChains.getHandlerChain().isEmpty()) {
             LOG.debug("No handlers");

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java (original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java Mon Jun  6 13:58:21 2011
@@ -23,8 +23,10 @@ import java.io.FileNotFoundException;
 import java.io.OutputStream;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.wsdl.Definition;
 import javax.wsdl.Import;
@@ -37,6 +39,7 @@ import javax.wsdl.extensions.schema.Sche
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLReader;
 import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
@@ -48,7 +51,7 @@ import javax.xml.transform.stream.Stream
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.jaxws.catalog.JAXWSCatalogManager;
 import org.apache.axis2.jaxws.description.EndpointDescription;
-
+import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.WSDLUtils;
 import org.apache.geronimo.jaxws.wsdl.CatalogWSDLLocator;
 import org.apache.xml.resolver.Catalog;
@@ -61,32 +64,70 @@ import org.w3c.dom.NodeList;
 public class WSDLQueryHandler {
 
     private static final Logger LOG = LoggerFactory.getLogger(WSDLQueryHandler.class);
-    
-    private static TransformerFactory transformerFactory = TransformerFactory.newInstance(); 
-    
+
+    public static final String WSDL_QUERY_MULTIPLE_PORT = "org.apache.geronimo.webservices.wsdlquery.multipleport";
+
+    private static final boolean multiplePortInWSDLQuery = Boolean.getBoolean(WSDL_QUERY_MULTIPLE_PORT);
+
+    private static TransformerFactory transformerFactory = TransformerFactory.newInstance();
+
     private Map<String, Definition> wsdlMap;
     private Map<String, SchemaReference> schemaMap;
     private Map<String, String> importMap;
     private int wsdlCounter;
     private int schemaCounter;
     private AxisService service;
-    private Catalog catalog;    
-    
+    private Catalog catalog;
+    private Map<QName,Map<String, String>> servicePortNameLocationMap;
+    private Map<QName, Set<String>> servicePortNamesMap;
+    private PortInfo portInfo;
+
     public WSDLQueryHandler(AxisService service) {
+        this(service, null, null);
+    }
+
+    public WSDLQueryHandler(AxisService service, PortInfo portInfo, Collection<PortInfo> portInfos) {
         this.service = service;
         EndpointDescription ed = AxisServiceGenerator.getEndpointDescription(this.service);
         JAXWSCatalogManager catalogManager = ed.getServiceDescription().getCatalogManager();
         if (catalogManager != null) {
             this.catalog = catalogManager.getCatalog();
         }
+        if (portInfo != null && portInfos != null) {
+            this.portInfo = portInfo;
+            servicePortNameLocationMap = new HashMap<QName, Map<String, String>>();
+            servicePortNamesMap = new HashMap<QName, Set<String>>();
+            for (PortInfo p : portInfos) {
+                if (p.getWsdlFile() == null || !p.getWsdlFile().equals(portInfo.getWsdlFile())) {
+                    continue;
+                }
+                QName serviceName = p.getWsdlService();
+                QName portName = p.getWsdlPort();
+                if (serviceName == null || portName == null) {
+                    continue;
+                }
+                Map<String, String> portNameLocationMap = servicePortNameLocationMap.get(serviceName);
+                if (portNameLocationMap == null) {
+                    portNameLocationMap = new HashMap<String, String>();
+                    servicePortNameLocationMap.put(serviceName, portNameLocationMap);
+                }
+                portNameLocationMap.put(portName.getLocalPart(), p.getLocation());
+                Set<String> portNames = servicePortNamesMap.get(serviceName);
+                if(portNames == null) {
+                    portNames = new HashSet<String>();
+                    servicePortNamesMap.put(serviceName, portNames);
+                }
+                portNames.add(portName.getLocalPart());
+            }
+        }
     }
-    
+
     public void writeResponse(String baseUri, String wsdlUri, OutputStream os) throws Exception {
 
         String base = null;
         String wsdlKey = "";
         String xsdKey = null;
-        
+
         int idx = baseUri.toLowerCase().indexOf("?wsdl");
         if (idx != -1) {
             base = baseUri.substring(0, idx);
@@ -118,29 +159,43 @@ public class WSDLQueryHandler {
             }
 
             // update service port location on each request
-            if (wsdlKey.equals("")) {
-                WSDLUtils.updateLocations(def, base);
+            if (wsdlKey.isEmpty()) {
+                if(multiplePortInWSDLQuery && servicePortNameLocationMap != null) {
+                    String serverUrl = base.substring(0, base.length() - portInfo.getLocation().length());
+                    Map<QName, Map<String, String>> updatedServicePortNameLocationMap = new HashMap<QName, Map<String, String>>();
+                    for(Map.Entry<QName, Map<String, String>> servicePortNameLocationEntry : servicePortNameLocationMap.entrySet()) {
+                        Map<String, String> updatedPortNameLocationMap = new HashMap<String, String>();
+                        for(Map.Entry<String, String> portNameLocationEntry : servicePortNameLocationEntry.getValue().entrySet()) {
+                            updatedPortNameLocationMap.put(portNameLocationEntry.getKey(), serverUrl + portNameLocationEntry.getValue());
+                        }
+                        updatedServicePortNameLocationMap.put(servicePortNameLocationEntry.getKey(), updatedPortNameLocationMap);
+                    }
+                    WSDLUtils.updateLocations(def, updatedServicePortNameLocationMap);
+                }
+                else {
+                    WSDLUtils.updateLocations(def, base);
+                }
             }
-            
+
             WSDLFactory factory = WSDLFactory.newInstance();
             WSDLWriter writer = factory.newWSDLWriter();
 
             rootElement = writer.getDocument(def).getDocumentElement();
-            
+
             updateWSDLImports(rootElement, base, wsdlKey);
             updateSchemaImports(rootElement, base, wsdlKey);
         } else {
             SchemaReference si = schemaMap.get(xsdKey);
-            
+
             if (si == null) {
                 throw new FileNotFoundException("Schema not found: " + xsdKey);
             }
-            
+
             rootElement = si.getReferencedSchema().getElement();
-            
+
             updateSchemaImports(rootElement, base, xsdKey);
         }
-                
+
         writeTo(rootElement, os);
     }
 
@@ -149,24 +204,26 @@ public class WSDLQueryHandler {
             wsdlMap = new HashMap<String, Definition>();
             schemaMap = new HashMap<String, SchemaReference>();
             importMap = new HashMap<String, String>();
-            
-            Map docMap = new HashMap<String, String>();
-            
+
+            Map<String, String> docMap = new HashMap<String, String>();
+
             WSDLFactory factory = WSDLFactory.newInstance();
             WSDLReader reader = factory.newWSDLReader();
             reader.setFeature("javax.wsdl.importDocuments", true);
-            reader.setFeature("javax.wsdl.verbose", false);            
+            reader.setFeature("javax.wsdl.verbose", false);
             Definition def = reader.readWSDL(new CatalogWSDLLocator(wsdlUri, this.catalog));
             updateDefinition("", def, docMap, base);
-            // remove other services and ports from wsdl
-            WSDLUtils.trimDefinition(def, this.service.getName(), this.service.getEndpointName());
-            
+            if (multiplePortInWSDLQuery) {
+                WSDLUtils.trimDefinition(def, servicePortNamesMap);
+            } else {
+                WSDLUtils.trimDefinition(def, this.service.getName(), this.service.getEndpointName());
+            }
             wsdlMap.put("", def);
         }
     }
 
     private void updateWSDLImports(Element rootElement, String base, String parentDocKey) {
-        NodeList nl = rootElement.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "import");        
+        NodeList nl = rootElement.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "import");
         for (int x = 0; x < nl.getLength(); x++) {
             Element el = (Element) nl.item(x);
             String location = el.getAttribute("location");
@@ -189,7 +246,7 @@ public class WSDLQueryHandler {
                 el.setAttribute("schemaLocation", base + "?xsd=" + docKey);
             }
         }
-        
+
         nl = rootElement.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "include");
         for (int x = 0; x < nl.getLength(); x++) {
             Element el = (Element) nl.item(x);
@@ -201,19 +258,18 @@ public class WSDLQueryHandler {
             }
         }
     }
-       
+
     protected void updateDefinition(String parentDocKey,
                                     Definition def,
-                                    Map<String, String> docMap, 
+                                    Map<String, String> docMap,
                                     String base) {
-        Collection<List> imports = def.getImports().values();
-        for (List lst : imports) {
-            List<Import> impLst = lst;
+        Collection<List<Import>> imports = def.getImports().values();
+        for (List<Import> impLst : imports) {
             for (Import imp : impLst) {
                 String docURI = imp.getDefinition().getDocumentBaseURI();
-                String location = imp.getLocationURI();                
+                String location = imp.getLocationURI();
                 String importId = parentDocKey + "/" + location;
-                String docKey = docMap.get(docURI);                
+                String docKey = docMap.get(docURI);
                 if (docKey == null) {
                     docKey = getUniqueWSDLId();
                     docMap.put(docURI, docKey);
@@ -222,8 +278,8 @@ public class WSDLQueryHandler {
                 }
                 importMap.put(importId, docKey);
             }
-        }      
-               
+        }
+
         Types types = def.getTypes();
         if (types != null) {
             for (ExtensibilityElement el : (List<ExtensibilityElement>)types.getExtensibilityElements()) {
@@ -234,33 +290,34 @@ public class WSDLQueryHandler {
             }
         }
     }
-    
-    protected void updateSchemaImports(String parentDocKey, 
+
+    protected void updateSchemaImports(String parentDocKey,
                                        Schema schema,
-                                       Map<String, String> docMap, 
+                                       Map<String, String> docMap,
                                        String base) {
-        Collection<List> imports = schema.getImports().values();
-        for (List list : imports) {
-            List<SchemaImport> impList = list;
+        @SuppressWarnings("unchecked")
+        Collection<List<SchemaImport>> imports = schema.getImports().values();
+        for (List<SchemaImport> impList : imports) {
             for (SchemaImport s : impList) {
                 Schema importedSchema = s.getReferencedSchema();
                 if (importedSchema == null) {
                     continue;
                 }
                 String docURI = importedSchema.getDocumentBaseURI();
-                String location = s.getSchemaLocationURI(); 
-                String importId = parentDocKey + "/" + location;                                
-                String docKey = docMap.get(docURI);                
+                String location = s.getSchemaLocationURI();
+                String importId = parentDocKey + "/" + location;
+                String docKey = docMap.get(docURI);
                 if (docKey == null) {
                     docKey = getUniqueSchemaId();
                     docMap.put(docURI, docKey);
                     schemaMap.put(docKey, s);
                     updateSchemaImports(docKey, importedSchema, docMap, base);
-                }                
+                }
                 importMap.put(importId, docKey);
             }
         }
-        
+
+        @SuppressWarnings("unchecked")
         List<SchemaReference> includes = schema.getIncludes();
         for (SchemaReference s : includes) {
             Schema includedSchema = s.getReferencedSchema();
@@ -268,31 +325,31 @@ public class WSDLQueryHandler {
                 continue;
             }
             String docURI = includedSchema.getDocumentBaseURI();
-            String location = s.getSchemaLocationURI(); 
-            String importId = parentDocKey + "/" + location;                                
-            String docKey = docMap.get(docURI);                
+            String location = s.getSchemaLocationURI();
+            String importId = parentDocKey + "/" + location;
+            String docKey = docMap.get(docURI);
             if (docKey == null) {
                 docKey = getUniqueSchemaId();
                 docMap.put(docURI, docKey);
                 schemaMap.put(docKey, s);
                 updateSchemaImports(docKey, includedSchema, docMap, base);
-            }                
+            }
             importMap.put(importId, docKey);
         }
     }
-    
+
     private String getUniqueSchemaId() {
         return "xsd" + ++schemaCounter;
     }
-    
+
     private String getUniqueWSDLId() {
         return "wsdl" + ++wsdlCounter;
-    }    
-    
+    }
+
     public static void writeTo(Node node, OutputStream os) {
         writeTo(new DOMSource(node), os);
     }
-    
+
     public static void writeTo(Source src, OutputStream os) {
         Transformer it;
         try {
@@ -304,9 +361,8 @@ public class WSDLQueryHandler {
             it.setOutputProperty(OutputKeys.ENCODING, "utf-8");
             it.transform(src, new StreamResult(os));
         } catch (TransformerException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            LOG.error("Fail to output wsdl", e);
         }
     }
-    
+
 }

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java (original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java Mon Jun  6 13:58:21 2011
@@ -19,7 +19,6 @@ package org.apache.geronimo.axis2.pojo;
 
 import java.io.PrintWriter;
 import java.net.HttpURLConnection;
-
 import javax.naming.Context;
 import javax.xml.ws.WebServiceException;
 
@@ -64,8 +63,9 @@ public class POJOWebServiceContainer ext
                                    Context context,
                                    Axis2ModuleRegistry axis2ModuleRegistry,
                                    AnnotationHolder holder,
-                                   String contextRoot) {
-        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry);
+                                   String contextRoot,
+                                   String moduleName) {
+        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, moduleName);
         this.holder = holder;
         this.contextRoot = contextRoot;
     }

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java (original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java Mon Jun  6 13:58:21 2011
@@ -24,12 +24,14 @@ import javax.naming.NamingException;
 import javax.transaction.TransactionManager;
 
 import org.apache.geronimo.axis2.osgi.Axis2ModuleRegistry;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.annotations.AnnotationHolder;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
@@ -50,16 +52,17 @@ public class POJOWebServiceContainerFact
     private static final Logger LOG = LoggerFactory.getLogger(POJOWebServiceContainerFactoryGBean.class);
 
     private final ClassLoader classLoader;
-    private final org.apache.geronimo.jaxws.PortInfo portInfo;
+    private final PortInfo portInfo;
     private final String endpointClassName;
     private Context context;
     private AnnotationHolder holder;
     private String contextRoot;
     private Bundle bundle;
     private Axis2ModuleRegistry axis2ModuleRegistry;
+    private String webModuleName;
 
     public POJOWebServiceContainerFactoryGBean(
-                        @ParamAttribute(name="portInfo") org.apache.geronimo.jaxws.PortInfo portInfo,
+                        @ParamAttribute(name="portInfo") PortInfo portInfo,
                         @ParamAttribute(name="endpointClassName") String endpointClassName,
                         @ParamAttribute(name="componentContext") Map componentContext,
                         @ParamReference(name="TransactionManager", namingType=NameFactory.JTA_RESOURCE) TransactionManager transactionManager,
@@ -68,7 +71,8 @@ public class POJOWebServiceContainerFact
                         @ParamReference(name="Axis2ModuleRegistry") Axis2ModuleRegistry axis2ModuleRegistry,
                         @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel,
                         @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
-                        @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader)
+                        @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+                        @ParamSpecial(type = SpecialAttributeType.abstractName) AbstractName abName)
                      throws InstantiationException, IllegalAccessException, ClassNotFoundException {
 
         if (componentContext != null) {
@@ -89,10 +93,11 @@ public class POJOWebServiceContainerFact
         this.holder = holder;
         this.contextRoot = contextRoot;
         this.axis2ModuleRegistry = axis2ModuleRegistry;
+        this.webModuleName = abName.getNameProperty(NameFactory.WEB_MODULE);
     }
 
     public WebServiceContainer getWebServiceContainer() {
-        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, holder, contextRoot);
+        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, holder, contextRoot, webModuleName);
         try {
             container.init();
         } catch (Exception e) {

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java (original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java Mon Jun  6 13:58:21 2011
@@ -77,7 +77,7 @@ public class Axis2WebServiceContainerTes
 
         String endpointClassName = "org.apache.geronimo.axis2.testdata.simple.HelloWorld";
         Bundle mockBundle = new MockBundle(cl, null, 11L);
-        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName, mockBundle, null, new Axis2ModuleRegistry(mockBundle.getBundleContext()), AnnotationHolder.EMPTY, "/axis2");
+        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName, mockBundle, null, new Axis2ModuleRegistry(mockBundle.getBundleContext()), AnnotationHolder.EMPTY, "/axis2", "TestWebModuleName");
         container.init();
         container.invoke(req, res);
         out.flush();
@@ -152,7 +152,7 @@ public class Axis2WebServiceContainerTes
                 Axis2Response res = new Axis2Response("text/xml; charset=utf-8", "127.0.0.1", null, null, 8080, out);
                 Bundle mockBundle = new MockBundle(cl, null, 11L);
                 POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endPointClassName, mockBundle, null, new Axis2ModuleRegistry(mockBundle.getBundleContext()),
-                        AnnotationHolder.EMPTY, "/axis2");
+                        AnnotationHolder.EMPTY, "/axis2","TestWebModuleName");
                 container.init();
                 container.invoke(req, res);
                 System.out.println("Response "+out);

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java (original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java Mon Jun  6 13:58:21 2011
@@ -49,7 +49,7 @@ public abstract class CXFWebServiceConta
     public CXFWebServiceContainer(Bus bus, Object target, Bundle bundle) {
         this.bus = bus;
         this.bundle = bundle;
-        List ids = new ArrayList();
+        List<String> ids = new ArrayList<String>();
         ids.add("http://schemas.xmlsoap.org/wsdl/soap/");
 
         DestinationFactoryManager destinationFactoryManager = bus

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainerFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainerFactoryGBean.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainerFactoryGBean.java (original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainerFactoryGBean.java Mon Jun  6 13:58:21 2011
@@ -66,7 +66,6 @@ public class POJOWebServiceContainerFact
                                                Kernel kernel,
                                                Bundle bundle,
                                                TransactionManager transactionManager,
-                                               URL configurationBaseUrl,
                                                AnnotationHolder holder,
                                                String contextRoot)
             throws ClassNotFoundException,
@@ -128,7 +127,6 @@ public class POJOWebServiceContainerFact
         infoBuilder.addAttribute("kernel", Kernel.class, false);
         infoBuilder.addAttribute("bundle", Bundle.class, false);
         infoBuilder.addReference("TransactionManager", TransactionManager.class, NameFactory.JTA_RESOURCE);
-        infoBuilder.addAttribute("configurationBaseUrl", URL.class, true);
         infoBuilder.addAttribute("holder", AnnotationHolder.class, true);
         infoBuilder.addAttribute("contextRoot", String.class, true, true);
 
@@ -140,7 +138,6 @@ public class POJOWebServiceContainerFact
                 "kernel",
                 "bundle",
                 "TransactionManager",
-                "configurationBaseUrl",
                 "holder",
                 "contextRoot"
         });

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java Mon Jun  6 13:58:21 2011
@@ -118,6 +118,8 @@ public class AdvancedWARWebServiceFinder
                     PortInfo portInfo = new PortInfo();
                     portInfo.setLocation(contextRoot + location);
                     portInfo.setHandlerChainsInfo(annotationHandlerChainFinder.buildHandlerChainFromClass(service));
+                    portInfo.setWsdlService(JAXWSUtils.getServiceQName(service));
+                    portInfo.setWsdlPort(JAXWSUtils.getPortQName(service));
                     servletNamePortInfoMap.put(service.getName(), portInfo);
                 } else {
                     // found at least one mapped <servlet/> entry
@@ -126,6 +128,8 @@ public class AdvancedWARWebServiceFinder
                             LOG.debug("POJO Web Service class {} is mapped to {} servlet", service.getName(), servlet);
                         }
                         PortInfo portInfo = createPortInfo(servlet, portLocations);
+                        portInfo.setWsdlService(JAXWSUtils.getServiceQName(service));
+                        portInfo.setWsdlPort(JAXWSUtils.getPortQName(service));
                         servletNamePortInfoMap.put(servlet, portInfo);
                     }
                 }
@@ -158,6 +162,8 @@ public class AdvancedWARWebServiceFinder
                     String servletName = servletType.getServletName().trim();
                     portInfo = createPortInfo(servletName, portLocations);
                     portInfo.setHandlerChainsInfo(annotationHandlerChainFinder.buildHandlerChainFromClass(servletClass));
+                    portInfo.setWsdlService(JAXWSUtils.getServiceQName(servletClass));
+                    portInfo.setWsdlPort(JAXWSUtils.getPortQName(servletClass));
                 }
             } catch (ClassNotFoundException e) {
                 throw new DeploymentException("Failed to load servlet class " + servletClassName, e);

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java Mon Jun  6 13:58:21 2011
@@ -19,6 +19,7 @@ package org.apache.geronimo.jaxws.builde
 
 import java.io.InputStream;
 import java.net.URL;
+import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.bind.JAXBException;
@@ -38,7 +39,9 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.jaxws.JAXWSEJBApplicationContext;
 import org.apache.geronimo.jaxws.JAXWSUtils;
+import org.apache.geronimo.jaxws.JAXWSWebApplicationContext;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.annotations.AnnotationHolder;
 import org.apache.geronimo.jaxws.feature.AddressingFeatureInfo;
@@ -253,6 +256,21 @@ public abstract class JAXWSServiceBuilde
             return false;
         }
 
+        Map<String, PortInfo> servletNamePortInfoMap = null;
+        AbstractName jaxwsWebApplicationContextName = context.getNaming().createChildName(module.getModuleName(), "JAXWSWebApplicationContext", "JAXWSWebApplicationContext");
+        try {
+            servletNamePortInfoMap = (Map<String, PortInfo>)(context.getGBeanInstance(jaxwsWebApplicationContextName).getAttribute("servletNamePortInfoMap"));
+        } catch (GBeanNotFoundException e) {
+            GBeanData jaxwsWebApplicationContextGBeanData = new GBeanData(jaxwsWebApplicationContextName, JAXWSWebApplicationContext.class);
+            try {
+                context.addGBean(jaxwsWebApplicationContextGBeanData);
+            } catch (GBeanAlreadyExistsException e1) {
+            }
+            servletNamePortInfoMap = new HashMap<String, PortInfo>();
+            jaxwsWebApplicationContextGBeanData.setAttribute("servletNamePortInfoMap", servletNamePortInfoMap);
+        }
+        servletNamePortInfoMap.put(servletName, portInfo);
+
         Map componentContext = null;
         Holder moduleHolder = null;
         try {
@@ -335,9 +353,23 @@ public abstract class JAXWSServiceBuilde
             throw new DeploymentException("Endpoint URI for EJB WebService is missing");
         }
 
-        if (LOG.isDebugEnabled()) {
-            LOG.info("Configuring EJB JAX-WS Web Service: " + ejbName + " at " + location);
+        Map<String, PortInfo> ejbNamePortInfoMap = null;
+        DeploymentContext context = module.getEarContext();
+        AbstractName jaxwsEJBApplicationContextName = context.getNaming().createChildName(module.getModuleName(), "JAXWSEJBApplicationContext", "JAXWSEJBApplicationContext");
+        try {
+            ejbNamePortInfoMap = (Map<String, PortInfo>)(context.getGBeanInstance(jaxwsEJBApplicationContextName).getAttribute("ejbNamePortInfoMap"));
+        } catch (GBeanNotFoundException e) {
+            GBeanData jaxwsEJBApplicationContextGBeanData = new GBeanData(jaxwsEJBApplicationContextName, JAXWSEJBApplicationContext.class);
+            try {
+                context.addGBean(jaxwsEJBApplicationContextGBeanData);
+            } catch (GBeanAlreadyExistsException e1) {
+            }
+            ejbNamePortInfoMap = new HashMap<String, PortInfo>();
+            jaxwsEJBApplicationContextGBeanData.setAttribute("ejbNamePortInfoMap", ejbNamePortInfoMap);
         }
+        ejbNamePortInfoMap.put(ejbName, portInfo);
+
+        LOG.info("Configuring EJB JAX-WS Web Service: " + ejbName + " at " + location);
 
         targetGBean.setAttribute("portInfo", portInfo);
 

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java Mon Jun  6 13:58:21 2011
@@ -65,6 +65,8 @@ public class EJBWebServiceFinder impleme
                         location = "/" + JAXWSUtils.getServiceName(ejbClass) + "/" + JAXWSUtils.getName(ejbClass);
                     }
                     portInfo.setLocation(location);
+                    portInfo.setWsdlService(JAXWSUtils.getServiceQName(ejbClass));
+                    portInfo.setWsdlPort(JAXWSUtils.getPortQName(ejbClass));
                     map.put(bean.ejbName, portInfo);
                     ejbWebServiceClassNames.add(bean.ejbClass);
                 }

Added: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSApplicationContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSApplicationContext.java?rev=1132647&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSApplicationContext.java (added)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSApplicationContext.java Mon Jun  6 13:58:21 2011
@@ -0,0 +1,33 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.jaxws;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface JAXWSApplicationContext {//extends WebServiceApplicationContext {
+
+    public PortInfo getPortInfo(String id);
+
+    public Collection<PortInfo> getPortInfos();
+
+    public Set<String> getIds();
+}

Added: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSEJBApplicationContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSEJBApplicationContext.java?rev=1132647&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSEJBApplicationContext.java (added)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSEJBApplicationContext.java Mon Jun  6 13:58:21 2011
@@ -0,0 +1,94 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.jaxws;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@GBean(name = "JAXWSEJBApplicationContext", j2eeType = "JAXWSEJBApplicationContext")
+public class JAXWSEJBApplicationContext implements JAXWSApplicationContext, GBeanLifecycle {
+
+    private static Map<String, JAXWSEJBApplicationContext> ejbModuleNameJAXWSEJBApplicationContextMap = new ConcurrentHashMap<String, JAXWSEJBApplicationContext>();
+
+    private Bundle bundle;
+
+    private Map<String, PortInfo> ejbNamePortInfoMap;
+
+    private String ejbModuleName;
+
+    public JAXWSEJBApplicationContext(@ParamAttribute(name = "ejbNamePortInfoMap") Map<String, PortInfo> ejbNamePortInfoMap,
+                                                                        @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
+                                                                        @ParamSpecial(type = SpecialAttributeType.abstractName) AbstractName abName) {
+        this.ejbNamePortInfoMap = ejbNamePortInfoMap;
+        this.bundle = bundle;
+        this.ejbModuleName = abName.getNameProperty(NameFactory.EJB_MODULE);
+    }
+
+    @Override
+    public Collection<PortInfo> getPortInfos() {
+        return Collections.unmodifiableCollection(ejbNamePortInfoMap.values());
+    }
+
+    @Override
+    public Set<String> getIds() {
+        return Collections.unmodifiableSet(ejbNamePortInfoMap.keySet());
+    }
+
+    @Override
+    public PortInfo getPortInfo(String ejbName) {
+        return ejbNamePortInfoMap.get(ejbName);
+    }
+
+    @Override
+    public void doFail() {
+        try {
+            doStop();
+        } catch (Exception e) {
+        }
+    }
+
+    @Override
+    public void doStart() throws Exception {
+        ejbModuleNameJAXWSEJBApplicationContextMap.put(ejbModuleName, this);
+    }
+
+    @Override
+    public void doStop() throws Exception {
+        ejbModuleNameJAXWSEJBApplicationContextMap.remove(ejbModuleName);
+    }
+
+    public static JAXWSEJBApplicationContext get(String ejbModuleName) {
+        return ejbModuleNameJAXWSEJBApplicationContextMap.get(ejbModuleName);
+    }
+}

Added: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSWebApplicationContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSWebApplicationContext.java?rev=1132647&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSWebApplicationContext.java (added)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSWebApplicationContext.java Mon Jun  6 13:58:21 2011
@@ -0,0 +1,92 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.jaxws;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@GBean(name = "JAXWSWebApplicationContext", j2eeType = "JAXWSWebApplicationContext")
+public class JAXWSWebApplicationContext implements JAXWSApplicationContext, GBeanLifecycle {
+
+    private static Map<String, JAXWSWebApplicationContext> webModuleNameJAXWSWebApplicationContextMap = new ConcurrentHashMap<String, JAXWSWebApplicationContext>();
+
+    private Bundle bundle;
+
+    private Map<String, PortInfo> servletNamePortInfoMap;
+
+    private String webModuleName;
+
+    public JAXWSWebApplicationContext(@ParamAttribute(name = "servletNamePortInfoMap") Map<String, PortInfo> servletNamePortInfoMap,
+                                                                           @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
+                                                                           @ParamSpecial(type = SpecialAttributeType.abstractName) AbstractName abName) {
+        this.servletNamePortInfoMap = servletNamePortInfoMap;
+        this.webModuleName = abName.getNameProperty(NameFactory.WEB_MODULE);
+    }
+
+    @Override
+    public Collection<PortInfo> getPortInfos() {
+        return Collections.unmodifiableCollection(servletNamePortInfoMap.values());
+    }
+
+    @Override
+    public Set<String> getIds() {
+        return Collections.unmodifiableSet(servletNamePortInfoMap.keySet());
+    }
+
+    @Override
+    public PortInfo getPortInfo(String servletName) {
+        return servletNamePortInfoMap.get(servletName);
+    }
+
+    @Override
+    public void doFail() {
+        try {
+            doStop();
+        } catch (Exception e) {
+        }
+    }
+
+    @Override
+    public void doStart() throws Exception {
+        webModuleNameJAXWSWebApplicationContextMap.put(webModuleName, this);
+    }
+
+    @Override
+    public void doStop() throws Exception {
+        webModuleNameJAXWSWebApplicationContextMap.remove(webModuleName);
+    }
+
+    public static JAXWSWebApplicationContext get(String webModuleName) {
+        return webModuleNameJAXWSWebApplicationContextMap.get(webModuleName);
+    }
+}

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/WSDLUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/WSDLUtils.java?rev=1132647&r1=1132646&r2=1132647&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/WSDLUtils.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/WSDLUtils.java Mon Jun  6 13:58:21 2011
@@ -14,12 +14,14 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 package org.apache.geronimo.jaxws;
 
 import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
@@ -35,94 +37,142 @@ import org.slf4j.LoggerFactory;
 public class WSDLUtils {
 
     private static final Logger LOG = LoggerFactory.getLogger(WSDLUtils.class);
-    
-    public static void trimDefinition(Definition def, 
-                                      String serviceName, 
-                                      String portName) { 
-        Map services = def.getServices();
-        if (services != null) {
-            ArrayList<QName> servicesToRemove = new ArrayList<QName>(services.size());
-            
-            Iterator serviceIterator = services.entrySet().iterator();
-            while (serviceIterator.hasNext()) {
-                Map.Entry serviceEntry = (Map.Entry) serviceIterator.next();
-                QName currServiceName = (QName) serviceEntry.getKey();
-                if (currServiceName.getLocalPart().equals(serviceName)) {
-                    Service service = (Service) serviceEntry.getValue();
-                    trimService(service, portName);
-                } else {
-                    servicesToRemove.add(currServiceName);
-                }
-            }
-            
-            for (QName serviceToRemove : servicesToRemove) {
-                def.removeService(serviceToRemove);                
-            }
-        }
-    }
-
-    public static void trimService(Service service,
-                                   String portName) { 
-        Map ports = service.getPorts();
-        if (ports != null) {
-            ArrayList<String> portsToRemove = new ArrayList<String>(ports.size());
-            
-            Iterator portIterator = ports.entrySet().iterator();
-            while (portIterator.hasNext()) {
-                Map.Entry portEntry = (Map.Entry) portIterator.next();
-                String currPortName = (String) portEntry.getKey();
-                if (!currPortName.equals(portName)) {
-                    portsToRemove.add(currPortName);
-                }
-            }
-            
-            for (String portToRemove : portsToRemove) {
-                service.removePort(portToRemove);               
-            }
-        }
-    }
-    
-    public static void updateLocations(Definition def, 
-                                       String location) {
-        Map services = def.getServices();
-        if (services != null) {
-            Iterator serviceIterator = services.entrySet().iterator();
-            while (serviceIterator.hasNext()) {
-                Map.Entry serviceEntry = (Map.Entry) serviceIterator.next();
-                Service service = (Service) serviceEntry.getValue();                
-                updateLocations(service, location);
-            }
-        }            
-    }
-    
-    public static void updateLocations(Service service,
-                                       String location) {
-        boolean updated = false;
-        Map ports = service.getPorts();
-        if (ports != null) {
-            Iterator portIterator = ports.entrySet().iterator();
-            while (portIterator.hasNext()) {
-                Map.Entry portEntry = (Map.Entry) portIterator.next();
-                Port port = (Port) portEntry.getValue();
+
+    public static void trimDefinition(Definition def, Map<QName, Set<String>> servicePortNamesMap) {
+        @SuppressWarnings("unchecked")
+        Map<QName, Service> services = def.getServices();
+        if (services == null) {
+            return;
+        }
+        ArrayList<QName> servicesToRemove = new ArrayList<QName>(services.size());
+
+        for (Map.Entry<QName, Service> serviceEntry : services.entrySet()) {
+            QName currServiceName = serviceEntry.getKey();
+            if (servicePortNamesMap.containsKey(currServiceName)) {
+                Service service = serviceEntry.getValue();
+                trimService(service, servicePortNamesMap.get(currServiceName));
+            } else {
+                servicesToRemove.add(currServiceName);
+            }
+        }
+
+        for (QName serviceToRemove : servicesToRemove) {
+            def.removeService(serviceToRemove);
+        }
+    }
+
+    public static void trimDefinition(Definition def, String serviceName, String portName) {
+        @SuppressWarnings("unchecked")
+        Map<QName, Service> services = def.getServices();
+        if (services == null) {
+            return;
+        }
+        ArrayList<QName> servicesToRemove = new ArrayList<QName>(services.size());
+
+        for (Map.Entry<QName, Service> serviceEntry : services.entrySet()) {
+            QName currServiceName = serviceEntry.getKey();
+            if (currServiceName.getLocalPart().equals(serviceName)) {
+                Service service = serviceEntry.getValue();
+                trimService(service, portName);
+            } else {
+                servicesToRemove.add(currServiceName);
+            }
+        }
+
+        for (QName serviceToRemove : servicesToRemove) {
+            def.removeService(serviceToRemove);
+        }
+    }
+
+    public static void trimService(Service service, String portName) {
+        trimService(service, Collections.singleton(portName));
+    }
+
+    public static void trimService(Service service, Set<String> portName) {
+        @SuppressWarnings("unchecked")
+        Map<String, Port> ports = service.getPorts();
+        if (ports == null) {
+            return;
+        }
+        ArrayList<String> portsToRemove = new ArrayList<String>(ports.size());
+        for (Map.Entry<String, Port> portEntry : ports.entrySet()) {
+            String currPortName = portEntry.getKey();
+            if (!portName.contains(currPortName)) {
+                portsToRemove.add(currPortName);
+            }
+        }
+        for (String portToRemove : portsToRemove) {
+            service.removePort(portToRemove);
+        }
+    }
+
+    public static void updateLocations(Definition def, Map<QName, Map<String, String>> servicePortNameLocationMap) {
+        @SuppressWarnings("unchecked")
+        Map<QName, Service> services = def.getServices();
+        if (services == null) {
+            return;
+        }
+        for (Map.Entry<QName, Service> serviceEntry : services.entrySet()) {
+            Service service = serviceEntry.getValue();
+            Map<String, String> portNameLocationMap = servicePortNameLocationMap.get(service.getQName());
+            if (portNameLocationMap != null) {
+                updateLocations(service, portNameLocationMap);
+            }
+        }
+    }
+
+    public static void updateLocations(Service service, Map<String, String> portNameLocationsMap) {
+        @SuppressWarnings("unchecked")
+        Map<String, Port> ports = service.getPorts();
+        if (ports == null) {
+            return;
+        }
+        for (Map.Entry<String, Port> portEntry : ports.entrySet()) {
+            Port port = portEntry.getValue();
+            String location = portNameLocationsMap.get(port.getName());
+            if (location != null) {
                 updateLocations(port, location);
             }
         }
     }
-    
-    public static void updateLocations(Port port, 
-                                       String location) {
+
+    public static void updateLocations(Definition def, String location) {
+        @SuppressWarnings("unchecked")
+        Map<QName, Service> services = def.getServices();
+        if (services == null) {
+            return;
+        }
+        for (Map.Entry<QName, Service> serviceEntry : services.entrySet()) {
+            Service service = serviceEntry.getValue();
+            updateLocations(service, location);
+        }
+    }
+
+    public static void updateLocations(Service service, String location) {
+        @SuppressWarnings("unchecked")
+        Map<String, Port> ports = service.getPorts();
+        if (ports == null) {
+            return;
+        }
+        for (Map.Entry<String, Port> portEntry : ports.entrySet()) {
+            Port port = portEntry.getValue();
+            updateLocations(port, location);
+        }
+    }
+
+    public static void updateLocations(Port port, String location) {
         List<?> exts = port.getExtensibilityElements();
-        if (exts != null) {
-            for (Object extension : exts) {
-                if (extension instanceof SOAP12Address) {
-                    ((SOAP12Address)extension).setLocationURI(location);
-                } else if (extension instanceof SOAPAddress) {
-                    ((SOAPAddress)extension).setLocationURI(location);
-                } else if (extension instanceof HTTPAddress) {
-                    ((HTTPAddress)extension).setLocationURI(location);
-                }
+        if (exts == null) {
+            return;
+        }
+        for (Object extension : exts) {
+            if (extension instanceof SOAP12Address) {
+                ((SOAP12Address) extension).setLocationURI(location);
+            } else if (extension instanceof SOAPAddress) {
+                ((SOAPAddress) extension).setLocationURI(location);
+            } else if (extension instanceof HTTPAddress) {
+                ((HTTPAddress) extension).setLocationURI(location);
             }
         }
     }
-
 }



Mime
View raw message