[jboss-cvs] JBossAS SVN: r100356 - in branches/jaxrpc-cxf/webservices/src: resources/jbossws-jboss.deployer/META-INF and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 3 12:24:04 EST 2010


Author: alessio.soldano at jboss.com
Date: 2010-02-03 12:24:04 -0500 (Wed, 03 Feb 2010)
New Revision: 100356

Added:
   branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCClientClassPathDeployer.java
   branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCIntegrationClassPathDeployer.java
   branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCServerClassPathDeployer.java
Modified:
   branches/jaxrpc-cxf/webservices/src/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2916] Adding two describe stage deployers for properly setting classpath for jaxrpc client and server deployments


Added: branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCClientClassPathDeployer.java
===================================================================
--- branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCClientClassPathDeployer.java	                        (rev 0)
+++ branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCClientClassPathDeployer.java	2010-02-03 17:24:04 UTC (rev 100356)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.webservices.integration.deployers;
+
+import java.util.Iterator;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.client.spec.ApplicationClientMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
+import org.jboss.webservices.integration.util.ASHelper;
+
+/**
+ * A deployer for properly setting the classpath for jaxrpc client deployments;
+ * it's triggered by the ApplicationClientMetaData which is attached to the unit
+ * when a application-client.xml descriptor file is found in the deployment.
+ * This deployer then actually enables classpath modification when a jaxrpc-mapping
+ * is specified in the descriptor.
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 03-Feb-2010
+ *
+ */
+public class JAXRPCClientClassPathDeployer extends JAXRPCIntegrationClassPathDeployer<ApplicationClientMetaData>
+{
+   public JAXRPCClientClassPathDeployer()
+   {
+      super(ApplicationClientMetaData.class);
+      setInput(ApplicationClientMetaData.class); //makes the input mandatory instead of optional
+   }
+   
+   @Override
+   protected boolean isClassPathChangeRequired(VFSDeploymentUnit unit)
+   {
+      ApplicationClientMetaData applicationClientMetaData = ASHelper.getRequiredAttachment(unit, ApplicationClientMetaData.class);
+      ServiceReferencesMetaData serviceReferences = applicationClientMetaData.getServiceReferences();
+      if (serviceReferences != null)
+      {
+         for (Iterator<ServiceReferenceMetaData> it = serviceReferences.iterator(); it.hasNext();)
+         {
+            ServiceReferenceMetaData serviceReference = it.next();
+            if (serviceReference.getJaxrpcMappingFile() != null)
+            {
+               return true;
+            }
+         }
+      }
+      return false;
+   }
+}


Property changes on: branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCClientClassPathDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCIntegrationClassPathDeployer.java
===================================================================
--- branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCIntegrationClassPathDeployer.java	                        (rev 0)
+++ branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCIntegrationClassPathDeployer.java	2010-02-03 17:24:04 UTC (rev 100356)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.webservices.integration.deployers;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.plugins.classloader.UrlIntegrationDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.util.StringPropertyReplacer;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * An abstract deployer that properly set the classpath for JAX-RPC deployments.
+ * This is performed adding a reference to an integration lib from the jaxrpc
+ * deployers to the deployment unit's classpath.
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 02-Feb-2010
+ *
+ */
+public abstract class JAXRPCIntegrationClassPathDeployer<T> extends UrlIntegrationDeployer<T>
+{
+   private boolean integrationLibFound = false;
+   
+   public JAXRPCIntegrationClassPathDeployer(Class<T> input)
+   {
+      super(input);
+      setIntegrationURLs(getJBossWSIntegrationUrls());
+   }
+   
+   protected abstract boolean isClassPathChangeRequired(VFSDeploymentUnit unit);
+
+   @Override
+   protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
+   {
+      return integrationLibFound && isClassPathChangeRequired(unit);
+   }
+   
+   @Override
+   public void start()
+   {
+      //NOOP
+   }
+   
+   protected Set<URL> getJBossWSIntegrationUrls()
+   {
+      try
+      {
+         String url = getServerHome() + getServicesConfigLibInJAXRPCDeployer();
+         url = StringPropertyReplacer.replaceProperties(url);
+         VirtualFile integrationLib = VFS.getRoot(new URL(url));
+         Set<URL> result = new HashSet<URL>();
+         if (integrationLib != null && integrationLib.exists())
+         {
+            integrationLibFound = true;
+            result.add(integrationLib.toURL());
+         }
+         else
+         {
+            log.debug("Could not find JAX-RPC integration lib: " + url);
+         }
+         return result;
+      }
+      catch (Exception e)
+      {
+         throw new IllegalArgumentException("Unexpected error: " + e);
+      }
+   }
+   
+   /**
+    * Get server home.
+    *
+    * @return the jboss server home location
+    */
+   protected String getServerHome()
+   {
+      return "${jboss.server.home.url}";
+   }
+
+   /**
+    * Get the integration dir path
+    * 
+    * @return the integration path
+   */
+   protected String getServicesConfigLibInJAXRPCDeployer()
+   {
+      return "deployers/jbossws-jaxrpc.deployer/jbossws-native-services.jar";
+   }
+
+}


Property changes on: branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCIntegrationClassPathDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCServerClassPathDeployer.java
===================================================================
--- branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCServerClassPathDeployer.java	                        (rev 0)
+++ branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCServerClassPathDeployer.java	2010-02-03 17:24:04 UTC (rev 100356)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.webservices.integration.deployers;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * A deployer for properly setting the classpath for jaxrpc endpoint deployments;
+ * it's triggered by the WebservicesMetaData which is attached to the unit
+ * when a webservice.xml descriptor file is found in the deployment.
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 03-Feb-2010
+ *
+ */
+public class JAXRPCServerClassPathDeployer extends JAXRPCIntegrationClassPathDeployer<WebservicesMetaData>
+{
+   public JAXRPCServerClassPathDeployer()
+   {
+      super(WebservicesMetaData.class);
+      setInput(WebservicesMetaData.class); //makes the input mandatory instead of optional
+   }
+   
+   @Override
+   protected boolean isClassPathChangeRequired(VFSDeploymentUnit unit)
+   {
+      return true;
+   }
+}


Property changes on: branches/jaxrpc-cxf/webservices/src/main/java/org/jboss/webservices/integration/deployers/JAXRPCServerClassPathDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/jaxrpc-cxf/webservices/src/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
--- branches/jaxrpc-cxf/webservices/src/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml	2010-02-03 17:04:42 UTC (rev 100355)
+++ branches/jaxrpc-cxf/webservices/src/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml	2010-02-03 17:24:04 UTC (rev 100356)
@@ -139,4 +139,8 @@
     <property name="provides">WebMetaData</property>
   </bean>
 
+  <bean name="JAXRPCClientClassPathDeployer" class="org.jboss.webservices.integration.deployers.JAXRPCClientClassPathDeployer" />  
+
+  <bean name="JAXRPCServerClassPathDeployer" class="org.jboss.webservices.integration.deployers.JAXRPCServerClassPathDeployer" />  
+
 </deployment>




More information about the jboss-cvs-commits mailing list