[jboss-cvs] JBossAS SVN: r83569 - in projects/jboss-seam-int/trunk: jbossas and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 28 11:48:21 EST 2009


Author: alesj
Date: 2009-01-28 11:48:21 -0500 (Wed, 28 Jan 2009)
New Revision: 83569

Added:
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java
   projects/jboss-seam-int/trunk/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/vdf/
   projects/jboss-seam-int/trunk/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/vdf/DeploymentUnitAware.java
Modified:
   projects/jboss-seam-int/trunk/jbossas/pom.xml
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractVDFConnector.java
   projects/jboss-seam-int/trunk/pom.xml
Log:
Add bean initalization vdf.

Modified: projects/jboss-seam-int/trunk/jbossas/pom.xml
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/pom.xml	2009-01-28 16:29:01 UTC (rev 83568)
+++ projects/jboss-seam-int/trunk/jbossas/pom.xml	2009-01-28 16:48:21 UTC (rev 83569)
@@ -15,10 +15,15 @@
   
     <!-- Global dependencies -->
     <dependency>
+      <groupId>org.jboss.seam.integration</groupId>
+      <artifactId>jboss-seam-int-microcontainer</artifactId>
+    </dependency>
+    
+    <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jboss-common-core</artifactId>
     </dependency>
-    
+
     <dependency>
       <groupId>org.jboss.logging</groupId>
       <artifactId>jboss-logging-spi</artifactId>

Copied: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java (from rev 83562, projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java)
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java	2009-01-28 16:48:21 UTC (rev 83569)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.seam.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.seam.integration.microcontainer.vdf.DeploymentUnitAware;
+
+/**
+ * AbstractBeanFactoryInitializerTypeVDFConnector.
+ *
+ * @param <T> exact bean type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractBeanFactoryInitializerVDFConnector<T extends DeploymentUnitAware> extends AbstractBeanFactoryVDFConnector<T>
+{
+   protected AbstractBeanFactoryInitializerVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   @Override
+   protected void initialize(T bean)
+   {
+      VFSDeploymentUnitVDFConnector connector = new VFSDeploymentUnitVDFConnector(getServletContext());
+      if (connector.isValid() == false)
+         throw new IllegalArgumentException("No deployment unit.");
+
+      bean.setDeploymentUnit(connector.getUtility());
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java	2009-01-28 16:29:01 UTC (rev 83568)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java	2009-01-28 16:48:21 UTC (rev 83569)
@@ -53,11 +53,22 @@
          if (type.isInstance(bean) == false)
             throw new IllegalArgumentException("Bean " + bean + " is not instance of " + type);
 
-         return type.cast(bean);
+         T result = type.cast(bean);
+         initialize(result);
+         return result;
       }
       catch (Throwable t)
       {
          throw new RuntimeException(t);
       }
    }
+
+   /**
+    * Initialize the bean.
+    *
+    * @param bean the bean to initalize
+    */
+   protected void initialize(T bean)
+   {
+   }
 }
\ No newline at end of file

Modified: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractVDFConnector.java	2009-01-28 16:29:01 UTC (rev 83568)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractVDFConnector.java	2009-01-28 16:48:21 UTC (rev 83569)
@@ -43,6 +43,16 @@
    }
 
    /**
+    * Get servlet context.
+    *
+    * @return the servlet context
+    */
+   protected ServletContext getServletContext()
+   {
+      return servletContext;
+   }
+
+   /**
     * Get utility type.
     *
     * @return the utility type

Added: projects/jboss-seam-int/trunk/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/vdf/DeploymentUnitAware.java
===================================================================
--- projects/jboss-seam-int/trunk/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/vdf/DeploymentUnitAware.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/vdf/DeploymentUnitAware.java	2009-01-28 16:48:21 UTC (rev 83569)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.seam.integration.microcontainer.vdf;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Deployment unit aware marker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface DeploymentUnitAware
+{
+   /**
+    * Set the deployment unit.
+    *
+    * @param unit the deployment unit
+    */
+   void setDeploymentUnit(DeploymentUnit unit);
+}

Modified: projects/jboss-seam-int/trunk/pom.xml
===================================================================
--- projects/jboss-seam-int/trunk/pom.xml	2009-01-28 16:29:01 UTC (rev 83568)
+++ projects/jboss-seam-int/trunk/pom.xml	2009-01-28 16:48:21 UTC (rev 83569)
@@ -190,10 +190,15 @@
     <dependencies>
     
       <dependency>
+        <groupId>org.jboss.seam.integration</groupId>
+        <artifactId>jboss-seam-int-microcontainer</artifactId>
+        <version>${project.version}</version>
+      </dependency>      
+      <dependency>
         <groupId>org.jboss.deployers</groupId>
         <artifactId>jboss-deployers-client</artifactId>
         <version>${version.jboss.deployers}</version>
-      </dependency>      
+      </dependency>
       <dependency>
         <groupId>org.jboss.deployers</groupId>
         <artifactId>jboss-deployers-client-spi</artifactId>




More information about the jboss-cvs-commits mailing list