geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1349684 - 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/c...
Date Wed, 13 Jun 2012 08:46:59 GMT
Author: xuhaihong
Date: Wed Jun 13 08:46:58 2012
New Revision: 1349684

URL: http://svn.apache.org/viewvc?rev=1349684&view=rev
Log:
GERONIMO-6364 jaxws-catalog-tests test failed for UnknownHostExceptiion
Since Geronimo installs the whole ear as one bundle now, there may be issues while reading
wsdl and jax-ws-catalog.xml file. Now the solution is that,
for WAR in EAR, as the WAR will be extracted, we will add the module directory prefix for
those files, so that bundle.getEntry could work.
for EJB in EAR, the url will be something like ejb.jar!/META-INF/a.wsdl, we will try to build
a jar URL to get the resource, one thing that needs to improve is that, this kind of URL will
cause a full copy of the target jar file, as JarURLHandler may not recognize the bundleentry
protocol.

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/AxisServiceGenerator.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
  (contents, props changed)
    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/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.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/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/GeronimoAnnotationDeployer.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=1349684&r1=1349683&r2=1349684&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
Wed Jun 13 08:46:58 2012
@@ -52,8 +52,9 @@ public class EJBWebServiceContainer exte
                                   Context context,
                                   Axis2ModuleRegistry axis2ModuleRegistry,
                                   BeanContext deploymnetInfo,
-                                  String ejbModuleName) {
-        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, ejbModuleName);
+                                  String ejbModuleName,
+                                  String catalogName) {
+        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, ejbModuleName,
catalogName);
         this.deploymnetInfo = deploymnetInfo;
     }
 
@@ -98,7 +99,7 @@ public class EJBWebServiceContainer exte
     @Override
     protected AxisServiceGenerator createServiceGenerator() {
         AxisServiceGenerator serviceGenerator = super.createServiceGenerator();
-        serviceGenerator.setCatalogName(JAXWSUtils.DEFAULT_CATALOG_EJB);
+        serviceGenerator.setCatalogName(catalogName);
         EJBMessageReceiver messageReceiver =
             new EJBMessageReceiver(this, this.endpointClass, this.deploymnetInfo);
         serviceGenerator.setMessageReceiver(messageReceiver);

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=1349684&r1=1349683&r2=1349684&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
Wed Jun 13 08:46:58 2012
@@ -62,7 +62,8 @@ public class EJBWebServiceGBean implemen
                               @ParamAttribute(name="realmName")String realmName,
                               @ParamAttribute(name="authMethod")String authMethod,
                               @ParamAttribute(name="virtualHosts")String[] virtualHosts,
-                              @ParamAttribute(name="properties")Properties properties) throws
Exception {
+                              @ParamAttribute(name="properties")Properties properties,
+                              @ParamAttribute(name="catalogName")String catalogName) throws
Exception {
 
         if (ejbDeploymentContext == null || webContainers == null || webContainers.isEmpty()
|| portInfo == null) {
             return;
@@ -78,7 +79,7 @@ public class EJBWebServiceGBean implemen
         BeanContext deploymnetInfo = ejbDeploymentContext.getDeploymentInfo();
         Context context = deploymnetInfo.getJndiEnc();
 
-        this.container = new EJBWebServiceContainer(portInfo, beanClassName, bundle, context,
axis2ModuleRegistry, deploymnetInfo, abName.getNameProperty(NameFactory.EJB_MODULE));
+        this.container = new EJBWebServiceContainer(portInfo, beanClassName, bundle, context,
axis2ModuleRegistry, deploymnetInfo, abName.getNameProperty(NameFactory.EJB_MODULE), catalogName);
         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=1349684&r1=1349683&r2=1349684&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
Wed Jun 13 08:46:58 2012
@@ -135,8 +135,10 @@ public abstract class Axis2WebServiceCon
     protected Axis2ModuleRegistry axis2ModuleRegistry;
 
     protected String moduleName;
+    
+    protected String catalogName;
 
-    public Axis2WebServiceContainer(PortInfo portInfo, String endpointClassName, Bundle bundle,
Context context, Axis2ModuleRegistry axis2ModuleRegistry, String moduleName) {
+    public Axis2WebServiceContainer(PortInfo portInfo, String endpointClassName, Bundle bundle,
Context context, Axis2ModuleRegistry axis2ModuleRegistry, String moduleName, String catalogName)
{
         this.endpointClassName = endpointClassName;
         this.portInfo = portInfo;
         this.bundle = bundle;
@@ -144,6 +146,7 @@ public abstract class Axis2WebServiceCon
         this.jndiResolver = new ServerJNDIResolver(context);
         this.axis2ModuleRegistry = axis2ModuleRegistry;
         this.moduleName = moduleName;
+        this.catalogName = catalogName;
     }
 
     public void init() throws Exception {
@@ -395,7 +398,7 @@ public abstract class Axis2WebServiceCon
             // wsdl or xsd request
 
             if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals(""))
{
-                URL wsdlURL = AxisServiceGenerator.getWsdlURL(portInfo.getWsdlFile(), bundle);
+                URL wsdlURL = JAXWSUtils.getWsdlURL(bundle, portInfo.getWsdlFile());
                 this.wsdlQueryHandler.writeResponse(request.getURI().toString(), wsdlURL.toString(),
response.getOutputStream());
             } else {
                 throw new Exception("Service does not have WSDL");

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java?rev=1349684&r1=1349683&r2=1349684&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
Wed Jun 13 08:46:58 2012
@@ -162,7 +162,7 @@ public class AxisServiceGenerator
             //instance, we will call the parseCatalog(URL) to add the file
             //catalogManager.setCatalogFiles(catalogURL.toString());
         }
-        URL wsdlURL = getWsdlURL(wsdlFile, bundle);
+        URL wsdlURL = JAXWSUtils.getWsdlURL(bundle, wsdlFile);
         WSDL4JWrapper wsdlWrapper = new WSDL4JWrapper(wsdlURL, this.configurationContext,
catalogManager);
         Definition wsdlDefinition = wsdlWrapper.getDefinition();
 
@@ -327,30 +327,7 @@ public class AxisServiceGenerator
             composite.setWsdlDefinition(testMap);
             return composite;
         }
-    }
-
-    public static URL getWsdlURL(String wsdlFile, Bundle bundle) {
-        if (wsdlFile == null) {
-            return null;
-        }
-        URL wsdlURL;
-        try {
-            wsdlURL = BundleUtils.getEntry(bundle, wsdlFile);
-        } catch (MalformedURLException e) {
-            log.warn("MalformedURLException when getting entry:" + wsdlFile + " from bundle
" + bundle.getSymbolicName(), e);
-            wsdlURL = null;
-        }
-        if (wsdlURL == null) {
-            wsdlURL = bundle.getResource(wsdlFile);
-            if (wsdlURL == null) {
-                try {
-                    wsdlURL = new URL(wsdlFile);
-                } catch (MalformedURLException e) {
-                }
-            }
-        }
-        return wsdlURL;
-    }
+    }    
 
     public static EndpointDescription getEndpointDescription(AxisService service) {
         Parameter param = service.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java?rev=1349684&r1=1349683&r2=1349684&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java
Wed Jun 13 08:46:58 2012
@@ -17,6 +17,7 @@
 
 package org.apache.geronimo.axis2.client;
 
+import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
 import java.util.Map;
@@ -37,6 +38,7 @@ import org.apache.geronimo.jaxws.client.
 import org.apache.geronimo.jaxws.client.PortMethodInterceptor;
 import org.apache.geronimo.jaxws.handler.GeronimoHandlerResolver;
 import org.apache.geronimo.jaxws.info.HandlerChainsInfo;
+import org.apache.xml.resolver.Catalog;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,7 +67,14 @@ public class Axis2ServiceReference exten
         if (catalogURL != null) {
             composite = new DescriptionBuilderComposite();
             OASISCatalogManager catalogManager = new OASISCatalogManager();
-            catalogManager.setCatalogFiles(catalogURL.toString());
+            Catalog catalog = catalogManager.getCatalog();
+            try {
+                catalog.parseCatalog(catalogURL);
+            } catch (IOException e) {
+                NamingException toThrow = new NamingException("Fail to parse catalog file
" + catalogURL.toString());
+                toThrow.initCause(e);
+                throw toThrow;
+            }            
             composite.setCatalogManager(catalogManager);
         }
 

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=1349684&r1=1349683&r2=1349684&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
Wed Jun 13 08:46:58 2012
@@ -64,8 +64,9 @@ public class POJOWebServiceContainer ext
                                    Axis2ModuleRegistry axis2ModuleRegistry,
                                    AnnotationHolder holder,
                                    String contextRoot,
-                                   String moduleName) {
-        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, moduleName);
+                                   String moduleName,
+                                   String catalogName) {
+        super(portInfo, endpointClassName, bundle, context, axis2ModuleRegistry, moduleName,
catalogName);
         this.holder = holder;
         this.contextRoot = contextRoot;
     }
@@ -117,7 +118,7 @@ public class POJOWebServiceContainer ext
     @Override
     protected AxisServiceGenerator createServiceGenerator() {
         AxisServiceGenerator serviceGenerator = super.createServiceGenerator();
-        serviceGenerator.setCatalogName(JAXWSUtils.DEFAULT_CATALOG_WEB);
+        serviceGenerator.setCatalogName(catalogName);
         return serviceGenerator;
     }
 

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=1349684&r1=1349683&r2=1349684&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
Wed Jun 13 08:46:58 2012
@@ -60,6 +60,7 @@ public class POJOWebServiceContainerFact
     private Bundle bundle;
     private Axis2ModuleRegistry axis2ModuleRegistry;
     private String webModuleName;
+    private String catalogName;
 
     public POJOWebServiceContainerFactoryGBean(
                         @ParamAttribute(name="portInfo") PortInfo portInfo,
@@ -68,6 +69,7 @@ public class POJOWebServiceContainerFact
                         @ParamReference(name="TransactionManager", namingType=NameFactory.JTA_RESOURCE)
TransactionManager transactionManager,
                         @ParamAttribute(name="holder") AnnotationHolder holder,
                         @ParamAttribute(name="contextRoot") String contextRoot,
+                        @ParamAttribute(name="catalogName") String catalogName,
                         @ParamReference(name="Axis2ModuleRegistry") Axis2ModuleRegistry axis2ModuleRegistry,
                         @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel,
                         @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
@@ -94,10 +96,11 @@ public class POJOWebServiceContainerFact
         this.contextRoot = contextRoot;
         this.axis2ModuleRegistry = axis2ModuleRegistry;
         this.webModuleName = abName.getNameProperty(NameFactory.WEB_MODULE);
+        this.catalogName = catalogName;
     }
 
     public WebServiceContainer getWebServiceContainer() {
-        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName,
bundle, context, axis2ModuleRegistry, holder, contextRoot, webModuleName);
+        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName,
bundle, context, axis2ModuleRegistry, holder, contextRoot, webModuleName, catalogName);
         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=1349684&r1=1349683&r2=1349684&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
Wed Jun 13 08:46:58 2012
@@ -28,6 +28,7 @@ import javax.xml.parsers.DocumentBuilder
 
 import org.apache.geronimo.axis2.osgi.Axis2ModuleRegistry;
 import org.apache.geronimo.axis2.pojo.POJOWebServiceContainer;
+import org.apache.geronimo.jaxws.JAXWSUtils;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.jaxws.annotations.AnnotationHolder;
 import org.apache.geronimo.kernel.osgi.MockBundle;
@@ -77,7 +78,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", "TestWebModuleName");
+        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName,
mockBundle, null, new Axis2ModuleRegistry(mockBundle.getBundleContext()), AnnotationHolder.EMPTY,
"/axis2", "TestWebModuleName", JAXWSUtils.DEFAULT_CATALOG_WEB);
         container.init();
         container.invoke(req, res);
         out.flush();
@@ -152,7 +153,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","TestWebModuleName");
+                        AnnotationHolder.EMPTY, "/axis2","TestWebModuleName", JAXWSUtils.DEFAULT_CATALOG_WEB);
                 container.init();
                 container.invoke(req, res);
                 System.out.println("Response "+out);

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java?rev=1349684&r1=1349683&r2=1349684&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java
(original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSBuilderUtils.java
Wed Jun 13 08:46:58 2012
@@ -23,7 +23,8 @@ import java.net.URL;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 
-public class JAXWSBuilderUtils {    
+public class JAXWSBuilderUtils {
+
     private static boolean isURL(String name) {
         try {
             new URL(name);
@@ -37,22 +38,58 @@ public class JAXWSBuilderUtils {    
         // is Absolute URL path
         if (isURL(wsdlLocation)) return wsdlLocation;
         
+        Module parentModule = module.getParentModule();
+
+        if(parentModule == null) {
+            return wsdlLocation;
+        }
+
         // EAR
         //   L WAR
-        if (module.getType().equals(ConfigurationModuleType.WAR) && module.getParentModule()
!= null && module.getParentModule().getType().equals(ConfigurationModuleType.EAR))
+        if (module.getType().equals(ConfigurationModuleType.WAR) && parentModule.getType().equals(ConfigurationModuleType.EAR))
             return module.getTargetPathURI().resolve(wsdlLocation).toString();
         
         // EAR 
         //   L WAR
         //       L EJB
-        if (module.getType().equals(ConfigurationModuleType.EJB) && module.getParentModule()
!= null && module.getParentModule().getType().equals(ConfigurationModuleType.WAR)
-                && module.getParentModule().getParentModule() != null &&
module.getParentModule().getParentModule().getType().equals(ConfigurationModuleType.EAR))
-            return module.getParentModule().getTargetPathURI().resolve(wsdlLocation).toString();
+        if (module.getType().equals(ConfigurationModuleType.EJB) && parentModule.getType().equals(ConfigurationModuleType.WAR)
+                && parentModule.getParentModule() != null && parentModule.getParentModule().getType().equals(ConfigurationModuleType.EAR))
+            return parentModule.getTargetPathURI().resolve(wsdlLocation).toString();
         
-            
+        // EAR
+        //   L EJB
+        if(module.getType().equals(ConfigurationModuleType.EJB) && parentModule.getType().equals(ConfigurationModuleType.EAR))
{
+            return module.getModuleURI().toString() + "!/" + wsdlLocation;
+        }
+
         return wsdlLocation;
     }
     
+    public static String normalizeCatalogPath(Module module, String catalogName) {
+        if(isURL(catalogName)) {
+            return catalogName;
+        }
+
+        Module parentModule = module.getParentModule();
+
+        if(parentModule == null) {
+            return catalogName;
+        }
+        // EAR
+        // L WAR
+        if(module.getType().equals(ConfigurationModuleType.WAR) && parentModule.getType().equals(ConfigurationModuleType.EAR))
{
+            return module.getTargetPathURI().resolve(catalogName).toString();
+        }
+        
+        // EAR
+        //   L EJB
+        if(module.getType().equals(ConfigurationModuleType.EJB) && parentModule.getType().equals(ConfigurationModuleType.EAR))
{
+            return module.getModuleURI().toString() + "!/" + catalogName;
+        }
+
+        return catalogName;
+    }
+    
     private static boolean isURL(URI name) {
         try {
             name.toURL();

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=1349684&r1=1349683&r2=1349684&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
Wed Jun 13 08:46:58 2012
@@ -17,6 +17,7 @@
 
 package org.apache.geronimo.jaxws.builder;
 
+import java.io.BufferedInputStream;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
@@ -93,7 +94,7 @@ public abstract class JAXWSServiceBuilde
         if (wsDDUrl != null) {
             InputStream in = null;
             try {
-                in = wsDDUrl.openStream();
+                in = new BufferedInputStream(wsDDUrl.openStream());
 
                 Webservices wst = (Webservices) JaxbJavaee.unmarshalJavaee(Webservices.class,
in);
                 for (WebserviceDescription desc : wst.getWebserviceDescription()) {
@@ -303,6 +304,7 @@ public abstract class JAXWSServiceBuilde
         containerFactoryData.setAttribute("componentContext", componentContext);
         containerFactoryData.setAttribute("holder", serviceHolder);
         containerFactoryData.setAttribute("contextRoot", ((WebModule) module).getContextRoot());
+        containerFactoryData.setAttribute("catalogName", JAXWSBuilderUtils.normalizeCatalogPath(module,
JAXWSUtils.DEFAULT_CATALOG_WEB));
         try {
             context.addGBean(containerFactoryData);
         } catch (GBeanAlreadyExistsException e) {
@@ -375,6 +377,8 @@ public abstract class JAXWSServiceBuilde
 
         targetGBean.setAttribute("portInfo", portInfo);
 
+        targetGBean.setAttribute("catalogName", JAXWSBuilderUtils.normalizeCatalogPath(module,
JAXWSUtils.DEFAULT_CATALOG_EJB));
+
         initialize(targetGBean, beanClass, portInfo, module, bundle);
 
         return true;

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java?rev=1349684&r1=1349683&r2=1349684&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
(original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
Wed Jun 13 08:46:58 2012
@@ -19,6 +19,7 @@ package org.apache.geronimo.jaxws;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
@@ -312,23 +313,82 @@ public class JAXWSUtils {
         if (catalogName == null) {
             return null;
         }
-        LOG.debug("Checking for {} catalog in classloader", catalogName);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Checking for {} catalog in classloader", catalogName);
+        }
         URL catalogURL = bundle.getResource(catalogName);
         if (catalogURL == null ) {
             try {
-                LOG.debug("Checking for {} catalog in module directory", catalogName);
-                URL tmpCatalogURL = BundleUtils.getEntry(bundle, catalogName);
-                if (tmpCatalogURL != null) {
-                    tmpCatalogURL.openStream().close();
-                    catalogURL = tmpCatalogURL;
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Checking for {} catalog in module directory", catalogName);
+                }
+                int jarSeparatorIndex = catalogName.indexOf("!/"); 
+                if (jarSeparatorIndex != -1 && jarSeparatorIndex < (catalogName.length()
- 2)) {
+                    String jarFileName = catalogName.substring(0,jarSeparatorIndex);
+                    URL jarFileURL = bundle.getEntry(jarFileName);
+                    if(jarFileURL != null) {
+                        return new URL("jar:" + jarFileURL + "!/" + catalogName.substring(jarSeparatorIndex
+2));
+                    }
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Not found the entry {} in the bundle {}", jarFileName,
bundle.getLocation());
+                    }
+                } else {
+                    URL tmpCatalogURL = BundleUtils.getEntry(bundle, catalogName);
+                    if (tmpCatalogURL != null) {
+                        tmpCatalogURL.openStream().close();
+                        catalogURL = tmpCatalogURL;
+                    }
                 }
             } catch (FileNotFoundException e) {
-                LOG.debug("Catalog {} is not present in the module", catalogName);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Catalog {} is not present in the module", catalogName);
+                }
             } catch (IOException e) {
-                LOG.warn("Failed to open catalog file: " + catalogURL, e);
+                if (LOG.isDebugEnabled()) {
+                    LOG.warn("Failed to open catalog file: " + catalogURL, e);
+                }
             }
         }
         return catalogURL;
     }
 
+    public static URL getWsdlURL(Bundle bundle, String wsdlFile) {
+        if (wsdlFile == null) {
+            return null;
+        }
+        URL wsdlURL = null;
+        try {
+            /**
+             * Geronimo now installs the whole EAR as one bundle, and the nested WARs are
extracted, while EJB are left as Jar files.
+             * If the WSDL file is included in the EJB, it is required to get the Jar file
entry firstly, then use jar protocol to load the WSDL
+             * file.
+             */
+            int jarSeparatorIndex = wsdlFile.indexOf("!/");
+            if (jarSeparatorIndex != -1 && jarSeparatorIndex < (wsdlFile.length()
- 2)) {
+                String jarFileName = wsdlFile.substring(0, jarSeparatorIndex);
+                URL jarFileURL = bundle.getEntry(jarFileName);
+                if (jarFileURL != null) {
+                    wsdlURL = new URL("jar:" + jarFileURL + "!/" + wsdlFile.substring(jarSeparatorIndex
+ 2));
+                }
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Not found the entry {} in the bundle {}", jarFileName, bundle.getLocation());
+                }
+            } else {
+                wsdlURL = BundleUtils.getEntry(bundle, wsdlFile);
+            }
+        } catch (MalformedURLException e) {
+            LOG.warn("MalformedURLException when getting entry:" + wsdlFile + " from bundle
" + bundle.getSymbolicName(), e);
+            wsdlURL = null;
+        }
+        if (wsdlURL == null) {
+            wsdlURL = bundle.getResource(wsdlFile);
+            if (wsdlURL == null) {
+                try {
+                    wsdlURL = new URL(wsdlFile);
+                } catch (MalformedURLException e) {
+                }
+            }
+        }
+        return wsdlURL;
+    }
 }

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/GeronimoAnnotationDeployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/GeronimoAnnotationDeployer.java?rev=1349684&r1=1349683&r2=1349684&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/GeronimoAnnotationDeployer.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/GeronimoAnnotationDeployer.java
Wed Jun 13 08:46:58 2012
@@ -20,12 +20,7 @@
 
 package org.apache.geronimo.openejb.deployment;
 
-import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.config.AnnotationDeployer;
-import org.apache.openejb.config.AppModule;
-import org.apache.openejb.config.EnvEntriesPropertiesDeployer;
-import org.apache.openejb.jee.JndiConsumer;
-import org.apache.xbean.finder.ClassFinder;
 
 /**
  * @version $Rev$ $Date$



Mime
View raw message