[webbeans-commits] Webbeans SVN: r3674 - ri/trunk/jboss-as.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-09-15 18:42:39 -0400 (Tue, 15 Sep 2009)
New Revision: 3674
Modified:
ri/trunk/jboss-as/build.xml
Log:
new name for assembled deployer artifact
Modified: ri/trunk/jboss-as/build.xml
===================================================================
--- ri/trunk/jboss-as/build.xml 2009-09-15 19:27:25 UTC (rev 3673)
+++ ri/trunk/jboss-as/build.xml 2009-09-15 22:42:39 UTC (rev 3674)
@@ -23,7 +23,7 @@
<delete dir="target" failonerror="false" />
<artifact:dependencies filesetId="webbeans.deployer.fileset" versionsId="webbeans.deployer.versions">
- <dependency groupId="org.jboss.webbeans.integration" artifactId="webbeans-jboss-int-deployer" version="${webbeans-deployer.version}" type="zip" />
+ <dependency groupId="org.jboss.webbeans.integration" artifactId="webbeans-jboss-int-deployer-assembly" version="${webbeans-deployer.version}" type="zip" />
<dependency groupId="org.jboss.webbeans" artifactId="webbeans-core" version="${webbeans.version}" />
<remoteRepository id="repository.jboss.org" url="http://repository.jboss.org/maven2" />
<remoteRepository id="snapshots.jboss.org" url="http://snapshots.jboss.org/maven2" />
@@ -38,7 +38,7 @@
</chainedmapper>
</copy>
- <unzip dest="target" src="target/dependency/lib/webbeans-jboss-int-deployer.zip" />
+ <unzip dest="target" src="target/dependency/lib/webbeans-jboss-int-deployer-assembly.zip" />
<copy todir="target/webbeans.deployer/lib-int/" overwrite="true">
<fileset dir="target/dependency/lib">
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3673 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-09-15 15:27:25 -0400 (Tue, 15 Sep 2009)
New Revision: 3673
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java
Log:
Enable BV support
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java 2009-09-15 17:29:59 UTC (rev 3672)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java 2009-09-15 19:27:25 UTC (rev 3673)
@@ -43,7 +43,7 @@
userTransaction.getStatus();
}
- @Test(groups="jboss-as-broken")
+ @Test
@SpecAssertions({
@SpecAssertion(section="3.6", id="c")
})
@@ -55,7 +55,7 @@
defaultValidatorFactory.getValidator();
}
- @Test(groups="jboss-as-broken")
+ @Test
@SpecAssertions({
@SpecAssertion(section="3.6", id="d")
})
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3672 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/context/application/ejb and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-09-15 13:29:59 -0400 (Tue, 15 Sep 2009)
New Revision: 3672
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/ApplicationContextSharedTest.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
Some improvements
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-09-15 15:39:18 UTC (rev 3671)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-09-15 17:29:59 UTC (rev 3672)
@@ -22,7 +22,7 @@
@Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
@Resource(destination="SimplePage.html", source="SimplePage.html")
})
-@SpecVersion(spec = "jsr299", version="20090625")
+@SpecVersion(spec = "cdi", version="1.0.20090625")
public class ApplicationContextTest extends AbstractJSR299Test
{
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/ApplicationContextSharedTest.java (from rev 3671, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/ApplicationContextSharedTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/ApplicationContextSharedTest.java 2009-09-15 17:29:59 UTC (rev 3672)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.context.application.ejb;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+/**
+ * EJB and related tests with the built-in application context.
+ *
+ * @author David Allen
+ */
+@Artifact
+@IntegrationTest
+(a)Packaging(PackagingType.EAR)
+@SpecVersion(spec="cdi", version="1.0.20090625")
+public class ApplicationContextSharedTest extends AbstractJSR299Test
+{
+
+ @Test(groups = { "contexts", "ejb3", "integration", "rewrite" })
+ // TODO Needs to test *all* uses of app context are shared, not each type individually
+ @SpecAssertion(section = "6.7.3", id = "e")
+ public void testApplicationContextShared() throws Exception
+ {
+ FMS flightManagementSystem = getInstanceByType(FMS.class);
+ flightManagementSystem.climb();
+ flightManagementSystem.descend();
+ Thread.sleep(250);
+ assert flightManagementSystem.isSameBean();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/ApplicationContextSharedTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java 2009-09-15 15:39:18 UTC (rev 3671)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java 2009-09-15 17:29:59 UTC (rev 3672)
@@ -1,35 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.application.ejb;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.testng.annotations.Test;
-
-/**
- * EJB and related tests with the built-in application context.
- *
- * @author David Allen
- */
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.EAR)
-@SpecVersion(spec="cdi", version="1.0.20090625")
-public class EJBApplicationContextSharedBetweenTimeoutInvocationTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "contexts", "ejb3", "integration" })
- @SpecAssertion(section = "6.7.3", id = "ef")
- public void testApplicationContextSharedBetweenEJBTimeoutInvocations() throws Exception
- {
- FMS flightManagementSystem = getInstanceByType(FMS.class);
- flightManagementSystem.climb();
- flightManagementSystem.descend();
- Thread.sleep(250);
- assert flightManagementSystem.isSameBean();
- }
-
-}
Modified: tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-09-15 15:39:18 UTC (rev 3671)
+++ tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-09-15 17:29:59 UTC (rev 3672)
@@ -3232,14 +3232,35 @@
</section>
<section id="6.7.3" title="Application context lifecycle">
- <assertion id="aa">
- <text>The application scope is active during the |service()| method of any servlet in the web application ~, during the |doFilter()| method of any servlet filter and when the container calls any |ServletContextListener|, |HttpSessionListener|, |AsyncListener| or |ServletRequestListener|.~</text>
- </assertion>
+ <group>
+ <text>The application scope is active during the |service()| method of any servlet in the web application, during the |doFilter()| method of any servlet filter and when the container calls any |ServletContextListener|, |HttpSessionListener|, |AsyncListener| or |ServletRequestListener|.</text>
+ <assertion id="aa">
+ <text>Check service method</text>
+ </assertion>
- <assertion id="ab">
- <text>The application scope is active during ~the |service()| method of any servlet in the web application, during~ the |doFilter()| method of any servlet filter and when the container calls any |ServletContextListener|, |HttpSessionListener|, |AsyncListener| or |ServletRequestListener|.~</text>
- </assertion>
+ <assertion id="ab">
+ <text>Check filter.</text>
+ </assertion>
+
+ <assertion id="ac">
+ <text>Check |ServletContextListener|.</text>
+ </assertion>
+
+ <assertion id="ad">
+ <text>Check |HttpSessionListener|</text>
+ </assertion>
+
+ <assertion id="ae">
+ <text>Check |AsyncListener|</text>
+ </assertion>
+
+ <assertion id="af">
+ <text>Check |ServletRequestListener|</text>
+ </assertion>
+
+ </group>
+
<assertion id="b">
<text>The application scope is active during any Java EE web service invocation.</text>
</assertion>
@@ -3248,61 +3269,52 @@
<text>The application scope is active during any asynchronous observer method notification.</text>
</assertion>
- <assertion id="da">
- <text>The application scope is also active during any remote method invocation of any EJB~, during any asynchronous method invocation of any EJB, during any call to an EJB timeout method and during message delivery to any EJB message-driven bean.</text>
- </assertion>
+ <group>
+ <text>The application scope is also active during any remote method invocation of any EJB, during any asynchronous method invocation of any EJB, during any call to an EJB timeout method and during message delivery to any EJB message-driven bean.</text>
+ <assertion id="da">
+ <text>Test remote method invocation</text>
+ </assertion>
- <assertion id="db">
- <text>The application scope is also active ~during any remote method invocation of any EJB~, during any asynchronous method invocation of any EJB~, during any call to an EJB timeout method and during message delivery to any EJB message-driven bean.~</text>
- </assertion>
+ <assertion id="db">
+ <text> Test asynchronous method invocation</text>
+ </assertion>
- <assertion id="dc">
- <text>The application scope is also active ~during any remote method invocation of any EJB, during any asynchronous method invocation of any EJB,~ during any call to an EJB timeout method~ and during message delivery to any EJB message-driven bean.~</text>
- </assertion>
+ <assertion id="dc">
+ <text>Test EJB timeout method</text>
+ </assertion>
- <assertion id="dd">
- <text>The application scope is also active ~during any remote method invocation of any EJB, during any asynchronous method invocation of any EJB, during any call to an EJB timeout method and~ during message delivery to any EJB message-driven bean.</text>
- </assertion>
-
- <assertion id="de">
+ <assertion id="dd">
+ <text>Test message delivery to any EJB message-driven bean.</text>
+ </assertion>
+ </group>
+
+ <group>
<text>The application scope is active during any message delivery to a |MessageListener| for a JMS topic or queue obtained from the Java EE component environment.</text>
- </assertion>
+ <assertion id="de">
+ <text>Test JMS topic</text>
+ </assertion>
+ <assertion id="df">
+ <text>Test JMS queue</text>
+ </assertion>
+ </group>
- <assertion id="df">
+ <group>
<text>The application scope is active when the disposer method or |@PreDestroy| callback of any bean with any normal scope other than |@ApplicationScoped| is called.</text>
- </assertion>
+ <assertion id="dg">
+ <text>Test disposer method</text>
+ </assertion>
+ <assertion id="dh">
+ <text>Test |@PreDestroy| method</text>
+ </assertion>
+ </group>
- <assertion id="ea">
- <text>The application context is shared between all servlet requests~, asynchronous observer method notifications, web service invocations, EJB remote method invocations, EJB asynchronous method invocations, EJB timeouts and message deliveries to message driven beans ~that execute within the same application.</text>
+ <assertion id="e">
+ <text>The application context is shared between all servlet requests, asynchronous observer method notifications, web service invocations, EJB remote method invocations, EJB asynchronous method invocations, EJB timeouts and message deliveries to message driven beans that execute within the same application.</text>
+ <note>A single test needs check *all* these request types</note>
</assertion>
- <assertion id="eb">
- <text>The application context is shared between all ~servlet requests,~ asynchronous observer method notifications~, web service invocations, EJB remote method invocations, EJB asynchronous method invocations, EJB timeouts and message deliveries to message driven beans ~that execute within the same application.</text>
- </assertion>
-
- <assertion id="ec">
- <text>The application context is shared between all ~servlet requests, asynchronous observer method notifications,~ web service invocations~, EJB remote method invocations, EJB asynchronous method invocations, EJB timeouts and message deliveries to message driven beans ~that execute within the same application~.</text>
- </assertion>
-
- <assertion id="ed">
- <text>The application context is shared between all ~servlet requests, asynchronous observer method notifications, web service invocations,~ EJB remote method invocations~, EJB asynchronous method invocations, EJB timeouts and message deliveries to message driven beans ~that execute within the same application~.</text>
- </assertion>
-
- <assertion id="ee">
- <text>The application context is shared between all ~servlet requests, asynchronous observer method notifications, web service invocations, EJB remote method invocations,~ EJB asynchronous method invocations~, EJB timeouts and message deliveries to message driven beans ~that execute within the same application.</text>
- </assertion>
-
- <assertion id="ef">
- <text>The application context is shared between all ~servlet requests, asynchronous observer method notifications, web service invocations, EJB remote method invocations, EJB asynchronous method invocations,~ EJB timeouts ~and message deliveries to message driven beans ~that execute within the same application.</text>
- </assertion>
-
- <assertion id="eg">
- <text>The application context is shared between all ~servlet requests, asynchronous observer method notifications, web service invocations, EJB remote method invocations, EJB asynchronous method invocations, EJB timeouts and~ message deliveries to message driven beans ~that execute within the same application.</text>
- </assertion>
-
<assertion id="f">
- <text>The application context is destroyed when the application
-is undeployed.</text>
+ <text>The application context is destroyed when the application is undeployed.</text>
</assertion>
</section>
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3671 - in ri/branches/kabir-builder: impl/src/main/java/org/jboss/webbeans/el and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: kabir.khan(a)jboss.com
Date: 2009-09-15 11:39:18 -0400 (Tue, 15 Sep 2009)
New Revision: 3671
Removed:
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java
Modified:
ri/branches/kabir-builder/
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java
ri/branches/kabir-builder/jboss-as/build.properties
ri/branches/kabir-builder/version-matrix/pom.xml
Log:
Merged revisions 3666 via svnmerge from
https://svn.jboss.org/repos/webbeans/ri/trunk
.......
r3666 | pete.muir(a)jboss.org | 2009-09-15 14:00:42 +0100 (Tue, 15 Sep 2009) | 1 line
update JBoss AS version, and remove old JSF/JSP integration classes
.......
Property changes on: ri/branches/kabir-builder
___________________________________________________________________
Name: svnmerge-integrated
- /ri/trunk:1-3665
+ /ri/trunk:1-3669
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java 2009-09-15 15:39:18 UTC (rev 3671)
@@ -34,6 +34,10 @@
public WebBeansExpressionFactory(ExpressionFactory expressionFactory)
{
+ if (expressionFactory == null)
+ {
+ throw new IllegalArgumentException("Cannot pass null expressionFactory");
+ }
this.delegate = expressionFactory;
}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java 2009-09-15 15:39:18 UTC (rev 3671)
@@ -1,289 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
-
-import javax.faces.FacesException;
-import javax.faces.application.Application;
-import javax.faces.application.NavigationHandler;
-import javax.faces.application.StateManager;
-import javax.faces.application.ViewHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.PropertyResolver;
-import javax.faces.el.ReferenceSyntaxException;
-import javax.faces.el.ValueBinding;
-import javax.faces.el.VariableResolver;
-import javax.faces.event.ActionListener;
-import javax.faces.validator.Validator;
-
-/**
- * @author pmuir
- *
- */
-public abstract class ForwardingApplication extends Application
-{
-
- protected abstract Application delegate();
-
- @Override
- public void addComponent(String componentType, String componentClass)
- {
- delegate().addComponent(componentType, componentClass);
- }
-
- @Override
- public void addConverter(String converterId, String converterClass)
- {
- delegate().addConverter(converterId, converterClass);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void addConverter(Class targetClass, String converterClass)
- {
- delegate().addConverter(targetClass, converterClass);
- }
-
- @Override
- public void addValidator(String validatorId, String validatorClass)
- {
- delegate().addValidator(validatorId, validatorClass);
- }
-
- @Override
- public UIComponent createComponent(String componentType) throws FacesException
- {
- return delegate().createComponent(componentType);
- }
-
- @Override
- @Deprecated
- public UIComponent createComponent(ValueBinding componentBinding, FacesContext context, String componentType) throws FacesException
- {
- return delegate().createComponent(componentBinding, context, componentType);
- }
-
- @Override
- public Converter createConverter(String converterId)
- {
- return delegate().createConverter(converterId);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Converter createConverter(Class targetClass)
- {
- return delegate().createConverter(targetClass);
- }
-
- @SuppressWarnings("unchecked")
- @Deprecated
- @Override
- public MethodBinding createMethodBinding(String ref, Class[] params) throws ReferenceSyntaxException
- {
- return delegate().createMethodBinding(ref, params);
- }
-
- @Override
- public Validator createValidator(String validatorId) throws FacesException
- {
- return delegate().createValidator(validatorId);
- }
-
- @Override
- @Deprecated
- public ValueBinding createValueBinding(String ref) throws ReferenceSyntaxException
- {
- return delegate().createValueBinding(ref);
- }
-
- @Override
- public ActionListener getActionListener()
- {
- return delegate().getActionListener();
- }
-
- @Override
- public Iterator<String> getComponentTypes()
- {
- return delegate().getComponentTypes();
- }
-
- @Override
- public Iterator<String> getConverterIds()
- {
- return delegate().getConverterIds();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Iterator<Class> getConverterTypes()
- {
- return delegate().getConverterTypes();
- }
-
- @Override
- public Locale getDefaultLocale()
- {
- return delegate().getDefaultLocale();
- }
-
- @Override
- public String getDefaultRenderKitId()
- {
- return delegate().getDefaultRenderKitId();
- }
-
- @Override
- public String getMessageBundle()
- {
- return delegate().getMessageBundle();
- }
-
- @Override
- public NavigationHandler getNavigationHandler()
- {
- return delegate().getNavigationHandler();
- }
-
- @Override
- @Deprecated
- public PropertyResolver getPropertyResolver()
- {
- return delegate().getPropertyResolver();
- }
-
- @Override
- public StateManager getStateManager()
- {
- return delegate().getStateManager();
- }
-
- @Override
- public Iterator<Locale> getSupportedLocales()
- {
- return delegate().getSupportedLocales();
- }
-
- @Override
- public Iterator<String> getValidatorIds()
- {
- return delegate().getValidatorIds();
- }
-
- @Override
- @Deprecated
- public VariableResolver getVariableResolver()
- {
- return delegate().getVariableResolver();
- }
-
- @Override
- public ViewHandler getViewHandler()
- {
- return delegate().getViewHandler();
- }
-
- @Override
- public void setActionListener(ActionListener listener)
- {
- delegate().setActionListener(listener);
- }
-
- @Override
- public void setDefaultLocale(Locale locale)
- {
- delegate().setDefaultLocale(locale);
- }
-
- @Override
- public void setDefaultRenderKitId(String renderKitId)
- {
- delegate().setDefaultRenderKitId(renderKitId);
- }
-
- @Override
- public void setMessageBundle(String bundle)
- {
- delegate().setMessageBundle(bundle);
- }
-
- @Override
- public void setNavigationHandler(NavigationHandler handler)
- {
- delegate().setNavigationHandler(handler);
- }
-
-
- @Override
- @Deprecated
- public void setPropertyResolver(PropertyResolver resolver)
- {
- delegate().setPropertyResolver(resolver);
- }
-
- @Override
- public void setStateManager(StateManager manager)
- {
- delegate().setStateManager(manager);
- }
-
- @Override
- public void setSupportedLocales(Collection<Locale> locales)
- {
- delegate().setSupportedLocales(locales);
-
- }
-
- @Override
- @Deprecated
- public void setVariableResolver(VariableResolver resolver)
- {
- delegate().setVariableResolver(resolver);
- }
-
- @Override
- public void setViewHandler(ViewHandler handler)
- {
- delegate().setViewHandler(handler);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate().equals(obj);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
-}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java 2009-09-15 15:39:18 UTC (rev 3671)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import javax.faces.application.Application;
-import javax.faces.application.ApplicationFactory;
-
-/**
- * @author pmuir
- *
- */
-public abstract class ForwardingApplicationFactory extends ApplicationFactory
-{
-
- protected abstract ApplicationFactory delegate();
-
- @Override
- public Application getApplication()
- {
- return delegate().getApplication();
- }
-
- @Override
- public void setApplication(Application application)
- {
- delegate().setApplication(application);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate().equals(obj);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
-}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java 2009-09-15 15:39:18 UTC (rev 3671)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import javax.el.ELContext;
-import javax.faces.context.FacesContext;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.el.AbstractWebBeansELResolver;
-
-/**
- * @author pmuir
- *
- */
-public class JsfWebBeansELResolver extends AbstractWebBeansELResolver
-{
-
- @Override
- protected BeanManagerImpl getManager(ELContext context)
- {
- if (context.getContext(FacesContext.class) == null)
- {
- throw new IllegalStateException("Cannot use " + getClass().getSimpleName() + " outside JSF");
- }
- else
- {
- return JsfHelper.getModuleBeanManager((FacesContext) context.getContext(FacesContext.class));
- }
- }
-
-}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java 2009-09-15 15:39:18 UTC (rev 3671)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.el.ELContextListener;
-import javax.el.ExpressionFactory;
-import javax.faces.application.Application;
-
-import org.jboss.webbeans.el.WebBeansELContextListener;
-import org.jboss.webbeans.el.WebBeansExpressionFactory;
-
-/**
- * @author pmuir
- *
- */
-public class WebBeansApplication extends ForwardingApplication
-{
-
- private static final ELContextListener[] EMPTY_LISTENERS = {};
-
- private final Application application;
- private final Collection<ELContextListener> elContextListeners;
-
- public WebBeansApplication(Application application)
- {
- this.application = application;
- this.elContextListeners = new ArrayList<ELContextListener>();
- this.elContextListeners.add(new WebBeansELContextListener());
- application.addELResolver(new JsfWebBeansELResolver());
- }
-
- @Override
- protected Application delegate()
- {
- return application;
- }
-
- @Override
- public ExpressionFactory getExpressionFactory()
- {
- return new WebBeansExpressionFactory(delegate().getExpressionFactory());
- }
-
- @Override
- public ELContextListener[] getELContextListeners()
- {
- return elContextListeners.toArray(EMPTY_LISTENERS);
- }
-
- @Override
- public void addELContextListener(ELContextListener listener)
- {
- elContextListeners.add(listener);
- }
-
- @Override
- public void removeELContextListener(ELContextListener listener)
- {
- elContextListeners.remove(listener);
- }
-
-}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java 2009-09-15 15:39:18 UTC (rev 3671)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import javax.faces.application.Application;
-import javax.faces.application.ApplicationFactory;
-
-
-/**
- * @author pmuir
- *
- */
-public class WebBeansApplicationFactory extends ForwardingApplicationFactory
-{
-
- private final ApplicationFactory applicationFactory;
-
- private Application application;
-
- public WebBeansApplicationFactory(ApplicationFactory applicationFactory)
- {
- this.applicationFactory = applicationFactory;
- }
-
- @Override
- protected ApplicationFactory delegate()
- {
- return applicationFactory;
- }
-
- @Override
- public Application getApplication()
- {
- if (application == null)
- {
- application = new WebBeansApplication(delegate().getApplication());
- }
- return application;
- }
-
-}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java 2009-09-15 15:39:18 UTC (rev 3671)
@@ -22,14 +22,12 @@
*/
package org.jboss.webbeans.servlet;
-import javax.servlet.ServletContextEvent;
import javax.servlet.ServletRequestEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSessionEvent;
import org.jboss.webbeans.Container;
import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.jsp.JspInitialization;
import org.jboss.webbeans.servlet.api.helpers.AbstractServletListener;
/**
@@ -55,16 +53,6 @@
}
return lifecycle;
}
-
- @Override
- public void contextInitialized(ServletContextEvent sce)
- {
- // JBoss AS will still start the deployment even if WB fails
- if (Container.instance() != null && Container.instance().isInitialized())
- {
- new JspInitialization().init(sce.getServletContext());
- }
- }
/**
* Called when the session is created
Modified: ri/branches/kabir-builder/jboss-as/build.properties
===================================================================
--- ri/branches/kabir-builder/jboss-as/build.properties 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/jboss-as/build.properties 2009-09-15 15:39:18 UTC (rev 3671)
@@ -1,5 +1,5 @@
# Container a number of properties associated with installing Web Beans into JBoss AS and running the TCK in JBoss AS
-#jboss.home=/Applications/jboss-5.1.0.GA
+#jboss.home=/Applications/jboss-5.2.0.Beta1
org.jboss.testharness.container.javaOpts=-Xms128m -Xmx384m -XX:MaxPermSize=128m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
# time to allow before attempting to restart JBoss AS
Modified: ri/branches/kabir-builder/version-matrix/pom.xml
===================================================================
--- ri/branches/kabir-builder/version-matrix/pom.xml 2009-09-15 15:33:16 UTC (rev 3670)
+++ ri/branches/kabir-builder/version-matrix/pom.xml 2009-09-15 15:39:18 UTC (rev 3671)
@@ -128,7 +128,7 @@
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>javax.transaction</groupId>
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3670 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/util/el and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-09-15 11:33:16 -0400 (Tue, 15 Sep 2009)
New Revision: 3670
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELContext.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELResolver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingExpressionFactory.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingMethodExpression.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingValueExpression.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingLifecycle.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/ForwardingBeanStore.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbDescriptor.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/ForwardingJpaInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceLoader.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
Log:
Fix equals
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -65,7 +65,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELContext.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELContext.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -55,7 +55,7 @@
@Override
public boolean equals(Object obj)
{
- return delgate().equals(obj);
+ return this == obj || delgate().equals(obj);
}
@SuppressWarnings("unchecked")
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELResolver.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELResolver.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -66,7 +66,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingExpressionFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingExpressionFactory.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingExpressionFactory.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -58,7 +58,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingMethodExpression.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingMethodExpression.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingMethodExpression.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -55,11 +55,10 @@
return delegate().isLiteralText();
}
-
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingValueExpression.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingValueExpression.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingValueExpression.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -77,7 +77,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -63,7 +63,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj ||delegate().equals(obj);
}
public Bootstrap deployBeans()
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingLifecycle.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingLifecycle.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingLifecycle.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -105,7 +105,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -60,7 +60,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/ForwardingBeanStore.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/ForwardingBeanStore.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/ForwardingBeanStore.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -47,7 +47,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbDescriptor.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbDescriptor.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbDescriptor.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -65,7 +65,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -43,7 +43,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/ForwardingJpaInjectionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/ForwardingJpaInjectionServices.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/ForwardingJpaInjectionServices.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -62,7 +62,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceLoader.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceLoader.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceLoader.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -38,7 +38,7 @@
@Override
public boolean equals(Object obj)
{
- return delegate().equals(obj);
+ return this == obj || delegate().equals(obj);
}
@Override
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-09-15 15:25:53 UTC (rev 3669)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDescriptor.java 2009-09-15 15:33:16 UTC (rev 3670)
@@ -178,24 +178,24 @@
return builder.toString();
}
- @Override
- public boolean equals(Object other)
- {
- if (other instanceof EjbDescriptor)
- {
- EjbDescriptor<T> that = (EjbDescriptor<T>) other;
- return this.getBeanClass().equals(that.getBeanClass());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- return getEjbName().hashCode();
- }
+// @Override
+// public boolean equals(Object other)
+// {
+// if (other instanceof EjbDescriptor)
+// {
+// EjbDescriptor<T> that = (EjbDescriptor<T>) other;
+// return this.getBeanClass().equals(that.getBeanClass());
+// }
+// else
+// {
+// return false;
+// }
+// }
+//
+// @Override
+// public int hashCode()
+// {
+// return getEjbName().hashCode();
+// }
}
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3669 - in ri/branches/kabir-builder: tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: kabir.khan(a)jboss.com
Date: 2009-09-15 11:25:53 -0400 (Tue, 15 Sep 2009)
New Revision: 3669
Added:
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjb.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjbImpl.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingSimple.java
Modified:
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/DeploymentItem.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/WBClassDeploymentItem.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java
Log:
Check we are specializing the right thing
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/DeploymentItem.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/DeploymentItem.java 2009-09-15 13:31:15 UTC (rev 3668)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/DeploymentItem.java 2009-09-15 15:25:53 UTC (rev 3669)
@@ -86,7 +86,7 @@
if (candidate.equals(item))
return (DeploymentItem<T>)candidate;
}
- throw new IllegalStateException("Could not find item");
+ return null;
}
abstract DeploymentItem<T> getSuperClassDependency();
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java 2009-09-15 13:31:15 UTC (rev 3668)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java 2009-09-15 15:25:53 UTC (rev 3669)
@@ -23,6 +23,7 @@
import java.util.Set;
+import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.ejb.EjbDescriptors;
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.introspector.WBClass;
@@ -58,10 +59,15 @@
if (ejb.getBeanClass().equals(superClass))
{
DeploymentItem<InternalEjbDescriptor<?>> item = new EjbDeploymentItem(null, null, getWBClass().getWBSuperclass(), ejb);
- return findDeploymentItem(item);
+ DeploymentItem<?> found = findDeploymentItem(item);
+ if (found == null || found instanceof EjbDeploymentItem == false)
+ {
+ throw new DefinitionException(toString() + " annotation defined specializing EJB must have EJB superclass " + ejbDescriptor.getEjbName() + "(" + ejbDescriptor.getBeanClass() + ")");
+ }
+ return (EjbDeploymentItem)found;
}
}
- //TODO search wbclasses too?
- throw new IllegalStateException("Could not find super class for " + ejbDescriptor);
+
+ throw new DefinitionException(toString() + " does not specialize an EJB " + ejbDescriptor.getEjbName() + "(" + ejbDescriptor.getBeanClass() + ")");
}
}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/WBClassDeploymentItem.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/WBClassDeploymentItem.java 2009-09-15 13:31:15 UTC (rev 3668)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/WBClassDeploymentItem.java 2009-09-15 15:25:53 UTC (rev 3669)
@@ -23,6 +23,7 @@
import java.util.Set;
+import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.introspector.WBClass;
/**
@@ -45,7 +46,12 @@
DeploymentItem<WBClass<?>> getSuperClassDependency()
{
DeploymentItem<WBClass<?>> item = new WBClassDeploymentItem(null, getWBClass().getWBSuperclass());
- return findDeploymentItem(item);
+ DeploymentItem<WBClass<?>> found = findDeploymentItem(item);
+ if (found == null || found instanceof WBClassDeploymentItem == false)
+ {
+ throw new DefinitionException("Simple bean must specialize a simple bean " + getWBClass());
+ }
+
+ return found;
}
-
}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjb.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjb.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjb.java 2009-09-15 15:25:53 UTC (rev 3669)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Local;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Local
+public interface BadSpecializingEjb
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjbImpl.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjbImpl.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingEjbImpl.java 2009-09-15 15:25:53 UTC (rev 3669)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.enterprise.inject.Specializes;
+
+import javax.ejb.Stateless;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Stateless
+@Specializes
+public class BadSpecializingEjbImpl extends Employee implements BadSpecializingEjb
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingSimple.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingSimple.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/BadSpecializingSimple.java 2009-09-15 15:25:53 UTC (rev 3669)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.enterprise.inject.Specializes;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Specializes
+public class BadSpecializingSimple extends EmployeeManagerImpl
+{
+
+}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java 2009-09-15 13:31:15 UTC (rev 3668)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java 2009-09-15 15:25:53 UTC (rev 3669)
@@ -28,6 +28,7 @@
import java.util.Set;
import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.builder.sorter.DeploymentItem;
import org.jboss.webbeans.builder.sorter.Sorter;
import org.jboss.webbeans.introspector.WBClass;
@@ -35,6 +36,7 @@
import org.jboss.webbeans.mock.MockEELifecycle;
import org.jboss.webbeans.mock.MockEjbDescriptor;
import org.jboss.webbeans.resources.ClassTransformer;
+import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -137,6 +139,50 @@
assertArrays(sortClasses(createEjbDescriptors(SurgeonManagerImpl.class, DoctorManagerImpl.class), RedDecorator.class, BlueDecorator.class), RedDecorator.class, BlueDecorator.class, DoctorManagerImpl.class, SurgeonManagerImpl.class);
}
+ @Test
+ public void testBadSpecialisingEJB()
+ {
+ try
+ {
+ sortClasses(createEjbDescriptors(BadSpecializingEjbImpl.class), Employee.class);
+ Assert.fail("Should have picked up that superclass is not an EJB");
+ }
+ catch(DefinitionException expected)
+ {
+ }
+
+ try
+ {
+ sortClasses(createEjbDescriptors(BadSpecializingEjbImpl.class));
+ Assert.fail("Should have picked up that superclass does not exist");
+ }
+ catch(DefinitionException expected)
+ {
+ }
+ }
+
+ @Test
+ public void testBadSpecialisingSimple()
+ {
+ try
+ {
+ sortClasses(createEjbDescriptors(EmployeeManagerImpl.class), BadSpecializingSimple.class);
+ Assert.fail("Should have picked up that superclass is not a simple bean");
+ }
+ catch(DefinitionException expected)
+ {
+ }
+
+ try
+ {
+ sortClasses(BadSpecializingSimple.class);
+ Assert.fail("Should have picked up that superclass does not exist");
+ }
+ catch(DefinitionException expected)
+ {
+ }
+ }
+
private OrderedEjbDescriptors createEjbDescriptors(Class<?>...classes)
{
OrderedEjbDescriptors descriptors = new OrderedEjbDescriptors();
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3668 - in ri/branches/kabir-builder: api/src/main/java/javax/enterprise/inject/spi and 18 other directories.
by webbeans-commits@lists.jboss.org
Author: kabir.khan(a)jboss.com
Date: 2009-09-15 09:31:15 -0400 (Tue, 15 Sep 2009)
New Revision: 3668
Added:
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorImpl.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewManagedBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSessionBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java
Removed:
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java
Modified:
ri/branches/kabir-builder/
ri/branches/kabir-builder/api/src/main/java/javax/enterprise/inject/spi/BeanManager.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/Validator.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/builder/BeanBuilderImpl.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanInstance.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDecoratorResolver.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/util/Beans.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterprise/BootstrapTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterpriseAndSimple/BootstrapTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleSimple/BootstrapTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/newsimple/NewSimpleBeanTest.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/manager/EjbDescriptorLookupTest.java
Log:
Merged revisions 3659,3661,3663 via svnmerge from
https://svn.jboss.org/repos/webbeans/ri/trunk
.......
r3659 | pete.muir(a)jboss.org | 2009-09-14 12:39:54 +0100 (Mon, 14 Sep 2009) | 1 line
Rename classes to reflect new spec names
.......
r3661 | pete.muir(a)jboss.org | 2009-09-14 16:46:43 +0100 (Mon, 14 Sep 2009) | 1 line
WBRI-377
.......
r3663 | pete.muir(a)jboss.org | 2009-09-14 18:57:21 +0100 (Mon, 14 Sep 2009) | 1 line
Add wrapExpressionFactory
.......
Property changes on: ri/branches/kabir-builder
___________________________________________________________________
Name: svnmerge-integrated
- /ri/trunk:1-3656
+ /ri/trunk:1-3665
Modified: ri/branches/kabir-builder/api/src/main/java/javax/enterprise/inject/spi/BeanManager.java
===================================================================
--- ri/branches/kabir-builder/api/src/main/java/javax/enterprise/inject/spi/BeanManager.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/api/src/main/java/javax/enterprise/inject/spi/BeanManager.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -23,6 +23,7 @@
import java.util.Set;
import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
@@ -261,6 +262,14 @@
public ELResolver getELResolver();
/**
+ * Returns an ExpressionFactory
+ *
+ * @param expressionFactory
+ * @return
+ */
+ public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory);
+
+ /**
* Get an {@link AnnotatedType} for the given class
* @param <T> the type
* @param type the type
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -38,6 +38,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
@@ -56,9 +57,9 @@
import javax.enterprise.inject.spi.ObserverMethod;
import javax.inject.Qualifier;
-import org.jboss.webbeans.bean.DecoratorBean;
-import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.DecoratorImpl;
import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.bean.proxy.ClientProxyProvider;
import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.context.CreationalContextImpl;
@@ -67,6 +68,7 @@
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
import org.jboss.webbeans.el.Namespace;
import org.jboss.webbeans.el.WebBeansELResolver;
+import org.jboss.webbeans.el.WebBeansExpressionFactory;
import org.jboss.webbeans.introspector.WBAnnotated;
import org.jboss.webbeans.literal.AnyLiteral;
import org.jboss.webbeans.literal.DefaultLiteral;
@@ -185,7 +187,7 @@
private transient final Map<String, RIBean<?>> riBeans;
// TODO review this structure
- private transient final Map<EjbDescriptor<?>, EnterpriseBean<?>> enterpriseBeans;
+ private transient final Map<EjbDescriptor<?>, SessionBean<?>> enterpriseBeans;
// TODO This isn't right, specialization should follow accessibility rules, but I think we can enforce these in resolve()
private transient final Map<Contextual<?>, Contextual<?>> specializedBeans;
@@ -215,7 +217,7 @@
* archives
*/
private transient final TypeSafeBeanResolver<Bean<?>> beanResolver;
- private transient final TypeSafeResolver<DecoratorBean<?>> decoratorResolver;
+ private transient final TypeSafeResolver<DecoratorImpl<?>> decoratorResolver;
private transient final TypeSafeResolver<ObserverMethod<?,?>> observerResolver;
private transient final NameBasedResolver nameBasedResolver;
private transient final ELResolver webbeansELResolver;
@@ -231,7 +233,7 @@
* observers deployed in this bean deployment archive activity
*/
private transient final List<Bean<?>> beans;
- private transient final List<DecoratorBean<?>> decorators;
+ private transient final List<DecoratorImpl<?>> decorators;
private transient final List<String> namespaces;
private transient final List<ObserverMethod<?,?>> observers;
@@ -276,10 +278,10 @@
return new BeanManagerImpl(
serviceRegistry,
new CopyOnWriteArrayList<Bean<?>>(),
- new CopyOnWriteArrayList<DecoratorBean<?>>(),
+ new CopyOnWriteArrayList<DecoratorImpl<?>>(),
new CopyOnWriteArrayList<ObserverMethod<?,?>>(),
new CopyOnWriteArrayList<String>(),
- new ConcurrentHashMap<EjbDescriptor<?>, EnterpriseBean<?>>(),
+ new ConcurrentHashMap<EjbDescriptor<?>, SessionBean<?>>(),
new ConcurrentHashMap<String, RIBean<?>>(),
new ClientProxyProvider(),
contexts,
@@ -302,7 +304,7 @@
return new BeanManagerImpl(
services,
new CopyOnWriteArrayList<Bean<?>>(),
- new CopyOnWriteArrayList<DecoratorBean<?>>(),
+ new CopyOnWriteArrayList<DecoratorImpl<?>>(),
new CopyOnWriteArrayList<ObserverMethod<?,?>>(),
new CopyOnWriteArrayList<String>(),
rootManager.getEnterpriseBeans(),
@@ -360,10 +362,10 @@
private BeanManagerImpl(
ServiceRegistry serviceRegistry,
List<Bean<?>> beans,
- List<DecoratorBean<?>> decorators,
+ List<DecoratorImpl<?>> decorators,
List<ObserverMethod<?,?>> observers,
List<String> namespaces,
- Map<EjbDescriptor<?>, EnterpriseBean<?>> enterpriseBeans,
+ Map<EjbDescriptor<?>, SessionBean<?>> enterpriseBeans,
Map<String, RIBean<?>> riBeans,
ClientProxyProvider clientProxyProvider,
ListMultimap<Class<? extends Annotation>, Context> contexts,
@@ -473,10 +475,10 @@
};
- public static Transform<DecoratorBean<?>> DECORATOR_BEAN = new Transform<DecoratorBean<?>>()
+ public static Transform<DecoratorImpl<?>> DECORATOR_BEAN = new Transform<DecoratorImpl<?>>()
{
- public Iterable<DecoratorBean<?>> transform(BeanManagerImpl beanManager)
+ public Iterable<DecoratorImpl<?>> transform(BeanManagerImpl beanManager)
{
return beanManager.getDecorators();
}
@@ -524,9 +526,9 @@
{
return;
}
- if (bean.getClass().equals(EnterpriseBean.class))
+ if (bean.getClass().equals(SessionBean.class))
{
- EnterpriseBean<?> enterpriseBean = (EnterpriseBean<?>) bean;
+ SessionBean<?> enterpriseBean = (SessionBean<?>) bean;
enterpriseBeans.put(enterpriseBean.getEjbDescriptor(), enterpriseBean);
}
if (bean instanceof RIBean<?>)
@@ -543,7 +545,7 @@
beanResolver.clear();
}
- public void addDecorator(DecoratorBean<?> bean)
+ public void addDecorator(DecoratorImpl<?> bean)
{
decorators.add(bean);
riBeans.put(bean.getId(), bean);
@@ -748,7 +750,7 @@
*
* @return The bean map
*/
- public Map<EjbDescriptor<?>, EnterpriseBean<?>> getEnterpriseBeans()
+ public Map<EjbDescriptor<?>, SessionBean<?>> getEnterpriseBeans()
{
return enterpriseBeans;
}
@@ -764,7 +766,7 @@
return Collections.unmodifiableList(beans);
}
- public List<DecoratorBean<?>> getDecorators()
+ public List<DecoratorImpl<?>> getDecorators()
{
return Collections.unmodifiableList(decorators);
}
@@ -1324,6 +1326,11 @@
return webbeansELResolver;
}
+ public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ return new WebBeansExpressionFactory(expressionFactory);
+ }
+
public <T> WBCreationalContext<T> createCreationalContext(Contextual<T> contextual)
{
return new CreationalContextImpl<T>(contextual);
@@ -1356,9 +1363,9 @@
return getServices().get(EjbDescriptors.class).get(beanName);
}
- public <T> EnterpriseBean<T> getBean(EjbDescriptor<T> descriptor)
+ public <T> SessionBean<T> getBean(EjbDescriptor<T> descriptor)
{
- return (EnterpriseBean<T>) getEnterpriseBeans().get(descriptor);
+ return (SessionBean<T>) getEnterpriseBeans().get(descriptor);
}
public void cleanup()
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -41,10 +41,10 @@
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.AbstractProducerBean;
-import org.jboss.webbeans.bean.DecoratorBean;
-import org.jboss.webbeans.bean.DisposalMethodBean;
-import org.jboss.webbeans.bean.NewEnterpriseBean;
-import org.jboss.webbeans.bean.NewSimpleBean;
+import org.jboss.webbeans.bean.DecoratorImpl;
+import org.jboss.webbeans.bean.DisposalMethod;
+import org.jboss.webbeans.bean.NewSessionBean;
+import org.jboss.webbeans.bean.NewManagedBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.bootstrap.api.Service;
@@ -94,7 +94,7 @@
private void validateRIBean(RIBean<?> bean, BeanManagerImpl beanManager, Collection<RIBean<?>> specializedBeans)
{
validateBean(bean, beanManager);
- if (!(bean instanceof NewSimpleBean<?>) && !(bean instanceof NewEnterpriseBean<?>))
+ if (!(bean instanceof NewManagedBean<?>) && !(bean instanceof NewSessionBean<?>))
{
RIBean<?> abstractBean = bean;
if (abstractBean.isSpecializing())
@@ -276,7 +276,7 @@
{
// TODO Move building this list to the boot or sth
Set<Class<?>> decoratorBeanClasses = new HashSet<Class<?>>();
- for (DecoratorBean<?> bean : beanManager.getDecorators())
+ for (DecoratorImpl<?> bean : beanManager.getDecorators())
{
decoratorBeanClasses.add(bean.getType());
}
@@ -324,7 +324,7 @@
private void validateDisposalMethods(BeanDeployerEnvironment environment)
{
- Set<DisposalMethodBean<?>> beans = environment.getUnresolvedDisposalBeans();
+ Set<DisposalMethod<?>> beans = environment.getUnresolvedDisposalBeans();
if (!beans.isEmpty())
{
throw new DefinitionException("The following Disposal methods where not declared but not resolved to a producer method" + beans);
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -150,7 +150,7 @@
protected T applyDecorators(T instance, CreationalContext<T> creationalContext, InjectionPoint originalInjectionPoint)
{
- List<SerializableBeanInstance<DecoratorBean<Object>, Object>> decoratorInstances = new ArrayList<SerializableBeanInstance<DecoratorBean<Object>,Object>>();
+ List<SerializableBeanInstance<DecoratorImpl<Object>, Object>> decoratorInstances = new ArrayList<SerializableBeanInstance<DecoratorImpl<Object>,Object>>();
InjectionPoint ip = originalInjectionPoint;
boolean outside = decoratorStackPosition.get().intValue() == 0;
try
@@ -159,15 +159,15 @@
while (i < decorators.size())
{
Decorator<?> decorator = decorators.get(i);
- if (decorator instanceof DecoratorBean<?>)
+ if (decorator instanceof DecoratorImpl<?>)
{
decoratorStackPosition.set(++i);
@SuppressWarnings("unchecked")
- DecoratorBean<Object> decoratorBean = (DecoratorBean<Object>) decorator;
+ DecoratorImpl<Object> decoratorBean = (DecoratorImpl<Object>) decorator;
Object decoratorInstance = getManager().getReference(ip, decorator, creationalContext);
- decoratorInstances.add(new SerializableBeanInstance<DecoratorBean<Object>, Object>(decoratorBean, decoratorInstance));
+ decoratorInstances.add(new SerializableBeanInstance<DecoratorImpl<Object>, Object>(decoratorBean, decoratorInstance));
ip = decoratorBean.getDelegateInjectionPoint();
}
else
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,228 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Decorator;
-import javax.inject.Inject;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.injection.MethodInjectionPoint;
-import org.jboss.webbeans.injection.WBInjectionPoint;
-import org.jboss.webbeans.introspector.WBClass;
-
-public class DecoratorBean<T> extends SimpleBean<T> implements Decorator<T>
-{
-
- public static <T> Decorator<T> wrapForResolver(final Decorator<T> decorator)
- {
- return new ForwardingDecorator<T>()
- {
-
- @Override
- public Set<Annotation> getQualifiers()
- {
- return delegate().getDelegateQualifiers();
- }
-
- @Override
- public Set<Type> getTypes()
- {
- return delegate().getTypes();
- }
-
- @Override
- protected Decorator<T> delegate()
- {
- return decorator;
- }
-
- };
- }
-
- /**
- * Creates a decorator bean
- *
- * @param <T> The type
- * @param clazz The class
- * @param manager the current manager
- * @return a Bean
- */
- public static <T> DecoratorBean<T> of(WBClass<T> clazz, BeanManagerImpl manager)
- {
- return new DecoratorBean<T>(clazz, manager);
- }
-
- private WBInjectionPoint<?, ?> delegateInjectionPoint;
- private Set<Annotation> delegateBindings;
- private Type delegateType;
- private Set<Type> delegateTypes;
- private Set<Type> decoratedTypes;
-
- protected DecoratorBean(WBClass<T> type, BeanManagerImpl manager)
- {
- super(type, manager);
- }
-
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- if (!isInitialized())
- {
- super.initialize(environment);
- initDelegateInjectionPoint();
- initDecoratedTypes();
- initDelegateBindings();
- initDelegateType();
- checkDelegateType();
- }
- }
-
- protected void initDecoratedTypes()
- {
- this.decoratedTypes = new HashSet<Type>();
- this.decoratedTypes.addAll(getAnnotatedItem().getInterfaceOnlyFlattenedTypeHierarchy());
- this.decoratedTypes.remove(Serializable.class);
- }
-
- protected void initDelegateInjectionPoint()
- {
- this.delegateInjectionPoint = getDelegateInjectionPoints().iterator().next();
- }
-
- @Override
- protected void checkDelegateInjectionPoints()
- {
- for (WBInjectionPoint<?, ?> injectionPoint : getDelegateInjectionPoints())
- {
- if (injectionPoint instanceof MethodInjectionPoint<?, ?> && !injectionPoint.isAnnotationPresent(Inject.class))
- {
- throw new DefinitionException("Method with @Decorates parameter must be an initializer method " + injectionPoint);
- }
- }
- if (getDelegateInjectionPoints().size() == 0)
- {
- throw new DefinitionException("No delegate injection points defined " + this);
- }
- else if (getDelegateInjectionPoints().size() > 1)
- {
- throw new DefinitionException("Too many delegate injection point defined " + this);
- }
- }
-
- protected void initDelegateBindings()
- {
- this.delegateBindings = new HashSet<Annotation>();
- this.delegateBindings.addAll(this.delegateInjectionPoint.getQualifiers());
- }
-
- protected void initDelegateType()
- {
- this.delegateType = this.delegateInjectionPoint.getBaseType();
- this.delegateTypes = new HashSet<Type>();
- delegateTypes.add(delegateType);
- }
-
- protected void checkDelegateType()
- {
- for (Type decoratedType : getDecoratedTypes())
- {
- if (decoratedType instanceof Class)
- {
- if (!((Class<?>) decoratedType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
- {
- throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
- }
- }
- else if (decoratedType instanceof ParameterizedType)
- {
- ParameterizedType parameterizedType = (ParameterizedType) decoratedType;
- if (!delegateInjectionPoint.isParameterizedType())
- {
- throw new DefinitionException("The decorated type is parameterized, but the delegate type isn't. Delegate type " + delegateType + "." + this);
- }
- if (!Arrays.equals(delegateInjectionPoint.getActualTypeArguments(), parameterizedType.getActualTypeArguments()));
- Type rawType = ((ParameterizedType) decoratedType).getRawType();
- if (rawType instanceof Class && !((Class<?>) rawType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
- {
- throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
- }
- else
- {
- throw new IllegalStateException("Unable to process " + decoratedType);
- }
-
- }
- }
- }
-
- public Set<Annotation> getDelegateQualifiers()
- {
- return delegateBindings;
- }
-
- public Type getDelegateType()
- {
- return delegateType;
- }
-
- public Set<Type> getDecoratedTypes()
- {
- return decoratedTypes;
- }
-
- public WBInjectionPoint<?, ?> getDelegateInjectionPoint()
- {
- return delegateInjectionPoint;
- }
-
- /**
- * The type closure of the delegate type
- *
- * @return the delegateTypes
- */
- public Set<Type> getDelegateTypes()
- {
- return delegateTypes;
- }
-
- @Override
- protected void initDecorators()
- {
- // No-op, decorators can't have decorators
- }
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.bean.SimpleBean#toString()
- */
- @Override
- public String toString()
- {
- // TODO Auto-generated method stub
- return super.toString("decorator");
- }
-
-}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorImpl.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorImpl.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorImpl.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DecoratorImpl.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,228 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Decorator;
+import javax.inject.Inject;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
+import org.jboss.webbeans.injection.WBInjectionPoint;
+import org.jboss.webbeans.introspector.WBClass;
+
+public class DecoratorImpl<T> extends ManagedBean<T> implements Decorator<T>
+{
+
+ public static <T> Decorator<T> wrapForResolver(final Decorator<T> decorator)
+ {
+ return new ForwardingDecorator<T>()
+ {
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return delegate().getDelegateQualifiers();
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return delegate().getTypes();
+ }
+
+ @Override
+ protected Decorator<T> delegate()
+ {
+ return decorator;
+ }
+
+ };
+ }
+
+ /**
+ * Creates a decorator bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return a Bean
+ */
+ public static <T> DecoratorImpl<T> of(WBClass<T> clazz, BeanManagerImpl manager)
+ {
+ return new DecoratorImpl<T>(clazz, manager);
+ }
+
+ private WBInjectionPoint<?, ?> delegateInjectionPoint;
+ private Set<Annotation> delegateBindings;
+ private Type delegateType;
+ private Set<Type> delegateTypes;
+ private Set<Type> decoratedTypes;
+
+ protected DecoratorImpl(WBClass<T> type, BeanManagerImpl manager)
+ {
+ super(type, manager);
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ initDelegateInjectionPoint();
+ initDecoratedTypes();
+ initDelegateBindings();
+ initDelegateType();
+ checkDelegateType();
+ }
+ }
+
+ protected void initDecoratedTypes()
+ {
+ this.decoratedTypes = new HashSet<Type>();
+ this.decoratedTypes.addAll(getAnnotatedItem().getInterfaceOnlyFlattenedTypeHierarchy());
+ this.decoratedTypes.remove(Serializable.class);
+ }
+
+ protected void initDelegateInjectionPoint()
+ {
+ this.delegateInjectionPoint = getDelegateInjectionPoints().iterator().next();
+ }
+
+ @Override
+ protected void checkDelegateInjectionPoints()
+ {
+ for (WBInjectionPoint<?, ?> injectionPoint : getDelegateInjectionPoints())
+ {
+ if (injectionPoint instanceof MethodInjectionPoint<?, ?> && !injectionPoint.isAnnotationPresent(Inject.class))
+ {
+ throw new DefinitionException("Method with @Decorates parameter must be an initializer method " + injectionPoint);
+ }
+ }
+ if (getDelegateInjectionPoints().size() == 0)
+ {
+ throw new DefinitionException("No delegate injection points defined " + this);
+ }
+ else if (getDelegateInjectionPoints().size() > 1)
+ {
+ throw new DefinitionException("Too many delegate injection point defined " + this);
+ }
+ }
+
+ protected void initDelegateBindings()
+ {
+ this.delegateBindings = new HashSet<Annotation>();
+ this.delegateBindings.addAll(this.delegateInjectionPoint.getQualifiers());
+ }
+
+ protected void initDelegateType()
+ {
+ this.delegateType = this.delegateInjectionPoint.getBaseType();
+ this.delegateTypes = new HashSet<Type>();
+ delegateTypes.add(delegateType);
+ }
+
+ protected void checkDelegateType()
+ {
+ for (Type decoratedType : getDecoratedTypes())
+ {
+ if (decoratedType instanceof Class)
+ {
+ if (!((Class<?>) decoratedType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
+ {
+ throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
+ }
+ }
+ else if (decoratedType instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) decoratedType;
+ if (!delegateInjectionPoint.isParameterizedType())
+ {
+ throw new DefinitionException("The decorated type is parameterized, but the delegate type isn't. Delegate type " + delegateType + "." + this);
+ }
+ if (!Arrays.equals(delegateInjectionPoint.getActualTypeArguments(), parameterizedType.getActualTypeArguments()));
+ Type rawType = ((ParameterizedType) decoratedType).getRawType();
+ if (rawType instanceof Class && !((Class<?>) rawType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
+ {
+ throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
+ }
+ else
+ {
+ throw new IllegalStateException("Unable to process " + decoratedType);
+ }
+
+ }
+ }
+ }
+
+ public Set<Annotation> getDelegateQualifiers()
+ {
+ return delegateBindings;
+ }
+
+ public Type getDelegateType()
+ {
+ return delegateType;
+ }
+
+ public Set<Type> getDecoratedTypes()
+ {
+ return decoratedTypes;
+ }
+
+ public WBInjectionPoint<?, ?> getDelegateInjectionPoint()
+ {
+ return delegateInjectionPoint;
+ }
+
+ /**
+ * The type closure of the delegate type
+ *
+ * @return the delegateTypes
+ */
+ public Set<Type> getDelegateTypes()
+ {
+ return delegateTypes;
+ }
+
+ @Override
+ protected void initDecorators()
+ {
+ // No-op, decorators can't have decorators
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.bean.SimpleBean#toString()
+ */
+ @Override
+ public String toString()
+ {
+ // TODO Auto-generated method stub
+ return super.toString("decorator");
+ }
+
+}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,258 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
+import org.jboss.webbeans.introspector.WBMethod;
+
+public class DisposalMethod<T> extends AbstractReceiverBean<T, Method>
+{
+
+ protected MethodInjectionPoint<T, ?> disposalMethodInjectionPoint;
+ private final String id;
+
+ protected DisposalMethod(BeanManagerImpl manager, WBMethod<T, ?> disposalMethod, AbstractClassBean<?> declaringBean)
+ {
+ super(declaringBean, manager);
+ this.disposalMethodInjectionPoint = MethodInjectionPoint.of(this, disposalMethod);
+ this.id = createId("DisposalMethod-" + declaringBean.getName() + "-" + disposalMethod.getSignature().toString());
+ initBindings();
+ initType();
+ initTypes();
+ initStereotypes();
+ initPolicy();
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ addInjectionPoint(disposalMethodInjectionPoint);
+ super.initialize(environment);
+ checkDisposalMethod();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void initType()
+ {
+ this.type = (Class<T>) disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getJavaClass();
+ }
+
+ @Override
+ public WBMethod<T, ?> getAnnotatedItem()
+ {
+ return disposalMethodInjectionPoint;
+ }
+
+ public static <T> DisposalMethod<T> of(BeanManagerImpl manager, WBMethod<T, ?> disposalMethod, AbstractClassBean<?> declaringBean)
+ {
+ return new DisposalMethod<T>(manager, disposalMethod, declaringBean);
+ }
+
+ @Override
+ protected void initBindings()
+ {
+ // At least 1 parameter exists, already checked in constructor
+ this.bindings = new HashSet<Annotation>();
+ this.bindings.addAll(disposalMethodInjectionPoint.getWBParameters().get(0).getQualifiers());
+ initDefaultBindings();
+ }
+
+ /**
+ * Initializes the API types
+ */
+ @Override
+ protected void initTypes()
+ {
+ Set<Type> types = new HashSet<Type>();
+ types = new HashSet<Type>();
+ types.addAll(disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getTypeClosure());
+ types.add(Object.class);
+ super.types = types;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public String toString()
+ {
+ return disposalMethodInjectionPoint.toString();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ // Not relevant
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ // Not relevant
+ return false;
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return true;
+ }
+
+ public T create(CreationalContext<T> creationalContext)
+ {
+ // Not Relevant
+ return null;
+ }
+
+ public void invokeDisposeMethod(Object instance)
+ {
+ CreationalContext<T> creationalContext = manager.createCreationalContext(this);
+ Object receiverInstance = getReceiver(creationalContext);
+ if (receiverInstance == null)
+ {
+ disposalMethodInjectionPoint.invokeWithSpecialValue(null, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
+ }
+ else
+ {
+ disposalMethodInjectionPoint.invokeOnInstanceWithSpecialValue(receiverInstance, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
+ }
+ creationalContext.release();
+ }
+
+ private void checkDisposalMethod()
+ {
+ if (!disposalMethodInjectionPoint.getWBParameters().get(0).isAnnotationPresent(Disposes.class))
+ {
+ throw new DefinitionException(disposalMethodInjectionPoint.toString() + " doesn't have @Dispose as first parameter");
+ }
+ if (disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).size() > 1)
+ {
+ throw new DefinitionException(disposalMethodInjectionPoint.toString() + " has more than one @Dispose parameters");
+ }
+ if (disposalMethodInjectionPoint.getAnnotatedParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("@Observes is not allowed on disposal method, see " + disposalMethodInjectionPoint.toString());
+ }
+ if (disposalMethodInjectionPoint.getAnnotation(Inject.class) != null)
+ {
+ throw new DefinitionException("@Intitializer is not allowed on a disposal method, see " + disposalMethodInjectionPoint.toString());
+ }
+ if (disposalMethodInjectionPoint.getAnnotation(Produces.class) != null)
+ {
+ throw new DefinitionException("@Produces is not allowed on a disposal method, see " + disposalMethodInjectionPoint.toString());
+ }
+ if (getDeclaringBean() instanceof SessionBean<?>)
+ {
+ boolean methodDeclaredOnTypes = false;
+ // TODO use annotated item?
+ for (Type type : getDeclaringBean().getTypes())
+ {
+ if (type instanceof Class<?>)
+ {
+ Class<?> clazz = (Class<?>) type;
+ try
+ {
+ clazz.getDeclaredMethod(disposalMethodInjectionPoint.getName(), disposalMethodInjectionPoint.getParameterTypesAsArray());
+ methodDeclaredOnTypes = true;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // No - op
+ }
+ }
+ }
+ if (!methodDeclaredOnTypes)
+ {
+ throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
+ }
+ }
+ }
+
+ @Override
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ @Override
+ protected String getDefaultName()
+ {
+ return disposalMethodInjectionPoint.getPropertyName();
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ // No-op. Producer method dependent objects are destroyed in producer method bean
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ // Doesn't support specialization
+ return null;
+ }
+
+ @Override
+ protected void initScopeType()
+ {
+ // Disposal methods aren't scoped
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,258 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.injection.MethodInjectionPoint;
-import org.jboss.webbeans.introspector.WBMethod;
-
-public class DisposalMethodBean<T> extends AbstractReceiverBean<T, Method>
-{
-
- protected MethodInjectionPoint<T, ?> disposalMethodInjectionPoint;
- private final String id;
-
- protected DisposalMethodBean(BeanManagerImpl manager, WBMethod<T, ?> disposalMethod, AbstractClassBean<?> declaringBean)
- {
- super(declaringBean, manager);
- this.disposalMethodInjectionPoint = MethodInjectionPoint.of(this, disposalMethod);
- this.id = createId("DisposalMethod-" + declaringBean.getName() + "-" + disposalMethod.getSignature().toString());
- initBindings();
- initType();
- initTypes();
- initStereotypes();
- initPolicy();
- }
-
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- addInjectionPoint(disposalMethodInjectionPoint);
- super.initialize(environment);
- checkDisposalMethod();
- }
-
- @SuppressWarnings("unchecked")
- protected void initType()
- {
- this.type = (Class<T>) disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getJavaClass();
- }
-
- @Override
- public WBMethod<T, ?> getAnnotatedItem()
- {
- return disposalMethodInjectionPoint;
- }
-
- public static <T> DisposalMethodBean<T> of(BeanManagerImpl manager, WBMethod<T, ?> disposalMethod, AbstractClassBean<?> declaringBean)
- {
- return new DisposalMethodBean<T>(manager, disposalMethod, declaringBean);
- }
-
- @Override
- protected void initBindings()
- {
- // At least 1 parameter exists, already checked in constructor
- this.bindings = new HashSet<Annotation>();
- this.bindings.addAll(disposalMethodInjectionPoint.getWBParameters().get(0).getQualifiers());
- initDefaultBindings();
- }
-
- /**
- * Initializes the API types
- */
- @Override
- protected void initTypes()
- {
- Set<Type> types = new HashSet<Type>();
- types = new HashSet<Type>();
- types.addAll(disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getTypeClosure());
- types.add(Object.class);
- super.types = types;
- }
-
- @Override
- public String getName()
- {
- return null;
- }
-
- @Override
- public Class<? extends Annotation> getScope()
- {
- return null;
- }
-
- @Override
- public Set<Type> getTypes()
- {
- return types;
- }
-
- @Override
- public String toString()
- {
- return disposalMethodInjectionPoint.toString();
- }
-
- @Override
- public boolean isNullable()
- {
- // Not relevant
- return false;
- }
-
- @Override
- public boolean isSerializable()
- {
- // Not relevant
- return false;
- }
-
- @Override
- public boolean isProxyable()
- {
- return true;
- }
-
- public T create(CreationalContext<T> creationalContext)
- {
- // Not Relevant
- return null;
- }
-
- public void invokeDisposeMethod(Object instance)
- {
- CreationalContext<T> creationalContext = manager.createCreationalContext(this);
- Object receiverInstance = getReceiver(creationalContext);
- if (receiverInstance == null)
- {
- disposalMethodInjectionPoint.invokeWithSpecialValue(null, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
- }
- else
- {
- disposalMethodInjectionPoint.invokeOnInstanceWithSpecialValue(receiverInstance, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
- }
- creationalContext.release();
- }
-
- private void checkDisposalMethod()
- {
- if (!disposalMethodInjectionPoint.getWBParameters().get(0).isAnnotationPresent(Disposes.class))
- {
- throw new DefinitionException(disposalMethodInjectionPoint.toString() + " doesn't have @Dispose as first parameter");
- }
- if (disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).size() > 1)
- {
- throw new DefinitionException(disposalMethodInjectionPoint.toString() + " has more than one @Dispose parameters");
- }
- if (disposalMethodInjectionPoint.getAnnotatedParameters(Observes.class).size() > 0)
- {
- throw new DefinitionException("@Observes is not allowed on disposal method, see " + disposalMethodInjectionPoint.toString());
- }
- if (disposalMethodInjectionPoint.getAnnotation(Inject.class) != null)
- {
- throw new DefinitionException("@Intitializer is not allowed on a disposal method, see " + disposalMethodInjectionPoint.toString());
- }
- if (disposalMethodInjectionPoint.getAnnotation(Produces.class) != null)
- {
- throw new DefinitionException("@Produces is not allowed on a disposal method, see " + disposalMethodInjectionPoint.toString());
- }
- if (getDeclaringBean() instanceof EnterpriseBean<?>)
- {
- boolean methodDeclaredOnTypes = false;
- // TODO use annotated item?
- for (Type type : getDeclaringBean().getTypes())
- {
- if (type instanceof Class<?>)
- {
- Class<?> clazz = (Class<?>) type;
- try
- {
- clazz.getDeclaredMethod(disposalMethodInjectionPoint.getName(), disposalMethodInjectionPoint.getParameterTypesAsArray());
- methodDeclaredOnTypes = true;
- }
- catch (NoSuchMethodException nsme)
- {
- // No - op
- }
- }
- }
- if (!methodDeclaredOnTypes)
- {
- throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
- }
- }
- }
-
- @Override
- public Class<T> getType()
- {
- return type;
- }
-
- @Override
- protected String getDefaultName()
- {
- return disposalMethodInjectionPoint.getPropertyName();
- }
-
- public void destroy(T instance, CreationalContext<T> creationalContext)
- {
- // No-op. Producer method dependent objects are destroyed in producer method bean
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- @Override
- public AbstractBean<?, ?> getSpecializedBean()
- {
- // Doesn't support specialization
- return null;
- }
-
- @Override
- protected void initScopeType()
- {
- // Disposal methods aren't scoped
- }
-
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
-}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,402 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javassist.util.proxy.ProxyFactory;
-import javassist.util.proxy.ProxyObject;
-
-import javax.decorator.Decorator;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.CreationException;
-import javax.interceptor.Interceptor;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.bean.proxy.EnterpriseBeanInstance;
-import org.jboss.webbeans.bean.proxy.EnterpriseBeanProxyMethodHandler;
-import org.jboss.webbeans.bean.proxy.Marker;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.ejb.InternalEjbDescriptor;
-import org.jboss.webbeans.ejb.api.SessionObjectReference;
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbServices;
-import org.jboss.webbeans.injection.InjectionContextImpl;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Proxies;
-
-/**
- * An enterprise bean representation
- *
- * @author Pete Muir
- *
- * @param <T> The type (class) of the bean
- */
-public class EnterpriseBean<T> extends AbstractClassBean<T>
-{
- private final Log log = Logging.getLog(EnterpriseBean.class);
-
- // The EJB descriptor
- private InternalEjbDescriptor<T> ejbDescriptor;
-
- private Class<T> proxyClass;
-
- private EnterpriseBean<?> specializedBean;
-
- /**
- * Creates a simple, annotation defined Enterprise Web Bean
- *
- * @param <T> The type
- * @param clazz The class
- * @param manager the current manager
- * @return An Enterprise Web Bean
- */
- public static <T> EnterpriseBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
- {
- WBClass<T> type = manager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
- return new EnterpriseBean<T>(type, ejbDescriptor, manager);
- }
-
- /**
- * Constructor
- *
- * @param type The type of the bean
- * @param manager The Web Beans manager
- */
- protected EnterpriseBean(WBClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
- {
- super(type, manager);
- initType();
- this.ejbDescriptor = ejbDescriptor;
- initTypes();
- initBindings();
- }
-
- /**
- * Initializes the bean and its metadata
- */
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- if (!isInitialized())
- {
- super.initialize(environment);
- initProxyClass();
- checkEJBTypeAllowed();
- checkConflictingRoles();
- checkObserverMethods();
- checkScopeAllowed();
- }
- }
-
- @Override
- protected void initTypes()
- {
- Set<Type> types = new HashSet<Type>();
- types = new LinkedHashSet<Type>();
- types.add(Object.class);
- for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
- {
- types.add(businessInterfaceDescriptor.getInterface());
- }
- super.types = types;
- }
-
- protected void initProxyClass()
- {
- Set<Type> types = new LinkedHashSet<Type>(getTypes());
- types.add(EnterpriseBeanInstance.class);
- types.add(Serializable.class);
- ProxyFactory proxyFactory = Proxies.getProxyFactory(types);
-
- @SuppressWarnings("unchecked")
- Class<T> proxyClass = proxyFactory.createClass();
-
- this.proxyClass = proxyClass;
- }
-
- /**
- * Validates for non-conflicting roles
- */
- protected void checkConflictingRoles()
- {
- if (getType().isAnnotationPresent(Interceptor.class))
- {
- throw new DefinitionException("Enterprise beans cannot be interceptors");
- }
- if (getType().isAnnotationPresent(Decorator.class))
- {
- throw new DefinitionException("Enterprise beans cannot be decorators");
- }
- }
-
- /**
- * Check that the scope type is allowed by the stereotypes on the bean and
- * the bean type
- */
- protected void checkScopeAllowed()
- {
- if (ejbDescriptor.isStateless() && !isDependent())
- {
- throw new DefinitionException("Scope " + getScope() + " is not allowed on stateless enterpise beans for " + getType() + ". Only @Dependent is allowed on stateless enterprise beans");
- }
- if (ejbDescriptor.isSingleton() && !(isDependent() || getScope().equals(ApplicationScoped.class)))
- {
- throw new DefinitionException("Scope " + getScope() + " is not allowed on singleton enterpise beans for " + getType() + ". Only @Dependent or @ApplicationScoped is allowed on singleton enterprise beans");
- }
- }
-
- /**
- * Validates specialization
- */
- @Override
- protected void preSpecialize(BeanDeployerEnvironment environment)
- {
- super.preSpecialize(environment);
- // We appear to check this twice?
- if (!environment.getEjbDescriptors().contains(getAnnotatedItem().getWBSuperclass().getJavaClass()))
- {
- throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
- }
- }
-
- @Override
- protected void specialize(BeanDeployerEnvironment environment)
- {
- if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
- {
- throw new IllegalStateException(toString() + " does not specialize a bean");
- }
- AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
- if (!(specializedBean instanceof EnterpriseBean<?>))
- {
- throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + specializedBean);
- }
- else
- {
- this.specializedBean = (EnterpriseBean<?>) specializedBean;
- }
- }
-
- /**
- * Creates an instance of the bean
- *
- * @return The instance
- */
- public T create(final CreationalContext<T> creationalContext)
- {
- T instance = produce(creationalContext);
- if (hasDecorators())
- {
- instance = applyDecorators(instance, creationalContext, null);
- }
- return instance;
- }
-
- public void inject(final T instance, final CreationalContext<T> ctx)
- {
- new InjectionContextImpl<T>(getManager(), this, instance)
- {
-
- public void proceed()
- {
- Beans.injectBoundFields(instance, ctx, getManager(), getInjectableFields());
- Beans.callInitializers(instance, ctx, getManager(), getInitializerMethods());
- }
-
- }.run();
-
- }
-
- public T produce(CreationalContext<T> ctx)
- {
- try
- {
- T instance = proxyClass.newInstance();
- ctx.push(instance);
- ((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler<T>(this, ctx));
- log.trace("Enterprise bean instance created for bean {0}", this);
- return instance;
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException("Could not instantiate enterprise proxy for " + toString(), e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException("Could not access bean correctly when creating enterprise proxy for " + toString(), e);
- }
- catch (Exception e)
- {
- throw new CreationException("could not find the EJB in JNDI " + proxyClass, e);
- }
- }
-
- public void destroy(T instance, CreationalContext<T> creationalContext)
- {
- if (instance == null)
- {
- throw new IllegalArgumentException("instance to destroy cannot be null");
- }
- if (!(instance instanceof EnterpriseBeanInstance))
- {
- throw new IllegalArgumentException("Cannot destroy session bean instance not created by the container");
- }
- EnterpriseBeanInstance enterpiseBeanInstance = (EnterpriseBeanInstance) instance;
- enterpiseBeanInstance.destroy(Marker.INSTANCE, this, creationalContext);
- creationalContext.release();
- }
-
- /**
- * Validates the bean type
- */
- private void checkEJBTypeAllowed()
- {
- if (ejbDescriptor.isMessageDriven())
- {
- throw new DefinitionException("Message Driven Beans can't be Web Beans");
- }
- }
-
- /**
- * Gets a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- // buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()) +
- // Names.ejbTypeFromMetaData(getEjbMetaData()));
- if (getName() == null)
- {
- buffer.append(" unnamed enterprise bean");
- }
- else
- {
- buffer.append(" enterprise bean '" + getName() + "'");
- }
- buffer.append(" [" + getType().getName() + "] ");
- buffer.append("API types " + getTypes() + ", binding types " + getQualifiers());
- return buffer.toString();
- }
-
- public void postConstruct(T instance, CreationalContext<T> creationalContext)
- {
- Beans.injectBoundFields(instance, creationalContext, getManager(), getInjectableFields());
- Beans.callInitializers(instance, creationalContext, getManager(), getInitializerMethods());
- }
-
- public void preDestroy(CreationalContext<T> creationalContext)
- {
- creationalContext.release();
- }
-
- @Override
- protected void initSerializable()
- {
- // No-op
- }
-
- @Override
- public boolean isSerializable()
- {
- return true;
- }
-
- public InternalEjbDescriptor<T> getEjbDescriptor()
- {
- return ejbDescriptor;
- }
-
- public boolean isClientCanCallRemoveMethods()
- {
- return getEjbDescriptor().isStateful() && isDependent();
- }
-
- @Override
- public AbstractBean<?, ?> getSpecializedBean()
- {
- return specializedBean;
- }
-
- /**
- * If there are any observer methods, they must be static or business
- * methods.
- */
- protected void checkObserverMethods()
- {
- for (WBMethod<?, ?> method : this.annotatedItem.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
- {
- if (!method.isStatic())
- {
- if (!isMethodExistsOnTypes(method))
- {
- throw new DefinitionException("Observer method must be static or business method: " + method + " on " + getAnnotatedItem());
- }
- }
- }
- }
-
- // TODO must be a nicer way to do this!
- public boolean isMethodExistsOnTypes(WBMethod<?, ?> method)
- {
- for (Type type : getTypes())
- {
- if (type instanceof Class)
- {
- for (Method m : ((Class<?>) type).getMethods())
- {
- if (method.getName().equals(m.getName()) && Arrays.equals(method.getParameterTypesAsArray(), m.getParameterTypes()))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public SessionObjectReference createReference()
- {
- return manager.getServices().get(EjbServices.class).resolveEjb(getEjbDescriptor().delegate());
- }
-
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
-}
-
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,359 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.injection.ConstructorInjectionPoint;
+import org.jboss.webbeans.injection.InjectionContextImpl;
+import org.jboss.webbeans.injection.WBInjectionPoint;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.introspector.WBConstructor;
+import org.jboss.webbeans.introspector.WBField;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.Names;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ * Represents a simple bean
+ *
+ * @author Pete Muir
+ *
+ * @param <T> The type (class) of the bean
+ */
+public class ManagedBean<T> extends AbstractClassBean<T>
+{
+ // Logger
+ private static LogProvider log = Logging.getLogProvider(ManagedBean.class);
+
+ // The constructor
+ private ConstructorInjectionPoint<T> constructor;
+ private Set<WBInjectionPoint<?, ?>> ejbInjectionPoints;
+ private Set<WBInjectionPoint<?, ?>> persistenceContextInjectionPoints;
+ private Set<WBInjectionPoint<?, ?>> persistenceUnitInjectionPoints;
+ private Set<WBInjectionPoint<?, ?>> resourceInjectionPoints;
+
+ private ManagedBean<?> specializedBean;
+
+
+
+ /**
+ * Creates a simple, annotation defined Web Bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return A Web Bean
+ */
+ public static <T> ManagedBean<T> of(WBClass<T> clazz, BeanManagerImpl manager)
+ {
+ return new ManagedBean<T>(clazz, manager);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param type The type of the bean
+ * @param manager The Web Beans manager
+ */
+ protected ManagedBean(WBClass<T> type, BeanManagerImpl manager)
+ {
+ super(type, manager);
+ initType();
+ initTypes();
+ initBindings();
+ }
+
+ /**
+ * Creates an instance of the bean
+ *
+ * @return The instance
+ */
+ public T create(CreationalContext<T> creationalContext)
+ {
+ InjectionPoint originalInjectionPoint = null;
+ if (hasDecorators())
+ {
+ originalInjectionPoint = attachCorrectInjectionPoint();
+ }
+ T instance = produce(creationalContext);
+ inject(instance, creationalContext);
+ postConstruct(instance);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, originalInjectionPoint);
+ }
+ return instance;
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ T instance = constructor.newInstance(manager, ctx);
+ if (!hasDecorators())
+ {
+ // This should be safe, but needs verification PLM
+ // Without this, the chaining of decorators will fail as the incomplete instance will be resolved
+ ctx.push(instance);
+ }
+ return instance;
+ }
+
+ public void inject(final T instance, final CreationalContext<T> ctx)
+ {
+ new InjectionContextImpl<T>(getManager(), this, instance)
+ {
+
+ public void proceed()
+ {
+ Beans.injectEEFields(instance, getManager(), ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
+ Beans.injectBoundFields(instance, ctx, getManager(), getInjectableFields());
+ Beans.callInitializers(instance, ctx, getManager(), getInitializerMethods());
+ }
+
+ }.run();
+
+ }
+
+ protected InjectionPoint attachCorrectInjectionPoint()
+ {
+ Decorator<?> decorator = getDecorators().get(getDecorators().size() - 1);
+ if (decorator instanceof DecoratorImpl<?>)
+ {
+ DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator;
+ InjectionPoint outerDelegateInjectionPoint = decoratorBean.getDelegateInjectionPoint();
+ return getManager().replaceOrPushCurrentInjectionPoint(outerDelegateInjectionPoint);
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot operate on user defined decorator");
+ }
+ }
+
+ /**
+ * Destroys an instance of the bean
+ *
+ * @param instance The instance
+ */
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ try
+ {
+ preDestroy(instance);
+ creationalContext.release();
+ }
+ catch (Exception e)
+ {
+ log.error("Error destroying " + toString(), e);
+ }
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ initConstructor();
+ checkConstructor();
+ super.initialize(environment);
+ initPostConstruct();
+ initPreDestroy();
+ initEEInjectionPoints();
+ }
+ }
+
+ private void initEEInjectionPoints()
+ {
+ this.ejbInjectionPoints = Beans.getEjbInjectionPoints(this, getAnnotatedItem(), getManager());
+ this.persistenceContextInjectionPoints = Beans.getPersistenceContextInjectionPoints(this, getAnnotatedItem(), getManager());
+ this.persistenceUnitInjectionPoints = Beans.getPersistenceUnitInjectionPoints(this, getAnnotatedItem(), getManager());
+ this.resourceInjectionPoints = Beans.getResourceInjectionPoints(this, getAnnotatedItem(), manager);
+ }
+
+ /**
+ * Validates the type
+ */
+ protected void checkType()
+ {
+ if (getAnnotatedItem().isNonStaticMemberClass())
+ {
+ throw new DefinitionException("Simple bean " + type + " cannot be a non-static inner class");
+ }
+ if (!isDependent() && getAnnotatedItem().isParameterizedType())
+ {
+ throw new DefinitionException("Managed bean " + type + " must be @Dependent");
+ }
+ boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isPassivating();
+ if (passivating && !Reflections.isSerializable(getBeanClass()))
+ {
+ throw new DefinitionException("Simple bean declaring a passivating scope must have a serializable implementation class " + toString());
+ }
+ if (hasDecorators())
+ {
+ if (getAnnotatedItem().isFinal())
+ {
+ throw new DefinitionException("Bean class which has decorators cannot be declared final " + this);
+ }
+ for (Decorator<?> decorator : getDecorators())
+ {
+ if (decorator instanceof DecoratorImpl<?>)
+ {
+ DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator;
+ for (WBMethod<?, ?> decoratorMethod : decoratorBean.getAnnotatedItem().getWBMethods())
+ {
+ WBMethod<?, ?> method = getAnnotatedItem().getWBMethod(decoratorMethod.getSignature());
+ if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal())
+ {
+ throw new DefinitionException("Decorated bean method " + method + " (decorated by "+ decoratorMethod + ") cannot be declarted final");
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Can only operate on container provided decorators " + decorator);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void checkBeanImplementation()
+ {
+ super.checkBeanImplementation();
+ if (!isDependent())
+ {
+ for (WBField<?, ?> field : getAnnotatedItem().getWBFields())
+ {
+ if (field.isPublic() && !field.isStatic())
+ {
+ throw new DefinitionException("Normal scoped Web Bean implementation class has a public field " + getAnnotatedItem());
+ }
+ }
+ }
+ }
+
+ protected void checkConstructor()
+ {
+ if (!constructor.getAnnotatedWBParameters(Disposes.class).isEmpty())
+ {
+ throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Disposes " + constructor);
+ }
+ if (!constructor.getAnnotatedWBParameters(Observes.class).isEmpty())
+ {
+ throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Observes " + constructor);
+ }
+ }
+
+ @Override
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+ super.preSpecialize(environment);
+ if (environment.getEjbDescriptors().contains(getAnnotatedItem().getWBSuperclass().getJavaClass()))
+ {
+ throw new DefinitionException("Simple bean must specialize a simple bean");
+ }
+ }
+
+ @Override
+ protected void specialize(BeanDeployerEnvironment environment)
+ {
+ if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
+ {
+ throw new DefinitionException(toString() + " does not specialize a bean");
+ }
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
+ if (!(specializedBean instanceof ManagedBean))
+ {
+ throw new DefinitionException(toString() + " doesn't have a simple bean as a superclass " + specializedBean);
+ }
+ else
+ {
+ this.specializedBean = (ManagedBean<?>) specializedBean;
+ }
+ }
+
+
+ /**
+ * Initializes the constructor
+ */
+ protected void initConstructor()
+ {
+ this.constructor = Beans.getBeanConstructor(this, getAnnotatedItem());
+ // TODO We loop unecessarily many times here, I want to probably introduce some callback mechanism. PLM.
+ addInjectionPoints(Beans.getParameterInjectionPoints(this, constructor));
+ }
+
+ /**
+ * Returns the constructor
+ *
+ * @return The constructor
+ */
+ public WBConstructor<T> getConstructor()
+ {
+ return constructor;
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return toString("simple bean");
+ }
+
+ protected String toString(String beanType)
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(Names.scopeTypeToString(getScope()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed ").append(beanType);
+ }
+ else
+ {
+ buffer.append(beanType).append(" '" + getName() + "'");
+ }
+ buffer.append(" ").append(getType().getName()).append(", ");
+ buffer.append(" API types = ").append(Names.typesToString(getTypes())).append(", binding types = " + Names.annotationsToString(getQualifiers()));
+ return buffer.toString();
+ }
+
+ @Override
+ public ManagedBean<?> getSpecializedBean()
+ {
+ return specializedBean;
+ }
+
+}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.ejb.InternalEjbDescriptor;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.literal.NewLiteral;
-import org.jboss.webbeans.resources.ClassTransformer;
-
-/**
- * Represents a @New enterprise bean
- *
- * @author Nicklas Karlsson
- */
-public class NewEnterpriseBean<T> extends EnterpriseBean<T> implements NewBean
-{
-
- /**
- * Creates an instance of a NewEnterpriseBean from an annotated class
- *
- * @param clazz The annotated class
- * @param manager The Web Beans manager
- * @return a new NewEnterpriseBean instance
- */
- public static <T> NewEnterpriseBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
- {
- WBClass<T> type = manager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
- return new NewEnterpriseBean<T>(type, ejbDescriptor, manager);
- }
-
- private Set<Annotation> bindings;
-
- /**
- * Protected constructor
- *
- * @param type An annotated class
- * @param manager The Web Beans manager
- */
- protected NewEnterpriseBean(final WBClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
- {
- super(type, ejbDescriptor, manager);
- this.bindings = new HashSet<Annotation>();
- this.bindings.add(new NewLiteral()
- {
-
- public Class<?> value()
- {
- return type.getJavaClass();
- }
-
- });
- }
-
- /**
- * Gets the scope type
- *
- * @return @Dependent
- */
- @Override
- public Class<? extends Annotation> getScope()
- {
- return Dependent.class;
- }
-
- @Override
- public boolean isAlternative()
- {
- return false;
- }
-
- /**
- * Gets the name of the bean
- *
- * @return null
- */
- @Override
- public String getName()
- {
- return null;
- }
-
- /**
- * Gets the bindings
- *
- * @returns @New
- */
- @Override
- public Set<Annotation> getQualifiers()
- {
- return bindings;
- }
-
- @Override
- public boolean isSpecializing()
- {
- return false;
- }
-
- @Override
- protected void checkScopeAllowed()
- {
- // No-op
- }
-
-}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewManagedBean.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewManagedBean.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewManagedBean.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewManagedBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.literal.NewLiteral;
+
+/**
+ * Represents a @New simple bean
+ *
+ * @author Nicklas Karlsson
+ */
+public class NewManagedBean<T> extends ManagedBean<T> implements NewBean
+{
+
+ /**
+ * Creates an instance of a NewSimpleBean from an annotated class
+ *
+ * @param clazz The annotated class
+ * @param manager The Web Beans manager
+ * @return a new NewSimpleBean instance
+ */
+ public static <T> NewManagedBean<T> of(WBClass<T> clazz, BeanManagerImpl manager)
+ {
+ return new NewManagedBean<T>(clazz, manager);
+ }
+
+ private Set<Annotation> bindings;
+
+ /**
+ * Protected constructor
+ *
+ * @param type An annotated class
+ * @param manager The Web Beans manager
+ */
+ protected NewManagedBean(final WBClass<T> type, BeanManagerImpl manager)
+ {
+ super(type, manager);
+ this.bindings = new HashSet<Annotation>();
+ this.bindings.add(new NewLiteral()
+ {
+
+ public Class<?> value()
+ {
+ return type.getJavaClass();
+ }
+
+ });
+ }
+
+ /**
+ * Gets the scope type
+ *
+ * @return @Dependent
+ */
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the name of the bean
+ *
+ * @return null
+ */
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ /**
+ * Gets the bindings
+ *
+ * @returns @New
+ */
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return bindings;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSessionBean.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSessionBean.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSessionBean.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSessionBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.ejb.InternalEjbDescriptor;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.literal.NewLiteral;
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ * Represents a @New enterprise bean
+ *
+ * @author Nicklas Karlsson
+ */
+public class NewSessionBean<T> extends SessionBean<T> implements NewBean
+{
+
+ /**
+ * Creates an instance of a NewEnterpriseBean from an annotated class
+ *
+ * @param clazz The annotated class
+ * @param manager The Web Beans manager
+ * @return a new NewEnterpriseBean instance
+ */
+ public static <T> NewSessionBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
+ {
+ WBClass<T> type = manager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
+ return new NewSessionBean<T>(type, ejbDescriptor, manager);
+ }
+
+ private Set<Annotation> bindings;
+
+ /**
+ * Protected constructor
+ *
+ * @param type An annotated class
+ * @param manager The Web Beans manager
+ */
+ protected NewSessionBean(final WBClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
+ {
+ super(type, ejbDescriptor, manager);
+ this.bindings = new HashSet<Annotation>();
+ this.bindings.add(new NewLiteral()
+ {
+
+ public Class<?> value()
+ {
+ return type.getJavaClass();
+ }
+
+ });
+ }
+
+ /**
+ * Gets the scope type
+ *
+ * @return @Dependent
+ */
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the name of the bean
+ *
+ * @return null
+ */
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ /**
+ * Gets the bindings
+ *
+ * @returns @New
+ */
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return bindings;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+ @Override
+ protected void checkScopeAllowed()
+ {
+ // No-op
+ }
+
+}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.literal.NewLiteral;
-
-/**
- * Represents a @New simple bean
- *
- * @author Nicklas Karlsson
- */
-public class NewSimpleBean<T> extends SimpleBean<T> implements NewBean
-{
-
- /**
- * Creates an instance of a NewSimpleBean from an annotated class
- *
- * @param clazz The annotated class
- * @param manager The Web Beans manager
- * @return a new NewSimpleBean instance
- */
- public static <T> NewSimpleBean<T> of(WBClass<T> clazz, BeanManagerImpl manager)
- {
- return new NewSimpleBean<T>(clazz, manager);
- }
-
- private Set<Annotation> bindings;
-
- /**
- * Protected constructor
- *
- * @param type An annotated class
- * @param manager The Web Beans manager
- */
- protected NewSimpleBean(final WBClass<T> type, BeanManagerImpl manager)
- {
- super(type, manager);
- this.bindings = new HashSet<Annotation>();
- this.bindings.add(new NewLiteral()
- {
-
- public Class<?> value()
- {
- return type.getJavaClass();
- }
-
- });
- }
-
- /**
- * Gets the scope type
- *
- * @return @Dependent
- */
- @Override
- public Class<? extends Annotation> getScope()
- {
- return Dependent.class;
- }
-
- @Override
- public boolean isAlternative()
- {
- return false;
- }
-
- /**
- * Gets the name of the bean
- *
- * @return null
- */
- @Override
- public String getName()
- {
- return null;
- }
-
- /**
- * Gets the bindings
- *
- * @returns @New
- */
- @Override
- public Set<Annotation> getQualifiers()
- {
- return bindings;
- }
-
- @Override
- public boolean isSpecializing()
- {
- return false;
- }
-
-}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.introspector.WBField;
+import org.jboss.webbeans.util.Names;
+
+/**
+ * Represents a producer field
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public class ProducerField<T> extends AbstractProducerBean<T, Field>
+{
+ // The underlying field
+ private WBField<T, ?> field;
+ private final String id;
+
+ /**
+ * Creates a producer field
+ *
+ * @param field The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer field
+ */
+ public static <T> ProducerField<T> of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ return new ProducerField<T>(field, declaringBean, manager);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param method The producer field abstraction
+ * @param declaringBean The declaring bean
+ * @param manager The Web Beans manager
+ */
+ protected ProducerField(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ super(declaringBean, manager);
+ this.field = field;
+ initType();
+ initTypes();
+ initBindings();
+ this.id = createId("ProducerField-" + declaringBean.getType().getName() + "-"+ field.getName());
+ initStereotypes();
+ initPolicy();
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ }
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ dispose(instance);
+ }
+
+ public void dispose(T instance)
+ {
+ // No clean up required
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ return field.get(getReceiver(ctx));
+ }
+
+
+ /**
+ * Gets the annotated item representing the field
+ *
+ * @return The annotated item
+ */
+ @Override
+ protected WBField<T, ?> getAnnotatedItem()
+ {
+ return field;
+ }
+
+ /**
+ * Returns the default name
+ *
+ * @return The default name
+ */
+ @Override
+ protected String getDefaultName()
+ {
+ return field.getPropertyName();
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScope()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer field bean");
+ }
+ else
+ {
+ buffer.append("simple producer field bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getBeanClass().getName() + "] for class type [" + getType().getName() + "] API types " + getTypes() + ", binding types " + getQualifiers());
+ return buffer.toString();
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,168 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.util.Collections;
-import java.util.Set;
-
-import javax.enterprise.context.spi.CreationalContext;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.util.Names;
-
-/**
- * Represents a producer field bean
- *
- * @author Pete Muir
- *
- * @param <T>
- */
-public class ProducerFieldBean<T> extends AbstractProducerBean<T, Field>
-{
- // The underlying field
- private WBField<T, ?> field;
- private final String id;
-
- /**
- * Creates a producer field Web Bean
- *
- * @param field The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer Web Bean
- */
- public static <T> ProducerFieldBean<T> of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- return new ProducerFieldBean<T>(field, declaringBean, manager);
- }
-
- /**
- * Constructor
- *
- * @param method The producer field abstraction
- * @param declaringBean The declaring bean
- * @param manager The Web Beans manager
- */
- protected ProducerFieldBean(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- super(declaringBean, manager);
- this.field = field;
- initType();
- initTypes();
- initBindings();
- this.id = createId("ProducerField-" + declaringBean.getType().getName() + "-"+ field.getName());
- initStereotypes();
- initPolicy();
- }
-
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- if (!isInitialized())
- {
- super.initialize(environment);
- }
- }
-
- public void destroy(T instance, CreationalContext<T> creationalContext)
- {
- dispose(instance);
- }
-
- public void dispose(T instance)
- {
- // No clean up required
- }
-
- public T produce(CreationalContext<T> ctx)
- {
- return field.get(getReceiver(ctx));
- }
-
-
- /**
- * Gets the annotated item representing the field
- *
- * @return The annotated item
- */
- @Override
- protected WBField<T, ?> getAnnotatedItem()
- {
- return field;
- }
-
- /**
- * Returns the default name
- *
- * @return The default name
- */
- @Override
- protected String getDefaultName()
- {
- return field.getPropertyName();
- }
-
- /**
- * Gets a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Annotated " + Names.scopeTypeToString(getScope()));
- if (getName() == null)
- {
- buffer.append("unnamed producer field bean");
- }
- else
- {
- buffer.append("simple producer field bean '" + getName() + "'");
- }
- buffer.append(" [" + getBeanClass().getName() + "] for class type [" + getType().getName() + "] API types " + getTypes() + ", binding types " + getQualifiers());
- return buffer.toString();
- }
-
- @Override
- public AbstractBean<?, ?> getSpecializedBean()
- {
- return null;
- }
-
- @Override
- public boolean isSpecializing()
- {
- return false;
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
-}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,293 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.CreationException;
+import javax.enterprise.inject.Disposes;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
+import org.jboss.webbeans.injection.ParameterInjectionPoint;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.introspector.WBParameter;
+import org.jboss.webbeans.util.Names;
+
+/**
+ * Represents a producer method bean
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public class ProducerMethod<T> extends AbstractProducerBean<T, Method>
+{
+ // The underlying method
+ private MethodInjectionPoint<T, ?> method;
+
+ private DisposalMethod<?> disposalMethodBean;
+
+ private ProducerMethod<?> specializedBean;
+
+ private final String id;
+
+ /**
+ * Creates a producer method Web Bean
+ *
+ * @param method The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer Web Bean
+ */
+ public static <T> ProducerMethod<T> of(WBMethod<T, ?> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ return new ProducerMethod<T>(method, declaringBean, manager);
+ }
+
+ protected ProducerMethod(WBMethod<T, ?> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ super(declaringBean, manager);
+ this.method = MethodInjectionPoint.of(this, method);
+ initType();
+ initTypes();
+ initBindings();
+ this.id = createId("ProducerMethod-" + declaringBean.getType().getName() + "-" + method.getSignature().toString());
+ initStereotypes();
+ initPolicy();
+ }
+
+ public T produce(CreationalContext<T> creationalContext)
+ {
+ Object receiver = getReceiver(creationalContext);
+ if (receiver != null)
+ {
+ return method.invokeOnInstance(receiver, manager, creationalContext, CreationException.class);
+ }
+ else
+ {
+ return method.invoke(receiver, manager, creationalContext, CreationException.class);
+ }
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ initProducerMethodInjectableParameters();
+ super.initialize(environment);
+ checkProducerMethod();
+ initDisposalMethod(environment);
+ }
+ }
+
+ /**
+ * Initializes the injection points
+ */
+ protected void initProducerMethodInjectableParameters()
+ {
+ for (WBParameter<?, ?> parameter : method.getWBParameters())
+ {
+ addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
+ }
+ }
+
+ /**
+ * Validates the producer method
+ */
+ protected void checkProducerMethod()
+ {
+ if (getAnnotatedItem().getAnnotatedWBParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("Producer method cannot have parameter annotated @Observes");
+ }
+ else if (getAnnotatedItem().getAnnotatedWBParameters(Disposes.class).size() > 0)
+ {
+ throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
+ }
+ else if (getDeclaringBean() instanceof SessionBean<?>)
+ {
+ boolean methodDeclaredOnTypes = false;
+ // TODO use annotated item?
+ for (Type type : getDeclaringBean().getTypes())
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ try
+ {
+ clazz.getDeclaredMethod(getAnnotatedItem().getName(), getAnnotatedItem().getParameterTypesAsArray());
+ methodDeclaredOnTypes = true;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // No - op
+ }
+ }
+ }
+ if (!methodDeclaredOnTypes)
+ {
+ throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
+ }
+ }
+ }
+
+ /**
+ * Initializes the remove method
+ */
+ protected void initDisposalMethod(BeanDeployerEnvironment environment)
+ {
+ Set<DisposalMethod<?>> disposalBeans = environment.resolveDisposalBeans(getTypes(), getQualifiers(), getDeclaringBean());
+
+ if (disposalBeans.size() == 1)
+ {
+ this.disposalMethodBean = disposalBeans.iterator().next();
+ }
+ else if (disposalBeans.size() > 1)
+ {
+ // TODO List out found disposal methods
+ throw new DefinitionException("Cannot declare multiple disposal methods for this producer method. Producer method: " + this + ". Disposal methods: " + disposalBeans);
+ }
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ try
+ {
+ dispose(instance);
+ }
+ finally
+ {
+ if (getDeclaringBean().isDependent())
+ {
+ creationalContext.release();
+ }
+ }
+ }
+
+ public void dispose(T instance)
+ {
+ if (disposalMethodBean != null)
+ {
+ disposalMethodBean.invokeDisposeMethod(instance);
+ }
+ }
+
+ /**
+ * Gets the annotated item representing the method
+ *
+ * @return The annotated item
+ */
+ @Override
+ public WBMethod<T, ?> getAnnotatedItem()
+ {
+ return method;
+ }
+
+ /**
+ * Returns the default name
+ *
+ * @return The default name
+ */
+ @Override
+ protected String getDefaultName()
+ {
+ return method.getPropertyName();
+ }
+
+ /**
+ * Returns the disposal method
+ *
+ * @return The method representation
+ */
+ public DisposalMethod<?> getDisposalMethod()
+ {
+ return disposalMethodBean;
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(Names.scopeTypeToString(getScope()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer method bean");
+ }
+ else
+ {
+ buffer.append("simple producer method bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getBeanClass().getName() + "] for class type [" + getType().getName() + "] API types " + getTypes() + ", binding types " + getQualifiers());
+ return buffer.toString();
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ return specializedBean;
+ }
+
+ @Override
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+ if (getDeclaringBean().getAnnotatedItem().getWBSuperclass().getDeclaredWBMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
+ {
+ throw new DefinitionException("Specialized producer method does not override a method on the direct superclass");
+ }
+ }
+
+ @Override
+ protected void specialize(BeanDeployerEnvironment environment)
+ {
+ WBMethod<?, ?> superClassMethod = getDeclaringBean().getAnnotatedItem().getWBSuperclass().getWBMethod(getAnnotatedItem().getAnnotatedMethod());
+ if (environment.getProducerMethod(superClassMethod) == null)
+ {
+ throw new IllegalStateException(toString() + " does not specialize a bean");
+ }
+ this.specializedBean = environment.getProducerMethod(superClassMethod);
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,293 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Set;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.CreationException;
-import javax.enterprise.inject.Disposes;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.injection.MethodInjectionPoint;
-import org.jboss.webbeans.injection.ParameterInjectionPoint;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.util.Names;
-
-/**
- * Represents a producer method bean
- *
- * @author Pete Muir
- *
- * @param <T>
- */
-public class ProducerMethodBean<T> extends AbstractProducerBean<T, Method>
-{
- // The underlying method
- private MethodInjectionPoint<T, ?> method;
-
- private DisposalMethodBean<?> disposalMethodBean;
-
- private ProducerMethodBean<?> specializedBean;
-
- private final String id;
-
- /**
- * Creates a producer method Web Bean
- *
- * @param method The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer Web Bean
- */
- public static <T> ProducerMethodBean<T> of(WBMethod<T, ?> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- return new ProducerMethodBean<T>(method, declaringBean, manager);
- }
-
- protected ProducerMethodBean(WBMethod<T, ?> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- super(declaringBean, manager);
- this.method = MethodInjectionPoint.of(this, method);
- initType();
- initTypes();
- initBindings();
- this.id = createId("ProducerMethod-" + declaringBean.getType().getName() + "-" + method.getSignature().toString());
- initStereotypes();
- initPolicy();
- }
-
- public T produce(CreationalContext<T> creationalContext)
- {
- Object receiver = getReceiver(creationalContext);
- if (receiver != null)
- {
- return method.invokeOnInstance(receiver, manager, creationalContext, CreationException.class);
- }
- else
- {
- return method.invoke(receiver, manager, creationalContext, CreationException.class);
- }
- }
-
- /**
- * Initializes the bean and its metadata
- */
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- if (!isInitialized())
- {
- initProducerMethodInjectableParameters();
- super.initialize(environment);
- checkProducerMethod();
- initDisposalMethod(environment);
- }
- }
-
- /**
- * Initializes the injection points
- */
- protected void initProducerMethodInjectableParameters()
- {
- for (WBParameter<?, ?> parameter : method.getWBParameters())
- {
- addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
- }
- }
-
- /**
- * Validates the producer method
- */
- protected void checkProducerMethod()
- {
- if (getAnnotatedItem().getAnnotatedWBParameters(Observes.class).size() > 0)
- {
- throw new DefinitionException("Producer method cannot have parameter annotated @Observes");
- }
- else if (getAnnotatedItem().getAnnotatedWBParameters(Disposes.class).size() > 0)
- {
- throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
- }
- else if (getDeclaringBean() instanceof EnterpriseBean<?>)
- {
- boolean methodDeclaredOnTypes = false;
- // TODO use annotated item?
- for (Type type : getDeclaringBean().getTypes())
- {
- if (type instanceof Class)
- {
- Class<?> clazz = (Class<?>) type;
- try
- {
- clazz.getDeclaredMethod(getAnnotatedItem().getName(), getAnnotatedItem().getParameterTypesAsArray());
- methodDeclaredOnTypes = true;
- }
- catch (NoSuchMethodException nsme)
- {
- // No - op
- }
- }
- }
- if (!methodDeclaredOnTypes)
- {
- throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
- }
- }
- }
-
- /**
- * Initializes the remove method
- */
- protected void initDisposalMethod(BeanDeployerEnvironment environment)
- {
- Set<DisposalMethodBean<?>> disposalBeans = environment.resolveDisposalBeans(getTypes(), getQualifiers(), getDeclaringBean());
-
- if (disposalBeans.size() == 1)
- {
- this.disposalMethodBean = disposalBeans.iterator().next();
- }
- else if (disposalBeans.size() > 1)
- {
- // TODO List out found disposal methods
- throw new DefinitionException("Cannot declare multiple disposal methods for this producer method. Producer method: " + this + ". Disposal methods: " + disposalBeans);
- }
- }
-
- public void destroy(T instance, CreationalContext<T> creationalContext)
- {
- try
- {
- dispose(instance);
- }
- finally
- {
- if (getDeclaringBean().isDependent())
- {
- creationalContext.release();
- }
- }
- }
-
- public void dispose(T instance)
- {
- if (disposalMethodBean != null)
- {
- disposalMethodBean.invokeDisposeMethod(instance);
- }
- }
-
- /**
- * Gets the annotated item representing the method
- *
- * @return The annotated item
- */
- @Override
- public WBMethod<T, ?> getAnnotatedItem()
- {
- return method;
- }
-
- /**
- * Returns the default name
- *
- * @return The default name
- */
- @Override
- protected String getDefaultName()
- {
- return method.getPropertyName();
- }
-
- /**
- * Returns the disposal method
- *
- * @return The method representation
- */
- public DisposalMethodBean<?> getDisposalMethod()
- {
- return disposalMethodBean;
- }
-
- /**
- * Gets a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append(Names.scopeTypeToString(getScope()));
- if (getName() == null)
- {
- buffer.append("unnamed producer method bean");
- }
- else
- {
- buffer.append("simple producer method bean '" + getName() + "'");
- }
- buffer.append(" [" + getBeanClass().getName() + "] for class type [" + getType().getName() + "] API types " + getTypes() + ", binding types " + getQualifiers());
- return buffer.toString();
- }
-
- @Override
- public AbstractBean<?, ?> getSpecializedBean()
- {
- return specializedBean;
- }
-
- @Override
- protected void preSpecialize(BeanDeployerEnvironment environment)
- {
- if (getDeclaringBean().getAnnotatedItem().getWBSuperclass().getDeclaredWBMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
- {
- throw new DefinitionException("Specialized producer method does not override a method on the direct superclass");
- }
- }
-
- @Override
- protected void specialize(BeanDeployerEnvironment environment)
- {
- WBMethod<?, ?> superClassMethod = getDeclaringBean().getAnnotatedItem().getWBSuperclass().getWBMethod(getAnnotatedItem().getAnnotatedMethod());
- if (environment.getProducerMethod(superClassMethod) == null)
- {
- throw new IllegalStateException(toString() + " does not specialize a bean");
- }
- this.specializedBean = environment.getProducerMethod(superClassMethod);
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
-}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,402 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+
+import javax.decorator.Decorator;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.CreationException;
+import javax.interceptor.Interceptor;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.bean.proxy.EnterpriseBeanInstance;
+import org.jboss.webbeans.bean.proxy.EnterpriseBeanProxyMethodHandler;
+import org.jboss.webbeans.bean.proxy.Marker;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.ejb.InternalEjbDescriptor;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
+import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.injection.InjectionContextImpl;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.Proxies;
+
+/**
+ * An enterprise bean representation
+ *
+ * @author Pete Muir
+ *
+ * @param <T> The type (class) of the bean
+ */
+public class SessionBean<T> extends AbstractClassBean<T>
+{
+ private final Log log = Logging.getLog(SessionBean.class);
+
+ // The EJB descriptor
+ private InternalEjbDescriptor<T> ejbDescriptor;
+
+ private Class<T> proxyClass;
+
+ private SessionBean<?> specializedBean;
+
+ /**
+ * Creates a simple, annotation defined Enterprise Web Bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return An Enterprise Web Bean
+ */
+ public static <T> SessionBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
+ {
+ WBClass<T> type = manager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
+ return new SessionBean<T>(type, ejbDescriptor, manager);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param type The type of the bean
+ * @param manager The Web Beans manager
+ */
+ protected SessionBean(WBClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
+ {
+ super(type, manager);
+ initType();
+ this.ejbDescriptor = ejbDescriptor;
+ initTypes();
+ initBindings();
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ initProxyClass();
+ checkEJBTypeAllowed();
+ checkConflictingRoles();
+ checkObserverMethods();
+ checkScopeAllowed();
+ }
+ }
+
+ @Override
+ protected void initTypes()
+ {
+ Set<Type> types = new HashSet<Type>();
+ types = new LinkedHashSet<Type>();
+ types.add(Object.class);
+ for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
+ {
+ types.add(businessInterfaceDescriptor.getInterface());
+ }
+ super.types = types;
+ }
+
+ protected void initProxyClass()
+ {
+ Set<Type> types = new LinkedHashSet<Type>(getTypes());
+ types.add(EnterpriseBeanInstance.class);
+ types.add(Serializable.class);
+ ProxyFactory proxyFactory = Proxies.getProxyFactory(types);
+
+ @SuppressWarnings("unchecked")
+ Class<T> proxyClass = proxyFactory.createClass();
+
+ this.proxyClass = proxyClass;
+ }
+
+ /**
+ * Validates for non-conflicting roles
+ */
+ protected void checkConflictingRoles()
+ {
+ if (getType().isAnnotationPresent(Interceptor.class))
+ {
+ throw new DefinitionException("Enterprise beans cannot be interceptors");
+ }
+ if (getType().isAnnotationPresent(Decorator.class))
+ {
+ throw new DefinitionException("Enterprise beans cannot be decorators");
+ }
+ }
+
+ /**
+ * Check that the scope type is allowed by the stereotypes on the bean and
+ * the bean type
+ */
+ protected void checkScopeAllowed()
+ {
+ if (ejbDescriptor.isStateless() && !isDependent())
+ {
+ throw new DefinitionException("Scope " + getScope() + " is not allowed on stateless enterpise beans for " + getType() + ". Only @Dependent is allowed on stateless enterprise beans");
+ }
+ if (ejbDescriptor.isSingleton() && !(isDependent() || getScope().equals(ApplicationScoped.class)))
+ {
+ throw new DefinitionException("Scope " + getScope() + " is not allowed on singleton enterpise beans for " + getType() + ". Only @Dependent or @ApplicationScoped is allowed on singleton enterprise beans");
+ }
+ }
+
+ /**
+ * Validates specialization
+ */
+ @Override
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+ super.preSpecialize(environment);
+ // We appear to check this twice?
+ if (!environment.getEjbDescriptors().contains(getAnnotatedItem().getWBSuperclass().getJavaClass()))
+ {
+ throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
+ }
+ }
+
+ @Override
+ protected void specialize(BeanDeployerEnvironment environment)
+ {
+ if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
+ {
+ throw new IllegalStateException(toString() + " does not specialize a bean");
+ }
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
+ if (!(specializedBean instanceof SessionBean<?>))
+ {
+ throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + specializedBean);
+ }
+ else
+ {
+ this.specializedBean = (SessionBean<?>) specializedBean;
+ }
+ }
+
+ /**
+ * Creates an instance of the bean
+ *
+ * @return The instance
+ */
+ public T create(final CreationalContext<T> creationalContext)
+ {
+ T instance = produce(creationalContext);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, null);
+ }
+ return instance;
+ }
+
+ public void inject(final T instance, final CreationalContext<T> ctx)
+ {
+ new InjectionContextImpl<T>(getManager(), this, instance)
+ {
+
+ public void proceed()
+ {
+ Beans.injectBoundFields(instance, ctx, getManager(), getInjectableFields());
+ Beans.callInitializers(instance, ctx, getManager(), getInitializerMethods());
+ }
+
+ }.run();
+
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ try
+ {
+ T instance = proxyClass.newInstance();
+ ctx.push(instance);
+ ((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler<T>(this, ctx));
+ log.trace("Enterprise bean instance created for bean {0}", this);
+ return instance;
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException("Could not instantiate enterprise proxy for " + toString(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Could not access bean correctly when creating enterprise proxy for " + toString(), e);
+ }
+ catch (Exception e)
+ {
+ throw new CreationException("could not find the EJB in JNDI " + proxyClass, e);
+ }
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ if (instance == null)
+ {
+ throw new IllegalArgumentException("instance to destroy cannot be null");
+ }
+ if (!(instance instanceof EnterpriseBeanInstance))
+ {
+ throw new IllegalArgumentException("Cannot destroy session bean instance not created by the container");
+ }
+ EnterpriseBeanInstance enterpiseBeanInstance = (EnterpriseBeanInstance) instance;
+ enterpiseBeanInstance.destroy(Marker.INSTANCE, this, creationalContext);
+ creationalContext.release();
+ }
+
+ /**
+ * Validates the bean type
+ */
+ private void checkEJBTypeAllowed()
+ {
+ if (ejbDescriptor.isMessageDriven())
+ {
+ throw new DefinitionException("Message Driven Beans can't be Web Beans");
+ }
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ // buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()) +
+ // Names.ejbTypeFromMetaData(getEjbMetaData()));
+ if (getName() == null)
+ {
+ buffer.append(" unnamed enterprise bean");
+ }
+ else
+ {
+ buffer.append(" enterprise bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getType().getName() + "] ");
+ buffer.append("API types " + getTypes() + ", binding types " + getQualifiers());
+ return buffer.toString();
+ }
+
+ public void postConstruct(T instance, CreationalContext<T> creationalContext)
+ {
+ Beans.injectBoundFields(instance, creationalContext, getManager(), getInjectableFields());
+ Beans.callInitializers(instance, creationalContext, getManager(), getInitializerMethods());
+ }
+
+ public void preDestroy(CreationalContext<T> creationalContext)
+ {
+ creationalContext.release();
+ }
+
+ @Override
+ protected void initSerializable()
+ {
+ // No-op
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
+ public InternalEjbDescriptor<T> getEjbDescriptor()
+ {
+ return ejbDescriptor;
+ }
+
+ public boolean isClientCanCallRemoveMethods()
+ {
+ return getEjbDescriptor().isStateful() && isDependent();
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ return specializedBean;
+ }
+
+ /**
+ * If there are any observer methods, they must be static or business
+ * methods.
+ */
+ protected void checkObserverMethods()
+ {
+ for (WBMethod<?, ?> method : this.annotatedItem.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ {
+ if (!method.isStatic())
+ {
+ if (!isMethodExistsOnTypes(method))
+ {
+ throw new DefinitionException("Observer method must be static or business method: " + method + " on " + getAnnotatedItem());
+ }
+ }
+ }
+ }
+
+ // TODO must be a nicer way to do this!
+ public boolean isMethodExistsOnTypes(WBMethod<?, ?> method)
+ {
+ for (Type type : getTypes())
+ {
+ if (type instanceof Class)
+ {
+ for (Method m : ((Class<?>) type).getMethods())
+ {
+ if (method.getName().equals(m.getName()) && Arrays.equals(method.getParameterTypesAsArray(), m.getParameterTypes()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public SessionObjectReference createReference()
+ {
+ return manager.getServices().get(EjbServices.class).resolveEjb(getEjbDescriptor().delegate());
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+}
+
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,359 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean;
-
-import java.util.Set;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.spi.Decorator;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.injection.ConstructorInjectionPoint;
-import org.jboss.webbeans.injection.InjectionContextImpl;
-import org.jboss.webbeans.injection.WBInjectionPoint;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBConstructor;
-import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * Represents a simple bean
- *
- * @author Pete Muir
- *
- * @param <T> The type (class) of the bean
- */
-public class SimpleBean<T> extends AbstractClassBean<T>
-{
- // Logger
- private static LogProvider log = Logging.getLogProvider(SimpleBean.class);
-
- // The constructor
- private ConstructorInjectionPoint<T> constructor;
- private Set<WBInjectionPoint<?, ?>> ejbInjectionPoints;
- private Set<WBInjectionPoint<?, ?>> persistenceContextInjectionPoints;
- private Set<WBInjectionPoint<?, ?>> persistenceUnitInjectionPoints;
- private Set<WBInjectionPoint<?, ?>> resourceInjectionPoints;
-
- private SimpleBean<?> specializedBean;
-
-
-
- /**
- * Creates a simple, annotation defined Web Bean
- *
- * @param <T> The type
- * @param clazz The class
- * @param manager the current manager
- * @return A Web Bean
- */
- public static <T> SimpleBean<T> of(WBClass<T> clazz, BeanManagerImpl manager)
- {
- return new SimpleBean<T>(clazz, manager);
- }
-
- /**
- * Constructor
- *
- * @param type The type of the bean
- * @param manager The Web Beans manager
- */
- protected SimpleBean(WBClass<T> type, BeanManagerImpl manager)
- {
- super(type, manager);
- initType();
- initTypes();
- initBindings();
- }
-
- /**
- * Creates an instance of the bean
- *
- * @return The instance
- */
- public T create(CreationalContext<T> creationalContext)
- {
- InjectionPoint originalInjectionPoint = null;
- if (hasDecorators())
- {
- originalInjectionPoint = attachCorrectInjectionPoint();
- }
- T instance = produce(creationalContext);
- inject(instance, creationalContext);
- postConstruct(instance);
- if (hasDecorators())
- {
- instance = applyDecorators(instance, creationalContext, originalInjectionPoint);
- }
- return instance;
- }
-
- public T produce(CreationalContext<T> ctx)
- {
- T instance = constructor.newInstance(manager, ctx);
- if (!hasDecorators())
- {
- // This should be safe, but needs verification PLM
- // Without this, the chaining of decorators will fail as the incomplete instance will be resolved
- ctx.push(instance);
- }
- return instance;
- }
-
- public void inject(final T instance, final CreationalContext<T> ctx)
- {
- new InjectionContextImpl<T>(getManager(), this, instance)
- {
-
- public void proceed()
- {
- Beans.injectEEFields(instance, getManager(), ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
- Beans.injectBoundFields(instance, ctx, getManager(), getInjectableFields());
- Beans.callInitializers(instance, ctx, getManager(), getInitializerMethods());
- }
-
- }.run();
-
- }
-
- protected InjectionPoint attachCorrectInjectionPoint()
- {
- Decorator<?> decorator = getDecorators().get(getDecorators().size() - 1);
- if (decorator instanceof DecoratorBean<?>)
- {
- DecoratorBean<?> decoratorBean = (DecoratorBean<?>) decorator;
- InjectionPoint outerDelegateInjectionPoint = decoratorBean.getDelegateInjectionPoint();
- return getManager().replaceOrPushCurrentInjectionPoint(outerDelegateInjectionPoint);
- }
- else
- {
- throw new IllegalStateException("Cannot operate on user defined decorator");
- }
- }
-
- /**
- * Destroys an instance of the bean
- *
- * @param instance The instance
- */
- public void destroy(T instance, CreationalContext<T> creationalContext)
- {
- try
- {
- preDestroy(instance);
- creationalContext.release();
- }
- catch (Exception e)
- {
- log.error("Error destroying " + toString(), e);
- }
- }
-
- /**
- * Initializes the bean and its metadata
- */
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- if (!isInitialized())
- {
- initConstructor();
- checkConstructor();
- super.initialize(environment);
- initPostConstruct();
- initPreDestroy();
- initEEInjectionPoints();
- }
- }
-
- private void initEEInjectionPoints()
- {
- this.ejbInjectionPoints = Beans.getEjbInjectionPoints(this, getAnnotatedItem(), getManager());
- this.persistenceContextInjectionPoints = Beans.getPersistenceContextInjectionPoints(this, getAnnotatedItem(), getManager());
- this.persistenceUnitInjectionPoints = Beans.getPersistenceUnitInjectionPoints(this, getAnnotatedItem(), getManager());
- this.resourceInjectionPoints = Beans.getResourceInjectionPoints(this, getAnnotatedItem(), manager);
- }
-
- /**
- * Validates the type
- */
- protected void checkType()
- {
- if (getAnnotatedItem().isNonStaticMemberClass())
- {
- throw new DefinitionException("Simple bean " + type + " cannot be a non-static inner class");
- }
- if (!isDependent() && getAnnotatedItem().isParameterizedType())
- {
- throw new DefinitionException("Managed bean " + type + " must be @Dependent");
- }
- boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isPassivating();
- if (passivating && !Reflections.isSerializable(getBeanClass()))
- {
- throw new DefinitionException("Simple bean declaring a passivating scope must have a serializable implementation class " + toString());
- }
- if (hasDecorators())
- {
- if (getAnnotatedItem().isFinal())
- {
- throw new DefinitionException("Bean class which has decorators cannot be declared final " + this);
- }
- for (Decorator<?> decorator : getDecorators())
- {
- if (decorator instanceof DecoratorBean<?>)
- {
- DecoratorBean<?> decoratorBean = (DecoratorBean<?>) decorator;
- for (WBMethod<?, ?> decoratorMethod : decoratorBean.getAnnotatedItem().getWBMethods())
- {
- WBMethod<?, ?> method = getAnnotatedItem().getWBMethod(decoratorMethod.getSignature());
- if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal())
- {
- throw new DefinitionException("Decorated bean method " + method + " (decorated by "+ decoratorMethod + ") cannot be declarted final");
- }
- }
- }
- else
- {
- throw new IllegalStateException("Can only operate on container provided decorators " + decorator);
- }
- }
- }
- }
-
- @Override
- protected void checkBeanImplementation()
- {
- super.checkBeanImplementation();
- if (!isDependent())
- {
- for (WBField<?, ?> field : getAnnotatedItem().getWBFields())
- {
- if (field.isPublic() && !field.isStatic())
- {
- throw new DefinitionException("Normal scoped Web Bean implementation class has a public field " + getAnnotatedItem());
- }
- }
- }
- }
-
- protected void checkConstructor()
- {
- if (!constructor.getAnnotatedWBParameters(Disposes.class).isEmpty())
- {
- throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Disposes " + constructor);
- }
- if (!constructor.getAnnotatedWBParameters(Observes.class).isEmpty())
- {
- throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Observes " + constructor);
- }
- }
-
- @Override
- protected void preSpecialize(BeanDeployerEnvironment environment)
- {
- super.preSpecialize(environment);
- if (environment.getEjbDescriptors().contains(getAnnotatedItem().getWBSuperclass().getJavaClass()))
- {
- throw new DefinitionException("Simple bean must specialize a simple bean");
- }
- }
-
- @Override
- protected void specialize(BeanDeployerEnvironment environment)
- {
- if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
- {
- throw new DefinitionException(toString() + " does not specialize a bean");
- }
- AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
- if (!(specializedBean instanceof SimpleBean))
- {
- throw new DefinitionException(toString() + " doesn't have a simple bean as a superclass " + specializedBean);
- }
- else
- {
- this.specializedBean = (SimpleBean<?>) specializedBean;
- }
- }
-
-
- /**
- * Initializes the constructor
- */
- protected void initConstructor()
- {
- this.constructor = Beans.getBeanConstructor(this, getAnnotatedItem());
- // TODO We loop unecessarily many times here, I want to probably introduce some callback mechanism. PLM.
- addInjectionPoints(Beans.getParameterInjectionPoints(this, constructor));
- }
-
- /**
- * Returns the constructor
- *
- * @return The constructor
- */
- public WBConstructor<T> getConstructor()
- {
- return constructor;
- }
-
- /**
- * Gets a string representation
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return toString("simple bean");
- }
-
- protected String toString(String beanType)
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append(Names.scopeTypeToString(getScope()));
- if (getName() == null)
- {
- buffer.append("unnamed ").append(beanType);
- }
- else
- {
- buffer.append(beanType).append(" '" + getName() + "'");
- }
- buffer.append(" ").append(getType().getName()).append(", ");
- buffer.append(" API types = ").append(Names.typesToString(getTypes())).append(", binding types = " + Names.annotationsToString(getQualifiers()));
- return buffer.toString();
- }
-
- @Override
- public SimpleBean<?> getSpecializedBean()
- {
- return specializedBean;
- }
-
-}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/builder/BeanBuilderImpl.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/builder/BeanBuilderImpl.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/builder/BeanBuilderImpl.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -38,15 +38,15 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.DecoratorBean;
-import org.jboss.webbeans.bean.DisposalMethodBean;
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.NewEnterpriseBean;
-import org.jboss.webbeans.bean.NewSimpleBean;
-import org.jboss.webbeans.bean.ProducerFieldBean;
-import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.DecoratorImpl;
+import org.jboss.webbeans.bean.DisposalMethod;
+import org.jboss.webbeans.bean.ManagedBean;
+import org.jboss.webbeans.bean.NewManagedBean;
+import org.jboss.webbeans.bean.NewSessionBean;
+import org.jboss.webbeans.bean.ProducerField;
+import org.jboss.webbeans.bean.ProducerMethod;
import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.bean.builder.spi.DecoratorBeanBuilder;
import org.jboss.webbeans.bean.builder.spi.EnterpriseBeanBuilder;
import org.jboss.webbeans.bean.builder.spi.SimpleBeanBuilder;
@@ -104,7 +104,7 @@
private <T> Set<Bean<?>> createSimpleBeans(WBClass<T> clazz)
{
Set<Bean<?>> beans = new HashSet<Bean<?>>();
- SimpleBean<T> bean = SimpleBean.of(clazz, beanManager);
+ ManagedBean<T> bean = ManagedBean.of(clazz, beanManager);
beanDeployerEnvironment.addBean(bean);
beans.add(bean);
@@ -114,7 +114,7 @@
createSubBeans(beans, bean);
- NewSimpleBean<T> newBean = NewSimpleBean.of(clazz, beanManager);
+ NewManagedBean<T> newBean = NewManagedBean.of(clazz, beanManager);
beanDeployerEnvironment.addBean(newBean);
beans.add(newBean);
if (!delayInitialization)
@@ -126,7 +126,7 @@
private <T> Set<Bean<?>> createEnterpriseBeans(InternalEjbDescriptor<T> ejbDescriptor)
{
Set<Bean<?>> beans = new HashSet<Bean<?>>();
- EnterpriseBean<T> bean = EnterpriseBean.of(ejbDescriptor, beanManager);
+ SessionBean<T> bean = SessionBean.of(ejbDescriptor, beanManager);
beanDeployerEnvironment.addBean(bean);
beans.add(bean);
if (!delayInitialization)
@@ -134,7 +134,7 @@
createSubBeans(beans, bean);
- NewEnterpriseBean<T> newBean = NewEnterpriseBean.of(ejbDescriptor, beanManager);
+ NewSessionBean<T> newBean = NewSessionBean.of(ejbDescriptor, beanManager);
beanDeployerEnvironment.addBean(newBean);
beans.add(newBean);
if (!delayInitialization)
@@ -145,7 +145,7 @@
private <T> Set<Bean<?>> createDecorator(WBClass<T> annotatedClass)
{
- DecoratorBean<?> bean = DecoratorBean.of(annotatedClass, beanManager);
+ DecoratorImpl<?> bean = DecoratorImpl.of(annotatedClass, beanManager);
beanDeployerEnvironment.addBean(bean);
if (!delayInitialization)
bean.initialize(beanDeployerEnvironment);
@@ -185,7 +185,7 @@
{
for (WBMethod<?, ?> method : annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Disposes.class))
{
- DisposalMethodBean<?> disposalBean = DisposalMethodBean.of(beanManager, method, declaringBean);
+ DisposalMethod<?> disposalBean = DisposalMethod.of(beanManager, method, declaringBean);
beanDeployerEnvironment.addBean(disposalBean);
//Do not delay initialization of decorator beans, they get initialized right away in the original impl
disposalBean.initialize(beanDeployerEnvironment);
@@ -195,7 +195,7 @@
protected <T> void createProducerMethod(Set<Bean<?>> beans, AbstractClassBean<?> declaringBean, WBMethod<T, ?> annotatedMethod)
{
- ProducerMethodBean<T> bean = ProducerMethodBean.of(annotatedMethod, declaringBean, beanManager);
+ ProducerMethod<T> bean = ProducerMethod.of(annotatedMethod, declaringBean, beanManager);
beanDeployerEnvironment.addBean(bean);
beans.add(bean);
if (!delayInitialization)
@@ -212,7 +212,7 @@
protected <T> void createProducerField(Set<Bean<?>> beans, AbstractClassBean<?> declaringBean, WBField<T, ?> field)
{
- ProducerFieldBean<T> bean = ProducerFieldBean.of(field, declaringBean, beanManager);
+ ProducerField<T> bean = ProducerField.of(field, declaringBean, beanManager);
beanDeployerEnvironment.addBean(bean);
beans.add(bean);
if (!delayInitialization)
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee)
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java 2009-09-14 17:57:21 UTC (rev 3663)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.ProducerField;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.ejb.EJBApiAbstraction;
-import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
-import org.jboss.webbeans.ws.WSApiAbstraction;
-
-/**
- * @author pmuir
- *
- */
-public class EEResourceProducerField<T> extends ProducerField<T>
-{
-
- /**
- * Creates an EE resource producer field
- *
- * @param field The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer field
- */
- public static <T> EEResourceProducerField<T> of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- return new EEResourceProducerField<T>(field, declaringBean, manager);
- }
-
- protected EEResourceProducerField(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- super(field, declaringBean, manager);
- }
-
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- if (!isInitialized())
- {
- super.initialize(environment);
- checkEEResource();
- }
- }
-
- protected void checkEEResource()
- {
- EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
- PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
- WSApiAbstraction wsApiAbstraction = manager.getServices().get(WSApiAbstraction.class);
- if (!(getAnnotatedItem().isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS)) || getAnnotatedItem().isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS))
- {
- throw new IllegalStateException("Tried to create an EEResourceProducerField, but no @Resource, @PersistenceContext, @PersistenceUnit, @WebServiceRef or @EJB is present " + getAnnotatedItem());
- }
- }
-
-}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean.ee;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.ProducerField;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
+import org.jboss.webbeans.ejb.EJBApiAbstraction;
+import org.jboss.webbeans.introspector.WBField;
+import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
+import org.jboss.webbeans.ws.WSApiAbstraction;
+
+/**
+ * @author pmuir
+ *
+ */
+public class EEResourceProducerField<T> extends ProducerField<T>
+{
+
+ /**
+ * Creates an EE resource producer field
+ *
+ * @param field The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer field
+ */
+ public static <T> EEResourceProducerField<T> of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ return new EEResourceProducerField<T>(field, declaringBean, manager);
+ }
+
+ protected EEResourceProducerField(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ super(field, declaringBean, manager);
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ checkEEResource();
+ }
+ }
+
+ protected void checkEEResource()
+ {
+ EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
+ PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
+ WSApiAbstraction wsApiAbstraction = manager.getServices().get(WSApiAbstraction.class);
+ if (!(getAnnotatedItem().isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS)) || getAnnotatedItem().isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS))
+ {
+ throw new IllegalStateException("Tried to create an EEResourceProducerField, but no @Resource, @PersistenceContext, @PersistenceUnit, @WebServiceRef or @EJB is present " + getAnnotatedItem());
+ }
+ }
+
+}
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java 2009-09-14 17:57:21 UTC (rev 3663)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import javax.persistence.EntityManager;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.introspector.WBField;
-
-/**
- * @author pmuir
- *
- */
-public class PersistenceContextProducerField<T extends EntityManager> extends EEResourceProducerField<T>
-{
-
- /**
- * Creates an EE resource producer field
- *
- * @param field The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer field
- */
- public static <T extends EntityManager> EEResourceProducerField<T> of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- return new PersistenceContextProducerField<T>(field, declaringBean, manager);
- }
-
- /**
- * @param field
- * @param declaringBean
- * @param manager
- */
- protected PersistenceContextProducerField(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
- {
- super(field, declaringBean, manager);
- }
-
- public void dispose(T instance)
- {
- instance.close();
- }
-
-}
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean.ee;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.introspector.WBField;
+
+/**
+ * @author pmuir
+ *
+ */
+public class PersistenceContextProducerField<T extends EntityManager> extends EEResourceProducerField<T>
+{
+
+ /**
+ * Creates an EE resource producer field
+ *
+ * @param field The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer field
+ */
+ public static <T extends EntityManager> EEResourceProducerField<T> of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ return new PersistenceContextProducerField<T>(field, declaringBean, manager);
+ }
+
+ /**
+ * @param field
+ * @param declaringBean
+ * @param manager
+ */
+ protected PersistenceContextProducerField(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ {
+ super(field, declaringBean, manager);
+ }
+
+ public void dispose(T instance)
+ {
+ instance.close();
+ }
+
+}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -24,7 +24,7 @@
import javassist.util.proxy.MethodHandler;
-import org.jboss.webbeans.bean.DecoratorBean;
+import org.jboss.webbeans.bean.DecoratorImpl;
import org.jboss.webbeans.bean.SerializableBeanInstance;
import org.jboss.webbeans.introspector.MethodSignature;
import org.jboss.webbeans.introspector.WBMethod;
@@ -40,7 +40,7 @@
{
private static final long serialVersionUID = 4577632640130385060L;
- private final List<SerializableBeanInstance<DecoratorBean<Object>, Object>> decoratorInstances;
+ private final List<SerializableBeanInstance<DecoratorImpl<Object>, Object>> decoratorInstances;
private final Object instance;
@@ -51,7 +51,7 @@
*
* @param proxy The generic proxy
*/
- public DecoratorProxyMethodHandler(List<SerializableBeanInstance<DecoratorBean<Object>, Object>> decoratorInstances, Object instance)
+ public DecoratorProxyMethodHandler(List<SerializableBeanInstance<DecoratorImpl<Object>, Object>> decoratorInstances, Object instance)
{
this.decoratorInstances = decoratorInstances;
this.instance = instance;
@@ -77,7 +77,7 @@
public Object invoke(Object self, Method method, Method proceed, Object[] args) throws Throwable
{
MethodSignature methodSignature = new MethodSignatureImpl(method);
- for (SerializableBeanInstance<DecoratorBean<Object>, Object> beanInstance : decoratorInstances)
+ for (SerializableBeanInstance<DecoratorImpl<Object>, Object> beanInstance : decoratorInstances)
{
WBMethod<?, ?> decoratorMethod = beanInstance.getBean().getAnnotatedItem().getWBMethod(methodSignature);
if (decoratorMethod != null)
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanInstance.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanInstance.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanInstance.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -18,7 +18,7 @@
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.SessionBean;
/**
* Interface implemented by all enterprise bean proxies to query/control the proxy
@@ -29,6 +29,6 @@
public interface EnterpriseBeanInstance
{
- public void destroy(Marker marker, EnterpriseBean<?> enterpriseBean, CreationalContext<?> creationalContext);
+ public void destroy(Marker marker, SessionBean<?> enterpriseBean, CreationalContext<?> creationalContext);
}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -24,7 +24,7 @@
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.ejb.api.SessionObjectReference;
import org.jboss.webbeans.introspector.MethodSignature;
import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
@@ -59,7 +59,7 @@
*
* @param proxy The generic proxy
*/
- public EnterpriseBeanProxyMethodHandler(EnterpriseBean<T> bean, CreationalContext<T> creationalContext)
+ public EnterpriseBeanProxyMethodHandler(SessionBean<T> bean, CreationalContext<T> creationalContext)
{
this.objectInterface = bean.getEjbDescriptor().getObjectInterface();
this.removeMethodSignatures = bean.getEjbDescriptor().getRemoveMethodSignatures();
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -16,14 +16,12 @@
*/
package org.jboss.webbeans.bootstrap;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.DecoratorBean;
+import org.jboss.webbeans.bean.DecoratorImpl;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.builder.InternalBeanBuilderFactory;
import org.jboss.webbeans.bean.builder.spi.DecoratorBeanBuilder;
@@ -33,11 +31,14 @@
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.event.ObserverMethodImpl;
import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.introspector.WBField;
import org.jboss.webbeans.jsf.JsfApiAbstraction;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
import org.jboss.webbeans.servlet.ServletApiAbstraction;
import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.ws.WSApiAbstraction;
public class AbstractBeanDeployer
{
@@ -72,7 +73,7 @@
Set<RIBean<?>> beans = getEnvironment().getBeans();
// ensure that all decorators are initialized before initializing
// the rest of the beans
- for (DecoratorBean<?> bean : getEnvironment().getDecorators())
+ for (DecoratorImpl<?> bean : getEnvironment().getDecorators())
{
bean.initialize(getEnvironment());
manager.addDecorator(bean);
@@ -141,6 +142,20 @@
hasSimpleWebBeanConstructor(clazz);
}
+ protected boolean isEEResourceProducerField(WBField<?, ?> field)
+ {
+ EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
+ PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
+ WSApiAbstraction wsApiAbstraction = manager.getServices().get(WSApiAbstraction.class);
+ return field.isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) || field.isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || field.isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS);
+ }
+
+ protected boolean isPersistenceContextProducerField(WBField<?, ?> field)
+ {
+ PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
+ return field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS);
+ }
+
private static boolean hasSimpleWebBeanConstructor(WBClass<?> type)
{
return type.getNoArgsWBConstructor() != null || type.getAnnotatedWBConstructors(Inject.class).size() > 0;
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -28,11 +28,11 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.DecoratorBean;
-import org.jboss.webbeans.bean.DisposalMethodBean;
+import org.jboss.webbeans.bean.DecoratorImpl;
+import org.jboss.webbeans.bean.DisposalMethod;
import org.jboss.webbeans.bean.NewBean;
-import org.jboss.webbeans.bean.ProducerFieldBean;
-import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.ProducerField;
+import org.jboss.webbeans.bean.ProducerMethod;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.builtin.AbstractBuiltInBean;
import org.jboss.webbeans.bean.builtin.ExtensionBean;
@@ -47,29 +47,29 @@
{
private final Map<WBClass<?>, AbstractClassBean<?>> classBeanMap;
- private final Map<WBMethod<?, ?>, ProducerMethodBean<?>> producerMethodBeanMap;
+ private final Map<WBMethod<?, ?>, ProducerMethod<?>> producerMethodBeanMap;
private final Set<RIBean<?>> beans;
private final Set<ObserverMethodImpl<?, ?>> observers;
- private final List<DisposalMethodBean<?>> allDisposalBeans;
- private final Set<DisposalMethodBean<?>> resolvedDisposalBeans;
- private final Set<DecoratorBean<?>> decorators;
+ private final List<DisposalMethod<?>> allDisposalBeans;
+ private final Set<DisposalMethod<?>> resolvedDisposalBeans;
+ private final Set<DecoratorImpl<?>> decorators;
private final EjbDescriptors ejbDescriptors;
private final TypeSafeDisposerResolver disposalMethodResolver;
public BeanDeployerEnvironment(EjbDescriptors ejbDescriptors, BeanManagerImpl manager)
{
this.classBeanMap = new HashMap<WBClass<?>, AbstractClassBean<?>>();
- this.producerMethodBeanMap = new HashMap<WBMethod<?, ?>, ProducerMethodBean<?>>();
- this.allDisposalBeans = new ArrayList<DisposalMethodBean<?>>();
- this.resolvedDisposalBeans = new HashSet<DisposalMethodBean<?>>();
+ this.producerMethodBeanMap = new HashMap<WBMethod<?, ?>, ProducerMethod<?>>();
+ this.allDisposalBeans = new ArrayList<DisposalMethod<?>>();
+ this.resolvedDisposalBeans = new HashSet<DisposalMethod<?>>();
this.beans = new HashSet<RIBean<?>>();
- this.decorators = new HashSet<DecoratorBean<?>>();
+ this.decorators = new HashSet<DecoratorImpl<?>>();
this.observers = new HashSet<ObserverMethodImpl<?, ?>>();
this.ejbDescriptors = ejbDescriptors;
this.disposalMethodResolver = new TypeSafeDisposerResolver(manager, allDisposalBeans);
}
- public ProducerMethodBean<?> getProducerMethod(WBMethod<?, ?> method)
+ public ProducerMethod<?> getProducerMethod(WBMethod<?, ?> method)
{
if (!producerMethodBeanMap.containsKey(method))
{
@@ -77,7 +77,7 @@
}
else
{
- ProducerMethodBean<?> bean = producerMethodBeanMap.get(method);
+ ProducerMethod<?> bean = producerMethodBeanMap.get(method);
bean.initialize(this);
return bean;
}
@@ -97,13 +97,13 @@
}
}
- public void addBean(ProducerMethodBean<?> bean)
+ public void addBean(ProducerMethod<?> bean)
{
producerMethodBeanMap.put(bean.getAnnotatedItem(), bean);
beans.add(bean);
}
- public void addBean(ProducerFieldBean<?> bean)
+ public void addBean(ProducerField<?> bean)
{
beans.add(bean);
}
@@ -127,12 +127,12 @@
beans.add(bean);
}
- public void addBean(DecoratorBean<?> bean)
+ public void addBean(DecoratorImpl<?> bean)
{
decorators.add(bean);
}
- public void addBean(DisposalMethodBean<?> bean)
+ public void addBean(DisposalMethod<?> bean)
{
allDisposalBeans.add(bean);
}
@@ -147,7 +147,7 @@
return Collections.unmodifiableSet(beans);
}
- public Set<DecoratorBean<?>> getDecorators()
+ public Set<DecoratorImpl<?>> getDecorators()
{
return Collections.unmodifiableSet(decorators);
}
@@ -158,9 +158,9 @@
}
- public Set<DisposalMethodBean<?>> getUnresolvedDisposalBeans()
+ public Set<DisposalMethod<?>> getUnresolvedDisposalBeans()
{
- Set<DisposalMethodBean<?>> beans = new HashSet<DisposalMethodBean<?>>(allDisposalBeans);
+ Set<DisposalMethod<?>> beans = new HashSet<DisposalMethod<?>>(allDisposalBeans);
beans.removeAll(resolvedDisposalBeans);
return Collections.unmodifiableSet(beans);
}
@@ -179,9 +179,9 @@
* @param bindings The binding types to match
* @return The set of matching disposal methods
*/
- public Set<DisposalMethodBean<?>> resolveDisposalBeans(Set<Type> types, Set<Annotation> bindings, AbstractClassBean<?> declaringBean)
+ public Set<DisposalMethod<?>> resolveDisposalBeans(Set<Type> types, Set<Annotation> bindings, AbstractClassBean<?> declaringBean)
{
- Set<DisposalMethodBean<?>> beans = disposalMethodResolver.resolve(ResolvableFactory.of(types, bindings, declaringBean));
+ Set<DisposalMethod<?>> beans = disposalMethodResolver.resolve(ResolvableFactory.of(types, bindings, declaringBean));
resolvedDisposalBeans.addAll(beans);
return Collections.unmodifiableSet(beans);
}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -62,6 +62,7 @@
import org.jboss.webbeans.servlet.ServletApiAbstraction;
import org.jboss.webbeans.transaction.spi.TransactionServices;
import org.jboss.webbeans.util.serviceProvider.ServiceLoader;
+import org.jboss.webbeans.ws.WSApiAbstraction;
/**
* Common bootstrapping functionality that is run at application startup and
@@ -212,6 +213,7 @@
services.add(EJBApiAbstraction.class, new EJBApiAbstraction(resourceLoader));
services.add(JsfApiAbstraction.class, new JsfApiAbstraction(resourceLoader));
services.add(PersistenceApiAbstraction.class, new PersistenceApiAbstraction(resourceLoader));
+ services.add(WSApiAbstraction.class, new WSApiAbstraction(resourceLoader));
services.add(ServletApiAbstraction.class, new ServletApiAbstraction(resourceLoader));
// Temporary workaround to provide context for building annotated class
// TODO expose AnnotatedClass on SPI and allow container to provide impl of this via ResourceLoader
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDecoratorResolver.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDecoratorResolver.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDecoratorResolver.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -22,7 +22,7 @@
import java.util.TreeSet;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.DecoratorBean;
+import org.jboss.webbeans.bean.DecoratorImpl;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Reflections;
@@ -30,31 +30,31 @@
* @author pmuir
*
*/
-public class TypeSafeDecoratorResolver extends TypeSafeBeanResolver<DecoratorBean<?>>
+public class TypeSafeDecoratorResolver extends TypeSafeBeanResolver<DecoratorImpl<?>>
{
- public TypeSafeDecoratorResolver(BeanManagerImpl manager, Iterable<DecoratorBean<?>> decorators)
+ public TypeSafeDecoratorResolver(BeanManagerImpl manager, Iterable<DecoratorImpl<?>> decorators)
{
super(manager, decorators);
}
@Override
- protected boolean matches(Resolvable resolvable, DecoratorBean<?> bean)
+ protected boolean matches(Resolvable resolvable, DecoratorImpl<?> bean)
{
return Reflections.isAssignableFrom(bean.getDelegateTypes(), resolvable.getTypeClosure()) && Beans.containsAllBindings(bean.getDelegateQualifiers(), resolvable.getQualifiers(), getManager()) && getManager().getEnabledDecoratorClasses().contains(bean.getType());
}
@Override
- protected Set<DecoratorBean<?>> sortResult(Set<DecoratorBean<?>> matchedDecorators)
+ protected Set<DecoratorImpl<?>> sortResult(Set<DecoratorImpl<?>> matchedDecorators)
{
- Set<DecoratorBean<?>> sortedBeans = new TreeSet<DecoratorBean<?>>(new Comparator<DecoratorBean<?>>()
+ Set<DecoratorImpl<?>> sortedBeans = new TreeSet<DecoratorImpl<?>>(new Comparator<DecoratorImpl<?>>()
{
- public int compare(DecoratorBean<?> o1, DecoratorBean<?> o2)
+ public int compare(DecoratorImpl<?> o1, DecoratorImpl<?> o2)
{
List<Class<?>> enabledDecorators = getManager().getEnabledDecoratorClasses();
- int p1 = enabledDecorators.indexOf(((DecoratorBean<?>) o1).getType());
- int p2 = enabledDecorators.indexOf(((DecoratorBean<?>) o2).getType());
+ int p1 = enabledDecorators.indexOf(((DecoratorImpl<?>) o1).getType());
+ int p2 = enabledDecorators.indexOf(((DecoratorImpl<?>) o2).getType());
return p1 - p2;
}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -20,7 +20,7 @@
import java.util.Set;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.DisposalMethodBean;
+import org.jboss.webbeans.bean.DisposalMethod;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Reflections;
@@ -28,19 +28,19 @@
* @author pmuir
*
*/
-public class TypeSafeDisposerResolver extends TypeSafeResolver<DisposalMethodBean<?>>
+public class TypeSafeDisposerResolver extends TypeSafeResolver<DisposalMethod<?>>
{
private final BeanManagerImpl manager;
- public TypeSafeDisposerResolver(BeanManagerImpl manager, Iterable<DisposalMethodBean<?>> disposers)
+ public TypeSafeDisposerResolver(BeanManagerImpl manager, Iterable<DisposalMethod<?>> disposers)
{
super(disposers);
this.manager = manager;
}
@Override
- protected boolean matches(Resolvable resolvable, DisposalMethodBean<?> disposer)
+ protected boolean matches(Resolvable resolvable, DisposalMethod<?> disposer)
{
return resolvable.getDeclaringBean().equals(disposer.getDeclaringBean()) && Reflections.isAssignableFrom(disposer.getType(), resolvable.getTypeClosure()) && Beans.containsAllBindings(disposer.getQualifiers(), resolvable.getQualifiers(), manager);
}
@@ -54,7 +54,7 @@
}
@Override
- protected Set<DisposalMethodBean<?>> filterResult(Set<DisposalMethodBean<?>> matched)
+ protected Set<DisposalMethod<?>> filterResult(Set<DisposalMethod<?>> matched)
{
return matched;
}
@@ -66,7 +66,7 @@
}
@Override
- protected Set<DisposalMethodBean<?>> sortResult(Set<DisposalMethodBean<?>> matched)
+ protected Set<DisposalMethod<?>> sortResult(Set<DisposalMethod<?>> matched)
{
return matched;
}
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -38,7 +38,7 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.bean.AbstractProducerBean;
-import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
import org.jboss.webbeans.injection.ConstructorInjectionPoint;
@@ -80,9 +80,9 @@
*/
public static boolean isPassivatingScope(Bean<?> bean, BeanManagerImpl manager)
{
- if (bean instanceof EnterpriseBean<?>)
+ if (bean instanceof SessionBean<?>)
{
- return ((EnterpriseBean<?>) bean).getEjbDescriptor().isStateful();
+ return ((SessionBean<?>) bean).getEjbDescriptor().isStateful();
}
else
{
@@ -99,9 +99,9 @@
*/
public static boolean isPassivationCapableBean(Bean<?> bean)
{
- if (bean instanceof EnterpriseBean<?>)
+ if (bean instanceof SessionBean<?>)
{
- return ((EnterpriseBean<?>) bean).getEjbDescriptor().isStateful();
+ return ((SessionBean<?>) bean).getEjbDescriptor().isStateful();
}
else if (bean instanceof AbstractProducerBean<?, ?>)
{
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/ws)
Deleted: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java 2009-09-14 17:57:21 UTC (rev 3663)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.ws;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.util.ApiAbstraction;
-
-public class WSApiAbstraction extends ApiAbstraction implements Service
-{
-
- public final Class<? extends Annotation> WEB_SERVICE_REF_ANNOTATION_CLASS;
-
- /**
- * @param resourceLoader
- */
- public WSApiAbstraction(ResourceLoader resourceLoader)
- {
- super(resourceLoader);
- WEB_SERVICE_REF_ANNOTATION_CLASS = annotationTypeForName("javax.xml.ws.WebServiceRef");
- }
-
- public void cleanup() {}
-
-}
\ No newline at end of file
Copied: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java (from rev 3663, ri/trunk/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java)
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java (rev 0)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.ws;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.resources.spi.ResourceLoader;
+import org.jboss.webbeans.util.ApiAbstraction;
+
+public class WSApiAbstraction extends ApiAbstraction implements Service
+{
+
+ public final Class<? extends Annotation> WEB_SERVICE_REF_ANNOTATION_CLASS;
+
+ /**
+ * @param resourceLoader
+ */
+ public WSApiAbstraction(ResourceLoader resourceLoader)
+ {
+ super(resourceLoader);
+ WEB_SERVICE_REF_ANNOTATION_CLASS = annotationTypeForName("javax.xml.ws.WebServiceRef");
+ }
+
+ public void cleanup() {}
+
+}
\ No newline at end of file
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterprise/BootstrapTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterprise/BootstrapTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterprise/BootstrapTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -9,7 +9,7 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -36,10 +36,10 @@
assert classes.containsKey(Panther.class);
assert classes.containsKey(Tiger.class);
- assert classes.get(Hound.class) instanceof EnterpriseBean;
- assert classes.get(Elephant.class) instanceof EnterpriseBean;
- assert classes.get(Panther.class) instanceof EnterpriseBean;
- assert classes.get(Tiger.class) instanceof EnterpriseBean;
+ assert classes.get(Hound.class) instanceof SessionBean;
+ assert classes.get(Elephant.class) instanceof SessionBean;
+ assert classes.get(Panther.class) instanceof SessionBean;
+ assert classes.get(Tiger.class) instanceof SessionBean;
}
}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterpriseAndSimple/BootstrapTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterpriseAndSimple/BootstrapTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleEnterpriseAndSimple/BootstrapTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -9,9 +9,9 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.ManagedBean;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -41,14 +41,14 @@
assert classes.containsKey(SeaBass.class);
assert classes.containsKey(Sole.class);
- assert classes.get(Hound.class) instanceof EnterpriseBean;
- assert classes.get(Elephant.class) instanceof EnterpriseBean;
- assert classes.get(Panther.class) instanceof EnterpriseBean;
- assert classes.get(Tiger.class) instanceof EnterpriseBean;
- assert classes.get(Tuna.class) instanceof SimpleBean;
- assert classes.get(Salmon.class) instanceof SimpleBean;
- assert classes.get(SeaBass.class) instanceof SimpleBean;
- assert classes.get(Sole.class) instanceof SimpleBean;
+ assert classes.get(Hound.class) instanceof SessionBean;
+ assert classes.get(Elephant.class) instanceof SessionBean;
+ assert classes.get(Panther.class) instanceof SessionBean;
+ assert classes.get(Tiger.class) instanceof SessionBean;
+ assert classes.get(Tuna.class) instanceof ManagedBean;
+ assert classes.get(Salmon.class) instanceof ManagedBean;
+ assert classes.get(SeaBass.class) instanceof ManagedBean;
+ assert classes.get(Sole.class) instanceof ManagedBean;
}
}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleSimple/BootstrapTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleSimple/BootstrapTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/multipleSimple/BootstrapTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -8,7 +8,7 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.ManagedBean;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -33,10 +33,10 @@
assert classes.containsKey(SeaBass.class);
assert classes.containsKey(Sole.class);
- assert classes.get(Tuna.class) instanceof SimpleBean;
- assert classes.get(Salmon.class) instanceof SimpleBean;
- assert classes.get(SeaBass.class) instanceof SimpleBean;
- assert classes.get(Sole.class) instanceof SimpleBean;
+ assert classes.get(Tuna.class) instanceof ManagedBean;
+ assert classes.get(Salmon.class) instanceof ManagedBean;
+ assert classes.get(SeaBass.class) instanceof ManagedBean;
+ assert classes.get(Sole.class) instanceof ManagedBean;
}
}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -9,9 +9,9 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.ProducerMethod;
import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.ManagedBean;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -36,8 +36,8 @@
assert classes.containsKey(TarantulaProducer.class);
assert classes.containsKey(Tarantula.class);
- assert classes.get(TarantulaProducer.class) instanceof SimpleBean;
- assert classes.get(Tarantula.class) instanceof ProducerMethodBean;
+ assert classes.get(TarantulaProducer.class) instanceof ManagedBean;
+ assert classes.get(Tarantula.class) instanceof ProducerMethod;
}
}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -7,7 +7,7 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.ContextualIdStore;
import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.ManagedBean;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
@@ -38,7 +38,7 @@
private void addBean(BeanManagerImpl manager, Class<?> c)
{
WBClass<?> clazz = WBClassImpl.of(c, classTransformer);
- RIBean<?> bean = SimpleBean.of(clazz, manager);
+ RIBean<?> bean = ManagedBean.of(clazz, manager);
manager.addBean(bean);
BeanDeployerEnvironment environment = new BeanDeployerEnvironment(new EjbDescriptors(), manager);
bean.initialize(environment);
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -11,7 +11,7 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.Container;
import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.ManagedBean;
import org.jboss.webbeans.mock.MockBeanDeploymentArchive;
import org.jboss.webbeans.mock.MockServletLifecycle;
import org.testng.annotations.AfterClass;
@@ -60,10 +60,10 @@
assert beans.containsKey(SeaBass.class);
assert beans.containsKey(Sole.class);
- assert beans.get(Tuna.class) instanceof SimpleBean;
- assert beans.get(Salmon.class) instanceof SimpleBean;
- assert beans.get(SeaBass.class) instanceof SimpleBean;
- assert beans.get(Sole.class) instanceof SimpleBean;
+ assert beans.get(Tuna.class) instanceof ManagedBean;
+ assert beans.get(Salmon.class) instanceof ManagedBean;
+ assert beans.get(SeaBass.class) instanceof ManagedBean;
+ assert beans.get(Sole.class) instanceof ManagedBean;
manager.getInstanceByType(Sole.class, new AnnotationLiteral<Whitefish>() {}).ping();
}
@@ -82,7 +82,7 @@
Bean<?> bean = beans.get(TarantulaProducer.class);
- assert beans.get(TarantulaProducer.class) instanceof SimpleBean;
+ assert beans.get(TarantulaProducer.class) instanceof ManagedBean;
manager.getInstanceByType(Tarantula.class, new AnnotationLiteral<Tame>() {}).ping();
}
@@ -98,7 +98,7 @@
}
}
assert classes.containsKey(Hound.class);
- assert classes.get(Hound.class) instanceof SimpleBean;
+ assert classes.get(Hound.class) instanceof ManagedBean;
manager.getInstanceByType(HoundLocal.class, new AnnotationLiteral<Tame>() {}).ping();
}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -8,8 +8,8 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.NewEnterpriseBean;
+import org.jboss.webbeans.bean.SessionBean;
+import org.jboss.webbeans.bean.NewSessionBean;
import org.jboss.webbeans.introspector.WBAnnotated;
import org.jboss.webbeans.literal.NewLiteral;
import org.jboss.webbeans.test.AbstractWebBeansTest;
@@ -30,19 +30,19 @@
};
- private EnterpriseBean<WrappedEnterpriseBeanLocal> wrappedEnterpriseBean;
- private NewEnterpriseBean<WrappedEnterpriseBeanLocal> newEnterpriseBean;
+ private SessionBean<WrappedEnterpriseBeanLocal> wrappedEnterpriseBean;
+ private NewSessionBean<WrappedEnterpriseBeanLocal> newEnterpriseBean;
public void initNewBean()
{
Set<Bean<?>> beans = getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class);
assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).size() == 1;
- assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).iterator().next() instanceof EnterpriseBean;
- wrappedEnterpriseBean = (EnterpriseBean<WrappedEnterpriseBeanLocal>) getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).iterator().next();
+ assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).iterator().next() instanceof SessionBean;
+ wrappedEnterpriseBean = (SessionBean<WrappedEnterpriseBeanLocal>) getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).iterator().next();
assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).size() == 1;
- assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next() instanceof NewEnterpriseBean;
- newEnterpriseBean = (NewEnterpriseBean<WrappedEnterpriseBeanLocal>) getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next();
+ assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next() instanceof NewSessionBean;
+ newEnterpriseBean = (NewSessionBean<WrappedEnterpriseBeanLocal>) getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next();
}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/newsimple/NewSimpleBeanTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/newsimple/NewSimpleBeanTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/newsimple/NewSimpleBeanTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -5,8 +5,8 @@
import javax.enterprise.inject.New;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.bean.NewSimpleBean;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.NewManagedBean;
+import org.jboss.webbeans.bean.ManagedBean;
import org.jboss.webbeans.introspector.WBAnnotated;
import org.jboss.webbeans.literal.NewLiteral;
import org.jboss.webbeans.test.AbstractWebBeansTest;
@@ -15,20 +15,20 @@
@Artifact
public class NewSimpleBeanTest extends AbstractWebBeansTest
{
- private SimpleBean<WrappedSimpleBean> wrappedSimpleBean;
- private NewSimpleBean<WrappedSimpleBean> newSimpleBean;
+ private ManagedBean<WrappedSimpleBean> wrappedSimpleBean;
+ private NewManagedBean<WrappedSimpleBean> newSimpleBean;
private static final New NEW_LITERAL = new NewLiteral();
public void initNewBean() {
assert getCurrentManager().getBeans(WrappedSimpleBean.class).size() == 1;
- assert getCurrentManager().getBeans(WrappedSimpleBean.class).iterator().next() instanceof SimpleBean;
- wrappedSimpleBean = (SimpleBean<WrappedSimpleBean>) getCurrentManager().getBeans(WrappedSimpleBean.class).iterator().next();
+ assert getCurrentManager().getBeans(WrappedSimpleBean.class).iterator().next() instanceof ManagedBean;
+ wrappedSimpleBean = (ManagedBean<WrappedSimpleBean>) getCurrentManager().getBeans(WrappedSimpleBean.class).iterator().next();
assert getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).size() == 1;
- assert getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next() instanceof NewSimpleBean;
- newSimpleBean = (NewSimpleBean<WrappedSimpleBean>) getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next();
+ assert getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next() instanceof NewManagedBean;
+ newSimpleBean = (NewManagedBean<WrappedSimpleBean>) getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next();
}
@Test(groups = { "new" })
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/manager/EjbDescriptorLookupTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/manager/EjbDescriptorLookupTest.java 2009-09-15 13:02:01 UTC (rev 3667)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/manager/EjbDescriptorLookupTest.java 2009-09-15 13:31:15 UTC (rev 3668)
@@ -22,7 +22,7 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
import org.jboss.webbeans.test.AbstractWebBeansTest;
@@ -44,11 +44,11 @@
assert descriptor.getClass().equals(InternalEjbDescriptor.class);
Bean<CatLocal> bean = getCurrentManager().getBean(descriptor);
assert bean != null;
- assert bean instanceof EnterpriseBean;
+ assert bean instanceof SessionBean;
assert bean.getBeanClass().equals(Cat.class);
InjectionTarget<CatLocal> it = getCurrentManager().createInjectionTarget(descriptor);
assert it != null;
- assert it instanceof EnterpriseBean;
+ assert it instanceof SessionBean;
assert it == bean;
}
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3667 - doc/trunk/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-09-15 09:02:01 -0400 (Tue, 15 Sep 2009)
New Revision: 3667
Modified:
doc/trunk/reference/en-US/ri-spi.xml
Log:
add notes on new JSF/JSP integration
Modified: doc/trunk/reference/en-US/ri-spi.xml
===================================================================
--- doc/trunk/reference/en-US/ri-spi.xml 2009-09-15 13:00:42 UTC (rev 3666)
+++ doc/trunk/reference/en-US/ri-spi.xml 2009-09-15 13:02:01 UTC (rev 3667)
@@ -579,7 +579,7 @@
<listitem>
<para>
- If you are integrating the Web Beans into a JSF
+ If you are integrating the Web Beans into a JSF
environment you must register
<literal>org.jboss.webbeans.jsf.WebBeansPhaseListener</literal>
as a phase listener.
@@ -588,12 +588,41 @@
<para>
If you are integrating the Web Beans into a JSF
environment you must register
- <literal>org.jboss.webbeans.jsf.WebBeansApplicationFactory</literal>
- as an (wrapping) factory for the <literal>Application</literal>.
+ <literal>org.jboss.webbeans.el.WebBeansELContextListener</literal>
+ as as an EL Context listener.
</para>
<para>
If you are integrating the Web Beans into a JSF environment
+ you must obtain the bean manager for the module and then call
+ <literal>BeanManager.wrapExpressionFactory()</literal>,
+ passing <literal>Application.getExpressionFactory()</literal>
+ as the argument. The wrapped expression factory must be used
+ in all EL expression evaluations performed by JSF in this web
+ application.
+ </para>
+
+ <para>
+ If you are integrating the Web Beans into a JSF environment
+ you must obtain the bean manager for the module and then call
+ <literal>BeanManager.getELResolver()</literal>,
+ The returned EL resolver should be registered with JSF for
+ this web application.
+ </para>
+
+ <tip>
+ <para>
+ There are a number of ways you can obtain the bean manager
+ for the module. You could call
+ <literal>Bootstrap.getManager()</literal>, passing in the
+ BDA for this module. Alternatively, you could use the
+ injection into Java EE component classes, or look up the
+ bean manager in JNDI.
+ </para>
+ </tip>
+
+ <para>
+ If you are integrating the Web Beans into a JSF environment
you must register
<literal>org.jboss.webbeans.servlet.ConversationPropagationFilter</literal>
as a Servlet listener, either automatically, or through user
@@ -611,6 +640,49 @@
</varlistentry>
<varlistentry>
<term>
+ JSP
+ </term>
+ <listitem>
+
+ <para>
+ If you are integrating the Web Beans into a JSP
+ environment you must register
+ <literal>org.jboss.webbeans.el.WebBeansELContextListener</literal>
+ as as an EL Context listener.
+ </para>
+
+ <para>
+ If you are integrating the Web Beans into a JSP environment
+ you must obtain the bean manager for the module and then call
+ <literal>BeanManager.wrapExpressionFactory()</literal>,
+ passing <literal>Application.getExpressionFactory()</literal>
+ as the argument. The wrapped expression factory must be used
+ in all EL expression evaluations performed by JSP.
+ </para>
+
+ <para>
+ If you are integrating the Web Beans into a JSP environment
+ you must obtain the bean manager for the module and then call
+ <literal>BeanManager.getELResolver()</literal>,
+ The returned EL resolver should be registered with JSP for
+ this web application.
+ </para>
+
+ <tip>
+ <para>
+ There are a number of ways you can obtain the bean manager
+ for the module. You could call
+ <literal>Bootstrap.getManager()</literal>, passing in the
+ BDA for this module. Alternatively, you could use the
+ injection into Java EE component classes, or look up the
+ bean manager in JNDI.
+ </para>
+ </tip>
+
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
Session Bean Interceptor
</term>
<listitem>
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3666 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/jsf and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-09-15 09:00:42 -0400 (Tue, 15 Sep 2009)
New Revision: 3666
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java
ri/trunk/jboss-as/build.properties
ri/trunk/version-matrix/pom.xml
Log:
update JBoss AS version, and remove old JSF/JSP integration classes
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java 2009-09-15 13:00:42 UTC (rev 3666)
@@ -34,6 +34,10 @@
public WebBeansExpressionFactory(ExpressionFactory expressionFactory)
{
+ if (expressionFactory == null)
+ {
+ throw new IllegalArgumentException("Cannot pass null expressionFactory");
+ }
this.delegate = expressionFactory;
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplication.java 2009-09-15 13:00:42 UTC (rev 3666)
@@ -1,289 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
-
-import javax.faces.FacesException;
-import javax.faces.application.Application;
-import javax.faces.application.NavigationHandler;
-import javax.faces.application.StateManager;
-import javax.faces.application.ViewHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.PropertyResolver;
-import javax.faces.el.ReferenceSyntaxException;
-import javax.faces.el.ValueBinding;
-import javax.faces.el.VariableResolver;
-import javax.faces.event.ActionListener;
-import javax.faces.validator.Validator;
-
-/**
- * @author pmuir
- *
- */
-public abstract class ForwardingApplication extends Application
-{
-
- protected abstract Application delegate();
-
- @Override
- public void addComponent(String componentType, String componentClass)
- {
- delegate().addComponent(componentType, componentClass);
- }
-
- @Override
- public void addConverter(String converterId, String converterClass)
- {
- delegate().addConverter(converterId, converterClass);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void addConverter(Class targetClass, String converterClass)
- {
- delegate().addConverter(targetClass, converterClass);
- }
-
- @Override
- public void addValidator(String validatorId, String validatorClass)
- {
- delegate().addValidator(validatorId, validatorClass);
- }
-
- @Override
- public UIComponent createComponent(String componentType) throws FacesException
- {
- return delegate().createComponent(componentType);
- }
-
- @Override
- @Deprecated
- public UIComponent createComponent(ValueBinding componentBinding, FacesContext context, String componentType) throws FacesException
- {
- return delegate().createComponent(componentBinding, context, componentType);
- }
-
- @Override
- public Converter createConverter(String converterId)
- {
- return delegate().createConverter(converterId);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Converter createConverter(Class targetClass)
- {
- return delegate().createConverter(targetClass);
- }
-
- @SuppressWarnings("unchecked")
- @Deprecated
- @Override
- public MethodBinding createMethodBinding(String ref, Class[] params) throws ReferenceSyntaxException
- {
- return delegate().createMethodBinding(ref, params);
- }
-
- @Override
- public Validator createValidator(String validatorId) throws FacesException
- {
- return delegate().createValidator(validatorId);
- }
-
- @Override
- @Deprecated
- public ValueBinding createValueBinding(String ref) throws ReferenceSyntaxException
- {
- return delegate().createValueBinding(ref);
- }
-
- @Override
- public ActionListener getActionListener()
- {
- return delegate().getActionListener();
- }
-
- @Override
- public Iterator<String> getComponentTypes()
- {
- return delegate().getComponentTypes();
- }
-
- @Override
- public Iterator<String> getConverterIds()
- {
- return delegate().getConverterIds();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Iterator<Class> getConverterTypes()
- {
- return delegate().getConverterTypes();
- }
-
- @Override
- public Locale getDefaultLocale()
- {
- return delegate().getDefaultLocale();
- }
-
- @Override
- public String getDefaultRenderKitId()
- {
- return delegate().getDefaultRenderKitId();
- }
-
- @Override
- public String getMessageBundle()
- {
- return delegate().getMessageBundle();
- }
-
- @Override
- public NavigationHandler getNavigationHandler()
- {
- return delegate().getNavigationHandler();
- }
-
- @Override
- @Deprecated
- public PropertyResolver getPropertyResolver()
- {
- return delegate().getPropertyResolver();
- }
-
- @Override
- public StateManager getStateManager()
- {
- return delegate().getStateManager();
- }
-
- @Override
- public Iterator<Locale> getSupportedLocales()
- {
- return delegate().getSupportedLocales();
- }
-
- @Override
- public Iterator<String> getValidatorIds()
- {
- return delegate().getValidatorIds();
- }
-
- @Override
- @Deprecated
- public VariableResolver getVariableResolver()
- {
- return delegate().getVariableResolver();
- }
-
- @Override
- public ViewHandler getViewHandler()
- {
- return delegate().getViewHandler();
- }
-
- @Override
- public void setActionListener(ActionListener listener)
- {
- delegate().setActionListener(listener);
- }
-
- @Override
- public void setDefaultLocale(Locale locale)
- {
- delegate().setDefaultLocale(locale);
- }
-
- @Override
- public void setDefaultRenderKitId(String renderKitId)
- {
- delegate().setDefaultRenderKitId(renderKitId);
- }
-
- @Override
- public void setMessageBundle(String bundle)
- {
- delegate().setMessageBundle(bundle);
- }
-
- @Override
- public void setNavigationHandler(NavigationHandler handler)
- {
- delegate().setNavigationHandler(handler);
- }
-
-
- @Override
- @Deprecated
- public void setPropertyResolver(PropertyResolver resolver)
- {
- delegate().setPropertyResolver(resolver);
- }
-
- @Override
- public void setStateManager(StateManager manager)
- {
- delegate().setStateManager(manager);
- }
-
- @Override
- public void setSupportedLocales(Collection<Locale> locales)
- {
- delegate().setSupportedLocales(locales);
-
- }
-
- @Override
- @Deprecated
- public void setVariableResolver(VariableResolver resolver)
- {
- delegate().setVariableResolver(resolver);
- }
-
- @Override
- public void setViewHandler(ViewHandler handler)
- {
- delegate().setViewHandler(handler);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate().equals(obj);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ForwardingApplicationFactory.java 2009-09-15 13:00:42 UTC (rev 3666)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import javax.faces.application.Application;
-import javax.faces.application.ApplicationFactory;
-
-/**
- * @author pmuir
- *
- */
-public abstract class ForwardingApplicationFactory extends ApplicationFactory
-{
-
- protected abstract ApplicationFactory delegate();
-
- @Override
- public Application getApplication()
- {
- return delegate().getApplication();
- }
-
- @Override
- public void setApplication(Application application)
- {
- delegate().setApplication(application);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate().equals(obj);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfWebBeansELResolver.java 2009-09-15 13:00:42 UTC (rev 3666)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import javax.el.ELContext;
-import javax.faces.context.FacesContext;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.el.AbstractWebBeansELResolver;
-
-/**
- * @author pmuir
- *
- */
-public class JsfWebBeansELResolver extends AbstractWebBeansELResolver
-{
-
- @Override
- protected BeanManagerImpl getManager(ELContext context)
- {
- if (context.getContext(FacesContext.class) == null)
- {
- throw new IllegalStateException("Cannot use " + getClass().getSimpleName() + " outside JSF");
- }
- else
- {
- return JsfHelper.getModuleBeanManager((FacesContext) context.getContext(FacesContext.class));
- }
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java 2009-09-15 13:00:42 UTC (rev 3666)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.el.ELContextListener;
-import javax.el.ExpressionFactory;
-import javax.faces.application.Application;
-
-import org.jboss.webbeans.el.WebBeansELContextListener;
-import org.jboss.webbeans.el.WebBeansExpressionFactory;
-
-/**
- * @author pmuir
- *
- */
-public class WebBeansApplication extends ForwardingApplication
-{
-
- private static final ELContextListener[] EMPTY_LISTENERS = {};
-
- private final Application application;
- private final Collection<ELContextListener> elContextListeners;
-
- public WebBeansApplication(Application application)
- {
- this.application = application;
- this.elContextListeners = new ArrayList<ELContextListener>();
- this.elContextListeners.add(new WebBeansELContextListener());
- application.addELResolver(new JsfWebBeansELResolver());
- }
-
- @Override
- protected Application delegate()
- {
- return application;
- }
-
- @Override
- public ExpressionFactory getExpressionFactory()
- {
- return new WebBeansExpressionFactory(delegate().getExpressionFactory());
- }
-
- @Override
- public ELContextListener[] getELContextListeners()
- {
- return elContextListeners.toArray(EMPTY_LISTENERS);
- }
-
- @Override
- public void addELContextListener(ELContextListener listener)
- {
- elContextListeners.add(listener);
- }
-
- @Override
- public void removeELContextListener(ELContextListener listener)
- {
- elContextListeners.remove(listener);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplicationFactory.java 2009-09-15 13:00:42 UTC (rev 3666)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.jsf;
-
-import javax.faces.application.Application;
-import javax.faces.application.ApplicationFactory;
-
-
-/**
- * @author pmuir
- *
- */
-public class WebBeansApplicationFactory extends ForwardingApplicationFactory
-{
-
- private final ApplicationFactory applicationFactory;
-
- private Application application;
-
- public WebBeansApplicationFactory(ApplicationFactory applicationFactory)
- {
- this.applicationFactory = applicationFactory;
- }
-
- @Override
- protected ApplicationFactory delegate()
- {
- return applicationFactory;
- }
-
- @Override
- public Application getApplication()
- {
- if (application == null)
- {
- application = new WebBeansApplication(delegate().getApplication());
- }
- return application;
- }
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java 2009-09-15 13:00:42 UTC (rev 3666)
@@ -22,14 +22,12 @@
*/
package org.jboss.webbeans.servlet;
-import javax.servlet.ServletContextEvent;
import javax.servlet.ServletRequestEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSessionEvent;
import org.jboss.webbeans.Container;
import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.jsp.JspInitialization;
import org.jboss.webbeans.servlet.api.helpers.AbstractServletListener;
/**
@@ -55,16 +53,6 @@
}
return lifecycle;
}
-
- @Override
- public void contextInitialized(ServletContextEvent sce)
- {
- // JBoss AS will still start the deployment even if WB fails
- if (Container.instance() != null && Container.instance().isInitialized())
- {
- new JspInitialization().init(sce.getServletContext());
- }
- }
/**
* Called when the session is created
Modified: ri/trunk/jboss-as/build.properties
===================================================================
--- ri/trunk/jboss-as/build.properties 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/jboss-as/build.properties 2009-09-15 13:00:42 UTC (rev 3666)
@@ -1,5 +1,5 @@
# Container a number of properties associated with installing Web Beans into JBoss AS and running the TCK in JBoss AS
-#jboss.home=/Applications/jboss-5.1.0.GA
+#jboss.home=/Applications/jboss-5.2.0.Beta1
org.jboss.testharness.container.javaOpts=-Xms128m -Xmx384m -XX:MaxPermSize=128m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
# time to allow before attempting to restart JBoss AS
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-09-15 12:54:15 UTC (rev 3665)
+++ ri/trunk/version-matrix/pom.xml 2009-09-15 13:00:42 UTC (rev 3666)
@@ -128,7 +128,7 @@
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>javax.transaction</groupId>
15 years, 5 months
[webbeans-commits] Webbeans SVN: r3665 - in ri/branches/kabir-builder: tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: kabir.khan(a)jboss.com
Date: 2009-09-15 08:54:15 -0400 (Tue, 15 Sep 2009)
New Revision: 3665
Added:
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManager.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManagerImpl.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManager.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManagerImpl.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/OrderedEjbDescriptors.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManager.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManagerImpl.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManager.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManagerImpl.java
Modified:
ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java
ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java
Log:
Test EJB order
Modified: ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java
===================================================================
--- ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java 2009-09-15 00:18:59 UTC (rev 3664)
+++ ri/branches/kabir-builder/impl/src/main/java/org/jboss/webbeans/builder/sorter/EjbDeploymentItem.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -53,13 +53,12 @@
{
//This needs revisiting
Class<?> superClass = getWBClass().getWBSuperclass().getJavaClass();
- for (InternalEjbDescriptor ejb : allDescriptors)
+ for (InternalEjbDescriptor<?> ejb : allDescriptors)
{
if (ejb.getBeanClass().equals(superClass))
{
DeploymentItem<InternalEjbDescriptor<?>> item = new EjbDeploymentItem(null, null, getWBClass().getWBSuperclass(), ejb);
return findDeploymentItem(item);
-
}
}
//TODO search wbclasses too?
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManager.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManager.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManager.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Local;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Local
+public interface DoctorManager extends EmployeeManager
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManagerImpl.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManagerImpl.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/DoctorManagerImpl.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Stateless;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Stateless
+public class DoctorManagerImpl extends EmployeeManagerImpl implements DoctorManager
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManager.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManager.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManager.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Local;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Local
+public interface EmployeeManager
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManagerImpl.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManagerImpl.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/EmployeeManagerImpl.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Stateless;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Stateless
+public class EmployeeManagerImpl implements EmployeeManager
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/OrderedEjbDescriptors.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/OrderedEjbDescriptors.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/OrderedEjbDescriptors.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,100 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+
+import org.jboss.webbeans.ejb.EjbDescriptors;
+import org.jboss.webbeans.ejb.InternalEjbDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+
+/**
+ * Implementation of EjbDescriptors where we can rely on the order of the beans
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class OrderedEjbDescriptors extends EjbDescriptors
+{
+ // EJB name -> EJB descriptors map
+ private final Map<String, InternalEjbDescriptor<?>> ejbs;
+
+ private final Collection<Class<?>> ejbClasses;
+
+ public OrderedEjbDescriptors()
+ {
+ this.ejbs = new LinkedHashMap<String, InternalEjbDescriptor<?>>();
+ this.ejbClasses = new LinkedHashSet<Class<?>>();
+ }
+
+ public <T> InternalEjbDescriptor<T> get(String beanName)
+ {
+ return (InternalEjbDescriptor<T>) ejbs.get(beanName);
+ }
+
+ public <T> void add(EjbDescriptor<T> ejbDescriptor)
+ {
+ InternalEjbDescriptor<T> internalEjbDescriptor = new InternalEjbDescriptor<T>(ejbDescriptor);
+ ejbs.put(ejbDescriptor.getEjbName(), internalEjbDescriptor);
+ ejbClasses.add(ejbDescriptor.getBeanClass());
+ }
+
+ public boolean contains(String beanName)
+ {
+ return ejbs.containsKey(beanName);
+ }
+
+ public boolean contains(Class<?> beanClass)
+ {
+ return ejbClasses.contains(beanClass);
+ }
+
+ public void addAll(Iterable<EjbDescriptor<?>> ejbDescriptors)
+ {
+ for (EjbDescriptor<?> ejbDescriptor : ejbDescriptors)
+ {
+ add(ejbDescriptor);
+ }
+ }
+
+ public void clear()
+ {
+ ejbs.clear();
+ }
+
+ public Iterator<InternalEjbDescriptor<?>> iterator()
+ {
+ return ejbs.values().iterator();
+ }
+
+ public void cleanup() {}
+
+ public int size()
+ {
+ return ejbs.size();
+ }
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManager.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManager.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManager.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Local;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Local
+public interface PlasticSurgeonManager extends SurgeonManager
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManagerImpl.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManagerImpl.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/PlasticSurgeonManagerImpl.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Stateless;
+import javax.enterprise.inject.Specializes;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Stateless
+@Specializes
+public class PlasticSurgeonManagerImpl extends SurgeonManagerImpl implements PlasticSurgeonManager
+{
+
+}
Modified: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java 2009-09-15 00:18:59 UTC (rev 3664)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SorterTest.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -30,10 +30,10 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.builder.sorter.DeploymentItem;
import org.jboss.webbeans.builder.sorter.Sorter;
-import org.jboss.webbeans.ejb.EjbDescriptors;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.jlr.WBClassImpl;
import org.jboss.webbeans.mock.MockEELifecycle;
+import org.jboss.webbeans.mock.MockEjbDescriptor;
import org.jboss.webbeans.resources.ClassTransformer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -98,24 +98,68 @@
assertArrays(sortClasses(PlasticSurgeon.class, Employee.class, Surgeon.class, Doctor.class), Doctor.class, Surgeon.class, PlasticSurgeon.class, Employee.class);
}
+ @Test
+ public void testEjbSortNoDependencies()
+ {
+ assertArrays(sortClasses(createEjbDescriptors(DoctorManagerImpl.class, EmployeeManagerImpl.class)), DoctorManagerImpl.class, EmployeeManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(EmployeeManagerImpl.class, DoctorManagerImpl.class)), EmployeeManagerImpl.class, DoctorManagerImpl.class);
+ }
+
+ @Test
+ public void testEjbSortSpecializedDependencies()
+ {
+ assertArrays(sortClasses(createEjbDescriptors(DoctorManagerImpl.class, SurgeonManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(SurgeonManagerImpl.class, DoctorManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class);
+
+ assertArrays(sortClasses(createEjbDescriptors(DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(DoctorManagerImpl.class, PlasticSurgeonManagerImpl.class, SurgeonManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class, DoctorManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(SurgeonManagerImpl.class, DoctorManagerImpl.class, PlasticSurgeonManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(PlasticSurgeonManagerImpl.class, SurgeonManagerImpl.class, DoctorManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(PlasticSurgeonManagerImpl.class, DoctorManagerImpl.class, SurgeonManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class);
+
+ //TODO Not sure we can guarantee the order of Employee in these cases?
+ assertArrays(sortClasses(createEjbDescriptors(EmployeeManagerImpl.class, DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class)), EmployeeManagerImpl.class, DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(PlasticSurgeonManagerImpl.class, SurgeonManagerImpl.class, DoctorManagerImpl.class, EmployeeManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class, EmployeeManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(DoctorManagerImpl.class, SurgeonManagerImpl.class, EmployeeManagerImpl.class, PlasticSurgeonManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, EmployeeManagerImpl.class, PlasticSurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(PlasticSurgeonManagerImpl.class, EmployeeManagerImpl.class, SurgeonManagerImpl.class, DoctorManagerImpl.class)), DoctorManagerImpl.class, SurgeonManagerImpl.class, PlasticSurgeonManagerImpl.class, EmployeeManagerImpl.class);
+ }
+
+
@Test
public void testDecoratorsFirst()
{
assertArrays(sortClasses(RedDecorator.class, BlueDecorator.class, Doctor.class, Surgeon.class), RedDecorator.class, BlueDecorator.class, Doctor.class, Surgeon.class);
assertArrays(sortClasses(RedDecorator.class, Doctor.class, Surgeon.class, BlueDecorator.class), RedDecorator.class, BlueDecorator.class, Doctor.class, Surgeon.class);
assertArrays(sortClasses(Surgeon.class, Doctor.class, RedDecorator.class, BlueDecorator.class), RedDecorator.class, BlueDecorator.class, Doctor.class, Surgeon.class);
-
+
+ assertArrays(sortClasses(createEjbDescriptors(DoctorManagerImpl.class, SurgeonManagerImpl.class), RedDecorator.class, BlueDecorator.class), RedDecorator.class, BlueDecorator.class, DoctorManagerImpl.class, SurgeonManagerImpl.class);
+ assertArrays(sortClasses(createEjbDescriptors(SurgeonManagerImpl.class, DoctorManagerImpl.class), RedDecorator.class, BlueDecorator.class), RedDecorator.class, BlueDecorator.class, DoctorManagerImpl.class, SurgeonManagerImpl.class);
}
- @Test
- public void testEjbs()
+ private OrderedEjbDescriptors createEjbDescriptors(Class<?>...classes)
{
- assert 1 == 0 : "NYI";
+ OrderedEjbDescriptors descriptors = new OrderedEjbDescriptors();
+ for (Class<?> clazz : classes)
+ {
+ descriptors.add(MockEjbDescriptor.of(clazz));
+ }
+ return descriptors;
}
-
+
private Class<?>[] sortClasses(Class<?>...classes)
{
- if (classes == null || classes.length == 0)
+ return sortClasses(createEjbDescriptors(), classes);
+ }
+
+ private Class<?>[] sortClasses(OrderedEjbDescriptors ejbDescriptors)
+ {
+ return sortClasses(ejbDescriptors, new Class[0]);
+ }
+
+ private Class<?>[] sortClasses(OrderedEjbDescriptors ejbDescriptors, Class<?>...classes)
+ {
+ if (classes.length == 0 && ejbDescriptors.size() == 0)
return new Class<?>[0];
ClassTransformer transformer = manager.getServices().get(ClassTransformer.class);
@@ -126,14 +170,12 @@
wbClasses.add(WBClassImpl.of(clazz, transformer));
}
- Sorter sorter = Sorter.createSorter(manager, wbClasses, new EjbDescriptors());
+ Sorter sorter = Sorter.createSorter(manager, wbClasses, ejbDescriptors);
List<DeploymentItem<?>> sorted = sorter.sort();
- System.out.println("======>" + sorted);
+ assert sorted.size() == classes.length + ejbDescriptors.size();
- assert sorted.size() == classes.length;
-
- Class<?>[] result = new Class<?>[classes.length];
+ Class<?>[] result = new Class<?>[classes.length + ejbDescriptors.size()];
int i = 0;
for (DeploymentItem<?> item : sorted)
@@ -143,7 +185,7 @@
return result;
}
-
+
private void assertArrays(Class<?>[] actual, Class<?>...expected)
{
assert Arrays.equals(expected, actual) : printArrays(expected, actual);
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManager.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManager.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManager.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Local;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Local
+public interface SurgeonManager extends DoctorManager
+{
+
+}
Added: ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManagerImpl.java
===================================================================
--- ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManagerImpl.java (rev 0)
+++ ri/branches/kabir-builder/tests/src/test/java/org/jboss/webbeans/test/unit/builder/sorter/SurgeonManagerImpl.java 2009-09-15 12:54:15 UTC (rev 3665)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.test.unit.builder.sorter;
+
+import javax.ejb.Stateless;
+import javax.enterprise.inject.Specializes;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Stateless
+@Specializes
+public class SurgeonManagerImpl extends DoctorManagerImpl implements SurgeonManager
+{
+
+}
15 years, 5 months