[jboss-cvs] JBossAS SVN: r86774 - in trunk: webservices/src/main/org/jboss/wsf/container/jboss60/deployer and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Apr 4 04:08:21 EDT 2009


Author: richard.opalka at jboss.com
Date: 2009-04-04 04:08:20 -0400 (Sat, 04 Apr 2009)
New Revision: 86774

Added:
   trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployment/metadata/InjectionMetaDataDeploymentAspect.java
Modified:
   trunk/component-matrix/pom.xml
   trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployer/ArchiveDeployerHook.java
   trunk/webservices/src/main/org/jboss/wsf/container/jboss60/invocation/InvocationHandlerJSE.java
   trunk/webservices/src/resources/jbossws-jboss60.deployer/META-INF/jbossws-deployer-jboss-beans.xml
Log:
[JBWS-2074] JBossWS Native release candidate 1

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2009-04-04 07:46:05 UTC (rev 86773)
+++ trunk/component-matrix/pom.xml	2009-04-04 08:08:20 UTC (rev 86774)
@@ -32,10 +32,10 @@
     <version.javax.faces>1.2_12</version.javax.faces>
     <version.jboss.jaxr>1.2.1.GA</version.jboss.jaxr>
     <version.jboss.jbossts>4.4.0.GA</version.jboss.jbossts>
-    <version.jboss.jbossws-common>1.0.9.GA</version.jboss.jbossws-common>
-    <version.jboss.jbossws-framework>3.1.0.GA</version.jboss.jbossws-framework>
-    <version.jboss.jbossws-spi>1.1.0.GA</version.jboss.jbossws-spi>
-    <version.jboss.jbossws>3.1.0.GA</version.jboss.jbossws>
+    <version.jboss.jbossws-common>1.0.10.CR1</version.jboss.jbossws-common>
+    <version.jboss.jbossws-framework>3.1.1.CR1</version.jboss.jbossws-framework>
+    <version.jboss.jbossws-spi>1.1.1.CR1</version.jboss.jbossws-spi>
+    <version.jboss.jbossws>3.1.1.CR1</version.jboss.jbossws>
     <version.jboss.jms-integration-tests>1.0.1.GA</version.jboss.jms-integration-tests>
     <version.jboss.messaging>1.4.1.GA</version.jboss.messaging>
     <version.jboss.web>2.1.2.GA</version.jboss.web>

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployer/ArchiveDeployerHook.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployer/ArchiveDeployerHook.java	2009-04-04 07:46:05 UTC (rev 86773)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployer/ArchiveDeployerHook.java	2009-04-04 08:08:20 UTC (rev 86774)
@@ -73,7 +73,7 @@
          }
 
          unit.addAttachment(Deployment.class, dep);
-         getDeploymentAspectManager().deploy(dep);         
+         getDeploymentAspectManager().deploy(dep);
       }
    }
 

Added: trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployment/metadata/InjectionMetaDataDeploymentAspect.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployment/metadata/InjectionMetaDataDeploymentAspect.java	                        (rev 0)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss60/deployment/metadata/InjectionMetaDataDeploymentAspect.java	2009-04-04 08:08:20 UTC (rev 86774)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.wsf.container.jboss60.deployment.metadata;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
+
+/**
+ * Deployment aspect that builds injection meta data.
+ *
+ * @author ropalka at redhat.com
+ */
+public final class InjectionMetaDataDeploymentAspect extends DeploymentAspect
+{
+
+   @Override
+   public void create(Deployment dep)
+   {
+      super.create(dep);
+
+      DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+      if (unit == null)
+         throw new IllegalStateException();
+      
+      List<InjectionMetaData> injectionMD = new LinkedList<InjectionMetaData>();
+      DeploymentType deploymentType = dep.getType();
+
+      if (deploymentType == DeploymentType.JAXWS_JSE)
+      {
+         JBossWebMetaData webMD = unit.getAttachment(JBossWebMetaData.class);
+         injectionMD.addAll(buildInjectionMetaData(webMD.getEnvironmentEntries()));
+      }
+      else if (deploymentType == DeploymentType.JAXWS_EJB3)
+      {
+         // [JBWS-2074] see comment in JIRA
+         log.warn("Both @Resource annotated methods/fields and descriptor specified injections don't work in handlers associated with EJB3 endpoints");
+         /*
+         JBossMetaData jbossMD = unit.getAttachment(JBossMetaData.class);
+         JBossEnterpriseBeansMetaData jebMDs = jbossMD.getEnterpriseBeans();
+         
+         WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+         EnvironmentEntriesMetaData attachment = new EnvironmentEntriesMetaData();
+         
+         Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+         while (it.hasNext())
+         {
+            WebServiceDeclaration container = it.next();
+            if (isWebServiceBean(container))
+            {
+               String ejbName = container.getComponentName();
+               EnvironmentEntriesMetaData ejbEnvEntries = jebMDs.get(ejbName).getEnvironmentEntries(); 
+               attachment.addAll(ejbEnvEntries);
+               injectionMD.addAll(buildInjectionMetaData(ejbEnvEntries));
+            }
+         }
+         */
+      }
+
+      dep.getService().addAttachment(InjectionsMetaData.class, new InjectionsMetaData(injectionMD));
+   }
+
+   @Override
+   public void destroy(Deployment dep)
+   {
+      dep.getService().removeAttachment(InjectionMetaData.class);
+
+      super.destroy(dep);
+   }
+   
+   private List<InjectionMetaData> buildInjectionMetaData(EnvironmentEntriesMetaData envEntries)
+   {
+      if ((envEntries == null) || (envEntries.size() == 0))
+      {
+         return Collections.emptyList();
+      }
+      
+      EnvironmentEntryMetaData eeMD = null;
+      LinkedList<InjectionMetaData> retVal = new LinkedList<InjectionMetaData>();
+      String envEntryName = null;
+      String envEntryValue = null;
+      String targetClass = null;
+      String targetName = null;
+      String valueClass = null;
+      
+      for (Iterator<EnvironmentEntryMetaData> i = envEntries.iterator(); i.hasNext();)
+      {
+         eeMD = i.next();
+         envEntryName = eeMD.getEnvEntryName();
+         envEntryValue = eeMD.getValue();
+         valueClass = eeMD.getType();
+
+         Set<ResourceInjectionTargetMetaData> injectionTargets = eeMD.getInjectionTargets();
+         if ((injectionTargets != null) && (injectionTargets.size() > 0))
+         {
+            for (Iterator<ResourceInjectionTargetMetaData> j = injectionTargets.iterator(); j.hasNext(); )
+            {
+               ResourceInjectionTargetMetaData ritMD = j.next();
+               targetClass = ritMD.getInjectionTargetClass();
+               targetName = ritMD.getInjectionTargetName();
+               InjectionMetaData injectionMD = new InjectionMetaData(targetClass, targetName, valueClass, envEntryName, envEntryValue != null);
+               
+               retVal.add(injectionMD);
+               log.debug(injectionMD);
+            }
+         }
+      }
+      
+      return retVal;
+   }
+
+   private boolean isWebServiceBean(WebServiceDeclaration container)
+   {
+      boolean isWebService = container.getAnnotation(WebService.class) != null;
+      boolean isWebServiceProvider = container.getAnnotation(WebServiceProvider.class) != null;
+      
+      return isWebService || isWebServiceProvider;
+   }
+
+}

Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss60/invocation/InvocationHandlerJSE.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss60/invocation/InvocationHandlerJSE.java	2009-04-04 07:46:05 UTC (rev 86773)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss60/invocation/InvocationHandlerJSE.java	2009-04-04 08:08:20 UTC (rev 86774)
@@ -36,6 +36,7 @@
 import org.jboss.wsf.spi.invocation.InvocationHandler;
 import org.jboss.wsf.spi.invocation.ResourceInjector;
 import org.jboss.wsf.spi.invocation.ResourceInjectorFactory;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
 
 /**
  * Handles invocations on JSE endpoints.
@@ -80,14 +81,15 @@
          {
             throw new IllegalStateException("Cannot get target bean instance", ex);
          }
-         
-         JavaxAnnotationHelper.callPostConstructMethod(targetBean, targetBean.getClass().getClassLoader());
+
+         JavaxAnnotationHelper.injectResources(targetBean, ep.getService().getAttachment(InjectionsMetaData.class));
+         JavaxAnnotationHelper.callPostConstructMethod(targetBean);
          ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
       }
-      
+
       return targetBean;
    }
-   
+
    public void invoke(Endpoint ep, Invocation epInv) throws Exception
    {
       try

Modified: trunk/webservices/src/resources/jbossws-jboss60.deployer/META-INF/jbossws-deployer-jboss-beans.xml
===================================================================
--- trunk/webservices/src/resources/jbossws-jboss60.deployer/META-INF/jbossws-deployer-jboss-beans.xml	2009-04-04 07:46:05 UTC (rev 86773)
+++ trunk/webservices/src/resources/jbossws-jboss60.deployer/META-INF/jbossws-deployer-jboss-beans.xml	2009-04-04 08:08:20 UTC (rev 86774)
@@ -197,6 +197,11 @@
     <property name="provides">ContainerMetaData, VFSRoot</property>
   </bean>
   
+  <bean name="WSInjectionMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss60.deployment.metadata.InjectionMetaDataDeploymentAspect">
+    <property name="requires">ContainerMetaData</property>
+    <property name="provides">InjectionMetaData</property>
+  </bean>  
+
   <bean name="WSContextRootDeploymentAspect" class="org.jboss.wsf.framework.deployment.BackwardCompatibleContextRootDeploymentAspect">
     <property name="requires">ContainerMetaData</property>
     <property name="provides">ContextRoot</property>
@@ -286,6 +291,7 @@
     <property name="aspects">
       <set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
         <inject bean="WSContainerMetaDataDeploymentAspect"/>
+        <inject bean="WSInjectionMetaDataDeploymentAspect"/>
         <inject bean="WSContextRootDeploymentAspect"/>
         <inject bean="WSEndpointAddressDeploymentAspect"/>
         <inject bean="WSEndpointHandlerDeploymentAspect"/>
@@ -316,6 +322,7 @@
     <property name="aspects">
       <set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
         <inject bean="WSContainerMetaDataDeploymentAspect"/>
+        <inject bean="WSInjectionMetaDataDeploymentAspect"/>
         <inject bean="WSContextRootDeploymentAspect"/>
         <inject bean="WSVirtualHostDeploymentAspect"/>
         <inject bean="WSEndpointAddressDeploymentAspect"/>




More information about the jboss-cvs-commits mailing list