[jbossws-commits] JBossWS SVN: r3512 - in branches/jbossws-2.0/integration: native/src/main/resources/jbossws-native50.sar/META-INF and 2 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Fri Jun 8 13:21:58 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-06-08 13:21:58 -0400 (Fri, 08 Jun 2007)
New Revision: 3512

Added:
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java
Modified:
   branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml
   branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml
   branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java
Log:
ContextRoot, URLPattern always start with '/'
Add ServiceRefHandlerFactory


Modified: branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml	2007-06-08 15:55:54 UTC (rev 3511)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml	2007-06-08 17:21:58 UTC (rev 3512)
@@ -33,10 +33,6 @@
     <property name="bindAddress">${jboss.bind.address}</property>
   </bean>
   
-  <!-- Bind Service objects in client environment context  -->
-  <!-- The bean name is compiled into the server. Changeit with the next release. -->
-  <bean name="ServiceRefHandler" class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
-  
   <!-- Locate the single instance of the kernel -->  
   <bean name="WSKernelLocator" class="org.jboss.ws.integration.KernelLocator">
     <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>

Modified: branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml	2007-06-08 15:55:54 UTC (rev 3511)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml	2007-06-08 17:21:58 UTC (rev 3512)
@@ -33,10 +33,6 @@
     <property name="bindAddress">${jboss.bind.address}</property>
   </bean>
   
-  <!-- Bind Service objects in client environment context  -->
-  <!-- The bean name is compiled into the server. Changeit with the next release. -->
-  <bean name="ServiceRefHandler" class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
-  
   <!-- Locate the single instance of the kernel -->  
   <bean name="WSKernelLocator" class="org.jboss.ws.integration.KernelLocator">
     <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>

Modified: branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml
===================================================================
--- branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml	2007-06-08 15:55:54 UTC (rev 3511)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml	2007-06-08 17:21:58 UTC (rev 3512)
@@ -34,8 +34,7 @@
   </bean>
   
   <!-- Bind Service objects in client environment context  -->
-  <!-- The bean name is compiled into the server. Changeit with the next release. -->
-  <bean name="ServiceRefHandler" class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
+  <bean name="WSServiceRefHandler" class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
   
   <!-- Locate the single instance of the kernel -->  
   <bean name="WSKernelLocator" class="org.jboss.ws.integration.KernelLocator">

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java	2007-06-08 15:55:54 UTC (rev 3511)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java	2007-06-08 17:21:58 UTC (rev 3512)
@@ -37,8 +37,6 @@
  */
 public interface ServiceRefHandler
 {
-   String BEAN_NAME = "ServiceRefHandler";
-   
    ServiceRefMetaData newServiceRefMetaData();
 
    Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs);

Added: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java	                        (rev 0)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java	2007-06-08 17:21:58 UTC (rev 3512)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.integration;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.wsf.spi.utils.ServiceLoader;
+
+// $Id$
+
+/**
+ * A factory for the ServiceRefHandler 
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2004
+ */
+public abstract class ServiceRefHandlerFactory
+{
+   public static ServiceRefHandler getServiceRefHandler()
+   {
+      ServiceRefHandler handler;
+      Kernel kernel = KernelLocator.getKernel();
+      if (kernel != null)
+      {
+         KernelRegistry registry = kernel.getRegistry();
+         KernelRegistryEntry entry = registry.getEntry("WSServiceRefHandler");
+         handler = (ServiceRefHandler)entry.getTarget();
+         
+         // Try legancy JBossAS-4.2 name
+         if (handler == null)
+         {
+            entry = registry.getEntry("ServiceRefHandler");
+            handler = (ServiceRefHandler)entry.getTarget();
+         }
+      }
+      // The client does not have a microkernel
+      else
+      {
+         String propName = ServiceRefHandler.class.getName();
+         String defaultImpl = "org.jboss.ws.core.client.ServiceRefHandlerImpl";
+         handler = (ServiceRefHandler)ServiceLoader.loadService(propName, defaultImpl);
+      }
+      return handler;
+   }
+}


Property changes on: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java	2007-06-08 15:55:54 UTC (rev 3511)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java	2007-06-08 17:21:58 UTC (rev 3512)
@@ -26,7 +26,6 @@
 import org.jboss.wsf.spi.annotation.WebContext;
 import org.jboss.wsf.spi.metadata.j2ee.UnifiedApplicationMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
 
 /**
  * A deployer that assigns the context root to the service 
@@ -39,8 +38,14 @@
    @Override
    public void create(Deployment dep)
    {
+      String contextRoot = getContextRoot(dep);
+      dep.getService().setContextRoot(contextRoot);
+   }
+
+   private String getContextRoot(Deployment dep)
+   {
       String contextRoot = null;
-      
+
       // #1 Use the explicit context root from the web meta data
       UnifiedWebMetaData webMetaData = dep.getContext().getAttachment(UnifiedWebMetaData.class);
       if (webMetaData != null)
@@ -83,9 +88,10 @@
          }
       }
 
-      if (contextRoot.startsWith("/"))
-         contextRoot = contextRoot.substring(1);
-
-      dep.getService().setContextRoot(contextRoot);
+      // Always prefix with '/'
+      if (contextRoot.startsWith("/") == false)
+         contextRoot = "/" + contextRoot;
+      
+      return contextRoot;
    }
 }
\ No newline at end of file

Modified: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java	2007-06-08 15:55:54 UTC (rev 3511)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java	2007-06-08 17:21:58 UTC (rev 3512)
@@ -85,8 +85,12 @@
       // #4 Fallback to the ejb-name 
       if (urlPattern == null)
       {
-         urlPattern = "/" + ep.getShortName();
+         urlPattern = ep.getShortName();
       }
+      
+      // Always prefix with '/'
+      if (urlPattern.startsWith("/") == false)
+         urlPattern = "/" + urlPattern;
 
       return urlPattern;
    }




More information about the jbossws-commits mailing list