[jboss-cvs] JBossAS SVN: r80663 - in projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas: vdf and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 7 10:15:40 EST 2008


Author: alesj
Date: 2008-11-07 10:15:39 -0500 (Fri, 07 Nov 2008)
New Revision: 80663

Added:
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/
   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/AnnotationEnvironmentVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AttachmentVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseAttachmentVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelControllerVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelUtilityVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/NamedAttachmentVDFConnector.java
   projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java
Log:
Add VDF connectors to ServetContext's attributes.

Added: 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	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AbstractVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -0,0 +1,103 @@
+/*
+* 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;
+
+/**
+ * Abstract VDF connector.
+ * It knows how to access vdf utils from ServletContext.
+ *
+ * @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>
+{
+   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();
+
+   /**
+    * Is VDF connector valid.
+    * 
+    * Normally this means that servlet context's attribute is present
+    * or some utility from attibute can be derived.
+    *
+    * @return true is connector exists, false otherwise
+    */
+   public boolean isValid()
+   {
+      return getUtility() != null;
+   }
+
+   /**
+    * Get the underlying vdf utility.
+    *
+    * @return the utility
+    */
+   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);
+}

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AttachmentVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AttachmentVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AttachmentVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseAttachmentVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseAttachmentVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseAttachmentVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/BaseVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelControllerVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelControllerVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelControllerVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelUtilityVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelUtilityVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelUtilityVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/KernelVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.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;
+   }
+}

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/NamedAttachmentVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/NamedAttachmentVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/NamedAttachmentVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.seam.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

Added: projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java
===================================================================
--- projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java	                        (rev 0)
+++ projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java	2008-11-07 15:15:39 UTC (rev 80663)
@@ -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.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




More information about the jboss-cvs-commits mailing list