geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r525000 - /geronimo/server/trunk/modules/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
Date Tue, 03 Apr 2007 02:22:22 GMT
Author: dwoods
Date: Mon Apr  2 19:22:21 2007
New Revision: 525000

URL: http://svn.apache.org/viewvc?view=rev&rev=525000
Log:
GERONIMO-3045 Unable to run jax-rpc war test with Axis2
Thanks Lin.

Modified:
    geronimo/server/trunk/modules/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java

Modified: geronimo/server/trunk/modules/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java?view=diff&rev=525000&r1=524999&r2=525000
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
Mon Apr  2 19:22:21 2007
@@ -81,20 +81,64 @@
         Map portMap = null;
         String path = isEJB ? "META-INF/webservices.xml" : "WEB-INF/webservices.xml";
         JarFile moduleFile = module.getModuleFile();
-        try {
-            URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, path);
-            InputStream in = wsDDUrl.openStream();
-            portMap = parseWebServiceDescriptor(in, wsDDUrl, moduleFile, isEJB, servletLocations);
-        } catch (IOException e) {
-            // webservices.xml does not exist
-            portMap = discoverWebServices(module, isEJB, servletLocations);
-        }
+        if (containsAnnotation(module, isEJB)) {
+            try {
+                URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, path);
+                InputStream in = wsDDUrl.openStream();
+                portMap = parseWebServiceDescriptor(in, wsDDUrl, moduleFile, isEJB, servletLocations);
+            } catch (IOException e) {
+                // webservices.xml does not exist
+                portMap = discoverWebServices(module, isEJB, servletLocations);
+            }
 
-        if (portMap != null && !portMap.isEmpty()) {
-            EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
-            sharedContext.put(getKey(), portMap);
+            if (portMap != null && !portMap.isEmpty()) {
+                EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
+                sharedContext.put(getKey(), portMap);
+            }
         }
 
+    }
+    
+    private boolean containsAnnotation(Module module, boolean isEJB) throws DeploymentException
{
+        if (isEJB) {
+            ClassLoader classLoader = module.getEarContext().getClassLoader();
+            EjbModule ejbModule = (EjbModule) module;
+            for (EnterpriseBeanInfo bean : ejbModule.getEjbJarInfo().enterpriseBeans) {
+                if (bean.type != EnterpriseBeanInfo.STATELESS) {
+                    continue;
+                }            
+                try {
+                    Class ejbClass = classLoader.loadClass(bean.ejbClass);
+                    if (JAXWSUtils.isWebService(ejbClass)) {
+                        return true;
+                    }
+                } catch (Exception e) {
+                    throw new DeploymentException("Failed to load ejb class "
+                                                  + bean.ejbName, e);
+                }
+            }
+        } else {
+            ClassLoader classLoader = module.getEarContext().getClassLoader();
+            WebAppType webApp = (WebAppType) module.getSpecDD();
+
+            ServletType[] servletTypes = webApp.getServletArray();
+            for (ServletType servletType : servletTypes) {
+                if (servletType.isSetServletClass()) {
+                    String servletClassName = servletType.getServletClass().getStringValue().trim();
+                    try {
+                        Class servletClass = classLoader.loadClass(servletClassName);
+                        if (JAXWSUtils.isWebService(servletClass)) {
+                            return true;
+                        }
+                    } catch (Exception e) {
+                        throw new DeploymentException("Failed to load servlet class "
+                                                      + servletClassName, e);
+                    }
+                }
+            }
+            
+        }
+        return false;
     }
 
     private Map<String, PortInfo> discoverWebServices(Module module,



Mime
View raw message