[jboss-cvs] JBossAS SVN: r81343 - in projects/webbeans-ri-int/trunk/jbossas/src: main/java/org/jboss/webbeans/integration/jbossas and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 20 00:47:31 EST 2008


Author: petemuir
Date: 2008-11-20 00:47:31 -0500 (Thu, 20 Nov 2008)
New Revision: 81343

Added:
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AttachmentVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseAttachmentVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelControllerVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelUtilityVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/NamedAttachmentVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java
   projects/webbeans-ri-int/trunk/jbossas/src/test/
   projects/webbeans-ri-int/trunk/jbossas/src/test/java/
   projects/webbeans-ri-int/trunk/jbossas/src/test/java/org/
   projects/webbeans-ri-int/trunk/jbossas/src/test/java/org/jboss/
   projects/webbeans-ri-int/trunk/jbossas/src/test/java/org/jboss/test/
   projects/webbeans-ri-int/trunk/jbossas/src/test/java/org/jboss/test/deployers/
   projects/webbeans-ri-int/trunk/jbossas/src/test/java/org/jboss/test/deployers/vfs/
Removed:
   projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeanDiscovery.java
Modified:
   projects/webbeans-ri-int/trunk/jbossas/src/main/resources/META-INF/web-beans-ri.properties
Log:
Implement WebBeanDiscovery

Deleted: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeanDiscovery.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeanDiscovery.java	2008-11-20 05:11:52 UTC (rev 81342)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeanDiscovery.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -1,16 +0,0 @@
-package org.jboss.webbeans.integration.jbossas;
-import java.util.Set;
-
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-
-
-public class JBossWebBeanDiscovery implements WebBeanDiscovery
-{
-
-   public Set<Class<?>> discoverWebBeanClasses()
-   {
-      // TODO Auto-generated method stub
-      return null;
-   }
-   
-}

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.integration.jbossas;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss WebBeans custom meta data
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JBossWebBeansMetaData implements Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   private VirtualFile file;
+
+   public JBossWebBeansMetaData(VirtualFile file)
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+      this.file = file;
+   }
+
+   public URL getURL() throws Exception
+   {
+      return file.toURL();
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.integration.jbossas;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JBossWebBeansMetaDataDeployer extends AbstractVFSParsingDeployer<JBossWebBeansMetaData>  
+{
+   public JBossWebBeansMetaDataDeployer()
+   {
+      super(JBossWebBeansMetaData.class);
+      setName("jboss-web-beans.xml");
+   }
+
+   protected JBossWebBeansMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWebBeansMetaData root) throws Exception
+   {
+      return new JBossWebBeansMetaData(file);
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,168 @@
+/*
+ * 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.webbeans.integration.jbossas;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.visitor.ClassFilter;
+import org.jboss.classloading.spi.visitor.ResourceContext;
+import org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.classloading.spi.visitor.ResourceVisitor;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+
+/**
+ * WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryDeployer extends AbstractOptionalVFSRealDeployer<JBossWebBeansMetaData>
+{
+   public WebBeanDiscoveryDeployer()
+   {
+      super(JBossWebBeansMetaData.class);
+      addOutput(WebBeanDiscovery.class);
+   }
+
+   public void deploy(VFSDeploymentUnit unit, JBossWebBeansMetaData deployment) throws DeploymentException
+   {
+      VFSDeploymentUnit topUnit = unit.getTopLevel();
+      WebBeanDiscoveryEnvironment environment = topUnit.getAttachment(WebBeanDiscoveryEnvironment.class.getName(), WebBeanDiscoveryEnvironment.class);
+      if (environment == null)
+      {
+         environment = new WebBeanDiscoveryEnvironment();
+         topUnit.addAttachment(WebBeanDiscoveryEnvironment.class.getName(), environment);
+      }
+
+      List<URL> urls = new ArrayList<URL>();
+
+      try
+      {
+         if (deployment != null)
+         {
+            // do some custom stuff
+         }
+
+         Iterable<VirtualFile> classpaths = getClassPaths(unit);
+         for (VirtualFile cp : classpaths)
+         {
+            VirtualFile wbXml = cp.getChild("META-INF/web-beans.xml");
+            if (wbXml != null)
+            {
+               // add url
+               environment.addWebBeansXmlURL(wbXml.toURL());
+               // add classes
+               urls.add(cp.toURL());
+            }
+         }
+
+         // handle war slightly different
+         VirtualFile warWbXml = unit.getFile("WEB-INF/web-beans.xml");
+         if (warWbXml != null)
+         {
+            environment.addWebBeansXmlURL(warWbXml.toURL());
+
+            VirtualFile classes = unit.getFile("WEB-INF/classes");
+            if (classes != null)
+               urls.add(classes.toURL());
+         }
+      }
+      catch (Exception e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Cannot deploy WBD.", e);
+      }
+
+      if (urls.isEmpty() == false)
+      {
+         Module module = unit.getAttachment(Module.class);
+         if (module == null)
+         {
+            VFSDeploymentUnit parent = unit.getParent();
+            while (parent != null && module == null)
+            {
+               module = parent.getAttachment(Module.class);
+               parent = parent.getParent();
+            }
+            if (module == null)
+               throw new DeploymentException("No module in deployment unit's hierarchy: " + unit.getName());
+         }
+
+         WBDiscoveryVisitor visitor = new WBDiscoveryVisitor(environment);
+         module.visit(visitor, ClassFilter.INSTANCE, null, urls.toArray(new URL[urls.size()]));
+      }
+   }
+
+   /**
+    * Get the matching class paths that belong to this deployment unit.
+    *
+    * @param unit the deployment unit
+    * @return matching class paths
+    * @throws Exception for any error
+    */
+   protected Iterable<VirtualFile> getClassPaths(VFSDeploymentUnit unit) throws Exception
+   {
+      List<VirtualFile> classpath = unit.getClassPath();
+      if (classpath != null && classpath.isEmpty() == false)
+      {
+         List<VirtualFile> matching = new ArrayList<VirtualFile>();
+         VirtualFile root = unit.getRoot();
+         for (VirtualFile cp : classpath)
+         {
+            VirtualFile check = cp;
+            while (check != null && check.equals(root) == false)
+               check = check.getParent();
+
+            if (check != null)
+               matching.add(cp);
+         }
+         return matching;
+      }
+      return Collections.emptySet();
+   }
+
+   private class WBDiscoveryVisitor implements ResourceVisitor
+   {
+      private WebBeanDiscoveryEnvironment wbdi;
+
+      private WBDiscoveryVisitor(WebBeanDiscoveryEnvironment wbdi)
+      {
+         this.wbdi = wbdi;
+      }
+
+      public ResourceFilter getFilter()
+      {
+         return ClassFilter.INSTANCE;
+      }
+
+      public void visit(ResourceContext resource)
+      {
+         wbdi.addWebBeanClass(resource.loadClass());
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.integration.jbossas;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+
+/**
+ * WBD impl.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryEnvironment
+{
+   private Set<Class<?>> classes = new HashSet<Class<?>>();
+   private Set<URL> urls = new HashSet<URL>();
+
+   public void addWebBeanClass(Class<?> clazz)
+   {
+      classes.add(clazz);
+   }
+
+   public void addWebBeansXmlURL(URL url)
+   {
+      urls.add(url);      
+   }
+
+   public Iterable<Class<?>> getWebBeanClasses()
+   {
+      return classes;
+   }
+
+   public Iterable<URL> getWebBeansXml()
+   {
+      return urls;
+   }
+
+   public Map<Class<?>, EjbDescriptor<?>> discoverEjbs()
+   {
+      return new HashMap<Class<?>, EjbDescriptor<?>>();
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,38 @@
+package org.jboss.webbeans.integration.jbossas;
+
+import java.net.URL;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.integration.jbossas.vdf.VFSDeploymentUnitVDFConnector;
+
+public class WebBeanDiscoveryImpl implements WebBeanDiscovery
+{
+   
+   private WebBeanDiscoveryEnvironment environment;
+   
+   public WebBeanDiscoveryImpl(ServletContext servletContext)
+   {
+      environment = new VFSDeploymentUnitVDFConnector(servletContext).getUtility().getAttachment(WebBeanDiscoveryEnvironment.class);
+   }
+   
+   public Map<Class<?>, EjbDescriptor<?>> discoverEjbs()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+   
+   public Iterable<Class<?>> discoverWebBeanClasses()
+   {
+      return environment.getWebBeanClasses();
+   }
+   
+   public Iterable<URL> discoverWebBeansXml()
+   {
+      return environment.getWebBeansXml();
+   }
+   
+}


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,89 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+/**
+ * Abstract VDF connector.
+ *
+ * @param <U> exact vdf utility type
+ * @param <T> exact attribute type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractVDFConnector<U, T> implements VDFConnector<U>
+{
+   private ServletContext servletContext;
+   private U utility;
+
+   protected AbstractVDFConnector(ServletContext servletContext)
+   {
+      if (servletContext == null)
+         throw new IllegalArgumentException("Null servlet context.");
+      this.servletContext = servletContext;
+   }
+
+   /**
+    * Get utility type.
+    *
+    * @return the utility type
+    */
+   protected abstract Class<T> getAttributeType();
+
+   /**
+    * Get utility attribute key.
+    *
+    * @return the attribute key
+    */
+   protected abstract String getAttributeKey();
+
+   public boolean isValid()
+   {
+      return getUtility() != null;
+   }
+
+   public U getUtility()
+   {
+      if (utility == null)
+      {
+         String key = getAttributeKey();
+         Object attribute = servletContext.getAttribute(key);
+         if (attribute != null)
+         {
+            Class<T> type = getAttributeType();
+            if (type.isInstance(attribute) == false)
+               throw new IllegalArgumentException("Attribute " + key + " is not " + type.getName() + " instance: " + attribute);
+
+            utility = getUtilityFromAttribute(type.cast(attribute));
+         }
+      }
+      return utility;
+   }
+
+   /**
+    * Get utility from attribute.
+    *
+    * @param attribute the attribute
+    * @return attribute's utility
+    */
+   protected abstract U getUtilityFromAttribute(T attribute);
+}


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,44 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.spi.annotations.AnnotationEnvironment;
+
+/**
+ *  AnnotationEnvironment VDF connector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AnnotationEnvironmentVDFConnector extends BaseAttachmentVDFConnector<AnnotationEnvironment>
+{
+   protected AnnotationEnvironmentVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected Class<AnnotationEnvironment> getAttachmentType()
+   {
+      return AnnotationEnvironment.class;
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AttachmentVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AttachmentVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AttachmentVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,51 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Attachment VDF connector.
+ * It knows how to access vdf attachments from ServletContext.
+ *
+ * @param <U> exact vdf attachment type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AttachmentVDFConnector<U> extends AbstractVDFConnector<U, DeploymentUnit>
+{
+   protected AttachmentVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected Class<DeploymentUnit> getAttributeType()
+   {
+      return DeploymentUnit.class;
+   }
+
+   protected String getAttributeKey()
+   {
+      return DeploymentUnit.class.getName();
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AttachmentVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseAttachmentVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseAttachmentVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseAttachmentVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,53 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Attachment VDF connector.
+ * It knows how to access vdf attachments from ServletContext.
+ *
+ * @param <U> exact vdf attachment type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class BaseAttachmentVDFConnector<U> extends AttachmentVDFConnector<U>
+{
+   protected BaseAttachmentVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   /**
+    * Get attachment type.
+    *
+    * @return the attachment type
+    */
+   protected abstract Class<U> getAttachmentType();
+
+   protected U getUtilityFromAttribute(DeploymentUnit unit)
+   {
+      return unit.getAttachment(getAttachmentType());
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseAttachmentVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,44 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+/**
+ * Base VDF connector.
+ * The attribute is the utility.
+ *
+ * @param <U> exact vdf utility type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class BaseVDFConnector<U> extends AbstractVDFConnector<U, U>
+{
+   protected BaseVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected U getUtilityFromAttribute(U attribute)
+   {
+      return attribute;
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/BaseVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,76 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.spi.annotations.AnnotationEnvironment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ *  AnnotationEnvironment VDF connector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FederatedAnnotationEnvironmentVDFConnector extends AttachmentVDFConnector<List<AnnotationEnvironment>>
+{
+   protected FederatedAnnotationEnvironmentVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected List<AnnotationEnvironment> getUtilityFromAttribute(DeploymentUnit unit)
+   {
+      List<AnnotationEnvironment> list = new ArrayList<AnnotationEnvironment>();
+      DeploymentUnit parent = unit.getParent();
+      if (parent != null)
+      {
+         applyAnnotationEnvironment(parent, list);
+         List<DeploymentUnit> children = parent.getChildren();
+         // cannot be null, since unit is its child
+         for (DeploymentUnit child : children)
+         {
+            applyAnnotationEnvironment(child, list);
+         }
+      }
+      else
+      {
+         applyAnnotationEnvironment(unit, list);
+      }
+      return list;
+   }
+
+   /**
+    * Get annotation environment.
+    *
+    * @param unit the deployment unit
+    * @param list the list
+    */
+   protected void applyAnnotationEnvironment(DeploymentUnit unit, List<AnnotationEnvironment> list)
+   {
+      AnnotationEnvironment ae = unit.getAttachment(AnnotationEnvironment.class);
+      if (ae != null)
+         list.add(ae);
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelControllerVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelControllerVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelControllerVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,45 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+
+/**
+ * KernelVDFConnector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class KernelControllerVDFConnector extends KernelUtilityVDFConnector<KernelController>
+{
+   public KernelControllerVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected KernelController getUtilityFromAttribute(Kernel kernel)
+   {
+      return kernel.getController();
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelControllerVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelUtilityVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelUtilityVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelUtilityVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,51 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+
+/**
+ * KernelUtilityVDFConnector.
+ *
+ * @param <U> exact utility type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class KernelUtilityVDFConnector<U> extends AbstractVDFConnector<U, Kernel>
+{
+   protected KernelUtilityVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected Class<Kernel> getAttributeType()
+   {
+      return Kernel.class;
+   }
+
+   protected String getAttributeKey()
+   {
+      return KernelConstants.KERNEL_NAME;
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelUtilityVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+
+/**
+ * KernelVDFConnector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class KernelVDFConnector extends BaseVDFConnector<Kernel>
+{
+   public KernelVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected Class<Kernel> getAttributeType()
+   {
+      return Kernel.class;
+   }
+
+   protected String getAttributeKey()
+   {
+      return KernelConstants.KERNEL_NAME;
+   }
+}


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/KernelVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/NamedAttachmentVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/NamedAttachmentVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/NamedAttachmentVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,52 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Named attachment VDF connector.
+ *
+ * @param <U> exact vdf attachment type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class NamedAttachmentVDFConnector<U> extends BaseAttachmentVDFConnector<U>
+{
+   protected NamedAttachmentVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   /**
+    * Get attachment name.
+    *
+    * @return the attachment name
+    */
+   protected abstract String getAttchmentName();
+
+   protected U getUtilityFromAttribute(DeploymentUnit unit)
+   {
+      return unit.getAttachment(getAttchmentName(), getAttachmentType());
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/NamedAttachmentVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -0,0 +1,49 @@
+/*
+* 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.webbeans.integration.jbossas.vdf;
+
+/**
+ * VDF connector.
+ * It knows how to access vdf utils from ServletContext.
+ *
+ * @param <U> exact vdf utility type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface VDFConnector<U>
+{
+   /**
+    * Is VDF connector valid.
+    *
+    * Normally this means that servlet context's attribute is present
+    * or some utility from attibute can be derived.
+    *
+    * @return true if utility exists, false otherwise
+    */
+   boolean isValid();
+
+   /**
+    * Get the underlying vdf utility.
+    *
+    * @return the utility
+    */
+   U getUtility();
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java	2008-11-20 05:47:31 UTC (rev 81343)
@@ -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.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+
+/**
+ * KernelVDFConnector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VFSDeploymentUnitVDFConnector extends BaseVDFConnector<VFSDeploymentUnit>
+{
+   public VFSDeploymentUnitVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+   }
+
+   protected Class<VFSDeploymentUnit> getAttributeType()
+   {
+      return VFSDeploymentUnit.class;
+   }
+
+   protected String getAttributeKey()
+   {
+      return DeploymentUnit.class.getName();
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: projects/webbeans-ri-int/trunk/jbossas/src/main/resources/META-INF/web-beans-ri.properties
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/resources/META-INF/web-beans-ri.properties	2008-11-20 05:11:52 UTC (rev 81342)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/resources/META-INF/web-beans-ri.properties	2008-11-20 05:47:31 UTC (rev 81343)
@@ -1 +1 @@
-org.jboss.webbeans.bootstrap.webBeanDiscovery=org.jboss.webbeans.integration.jbossas.JBossWebBeanDiscovery
\ No newline at end of file
+org.jboss.webbeans.bootstrap.webBeanDiscovery=org.jboss.webbeans.integration.jbossas.WebBeanDiscoveryImpl
\ No newline at end of file




More information about the jboss-cvs-commits mailing list