geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r480224 - /geronimo/sandbox/javaee5/modules-jee5/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
Date Tue, 28 Nov 2006 21:46:41 GMT
Author: jbohn
Date: Tue Nov 28 13:46:40 2006
New Revision: 480224

URL: http://svn.apache.org/viewvc?view=rev&rev=480224
Log:
Add updates to match trunk changes in rev 479496:
GERONIMO-2597 make web service builder optional and allow multiple builders

Modified:
    geronimo/sandbox/javaee5/modules-jee5/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java

Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java?view=diff&rev=480224&r1=480223&r2=480224
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
(original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
Tue Nov 28 13:46:40 2006
@@ -30,6 +30,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.cxf.PortInfo;
@@ -46,6 +47,7 @@
     private static final Logger LOG = Logger.getLogger(CXFBuilder.class.getName());
 
     private final Environment defaultEnvironment;
+    private static final String KEY = CXFBuilder.class.getName();
     private JAXBContext ctx;
 
 
@@ -53,19 +55,18 @@
         this.defaultEnvironment = defaultEnvironment;
     }
 
-    public Map findWebServices(JarFile moduleFile, boolean isEJB, Map servletLocations, Environment
environment) throws DeploymentException {
+    public void findWebServices(JarFile moduleFile, boolean isEJB, Map servletLocations,
Environment environment, Map sharedContext) throws DeploymentException {
         final String path = isEJB ? "META-INF/webservices.xml" : "WEB-INF/webservices.xml";
         try {
             URL wsDDUrl = DeploymentUtil.createJarURL(moduleFile, path);
-            Map result = parseWebServiceDescriptor(wsDDUrl, moduleFile, isEJB, servletLocations);
-            if (result != null) {
+            Map portMap = parseWebServiceDescriptor(wsDDUrl, moduleFile, isEJB, servletLocations);
+            if (portMap != null) {
                 EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
-                return result;
+                sharedContext.put(KEY, portMap);
             }
         } catch (MalformedURLException e) {
             // The webservices.xml file doesn't exist.
         }
-        return Collections.EMPTY_MAP;
     }
     
     private Map<String, PortInfo> parseWebServiceDescriptor(URL wsDDUrl, JarFile moduleFile,
boolean isEJB, Map correctedPortLocations) throws DeploymentException {
@@ -122,21 +123,27 @@
     }
 
 
-    public void configurePOJO(GBeanData targetGBean, Module module, Object pi, String seiClassName,
DeploymentContext context) throws DeploymentException {
+    public boolean configurePOJO(GBeanData targetGBean, String servletName, Module module,
String seiClassName, DeploymentContext context) throws DeploymentException {
 
-        assert pi instanceof PortInfo : "received incorrect portInfo object";
+        // assert pi instanceof PortInfo : "received incorrect portInfo object";
+
+        Map sharedContext = ((WebModule) module).getSharedContext();
+        Map portInfoMap = (Map) sharedContext.get(KEY);
+        PortInfo portInfo = (PortInfo) portInfoMap.get(servletName);
+        if (portInfo == null) {
+            //not ours
+            return false;
+        }
 
-        PortInfo portInfo = (PortInfo) pi;
 
-        LOG.info("configuring POJO webservice: " + pi + " sei: " + seiClassName);
+        LOG.info("configuring POJO webservice: " + servletName + " sei: " + seiClassName);
 
         // verify that the class is loadable
         ClassLoader classLoader = context.getClassLoader();
         loadSEI(seiClassName, classLoader);
 
         /*List<Handler> handlers =*/ buildHandlerChain(portInfo);
-        AbstractName servletName = targetGBean.getAbstractName();
-        AbstractName containerFactoryName = context.getNaming().createChildName(servletName,
NameFactory.GERONIMO_SERVICE, "cxfWebServiceContainerFactory");
+        AbstractName containerFactoryName = context.getNaming().createChildName(targetGBean.getAbstractName(),
"cxfWebServiceContainerFactory", NameFactory.GERONIMO_SERVICE);
         GBeanData containerFactoryData = new GBeanData(containerFactoryName, CXFWebServiceContainerFactoryGBean.GBEAN_INFO);
         containerFactoryData.setAttribute("portInfo", portInfo);
         containerFactoryData.setAttribute("endpointClassName", seiClassName);
@@ -148,13 +155,11 @@
 
         targetGBean.setReferencePattern("WebServiceContainerFactory", containerFactoryName);
         targetGBean.setAttribute("pojoClassName", seiClassName);
+        return true;
     }
 
 
-    public void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfo,
-            ClassLoader classLoader)
-            throws DeploymentException {
-
+    public boolean configureEJB(GBeanData targetGBean, String ejbName, JarFile moduleFile,
Map sharedContext, ClassLoader classLoader) throws DeploymentException {
         throw new DeploymentException("configureEJB NYI");
     }
 



Mime
View raw message