[jboss-cvs] JBossAS SVN: r83579 - in projects/webbeans-ri-int/trunk: ejb/src/main/java/org/jboss/webbeans/integration/ejb and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jan 28 16:20:07 EST 2009
Author: alesj
Date: 2009-01-28 16:20:07 -0500 (Wed, 28 Jan 2009)
New Revision: 83579
Added:
projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/vdf/
projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/vdf/DeploymentUnitAware.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanTypeVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/SimpleBeanVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/AnnotationEnvironmentVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/FederatedAnnotationEnvironmentVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/JBossEjbDiscoveryVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/JBossEjbResolverVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/WebBeanDiscoveryEnvVDFConnector.java
Removed:
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/FederatedAnnotationEnvironmentVDFConnector.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java
Modified:
projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbDiscovery.java
projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbResolver.java
projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/util/JBossEjb.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossEjbDiscovery.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossWebBeanDiscovery.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb/ServletJBossEjbResolver.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractVDFConnector.java
Log:
Make JBossEjbResolver/Discovery MC beans.
Modified: projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbDiscovery.java
===================================================================
--- projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbDiscovery.java 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbDiscovery.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -3,17 +3,17 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.beans.metadata.api.annotations.Inject;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
-import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.integration.ejb.util.JBossEjb;
+import org.jboss.webbeans.integration.vdf.DeploymentUnitAware;
/**
* EjbDiscoveryEnvironment.
@@ -22,24 +22,36 @@
* @author Pete Muir
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class JBossEjbDiscovery implements EjbDiscovery
+public class JBossEjbDiscovery implements EjbDiscovery, DeploymentUnitAware
{
- private final List<EjbDescriptor<?>> ejbs;
+ private EjbReferenceResolver resolver;
+ private List<EjbDescriptor<?>> ejbs = new ArrayList<EjbDescriptor<?>>();
- public JBossEjbDiscovery(DeploymentUnit topLevelDeploymentUnit, KernelController controller)
+ @Inject
+ public void setResolver(EjbReferenceResolver resolver)
{
- EjbReferenceResolver resolver = JBossEjb.lookupEjbReferenceResolver(controller);
- this.ejbs = new ArrayList<EjbDescriptor<?>>();
- discoverEjbs(topLevelDeploymentUnit, resolver);
+ this.resolver = resolver;
}
/**
+ * Initialize.
+ *
+ * @param du the deployment unit
+ */
+ public void setDeploymentUnit(DeploymentUnit du)
+ {
+ if (du == null)
+ throw new IllegalArgumentException("Null deployment unit.");
+
+ discoverEjbs(du.getTopLevel());
+ }
+
+ /**
* Discover ejbs.
*
* @param du the deployment unit
- * @param resolver the ejb ref resolver
*/
- protected void discoverEjbs(DeploymentUnit du, EjbReferenceResolver resolver)
+ protected void discoverEjbs(DeploymentUnit du)
{
// Ensure it's an EJB3 DU (by looking for the processed metadata)
if (du.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class) != null && du.getAttachment(JBossMetaData.class).isEJB3x())
@@ -66,7 +78,7 @@
{
for (DeploymentUnit childDu : children)
{
- discoverEjbs(childDu, resolver);
+ discoverEjbs(childDu);
}
}
}
Modified: projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbResolver.java
===================================================================
--- projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbResolver.java 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/JBossEjbResolver.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -3,41 +3,71 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.inject.manager.InjectionPoint;
import javax.persistence.PersistenceContext;
+import org.jboss.beans.metadata.api.annotations.Inject;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
import org.jboss.ejb3.common.resolvers.spi.EjbReference;
+import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
import org.jboss.jpa.deployment.ManagedEntityManagerFactory;
import org.jboss.jpa.deployment.PersistenceUnitDeployment;
import org.jboss.jpa.injection.InjectedEntityManagerFactory;
import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.integration.ejb.util.JBossEjb;
import org.jboss.webbeans.integration.ejb.util.Reflections;
+import org.jboss.webbeans.integration.vdf.DeploymentUnitAware;
import org.jboss.webbeans.resources.spi.NamingContext;
-public class JBossEjbResolver implements EjbResolver
+/**
+ * An implementation of JBossEjbResolver for JBoss AS
+ *
+ * @author Pete Muir
+ * @author ales.justin at jboss.org
+ */
+public class JBossEjbResolver implements EjbResolver, DeploymentUnitAware
{
-
private static final String RESOURCE_LOOKUP_PREFIX = "java:/comp/env";
- protected final DeploymentUnit topLevelDeploymentUnit;
- protected final KernelController controller;
+ protected DeploymentUnit topLevelDeploymentUnit;
- public JBossEjbResolver(DeploymentUnit topLevelDeploymentUnit, KernelController controller)
+ protected KernelController controller;
+ protected EjbReferenceResolver resolver;
+ protected PersistenceUnitDependencyResolver persistenceUnitDependencyResolver;
+
+ public void setDeploymentUnit(DeploymentUnit du)
{
- super();
- this.topLevelDeploymentUnit = topLevelDeploymentUnit;
+ if (du == null)
+ throw new IllegalArgumentException("Null deployment unit.");
+
+ topLevelDeploymentUnit = du.getTopLevel();
+ }
+
+ @Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME)
+ public void setController(KernelController controller)
+ {
this.controller = controller;
}
+ @Inject
+ public void setResolver(EjbReferenceResolver resolver)
+ {
+ this.resolver = resolver;
+ }
+
+ @Inject(bean = "PersistenceUnitDependencyResolver")
+ public void setPersistenceUnitDependencyResolver(PersistenceUnitDependencyResolver persistenceUnitDependencyResolver)
+ {
+ this.persistenceUnitDependencyResolver = persistenceUnitDependencyResolver;
+ }
+
private static String getPersistenceUnitSupplier(DeploymentUnit deploymentUnit, PersistenceUnitDependencyResolver persistenceUnitDependencyResolver, String persistenceUnitName)
{
if ((deploymentUnit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class) != null && deploymentUnit.getAttachment(JBossMetaData.class).isEJB3x()) || (deploymentUnit.getAttachment(JBossWebMetaData.class) != null))
@@ -92,7 +122,7 @@
}
}
- String jndiName = JBossEjb.lookupEjbReferenceResolver(controller).resolveEjb(topLevelDeploymentUnit, new EjbReference(beanName, beanInterface, mappedName));
+ String jndiName = resolver.resolveEjb(topLevelDeploymentUnit, new EjbReference(beanName, beanInterface, mappedName));
if (jndiName == null)
{
throw new IllegalStateException("No EJBs available which can be injected into " + injectionPoint);
@@ -111,7 +141,6 @@
throw new IllegalArgumentException("Injection point represents a method which doesn't follow JavaBean conventions (must have exactly one parameter) " + injectionPoint);
}
String persistenceUnitName = injectionPoint.getAnnotation(PersistenceContext.class).unitName();
- PersistenceUnitDependencyResolver persistenceUnitDependencyResolver = JBossEjb.lookupPersistenceUnitDependencyResolver(controller);
String beanName = getPersistenceUnitSupplier(topLevelDeploymentUnit, persistenceUnitDependencyResolver, persistenceUnitName);
if (beanName == null)
{
@@ -184,5 +213,4 @@
String className = injectionPoint.getMember().getDeclaringClass().getName();
return RESOURCE_LOOKUP_PREFIX + "/" + className + "/" + propertyName;
}
-
}
\ No newline at end of file
Modified: projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/util/JBossEjb.java
===================================================================
--- projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/util/JBossEjb.java 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/ejb/util/JBossEjb.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -1,24 +1,20 @@
package org.jboss.webbeans.integration.ejb.util;
import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.ejb3.common.resolvers.spi.EjbReferenceResolver;
import org.jboss.jpa.deployment.PersistenceUnitDeployment;
-import org.jboss.jpa.resolvers.PersistenceUnitDependencyResolver;
import org.jboss.kernel.spi.dependency.KernelController;
/**
* Utitlies for use with JBoss EJB implementation
*
* @author Pete Muir
+ * @author ales.justin at jboss.org
*
*/
public class JBossEjb
{
-
private static class NoSuchInstantiatedBeanException extends IllegalArgumentException
{
-
public NoSuchInstantiatedBeanException()
{
super();
@@ -40,46 +36,13 @@
}
}
- private static final String MC_BEAN_NAME_EJB_REFERENCE_RESOLVER = "org.jboss.ejb3.EjbReferenceResolver";
- private static final String MC_BEAN_NAME_PERSISTENCE_UNIT_DEPENDENCY_RESOLVER = "PersistenceUnitDependencyResolver";
-
-
/**
- * Get the EjbReferenceResolver from the MC controller
+ * Get the EjbReferenceResolver from the MC controller.
+ *
+ * @param name the bean name
+ * @param controller the controller
* @return the EjbReferenceResolver
*/
- public static EjbReferenceResolver lookupEjbReferenceResolver(KernelController controller)
- {
- try
- {
- return (EjbReferenceResolver) lookup(MC_BEAN_NAME_EJB_REFERENCE_RESOLVER, false, controller);
- }
- catch (NoSuchInstantiatedBeanException e)
- {
- throw new IllegalStateException("EjbReferenceResolver cannot be found, check that you have correctly updated JBoss EJB3");
- }
- }
-
- /**
- * Get the EjbReferenceResolver from the MC controller
- * @return the EjbReferenceResolver
- */
- public static PersistenceUnitDependencyResolver lookupPersistenceUnitDependencyResolver(KernelController controller)
- {
- try
- {
- return (PersistenceUnitDependencyResolver) lookup(MC_BEAN_NAME_PERSISTENCE_UNIT_DEPENDENCY_RESOLVER, false, controller);
- }
- catch (NoSuchInstantiatedBeanException e)
- {
- throw new IllegalStateException("PersistenceUnitDependencyResolver cannot be found");
- }
- }
-
- /**
- * Get the EjbReferenceResolver from the MC controller
- * @return the EjbReferenceResolver
- */
public static PersistenceUnitDeployment lookupPersistenceUnitDeployment(String name, KernelController controller)
{
try
@@ -97,12 +60,13 @@
*
* @param name the bean name
* @param shouldExist must the bean be present
+ * @param controller the controller
* @return the bean
*/
public static Object lookup(final Object name, boolean shouldExist, KernelController controller)
{
// Get Controller Context
- ControllerContext context = controller.getContext(name, ControllerState.INSTANTIATED);
+ ControllerContext context = controller.getInstalledContext(name);
if (context == null)
{
if (shouldExist)
@@ -125,5 +89,4 @@
// Return
return context.getTarget();
}
-
}
Added: projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/vdf/DeploymentUnitAware.java
===================================================================
--- projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/vdf/DeploymentUnitAware.java (rev 0)
+++ projects/webbeans-ri-int/trunk/ejb/src/main/java/org/jboss/webbeans/integration/vdf/DeploymentUnitAware.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -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.webbeans.integration.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/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossEjbDiscovery.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossEjbDiscovery.java 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossEjbDiscovery.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -2,38 +2,27 @@
import javax.servlet.ServletContext;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
import org.jboss.webbeans.bootstrap.spi.ForwardingEjbDiscovery;
-import org.jboss.webbeans.integration.ejb.JBossEjbDiscovery;
-import org.jboss.webbeans.integration.jbossas.vdf.KernelControllerVDFConnector;
-import org.jboss.webbeans.integration.jbossas.vdf.VFSDeploymentUnitVDFConnector;
+import org.jboss.webbeans.integration.jbossas.vdf.plugins.JBossEjbDiscoveryVDFConnector;
+/**
+ * WB 2 EjbDiscovery bridge.
+ *
+ * @author Pete Muir
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
public class ServletJBossEjbDiscovery extends ForwardingEjbDiscovery
{
-
private final EjbDiscovery delegate;
public ServletJBossEjbDiscovery(ServletContext servletContext)
{
- KernelControllerVDFConnector controllerVDFConnector = new KernelControllerVDFConnector(servletContext);
- if (controllerVDFConnector.isValid() == false)
- {
- throw new IllegalArgumentException("No such KernelController utility: " + servletContext);
- }
+ JBossEjbDiscoveryVDFConnector connector = new JBossEjbDiscoveryVDFConnector(servletContext);
+ if (connector.isValid() == false)
+ throw new IllegalArgumentException("No such bean: " + connector);
- KernelController controller = controllerVDFConnector.getUtility();
-
- VFSDeploymentUnitVDFConnector duConnector = new VFSDeploymentUnitVDFConnector(servletContext);
- if (duConnector.isValid() == false)
- {
- throw new IllegalArgumentException("No such DeploymentUnit utility: " + servletContext);
- }
-
- DeploymentUnit du = duConnector.getUtility();
-
- this.delegate = new JBossEjbDiscovery(du.getTopLevel(), controller);
+ this.delegate = connector.getUtility();
}
@Override
@@ -41,5 +30,4 @@
{
return delegate;
}
-
}
Modified: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossWebBeanDiscovery.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossWebBeanDiscovery.java 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/bootstrap/ServletJBossWebBeanDiscovery.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -5,7 +5,7 @@
import javax.servlet.ServletContext;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.integration.jbossas.vdf.WebBeanDiscoveryEnvVDFConnector;
+import org.jboss.webbeans.integration.jbossas.vdf.plugins.WebBeanDiscoveryEnvVDFConnector;
import org.jboss.webbeans.integration.microcontainer.deployer.env.WebBeanDiscoveryEnvironment;
public class ServletJBossWebBeanDiscovery implements WebBeanDiscovery
Modified: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb/ServletJBossEjbResolver.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb/ServletJBossEjbResolver.java 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/ejb/ServletJBossEjbResolver.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -3,42 +3,27 @@
import javax.servlet.ServletContext;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.ejb.spi.ForwardingEjbResolver;
-import org.jboss.webbeans.integration.ejb.JBossEjbResolver;
-import org.jboss.webbeans.integration.jbossas.vdf.KernelControllerVDFConnector;
-import org.jboss.webbeans.integration.jbossas.vdf.VFSDeploymentUnitVDFConnector;
+import org.jboss.webbeans.integration.jbossas.vdf.plugins.JBossEjbResolverVDFConnector;
/**
* An implementation of EjbResolver for JBoss AS
*
* @author Pete Muir
- *
+ * @author ales.justin at jboss.org
*/
public class ServletJBossEjbResolver extends ForwardingEjbResolver
{
-
private final EjbResolver delegate;
public ServletJBossEjbResolver(ServletContext servletContext)
{
- KernelControllerVDFConnector controllerVDFConnector = new KernelControllerVDFConnector(servletContext);
- if (controllerVDFConnector.isValid() == false)
- {
- throw new IllegalArgumentException("No such KernelController utility: " + servletContext);
- }
- KernelController controller = controllerVDFConnector.getUtility();
-
- VFSDeploymentUnitVDFConnector duConnector = new VFSDeploymentUnitVDFConnector(servletContext);
- if (duConnector.isValid() == false)
- {
- throw new IllegalArgumentException("No such DeploymentUnit utility: " + servletContext);
- }
- DeploymentUnit du = duConnector.getUtility();
- DeploymentUnit topLevelDeploymentUnit = du.getTopLevel();
- delegate = new JBossEjbResolver(topLevelDeploymentUnit, controller);
+ JBossEjbResolverVDFConnector connector = new JBossEjbResolverVDFConnector(servletContext);
+ if (connector.isValid() == false)
+ throw new IllegalArgumentException("No such bean: " + connector);
+
+ delegate = connector.getUtility();
}
@Override
@@ -46,5 +31,4 @@
{
return delegate;
}
-
}
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryInitializerVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -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.webbeans.integration.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
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanFactoryVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -0,0 +1,74 @@
+/*
+* 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.beans.metadata.spi.factory.BeanFactory;
+
+/**
+ * AbstractBeanFactoryTypeVDFConnector.
+ *
+ * @param <T> exact bean type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractBeanFactoryVDFConnector<T> extends AbstractBeanVDFConnector<T, BeanFactory>
+{
+ protected AbstractBeanFactoryVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
+ protected Class<BeanFactory> getBeanType()
+ {
+ return BeanFactory.class;
+ }
+
+ @Override
+ protected T unwrap(BeanFactory factory)
+ {
+ try
+ {
+ Object bean = factory.createBean();
+ Class<T> type = getUnwrappedType();
+ if (type.isInstance(bean) == false)
+ throw new IllegalArgumentException("Bean " + bean + " is not instance of " + type);
+
+ 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
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanTypeVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanTypeVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanTypeVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -0,0 +1,43 @@
+/*
+* 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;
+
+/**
+ * AbstractBeanTypeVDFConnector.
+ *
+ * @param <T> exact bean type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractBeanTypeVDFConnector<T> extends SimpleBeanVDFConnector<T>
+{
+ protected AbstractBeanTypeVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
+ protected Object getBeanKey()
+ {
+ return getBeanType();
+ }
+}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractBeanVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -0,0 +1,136 @@
+/*
+* 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.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+import org.jboss.kernel.spi.dependency.KernelController;
+
+/**
+ * AbstractBeanVDFConnector.
+ *
+ * @param <U> exact unwrapped type
+ * @param <T> exact bean type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractBeanVDFConnector<U, T> extends AbstractVDFConnector<U, Kernel>
+{
+ /** The bean state */
+ private ControllerState state;
+
+ public AbstractBeanVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
+ protected Class<Kernel> getAttributeType()
+ {
+ return Kernel.class;
+ }
+
+ protected String getAttributeKey()
+ {
+ return KernelConstants.KERNEL_NAME;
+ }
+
+ /**
+ * Get bean key.
+ *
+ * @return the bean key
+ */
+ protected abstract Object getBeanKey();
+
+ /**
+ * The bean type.
+ *
+ * @return the bean type
+ */
+ protected abstract Class<T> getBeanType();
+
+ /**
+ * Get unwrapped type.
+ * e.g. bean might be bean factory
+ *
+ * @return the unwrapped type
+ */
+ protected abstract Class<U> getUnwrappedType();
+
+ /**
+ * Unwrap bean.
+ * Default impl just re-casts.
+ *
+ * @param bean the bean
+ * @return unwrapped bean
+ */
+ protected U unwrap(T bean)
+ {
+ Class<U> unwrappedType = getUnwrappedType();
+ if (unwrappedType.isInstance(bean) == false)
+ throw new IllegalArgumentException("Bean " + bean + " is not instance of " + unwrappedType);
+
+ return unwrappedType.cast(bean);
+ }
+
+ protected U getUtilityFromAttribute(Kernel kernel)
+ {
+ KernelController controller = kernel.getController();
+ ControllerContext context;
+ if (state == null)
+ context = controller.getContext(getBeanKey(), state);
+ else
+ context = controller.getInstalledContext(getBeanKey());
+
+ if (context == null)
+ return null;
+
+ Object target = context.getTarget();
+ Class<T> beanType = getBeanType();
+ if (beanType.isInstance(target) == false)
+ throw new IllegalArgumentException("Bean " + target + " is not instance of " + beanType);
+
+ return unwrap(beanType.cast(target));
+ }
+
+ /**
+ * Set the expected bean state.
+ *
+ * @param state the bean state
+ */
+ public void setState(ControllerState state)
+ {
+ this.state = state;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("bean=").append(getBeanKey());
+ if (state != null)
+ builder.append(", state=").append(state);
+ return builder.toString();
+ }
+}
\ No newline at end of file
Modified: 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 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AbstractVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -43,6 +43,16 @@
}
/**
+ * Get the servlet context.
+ *
+ * @return the servlet context
+ */
+ protected ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ /**
* Get utility type.
*
* @return the utility type
Deleted: 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 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -1,44 +0,0 @@
-/*
-* 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
Deleted: 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 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/FederatedAnnotationEnvironmentVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -1,77 +0,0 @@
-/*
-* 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
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/SimpleBeanVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/SimpleBeanVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/SimpleBeanVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -0,0 +1,43 @@
+/*
+* 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;
+
+/**
+ * AbstractBeanTypeVDFConnector.
+ *
+ * @param <T> exact bean type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class SimpleBeanVDFConnector<T> extends AbstractBeanVDFConnector<T, T>
+{
+ protected SimpleBeanVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
+ protected Class<T> getUnwrappedType()
+ {
+ return getBeanType();
+ }
+}
\ No newline at end of file
Deleted: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java 2009-01-28 19:58:25 UTC (rev 83578)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -1,45 +0,0 @@
-/*
- * 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.vdf;
-
-import javax.servlet.ServletContext;
-
-import org.jboss.webbeans.integration.microcontainer.deployer.env.WebBeanDiscoveryEnvironment;
-
-/**
- * WebBeanDiscoveryEnv VDF connector.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class WebBeanDiscoveryEnvVDFConnector extends BaseAttachmentVDFConnector<WebBeanDiscoveryEnvironment>
-{
- public WebBeanDiscoveryEnvVDFConnector(ServletContext servletContext)
- {
- super(servletContext);
- setAllowHierarchyLookup(true);
- }
-
- protected Class<WebBeanDiscoveryEnvironment> getAttachmentType()
- {
- return WebBeanDiscoveryEnvironment.class;
- }
-}
Copied: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/AnnotationEnvironmentVDFConnector.java (from rev 83556, 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/plugins/AnnotationEnvironmentVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/AnnotationEnvironmentVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -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.plugins;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.deployers.spi.annotations.AnnotationEnvironment;
+import org.jboss.webbeans.integration.jbossas.vdf.BaseAttachmentVDFConnector;
+
+/**
+ * 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/plugins/AnnotationEnvironmentVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/FederatedAnnotationEnvironmentVDFConnector.java (from rev 83556, 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/plugins/FederatedAnnotationEnvironmentVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/FederatedAnnotationEnvironmentVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -0,0 +1,84 @@
+/*
+* 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.plugins;
+
+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;
+import org.jboss.webbeans.integration.jbossas.vdf.AttachmentVDFConnector;
+
+/**
+ * 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 top = unit.getTopLevel();
+ findAllAnnotationEnvironments(top, list);
+ return list;
+ }
+
+ /**
+ * Find all anotation environments recursively.
+ *
+ * @param unit the current deployment unit
+ * @param list the holder list
+ */
+ protected void findAllAnnotationEnvironments(DeploymentUnit unit, List<AnnotationEnvironment> list)
+ {
+ applyAnnotationEnvironment(unit, list);
+ List<DeploymentUnit> children = unit.getChildren();
+ if (children != null && children.isEmpty() == false)
+ {
+ for (DeploymentUnit child : children)
+ {
+ findAllAnnotationEnvironments(child, 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/plugins/FederatedAnnotationEnvironmentVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/JBossEjbDiscoveryVDFConnector.java (from rev 83556, 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/plugins/JBossEjbDiscoveryVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/JBossEjbDiscoveryVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -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.plugins;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.webbeans.integration.ejb.JBossEjbDiscovery;
+import org.jboss.webbeans.integration.jbossas.vdf.AbstractBeanFactoryInitializerVDFConnector;
+
+/**
+ * JBossEjbDiscoveryVDFConnector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class JBossEjbDiscoveryVDFConnector extends AbstractBeanFactoryInitializerVDFConnector<JBossEjbDiscovery>
+{
+ public JBossEjbDiscoveryVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
+ protected Object getBeanKey()
+ {
+ return "JBossEjbDiscovery";
+ }
+
+ protected Class<JBossEjbDiscovery> getUnwrappedType()
+ {
+ return JBossEjbDiscovery.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/plugins/JBossEjbDiscoveryVDFConnector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/JBossEjbResolverVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/JBossEjbResolverVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/JBossEjbResolverVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -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.plugins;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.webbeans.integration.ejb.JBossEjbResolver;
+import org.jboss.webbeans.integration.jbossas.vdf.AbstractBeanFactoryInitializerVDFConnector;
+
+/**
+ * JBossEjbDiscoveryVDFConnector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class JBossEjbResolverVDFConnector extends AbstractBeanFactoryInitializerVDFConnector<JBossEjbResolver>
+{
+ public JBossEjbResolverVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
+ protected Object getBeanKey()
+ {
+ return "JBossEjbResolver";
+ }
+
+ protected Class<JBossEjbResolver> getUnwrappedType()
+ {
+ return JBossEjbResolver.class;
+ }
+}
\ No newline at end of file
Copied: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/WebBeanDiscoveryEnvVDFConnector.java (from rev 83556, projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java)
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/WebBeanDiscoveryEnvVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/plugins/WebBeanDiscoveryEnvVDFConnector.java 2009-01-28 21:20:07 UTC (rev 83579)
@@ -0,0 +1,46 @@
+/*
+ * 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.vdf.plugins;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.webbeans.integration.microcontainer.deployer.env.WebBeanDiscoveryEnvironment;
+import org.jboss.webbeans.integration.jbossas.vdf.BaseAttachmentVDFConnector;
+
+/**
+ * WebBeanDiscoveryEnv VDF connector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryEnvVDFConnector extends BaseAttachmentVDFConnector<WebBeanDiscoveryEnvironment>
+{
+ public WebBeanDiscoveryEnvVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ setAllowHierarchyLookup(true);
+ }
+
+ protected Class<WebBeanDiscoveryEnvironment> getAttachmentType()
+ {
+ return WebBeanDiscoveryEnvironment.class;
+ }
+}
More information about the jboss-cvs-commits
mailing list