[webbeans-commits] Webbeans SVN: r800 - in ri/trunk: webbeans-ri/src/main/java/org/jboss/webbeans/ejb and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 18:52:50 -0500 (Tue, 06 Jan 2009)
New Revision: 800
Added:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java
Removed:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java
Modified:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java
Log:
move Ejb classes to ejb package
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-01-06 23:51:50 UTC (rev 799)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -36,8 +36,8 @@
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java 2009-01-06 23:51:50 UTC (rev 799)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -23,7 +23,7 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet;
-import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
/**
* EJB descriptors by EJB implementation class or name
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java 2009-01-06 23:51:50 UTC (rev 799)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -11,8 +11,8 @@
import javax.ejb.Stateful;
import javax.ejb.Stateless;
-import org.jboss.webbeans.bootstrap.spi.BusinessInterfaceDescriptor;
-import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
import org.jboss.webbeans.test.annotations.Singleton;
public class MockEjbDescriptor<T> implements EjbDescriptor<T>
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java 2009-01-06 23:51:50 UTC (rev 799)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockWebBeanDiscovery.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -11,8 +11,8 @@
import javax.ejb.Stateful;
import javax.ejb.Stateless;
-import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
public class MockWebBeanDiscovery implements WebBeanDiscovery
{
Deleted: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java 2009-01-06 23:51:50 UTC (rev 799)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -1,42 +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.bootstrap.spi;
-
-/**
- * Represents the business interface of an EJB
- *
- * @author Pete Muir
- *
- * @param <T>
- */
-public interface BusinessInterfaceDescriptor<T>
-{
-
- /**
- * Gets the business interface class
- */
- public Class<T> getInterface();
-
- /**
- * Gets the JNDI name under which the EJB is registered
- *
- * @return The JNDI name
- */
- public String getJndiName();
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java 2009-01-06 23:51:50 UTC (rev 799)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -1,103 +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.bootstrap.spi;
-
-import java.lang.reflect.Method;
-
-
-/**
- * EJB metadata from the EJB descriptor
- *
- * @author Pete Muir
- *
- * @param <T>
- */
-public interface EjbDescriptor<T>
-{
-
- /**
- * Gets the EJB type
- *
- * @return The EJB Bean class
- */
- public Class<T> getType();
-
- /**
- * Gets the local business interfaces of the EJB
- *
- * @return An iterator over the local business interfaces
- */
- public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces();
-
- /**
- * Gets the remote business interfaces of the EJB
- *
- * @return An iterator over the remote business interfaces
- */
- public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces();
-
- /**
- * Get the remove methods of the EJB
- *
- * @return An iterator over the remove methods
- */
- public Iterable<Method> getRemoveMethods();
-
- /**
- * Indicates if the bean is stateless
- *
- * @return True if stateless, false otherwise
- */
- public boolean isStateless();
-
- /**
- * Indicates if the bean is a EJB 3.1 Singleton
- *
- * @return True if the bean is a singleton, false otherwise
- */
- public boolean isSingleton();
-
- /**
- * Indicates if the EJB is stateful
- *
- * @return True if the bean is stateful, false otherwise
- */
- public boolean isStateful();
-
- /**
- * Indicates if the EJB is and MDB
- *
- * @return True if the bean is an MDB, false otherwise
- */
- public boolean isMessageDriven();
-
- /**
- * Gets the EJB name
- *
- * @return The name
- */
- public String getEjbName();
-
- /**
- * @return The JNDI string which can be used to lookup a proxy which
- * implements all local business interfaces
- *
- */
- public String getLocalJndiName();
-
-}
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java 2009-01-06 23:51:50 UTC (rev 799)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -19,6 +19,8 @@
import java.net.URL;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+
/**
* A container should implement this interface to allow the Web Beans RI to
* discover the Web Beans to deploy
Copied: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java (from rev 797, ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BusinessInterfaceDescriptor.java)
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java (rev 0)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -0,0 +1,42 @@
+/*
+ * 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.ejb.spi;
+
+/**
+ * Represents the business interface of an EJB
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public interface BusinessInterfaceDescriptor<T>
+{
+
+ /**
+ * Gets the business interface class
+ */
+ public Class<T> getInterface();
+
+ /**
+ * Gets the JNDI name under which the EJB is registered
+ *
+ * @return The JNDI name
+ */
+ public String getJndiName();
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java (from rev 797, ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java)
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java (rev 0)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java 2009-01-06 23:52:50 UTC (rev 800)
@@ -0,0 +1,103 @@
+/*
+ * 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.ejb.spi;
+
+import java.lang.reflect.Method;
+
+
+/**
+ * EJB metadata from the EJB descriptor
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public interface EjbDescriptor<T>
+{
+
+ /**
+ * Gets the EJB type
+ *
+ * @return The EJB Bean class
+ */
+ public Class<T> getType();
+
+ /**
+ * Gets the local business interfaces of the EJB
+ *
+ * @return An iterator over the local business interfaces
+ */
+ public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces();
+
+ /**
+ * Gets the remote business interfaces of the EJB
+ *
+ * @return An iterator over the remote business interfaces
+ */
+ public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces();
+
+ /**
+ * Get the remove methods of the EJB
+ *
+ * @return An iterator over the remove methods
+ */
+ public Iterable<Method> getRemoveMethods();
+
+ /**
+ * Indicates if the bean is stateless
+ *
+ * @return True if stateless, false otherwise
+ */
+ public boolean isStateless();
+
+ /**
+ * Indicates if the bean is a EJB 3.1 Singleton
+ *
+ * @return True if the bean is a singleton, false otherwise
+ */
+ public boolean isSingleton();
+
+ /**
+ * Indicates if the EJB is stateful
+ *
+ * @return True if the bean is stateful, false otherwise
+ */
+ public boolean isStateful();
+
+ /**
+ * Indicates if the EJB is and MDB
+ *
+ * @return True if the bean is an MDB, false otherwise
+ */
+ public boolean isMessageDriven();
+
+ /**
+ * Gets the EJB name
+ *
+ * @return The name
+ */
+ public String getEjbName();
+
+ /**
+ * @return The JNDI string which can be used to lookup a proxy which
+ * implements all local business interfaces
+ *
+ */
+ public String getLocalJndiName();
+
+}
Property changes on: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years
[webbeans-commits] Webbeans SVN: r799 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 18:51:50 -0500 (Tue, 06 Jan 2009)
New Revision: 799
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
Log:
Fix build
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-01-06 23:46:48 UTC (rev 798)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-01-06 23:51:50 UTC (rev 799)
@@ -39,7 +39,7 @@
T instance = getConstructor().newInstance(manager);
bindDecorators();
bindInterceptors();
- injectEjbAndCommonFields();
+ injectEjbAndCommonFields(instance);
injectBoundFields(instance, manager);
callInitializers(instance);
callPostConstruct(instance);
16 years
[webbeans-commits] Webbeans SVN: r798 - in ri/trunk: webbeans-ri and 15 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 18:46:48 -0500 (Tue, 06 Jan 2009)
New Revision: 798
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java
Removed:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/JpaResolver.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java
Modified:
ri/trunk/pom.xml
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/resources/spi/Naming.java
ri/trunk/webbeans-ri/pom.xml
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/PropertiesBasedBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
Log:
rationalize SPI, switch to a returning singleton on manager deserialization (and remove implements Serializable on helper classes), add AnnotatedMember and alter InjectionPointImpl to take AnnotatedMember, wire in EjbResolver to SimpleBean field injection, refactor bootstrap slightly to inject externally specified helper classes into Manager
Modified: ri/trunk/pom.xml
===================================================================
--- ri/trunk/pom.xml 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/pom.xml 2009-01-06 23:46:48 UTC (rev 798)
@@ -85,6 +85,12 @@
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ </dependency>
<dependency>
<groupId>org.scannotation</groupId>
Modified: ri/trunk/webbeans-ri/pom.xml
===================================================================
--- ri/trunk/webbeans-ri/pom.xml 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/pom.xml 2009-01-06 23:46:48 UTC (rev 798)
@@ -46,12 +46,20 @@
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
+ <optional>true</optional>
</dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>javassist</groupId>
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -54,11 +54,13 @@
import org.jboss.webbeans.bean.proxy.ProxyPool;
import org.jboss.webbeans.context.ContextMap;
import org.jboss.webbeans.ejb.EjbDescriptorCache;
+import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.event.EventManager;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.resources.spi.Naming;
+import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.util.Reflections;
/**
@@ -80,40 +82,47 @@
public static final String JNDI_KEY = "java:comp/Manager";
// The enabled deployment types from web-beans.xml
- private List<Class<? extends Annotation>> enabledDeploymentTypes;
+ private transient List<Class<? extends Annotation>> enabledDeploymentTypes;
// The Web Beans manager
- private EventManager eventManager;
+ private transient final EventManager eventManager;
// The bean resolver
- // The cache can be rebuilt at any time
- private transient Resolver resolver;
+ private transient final Resolver resolver;
// The registered contexts
- private ContextMap contextMap;
+ private transient final ContextMap contextMap;
// The client proxy pool
- private ProxyPool proxyPool;
+ private transient final ProxyPool proxyPool;
// The registered beans
- private List<Bean<?>> beans;
+ private transient List<Bean<?>> beans;
// The registered beans, mapped by implementation class
- private Map<Class<?>, Bean<?>> beanMap;
+ private transient final Map<Class<?>, Bean<?>> beanMap;
// The registered decorators
- private Set<Decorator> decorators;
+ private transient final Set<Decorator> decorators;
// The registered interceptors
- private Set<Interceptor> interceptors;
+ private transient final Set<Interceptor> interceptors;
+
+ // The EJB resolver provided by the container
+ // TODO This can't be transient!
+ private transient final EjbResolver ejbResolver;
- private EjbDescriptorCache ejbDescriptorCache;
+ private transient final EjbDescriptorCache ejbDescriptorCache;
+
+ private transient final ResourceLoader resourceLoader;
// The Naming (JNDI) access
- private Naming naming;
+ private transient final Naming naming;
/**
- * Constructor
+ * Create a new manager
*
- * @param enabledDeploymentTypes any enabled deployment types, an empty set
- * if none are specified
+ * @param ejbResolver the ejbResolver to use
*/
- public ManagerImpl()
+ public ManagerImpl(Naming naming, EjbResolver ejbResolver, ResourceLoader resourceLoader)
{
+ this.ejbResolver = ejbResolver;
+ this.naming = naming;
+ this.resourceLoader = resourceLoader;
this.beans = new CopyOnWriteArrayList<Bean<?>>();
this.beanMap = new ConcurrentHashMap<Class<?>, Bean<?>>();
this.resolver = new Resolver(this);
@@ -736,10 +745,17 @@
{
return naming;
}
-
- public void setNaming(Naming naming)
+
+ public EjbResolver getEjbResolver()
{
- this.naming = naming;
+ return ejbResolver;
}
+
+ // Serialization
+
+ protected Object readResolve()
+ {
+ return CurrentManager.rootManager();
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -25,11 +25,13 @@
import javax.annotation.PreDestroy;
import javax.webbeans.DefinitionException;
import javax.webbeans.Initializer;
+import javax.webbeans.InjectionPoint;
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.injection.InjectionPointImpl;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -90,7 +92,7 @@
T instance = constructor.newInstance(manager);
bindDecorators();
bindInterceptors();
- injectEjbAndCommonFields();
+ injectEjbAndCommonFields(instance);
injectBoundFields(instance, manager);
callInitializers(instance);
callPostConstruct(instance);
@@ -185,9 +187,23 @@
/**
* Injects EJBs and common fields
*/
- protected void injectEjbAndCommonFields()
+ protected void injectEjbAndCommonFields(T beanInstance)
{
- // Support common and EJB annotations
+ for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getEjbResolver().getEJBAnnotation()))
+ {
+ InjectionPoint injectionPoint = new InjectionPointImpl(field, this, beanInstance);
+ String name = manager.getEjbResolver().resolveEjb(injectionPoint);
+ Object ejbInstance = manager.getNaming().lookup(name, Object.class);
+ field.inject(beanInstance, ejbInstance);
+ }
+
+ for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getEjbResolver().getPersistenceContextAnnotation()))
+ {
+ InjectionPoint injectionPoint = new InjectionPointImpl(field, this, beanInstance);
+ String name = manager.getEjbResolver().resolvePersistenceUnit(injectionPoint);
+ Object puInstance = manager.getNaming().lookup(name, Object.class);
+ field.inject(beanInstance, puInstance);
+ }
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -39,7 +39,7 @@
*
* @see org.jboss.webbeans.bean.proxy.ProxyMethodHandler
*/
-public class ProxyPool implements Serializable
+public class ProxyPool
{
private static final long serialVersionUID = 9029999149357529341L;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/PropertiesBasedBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/PropertiesBasedBootstrap.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/PropertiesBasedBootstrap.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -24,8 +24,6 @@
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.resource.DefaultNaming;
-import org.jboss.webbeans.resources.spi.Naming;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.servlet.ServletBootstrap;
import org.jboss.webbeans.util.DeploymentProperties;
@@ -40,6 +38,7 @@
*/
public abstract class PropertiesBasedBootstrap extends WebBeansBootstrap
{
+
// The log provider
private static final LogProvider log = Logging.getLogProvider(ServletBootstrap.class);
@@ -101,25 +100,6 @@
}
/**
- * Initializes the naming provider
- *
- * Only safe to call once resourceloader and deployment properties are set
- */
- protected void initProperties()
- {
- Constructor<? extends Naming> namingConstructor = getClassConstructor(getDeploymentProperties(), getResourceLoader(), Naming.PROPERTY_NAME, Naming.class);
- if (namingConstructor != null)
- {
- getManager().setNaming(newInstance(namingConstructor));
- }
- else
- {
- getManager().setNaming(new DefaultNaming());
- }
- }
-
-
- /**
* Gets the deployment properties
*
* @return The deployment properties
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -30,6 +30,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -53,6 +54,7 @@
import org.jboss.webbeans.binding.InitializedBinding;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
+import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
@@ -60,6 +62,7 @@
import org.jboss.webbeans.jsf.JSFApiAbstraction;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.resources.spi.Naming;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.servlet.ServletApiAbstraction;
import org.jboss.webbeans.transaction.Transaction;
@@ -76,13 +79,20 @@
// The log provider
private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
- protected void registerManager()
+ // The Web Beans manager
+ private ManagerImpl manager;
+
+ protected void initManager(Naming naming, EjbResolver ejbResolver, ResourceLoader resourceLoader)
{
- getManager().getNaming().bind(ManagerImpl.JNDI_KEY, getManager());
- CurrentManager.setRootManager(getManager());
+ this.manager = new ManagerImpl(naming, ejbResolver, resourceLoader);
+ manager.getNaming().bind(ManagerImpl.JNDI_KEY, getManager());
+ CurrentManager.setRootManager(manager);
}
- public abstract ManagerImpl getManager();
+ public ManagerImpl getManager()
+ {
+ return manager;
+ }
protected abstract WebBeanDiscovery getWebBeanDiscovery();
@@ -140,6 +150,18 @@
{
@Override
+ protected void initConstructor()
+ {
+ // No - op, no constructor needed
+ }
+
+ @Override
+ protected void initInjectionPoints()
+ {
+ injectionPoints = Collections.emptySet();
+ }
+
+ @Override
public ManagerImpl create()
{
return managerImpl;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -37,7 +37,6 @@
*/
public class ContextMap extends ConcurrentCache<Class<? extends Annotation>, List<Context>>
{
- private static final long serialVersionUID = 1L;
/**
* Gets the dependent context
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -17,7 +17,6 @@
package org.jboss.webbeans.event;
-import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.util.HashSet;
import java.util.List;
@@ -40,16 +39,14 @@
* @author David Allen
*
*/
-public class EventManager implements Serializable
+public class EventManager
{
- private static final long serialVersionUID = 1L;
/**
* An event type -> observer list map
*/
- private class RegisteredObserversMap extends ForwardingMap<Class<?>, List<EventObserver<?>>> implements Serializable
+ private class RegisteredObserversMap extends ForwardingMap<Class<?>, List<EventObserver<?>>>
{
- private static final long serialVersionUID = 1L;
// The map delegate
private ConcurrentHashMap<Class<?>, List<EventObserver<?>>> delegate;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointImpl.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointImpl.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -27,7 +27,7 @@
import javax.webbeans.Standard;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember;
+import org.jboss.webbeans.introspector.AnnotatedMember;
/**
* The container provided implementation for InjectionPoint beans
@@ -38,7 +38,7 @@
@Dependent
public class InjectionPointImpl implements InjectionPoint
{
- private final AbstractAnnotatedMember<?, ? extends Member> memberInjectionPoint;
+ private final AnnotatedMember<?, ?> memberInjectionPoint;
private final Bean<?> bean;
private final Object beanInstance;
@@ -49,7 +49,7 @@
* @param bean The bean being injected
* @param beanInstance The instance of the bean being injected
*/
- public InjectionPointImpl(AbstractAnnotatedMember<?, ? extends Member> injectedMember, Bean<?> bean, Object beanInstance)
+ public InjectionPointImpl(AnnotatedMember<?, ?> injectedMember, Bean<?> bean, Object beanInstance)
{
this.memberInjectionPoint = injectedMember;
this.bean = bean;
@@ -83,7 +83,7 @@
public Member getMember()
{
- return this.memberInjectionPoint.getDelegate();
+ return this.memberInjectionPoint.getMember();
}
public Type getType()
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -29,7 +29,7 @@
* @author Pete Muir
*
*/
-public interface AnnotatedConstructor<T> extends AnnotatedItem<T, Constructor<T>>
+public interface AnnotatedConstructor<T> extends AnnotatedMember<T, Constructor<T>>
{
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -28,7 +28,7 @@
* @author Pete Muir
*
*/
-public interface AnnotatedField<T> extends AnnotatedItem<T, Field>
+public interface AnnotatedField<T> extends AnnotatedMember<T, Field>
{
/**
@@ -39,26 +39,46 @@
public Field getAnnotatedField();
/**
- * Injects an instance
+ * Injects into the field using the value provided by the manager.
*
- * @param instance The instance to inject
+ * @param declaringInstance The instance to inject into
* @param manager The Web Beans manager
*/
- public void inject(Object instance, Manager manager);
+ public void inject(Object declaringInstance, Manager manager);
/**
* Injects an instance
*
- * @param instance The instance to inject
- * @param manager The Web Beans manager
+ *
+ * @param declaringInstance The instance to inject into
+ * @param value The value to inject
*/
- public void injectIntoInstance(Object instance, Manager manager);
+ public void inject(Object declaringInstance, Object value);
/**
+ * Injects into the field using the value provided by the manager
+ *
+ * Unlike {@link #inject(Object, Manager)} the field injected into is
+ * discovered from the declaring instance. This is slower, but safe to use
+ * with proxies.
+ *
+ * @param declaringInstance The instance to inject into
+ * @param value The value to inject
+ */
+ public void injectIntoInstance(Object declaringInstance, Object value);
+
+ /**
* Injects an instance
*
- * @param instance The instance to inject
+ * Unlike {@link #inject(Object, Manager)} the field injected into is
+ * discovered from the declaring instance. This is slower, but safe to use
+ * with proxies.
+ *
+ * @param declaringInstance The instance to inject
+ * @param manager The Web Beans manager
*/
+ public void injectIntoInstance(Object declaringInstance, Manager manager);
+
public T get(Object instance);
/**
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.reflect.Member;
+
+public interface AnnotatedMember<T, S extends Member> extends AnnotatedItem<T, S>
+{
+
+ public S getMember();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMember.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -41,7 +41,7 @@
* @author Pete Muir
*
*/
-public interface AnnotatedMethod<T> extends AnnotatedItem<T, Method>
+public interface AnnotatedMethod<T> extends AnnotatedMember<T, Method>
{
@SuppressWarnings("unchecked")
public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Disposes.class, Observes.class, Fires.class, IfExists.class, BeforeTransactionCompletion.class, AfterTransactionCompletion.class, AfterTransactionFailure.class, AfterTransactionSuccess.class));
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -27,6 +27,7 @@
import javax.webbeans.BindingType;
import javax.webbeans.manager.Manager;
+import org.jboss.webbeans.introspector.AnnotatedMember;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
@@ -43,7 +44,7 @@
* @param <T>
* @param <S>
*/
-public abstract class AbstractAnnotatedMember<T, S extends Member> extends AbstractAnnotatedItem<T, S>
+public abstract class AbstractAnnotatedMember<T, S extends Member> extends AbstractAnnotatedItem<T, S> implements AnnotatedMember<T, S>
{
/**
* An annotation type -> list of annotations map
@@ -172,5 +173,10 @@
toString = "Abstract annotated member " + getName();
return toString;
}
+
+ public S getMember()
+ {
+ return getDelegate();
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -62,6 +62,7 @@
{
super(buildAnnotationMap(field), field);
this.field = field;
+ field.setAccessible(true);
this.declaringClass = declaringClass;
if (field.getGenericType() instanceof ParameterizedType)
{
@@ -129,6 +130,16 @@
{
Reflections.setAndWrap(getName(), instance, getValue(manager));
}
+
+ public void inject(Object instance, Object value)
+ {
+ Reflections.setAndWrap(getDelegate(), instance, value);
+ }
+
+ public void injectIntoInstance(Object instance, Object value)
+ {
+ Reflections.setAndWrap(getName(), instance, value);
+ }
@SuppressWarnings("unchecked")
public T get(Object instance)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletBootstrap.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletBootstrap.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -21,7 +21,6 @@
import javax.servlet.ServletContext;
-import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bootstrap.PropertiesBasedBootstrap;
import org.jboss.webbeans.bootstrap.SimpleResourceLoader;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
@@ -29,6 +28,9 @@
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.context.SessionContext;
+import org.jboss.webbeans.ejb.spi.EjbResolver;
+import org.jboss.webbeans.resource.DefaultNaming;
+import org.jboss.webbeans.resources.spi.Naming;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.util.DeploymentProperties;
@@ -39,8 +41,7 @@
*/
public class ServletBootstrap extends PropertiesBasedBootstrap
{
- // The Web Beans manager
- private ManagerImpl manager;
+
// The resource loader
private ResourceLoader resourceLoader;
// The discover implementation
@@ -50,8 +51,6 @@
public ServletBootstrap(ServletContext servletContext)
{
- // Create the manager
- this.manager = new ManagerImpl();
// Create a simpple resource loader based for initial loading
this.resourceLoader = new SimpleResourceLoader();
@@ -64,9 +63,8 @@
this.resourceLoader = newInstance(resourceLoaderConstructor, servletContext);
}
- // Now safe to initialize other properties and register the manager
- super.initProperties();
- super.registerManager();
+ // Now safe to initialize the manager
+ initManager(servletContext);
// Attempt to create a plugin web beans discovery
Constructor<? extends WebBeanDiscovery> webBeanDiscoveryConstructor = getClassConstructor(deploymentProperties, resourceLoader, WebBeanDiscovery.PROPERTY_NAME, WebBeanDiscovery.class, ServletContext.class);
@@ -87,6 +85,37 @@
ApplicationContext.INSTANCE.setBeanMap(new ApplicationBeanMap(servletContext));
}
+ private void initManager(ServletContext servletContext)
+ {
+ initManager(getNaming(servletContext), getEjbResolver(servletContext), getResourceLoader());
+ }
+
+ public Naming getNaming(ServletContext servletContext)
+ {
+ Constructor<? extends Naming> namingConstructor = getClassConstructor(getDeploymentProperties(), getResourceLoader(), Naming.PROPERTY_NAME, Naming.class, ServletContext.class);
+ if (namingConstructor != null)
+ {
+ return newInstance(namingConstructor, servletContext);
+ }
+ else
+ {
+ return new DefaultNaming();
+ }
+ }
+
+ public EjbResolver getEjbResolver(ServletContext servletContext)
+ {
+ Constructor<? extends EjbResolver> constructor = getClassConstructor(getDeploymentProperties(), getResourceLoader(), EjbResolver.PROPERTY_NAME, EjbResolver.class, ServletContext.class);
+ if (constructor != null)
+ {
+ return newInstance(constructor, servletContext);
+ }
+ else
+ {
+ throw new IllegalStateException("Unable to find a EjbResolver, check Web Beans is correctly installed in your container");
+ }
+ }
+
@Override
protected DeploymentProperties getDeploymentProperties()
{
@@ -105,10 +134,4 @@
return webBeanDiscovery;
}
- @Override
- public ManagerImpl getManager()
- {
- return manager;
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -17,7 +17,6 @@
package org.jboss.webbeans.util;
-import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
@@ -32,9 +31,8 @@
*
* @author Pete Muir
*/
-public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>> implements Serializable
+public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
{
- private static final long serialVersionUID = 1L;
// The backing map with the value wrapped in a Future instance
private ConcurrentHashMap<K, Future<V>> map;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -11,18 +11,20 @@
import javax.webbeans.Standard;
import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
import org.jboss.webbeans.test.mock.MockBootstrap;
import org.jboss.webbeans.test.mock.MockEjbDescriptor;
-import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.testng.annotations.BeforeMethod;
public class AbstractTest
{
- protected MockManagerImpl manager;
+ protected static final int BUILT_IN_BEANS = 3;
+
+ protected ManagerImpl manager;
protected MockBootstrap webBeansBootstrap;
public static boolean visited = false;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -26,7 +26,6 @@
import org.jboss.webbeans.test.beans.Tiger;
import org.jboss.webbeans.test.beans.Tuna;
import org.jboss.webbeans.test.ejb.valid.Hound;
-import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
import org.testng.annotations.Test;
@@ -39,7 +38,7 @@
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 1 + BUILT_IN_BEANS;
for (Bean<?> bean : beans)
{
if (bean instanceof AbstractBean)
@@ -56,7 +55,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 1 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -74,7 +73,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Tuna.class, Salmon.class, SeaBass.class, Sole.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 4 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 4 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -100,7 +99,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TarantulaProducer.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 2 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 2 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -122,7 +121,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 4 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 4 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -148,7 +147,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 8 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 8 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -181,7 +180,7 @@
{
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TarantulaProducer.class));
webBeansBootstrap.boot();
- assert manager.getBeans().size() == 2 + MockManagerImpl.BUILT_IN_BEANS;
+ assert manager.getBeans().size() == 2 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : manager.getBeans())
{
@@ -203,7 +202,7 @@
{
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
webBeansBootstrap.boot();
- assert manager.getBeans().size() == 8 + MockManagerImpl.BUILT_IN_BEANS;
+ assert manager.getBeans().size() == 8 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : manager.getBeans())
{
@@ -244,7 +243,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class))));
webBeansBootstrap.boot();
- assert manager.getBeans().size() == 8 + MockManagerImpl.BUILT_IN_BEANS;
+ assert manager.getBeans().size() == 8 + BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : manager.getBeans())
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -40,7 +40,6 @@
import org.jboss.webbeans.test.ejb.invalid.YorkshireTerrier;
import org.jboss.webbeans.test.ejb.valid.BullTerrier;
import org.jboss.webbeans.test.ejb.valid.Pomeranian;
-import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
import org.testng.annotations.Test;
@@ -327,7 +326,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Pomeranian.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 1 + BUILT_IN_BEANS;
Set<Observer<String>> observers = manager.resolveObservers("An event");
assert observers.size() == 2;
}
@@ -339,7 +338,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TibetanTerrier.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 1 + BUILT_IN_BEANS;
Set<Observer<String>> observers = manager.resolveObservers("An event");
assert observers.size() == 1;
}
@@ -382,7 +381,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Pomeranian.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 1 + BUILT_IN_BEANS;
// Resolve registered observers with an event containing no binding types
Set<Observer<String>> resolvedObservers = manager.resolveObservers("A new event");
@@ -584,7 +583,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TeaCupPomeranian.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 1 + BUILT_IN_BEANS;
manager.fireEvent("Another event");
}
@@ -595,7 +594,7 @@
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TeaCupPomeranian.class));
webBeansBootstrap.boot();
List<Bean<?>> beans = manager.getBeans();
- assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
+ assert beans.size() == 1 + BUILT_IN_BEANS;
manager.fireEvent(new Integer(1));
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -43,7 +43,6 @@
import org.jboss.webbeans.test.bindings.BindingTypeWithBindingArrayTypeMemberAnnotationLiteral;
import org.jboss.webbeans.test.bindings.ChunkyAnnotationLiteral;
import org.jboss.webbeans.test.bindings.ExpensiveAnnotationLiteral;
-import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.testng.annotations.Test;
@SpecVersion("20081206")
@@ -277,7 +276,7 @@
Set<Bean<Object>> beans = manager.resolveByType(Object.class);
- assert manager.resolveByType(Object.class).size() == 3 + MockManagerImpl.BUILT_IN_BEANS;
+ assert manager.resolveByType(Object.class).size() == 3 + BUILT_IN_BEANS;
assert manager.resolveByType(Object.class).contains(plaiceBean);
assert manager.resolveByType(Object.class).contains(salmonBean);
assert manager.resolveByType(Object.class).contains(soleBean);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -38,7 +38,6 @@
import org.jboss.webbeans.test.beans.nonBeans.ServletRequestListenerBean;
import org.jboss.webbeans.test.beans.nonBeans.UIComponentBean;
import org.jboss.webbeans.test.bindings.SynchronousAnnotationLiteral;
-import org.jboss.webbeans.test.mock.MockManagerImpl;
import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
import org.testng.annotations.Test;
@@ -90,7 +89,7 @@
{
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(FilterBean.class, HttpSessionListenerBean.class, ServletBean.class, ServletContextListenerBean.class, ServletRequestListenerBean.class)), null, new HashSet<Class<?>>()));
webBeansBootstrap.boot();
- assert manager.getBeans().size() == MockManagerImpl.BUILT_IN_BEANS;
+ assert manager.getBeans().size() == BUILT_IN_BEANS;
}
@Test
@@ -98,7 +97,7 @@
{
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(EnterpriseBeanWebBean.class)), null, new HashSet<Class<?>>()));
webBeansBootstrap.boot();
- assert manager.getBeans().size() == MockManagerImpl.BUILT_IN_BEANS;
+ assert manager.getBeans().size() == BUILT_IN_BEANS;
}
@Test
@@ -106,7 +105,7 @@
{
webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(UIComponentBean.class)), null, new HashSet<Class<?>>()));
webBeansBootstrap.boot();
- assert manager.getBeans().size() == MockManagerImpl.BUILT_IN_BEANS;
+ assert manager.getBeans().size() == BUILT_IN_BEANS;
}
@Test(groups="stub")
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -1,5 +1,11 @@
package org.jboss.webbeans.test.mock;
+import java.lang.annotation.Annotation;
+
+import javax.ejb.EJB;
+import javax.persistence.PersistenceContext;
+import javax.webbeans.InjectionPoint;
+
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.context.ApplicationContext;
@@ -7,29 +13,74 @@
import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
+import org.jboss.webbeans.ejb.spi.EjbResolver;
+import org.jboss.webbeans.resources.spi.Naming;
import org.jboss.webbeans.resources.spi.ResourceLoader;
public class MockBootstrap extends WebBeansBootstrap
{
+ private static final Naming MOCK_NAMING = new Naming()
+ {
+
+ public void bind(String key, Object value)
+ {
+ // no-op
+ }
+
+ public <T> T lookup(String name, Class<? extends T> expectedType)
+ {
+ // No-op
+ return null;
+ }
+
+ };
+
+ private static final EjbResolver MOCK_EJB_RESOLVER = new EjbResolver()
+ {
+
+ public Class<? extends Annotation> getEJBAnnotation()
+ {
+ return EJB.class;
+ }
+
+ public Class<? extends Annotation> getPersistenceContextAnnotation()
+ {
+ return PersistenceContext.class;
+ }
+
+ public String resolveEjb(InjectionPoint injectionPoint)
+ {
+ // TODO Implement EJB resolution for Unit tests
+ return null;
+ }
+
+ public String resolvePersistenceUnit(InjectionPoint injectionPoint)
+ {
+ // TODO Implement PU resolution for Unit tests
+ return null;
+ }
+
+
+
+ };
+
private WebBeanDiscovery webBeanDiscovery;
private ResourceLoader resourceLoader;
- private MockManagerImpl manager;
public MockBootstrap()
{
- this.manager = new MockManagerImpl();
this.resourceLoader = new MockResourceLoader();
- registerManager();
+ initManager(MOCK_NAMING, MOCK_EJB_RESOLVER, resourceLoader);
registerStandardBeans();
// Set up the mock contexts
- manager.addContext(RequestContext.INSTANCE);
+ getManager().addContext(RequestContext.INSTANCE);
SessionContext.INSTANCE.setBeanMap(new SimpleBeanMap());
- manager.addContext(SessionContext.INSTANCE);
+ getManager().addContext(SessionContext.INSTANCE);
ApplicationContext.INSTANCE.setBeanMap(new SimpleBeanMap());
- manager.addContext(ApplicationContext.INSTANCE);
- manager.addContext(DependentContext.INSTANCE);
+ getManager().addContext(ApplicationContext.INSTANCE);
+ getManager().addContext(DependentContext.INSTANCE);
}
protected void registerStandardBeans()
@@ -53,11 +104,5 @@
{
return resourceLoader;
}
-
- @Override
- public MockManagerImpl getManager()
- {
- return manager;
- }
}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -1,33 +0,0 @@
-package org.jboss.webbeans.test.mock;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.resources.spi.Naming;
-
-public class MockManagerImpl extends ManagerImpl
-{
-
- private Naming naming = new Naming()
- {
-
- public void bind(String key, Object value)
- {
- // no-op
- }
-
- public <T> T lookup(String name, Class<? extends T> expectedType)
- {
- // No-op
- return null;
- }
-
- };
-
- public static int BUILT_IN_BEANS = 3;
-
- @Override
- public Naming getNaming()
- {
- return naming;
- }
-
-}
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -1,5 +1,9 @@
package org.jboss.webbeans.ejb.spi;
+import java.lang.annotation.Annotation;
+
+import javax.webbeans.InjectionPoint;
+
/**
* A container should implement this interface to allow the Web Beans RI to
* resolve EJBs and JPA persistence units
@@ -9,41 +13,27 @@
*/
public interface EjbResolver
{
+
+ public static final String PROPERTY_NAME = EjbResolver.class.getName();
+
/**
- * Resolve the EJB for the given parameters
+ * Resolve the JNDI name for the @EJB injection point
*
- * @param name
- * The logical name of the ejb reference within the declaring
- * component's (java:comp/env) environment.
- * @param beanName
- * The ejb-name of the Enterprise Java Bean to which this reference
- * is mapped. Only applicable if the target EJB is defined within
- * the same application or stand-alone module as the declaring
- * component.
- * @param beanInterface
- * Holds one of the following interface types of the target EJB : [
- * Local business interface, Remote business interface, Local Home
- * interface, Remote Home interface ]
- * @param mappedName
- * The product specific name of the EJB component to which this ejb
- * reference should be mapped. This mapped name is often a global
- * JNDI name, but may be a name of any form. Application servers
- * are not required to support any particular form or type of
- * mapped name, nor the ability to use mapped names. The mapped
- * name is product-dependent and often installation-dependent. No
- * use of a mapped name is portable.
- * @return
+ * @param injectionPoint The injection point metadata
+ * @return the JNDI name
*/
- public Object resolveEjb(String name, String beanName, Class<?> beanInterface, String mappedName);
+ public String resolveEjb(InjectionPoint injectionPoint);
/**
- * Resolve the persistence unit for the given peristence unit name
+ * Resolve the JNDI name for the @PersistenceContext injection point
*
- * @param persistenceUnitName
- * the name of the persistence unit to resolve, if null, the
- * default persistence unit for the application should be resolved
- * @return the resolved persistence unit
+ * @param injectionPoint The injection point metadata
+ * @return the JNDI name
*/
- public Object resolvePersistenceUnit(String persistenceUnitName);
+ public String resolvePersistenceUnit(InjectionPoint injectionPoint);
+ public Class<? extends Annotation> getEJBAnnotation();
+
+ public Class<? extends Annotation> getPersistenceContextAnnotation();
+
}
Deleted: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/JpaResolver.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/JpaResolver.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/JpaResolver.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -1,23 +0,0 @@
-package org.jboss.webbeans.ejb.spi;
-
-/**
- * A container should implement this interface to allow the Web Beans RI to
- * resolve JPA persistence units
- *
- * @author Pete Muir
- *
- */
-public interface JpaResolver
-{
-
- /**
- * Resolve the persistence unit for the given peristence unit name
- *
- * @param persistenceUnitName
- * the name of the persistence unit to resolve, if null, the
- * default persistence unit for the application should be resolved
- * @return the resolved persistence unit
- */
- public Object resolvePersistenceUnit(String persistenceUnitName);
-
-}
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/resources/spi/Naming.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/resources/spi/Naming.java 2009-01-06 23:37:27 UTC (rev 797)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/resources/spi/Naming.java 2009-01-06 23:46:48 UTC (rev 798)
@@ -17,10 +17,7 @@
package org.jboss.webbeans.resources.spi;
-import java.io.Serializable;
-
-
-public interface Naming extends Serializable
+public interface Naming
{
public static final String PROPERTY_NAME = Naming.class.getName();
16 years
[webbeans-commits] Webbeans SVN: r797 - ri/trunk/webbeans-api/src/main/java/javax/webbeans.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 18:37:27 -0500 (Tue, 06 Jan 2009)
New Revision: 797
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/ContextNotActiveException.java
Log:
Javadoc
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/ContextNotActiveException.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/ContextNotActiveException.java 2009-01-06 23:12:31 UTC (rev 796)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/ContextNotActiveException.java 2009-01-06 23:37:27 UTC (rev 797)
@@ -1,24 +1,28 @@
/*
-* 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.
-*/
+ * 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 javax.webbeans;
/**
- * This exception is thrown if an invocation is performed on an inactive scope.
+ * A ContextNotActiveException is thrown if at a particular point in the
+ * execution of the program the scope is inactive with respect to the current
+ * thread. When the scope is inactive, any invocation of the get() from the
+ * current thread upon the Context object for that scope results in a
+ * ContextNotActiveException.
*
* @author Pete Muir
* @author Shane Bryzak
@@ -26,25 +30,25 @@
public class ContextNotActiveException extends ExecutionException
{
-
+
public ContextNotActiveException()
{
super();
}
-
+
public ContextNotActiveException(String message)
{
super(message);
}
-
+
public ContextNotActiveException(Throwable cause)
{
super(cause);
}
-
+
public ContextNotActiveException(String message, Throwable cause)
{
super(message, cause);
}
-
+
}
16 years
[webbeans-commits] Webbeans SVN: r796 - ri/trunk/webbeans-api/src/main/java/javax/webbeans.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 18:12:31 -0500 (Tue, 06 Jan 2009)
New Revision: 796
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/AmbiguousDependencyException.java
Log:
Javadoc
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/AmbiguousDependencyException.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/AmbiguousDependencyException.java 2009-01-06 23:07:39 UTC (rev 795)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/AmbiguousDependencyException.java 2009-01-06 23:12:31 UTC (rev 796)
@@ -15,33 +15,36 @@
* limitations under the License.
*/
-
package javax.webbeans;
/**
+ * An AmbiguousDependencyException is thrown when within the set of enabled Web
+ * Beans with the API type and bind- ing types declared there exists no unique
+ * Web Bean with a higher precedence than all other Web Beans in the set.
*
+ *
* @author Pete Muir
*/
public class AmbiguousDependencyException extends DeploymentException
{
-
+
public AmbiguousDependencyException()
{
}
-
+
public AmbiguousDependencyException(String message, Throwable throwable)
{
super(message, throwable);
}
-
+
public AmbiguousDependencyException(String message)
{
super(message);
}
-
+
public AmbiguousDependencyException(Throwable throwable)
{
super(throwable);
}
-
+
}
16 years
[webbeans-commits] Webbeans SVN: r795 - ri/trunk/webbeans-api/src/main/java/javax/webbeans.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 18:07:39 -0500 (Tue, 06 Jan 2009)
New Revision: 795
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/Instance.java
Log:
Javadoc
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/Instance.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/Instance.java 2009-01-06 22:59:22 UTC (rev 794)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/Instance.java 2009-01-06 23:07:39 UTC (rev 795)
@@ -1,19 +1,19 @@
/*
-* 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.
-*/
+ * 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 javax.webbeans;
@@ -25,10 +25,25 @@
* @author Gavin King
*
* @param <T>
-* the type of the event object
+ * the type of the event object
*/
public interface Instance<T>
{
- public T get(Annotation... bindings);
+ /**
+ * Get an instance of a Web Bean of the specified type.
+ *
+ * Additional binding annotations may be specified at the injection point.
+ *
+ * @param bindings
+ * Additional binding types
+ * @return an instance of a Web Bean of the specified type
+ * @throws DuplicateBindingTypeException
+ * if two instances of the same binding type are passed
+ * @throws IllegalArgumentException
+ * if an instance of an annotation that is not a binding type is
+ * passed
+ *
+ */
+ public T get(Annotation... bindings);
}
16 years
[webbeans-commits] Webbeans SVN: r794 - ri/trunk/webbeans-api/src/main/java/javax/webbeans.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 17:59:22 -0500 (Tue, 06 Jan 2009)
New Revision: 794
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java
Log:
Javadoc
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java 2009-01-06 22:43:56 UTC (rev 793)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/InjectionPoint.java 2009-01-06 22:59:22 UTC (rev 794)
@@ -1,19 +1,19 @@
/*
-* 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.
-*/
+ * 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 javax.webbeans;
@@ -24,13 +24,95 @@
import javax.webbeans.manager.Bean;
-public interface InjectionPoint {
- public Type getType();
- public Set<Annotation> getBindingTypes();
- public Object getInstance();
- public Bean<?> getBean();
- public Member getMember();
- public <T extends Annotation> T getAnnotation(Class<T> annotationType);
- public Annotation[] getAnnotations();
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
-}
+/**
+ *
+ * Provides access to metadata about the injection point into which a dependent
+ * object is injected.
+ *
+ * @author Gavin King
+ * @author Pete Muir
+ */
+public interface InjectionPoint
+{
+
+ /**
+ * Get the declared type of injection point
+ *
+ * If the injection point is declared in XML, the type and binding types are
+ * determined according to Section 10.8, �Specifying API types and binding
+ * types�.
+ *
+ * @return the declared type of the injection point
+ */
+ public Type getType();
+
+ /**
+ * Get the declared binding types of the injection point
+ *
+ * If the injection point is declared in XML, the type and binding types are
+ * determined according to Section 10.8, �Specifying API types and binding
+ * types�.
+ *
+ * @return the declared binding types of the injection point
+ */
+ public Set<Annotation> getBindingTypes();
+
+ /**
+ * Get the Web Bean instance into which the dependent object was injected
+ *
+ * @return the Web Bean instance into which the dependent object was injected
+ * @throws IllegalStateException
+ * if invoked while the instance is being created or destroyed
+ */
+ public Object getInstance();
+
+ /**
+ * Get the Bean object representing the Web Bean that defines the injection
+ * point
+ *
+ * @return the Bean object representing the Web Bean that defines the
+ * injection point
+ */
+ public Bean<?> getBean();
+
+ /**
+ * Get the Field object in the case of field injection, the Method object in
+ * the case of method parameter injection or the Constructor object in the
+ * case of constructor parameter injection.
+ *
+ * @return the member being injected into
+ */
+ public Member getMember();
+
+ /**
+ * Get the annotation instance for the given annotation type of the field in
+ * the case of field injection, or annotations of the parameter in the case
+ * of method parameter or constructor parameter injection.
+ *
+ * @param <T>
+ * the type of the annotation
+ * @param annotationType
+ * the type of the annotation
+ * @return the annotation of the specified annotationType, or null if no such
+ * annotation exists
+ */
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType);
+
+ /**
+ * Get the annotations of the field in the case of field injection, or
+ * annotations of the parameter in the case of method parameter or
+ * constructor parameter injection.
+ *
+ * @return the annotations of the field
+ */
+ public Annotation[] getAnnotations();
+
+ /**
+ * Determine if the specified annotation is present on the injection point
+ *
+ * @param annotationType
+ * the type of the annotation
+ * @return true if an annotation of the specified type is present, else false
+ */
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
+}
16 years
[webbeans-commits] Webbeans SVN: r793 - in ri/trunk: webbeans-ri and 15 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-01-06 17:43:56 -0500 (Tue, 06 Jan 2009)
New Revision: 793
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/invalid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java
ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
ri/trunk/webbeans-ri/testng.xml
Log:
Preliminary support for @New Simple Bean case
removal of toDetailedString():s
Manager.resolveDecorators param Class<?> -> Type
WS, cleanups
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Bean.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -21,6 +21,8 @@
import java.lang.reflect.Type;
import java.util.Set;
+import javax.webbeans.InjectionPoint;
+
/**
* The contract between the Web Bean manager and a Web Bean. This interface
* should not be called directly by the application.
@@ -31,7 +33,6 @@
*/
public abstract class Bean<T> implements Contextual<T>
{
-
private final Manager manager;
protected Bean(Manager manager)
@@ -62,4 +63,6 @@
public abstract boolean isNullable();
+// public abstract Set<InjectionPoint> getInjectionPoints();
+
}
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/manager/Manager.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -19,6 +19,7 @@
import java.io.InputStream;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
import java.util.List;
import java.util.Set;
@@ -81,6 +82,6 @@
public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings);
- public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation... bindings);
+ public List<Decorator> resolveDecorators(Set<Type> types, Annotation... bindings);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -60,7 +60,6 @@
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.resources.spi.Naming;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
/**
* Implementation of the Web Beans Manager.
@@ -175,7 +174,8 @@
*/
public <T> Set<AnnotatedMethod<Object>> resolveDisposalMethods(Class<T> apiType, Annotation... bindings)
{
- return new HashSet<AnnotatedMethod<Object>>();
+ //TODO Implement disposal methods
+ return Collections.emptySet();
}
/**
@@ -634,7 +634,7 @@
/**
* Resolves a list of decorators based on API types and binding types
- *
+ * Os
* @param types The set of API types to match
* @param bindingTypes The binding types to match
* @return A list of matching decorators
@@ -642,7 +642,7 @@
* @see javax.webbeans.manager.Manager#resolveDecorators(java.util.Set,
* java.lang.annotation.Annotation[])
*/
- public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation... bindings)
+ public List<Decorator> resolveDecorators(Set<Type> types, Annotation... bindings)
{
return resolver.resolveDecorators(types, bindings);
}
@@ -696,21 +696,6 @@
return buffer.toString();
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append(Strings.collectionToString("Enabled deployment types: ", getEnabledDeploymentTypes()));
- buffer.append(eventManager.toString() + "\n");
- buffer.append(MetaDataCache.instance().toString() + "\n");
- buffer.append(resolver.toString() + "\n");
- buffer.append(contextMap.toString() + "\n");
- buffer.append(proxyPool.toString() + "\n");
- buffer.append(Strings.collectionToString("Registered beans: ", getBeans()));
- buffer.append(Strings.collectionToString("Registered decorators: ", decorators));
- buffer.append(Strings.collectionToString("Registered interceptors: ", interceptors));
- return buffer.toString();
- }
-
public Manager parse(InputStream xmlStream)
{
// TODO Implement XML parsing
@@ -732,30 +717,6 @@
{
throw new UnserializableDependencyException(bean + " is not serializable or has unserializable dependencies");
}
- // // TODO: Not that pretty. Can this logic be moved to the
- // isSerializable()
- // // of SimpleBean and EnterpriseBean or are they too strict there?
- // if (bean instanceof EnterpriseBean)
- // {
- // boolean stateful =
- // getEjbDescriptorCache().containsKey(((EnterpriseBean<?>)
- // bean).getType());
- // if (stateful && !bean.isSerializable())
- // {
- // throw new UnserializableDependencyException(bean +
- // " is not serializable or has unserializable dependencies");
- // }
- // }
- // else if (bean instanceof SimpleBean)
- // {
- // boolean passivating =
- // MetaDataCache.instance().getScopeModel(bean.getScopeType()).isPassivating();
- // if (passivating && !bean.isSerializable())
- // {
- // throw new UnserializableDependencyException(bean +
- // " is not serializable or has unserializable dependencies");
- // }
- // }
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -18,6 +18,7 @@
package org.jboss.webbeans;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -360,10 +361,10 @@
* @param bindingTypes The binding types to match
* @return The set of matching decorators
*/
- public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation[] bindingTypes)
+ public List<Decorator> resolveDecorators(Set<Type> types, Annotation[] bindingTypes)
{
// TODO Implement decorators
- return null;
+ return Collections.emptyList();
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -48,7 +48,6 @@
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.model.MergedStereotypes;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
/**
* An abstract bean representation common for all beans
@@ -559,22 +558,4 @@
{
return "AbstractBean " + getName();
}
-
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AbstractBean:\n");
- buffer.append("Name: " + name + "\n");
- buffer.append("Type: " + type + "\n");
- buffer.append("Scope type " + scopeType.toString() + "\n");
- buffer.append("Deployment type: " + deploymentType.toString() + "\n");
- buffer.append("Primitive : " + primitive + "\n");
- buffer.append("Declared bean type: " + (declaredBeanType == null ? "null" : declaredBeanType.toString()) + "\n");
- buffer.append(Strings.collectionToString("Binding types: ", getBindingTypes()));
- buffer.append(Strings.collectionToString("API types: ", getTypes()));
- buffer.append(Strings.collectionToString("Injection points: ", getInjectionPoints()));
- buffer.append(mergedStereotypes.toString() + "\n");
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -26,7 +26,6 @@
import javax.webbeans.Dependent;
import javax.webbeans.Destructor;
import javax.webbeans.Disposes;
-import javax.webbeans.IllegalProductException;
import javax.webbeans.Initializer;
import javax.webbeans.Observes;
import javax.webbeans.Produces;
@@ -40,9 +39,7 @@
import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -315,18 +312,6 @@
return "AbstractClassBean " + getName();
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AbstractClassBean:\n");
- buffer.append(super.toString() + "\n");
- buffer.append("Annotated item: " + annotatedItem.toString() + "\n");
- buffer.append(Strings.collectionToString("Initializer methods: ", getInitializerMethods()));
- buffer.append(Strings.collectionToString("Injectable fields: ", getInjectableFields()));
- buffer.append(Strings.collectionToString("Producer methods: ", getProducerMethods()));
- return buffer.toString();
- }
-
@Override
/*
* Gets the default deployment type
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/BeanFactory.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -130,7 +130,7 @@
{
return new EventBean<T, S>(field, manager);
}
-
+
/**
* Creates an instance Web Bean
*
@@ -143,7 +143,7 @@
{
return new InstanceBean<T, S>(field, manager);
}
-
+
/**
* Creates an observer
*
@@ -157,4 +157,9 @@
return new ObserverImpl<T>(method, declaringBean, manager);
}
+ public static <T> NewSimpleBean<T> createNewSimpleBean(Class<T> type, ManagerImpl manager)
+ {
+ return new NewSimpleBean<T>(type, manager);
+ }
+
}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewBean.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,62 @@
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.Standard;
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Manager;
+
+import org.jboss.webbeans.binding.NewBinding;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+
+public class NewBean<T> extends ForwardingBean<T>
+{
+ private AbstractClassBean<T> wrappedBean;
+
+ public NewBean(AbstractClassBean<T> wrappedBean, Manager manager)
+ {
+ super(manager);
+ this.wrappedBean = wrappedBean;
+ }
+
+ @Override
+ protected Bean<T> delegate()
+ {
+ return wrappedBean;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Standard.class;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ public Set<AnnotatedItem<?, ?>> getInjectionPoints()
+ {
+ return wrappedBean.getInjectionPoints();
+ }
+
+ @Override
+ public Set<Annotation> getBindingTypes()
+ {
+ return new HashSet<Annotation>(Arrays.asList(new NewBinding()));
+ }
+
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,96 @@
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.MetaDataCache;
+import org.jboss.webbeans.binding.NewBinding;
+import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+public class NewSimpleBean<T> extends SimpleBean<T>
+{
+ private static Set<Annotation> NEW_BINDING_SET = new HashSet<Annotation>(Arrays.asList(new NewBinding()));
+
+ public NewSimpleBean(Class<T> type, ManagerImpl manager)
+ {
+ super(type, manager);
+ }
+
+ @Override
+ public T create()
+ {
+ try
+ {
+ DependentContext.INSTANCE.setActive(true);
+ boolean passivating = MetaDataCache.instance().getScopeModel(getScopeType()).isPassivating();
+ if (passivating)
+ {
+ checkProducedInjectionPoints();
+ }
+ T instance = getConstructor().newInstance(manager);
+ bindDecorators();
+ bindInterceptors();
+ injectEjbAndCommonFields();
+ injectBoundFields(instance, manager);
+ callInitializers(instance);
+ callPostConstruct(instance);
+ return instance;
+ }
+ finally
+ {
+ DependentContext.INSTANCE.setActive(false);
+ }
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Standard.class;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<AnnotatedMethod<Object>> getObserverMethods()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<AnnotatedField<Object>> getProducerFields()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<AnnotatedMethod<Object>> getProducerMethods()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<Annotation> getBindingTypes()
+ {
+ return NEW_BINDING_SET;
+ }
+
+}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -408,17 +408,6 @@
return buffer.toString();
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("SimpleBean\n");
- buffer.append(super.toString() + "\n");
- buffer.append("Constructor: " + constructor.toString() + "\n");
- buffer.append("Post-construct: " + (postConstruct == null ? "null" : postConstruct.toString()) + "\n");
- buffer.append("Pre-destroy: " + (preDestroy == null ? "null" : preDestroy.toString()) + "\n");
- return buffer.toString();
- }
-
/**
* Indicates if the bean is serializable
*
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -41,8 +41,8 @@
*/
public class ProxyPool implements Serializable
{
-
-
+ private static final long serialVersionUID = 9029999149357529341L;
+
/**
* A container/cache for previously created proxies
*
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/binding/NewBinding.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,28 @@
+/*
+ * 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.binding;
+
+import javax.webbeans.AnnotationLiteral;
+import javax.webbeans.New;
+
+/**
+ * Annotation literal for @Current
+ *
+ * @author Pete Muir
+ */
+public class NewBinding extends AnnotationLiteral<New> implements New {}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -57,7 +57,6 @@
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.jsf.JSFApiAbstraction;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/ContextMap.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -27,7 +27,6 @@
import javax.webbeans.manager.Context;
import org.jboss.webbeans.util.ConcurrentCache;
-import org.jboss.webbeans.util.Strings;
/**
* A map from a scope to a list of contexts
@@ -126,11 +125,6 @@
return "ContextMap holding " + delegate().size() + " contexts: " + delegate().keySet();
}
- public String toDetailedString()
- {
- return Strings.mapToString("ContextMap (scope type -> context list): ", delegate());
- }
-
/**
* Adds a context under a scope type
*
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/beanmap/SimpleBeanMap.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -26,7 +26,6 @@
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Strings;
import com.google.common.collect.ForwardingMap;
@@ -136,9 +135,4 @@
return "holding " + delegate.size() + " instances";
}
- public String toDetailedString()
- {
- return Strings.mapToString("SimpleBeanMap (bean -> instance): ", delegate);
- }
-
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -449,16 +449,6 @@
return toString;
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AbstractAnnotatedItem:\n");
- buffer.append(Strings.collectionToString("Annotations: ", getAnnotations()));
- buffer.append(annotationMap == null ? "" : (annotationMap.toString() + "\n"));
- buffer.append(metaAnnotationMap == null ? "" : (metaAnnotationMap.toString()) + "\n");
- return buffer.toString();
- }
-
/**
* Gets the binding types of the item
*
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -173,15 +173,4 @@
return toString;
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AbstractAnnotatedMember:\n");
- buffer.append(super.toString() + "\n");
- buffer.append("Final: " + isFinal() + "\n");
- buffer.append("Static: " + isStatic() + "\n");
- buffer.append("Name: " + getName() + "\n");
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -126,16 +126,4 @@
return toString;
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AbstractAnnotatedType:\n");
- buffer.append(super.toString() + "\n");
- buffer.append("Superclass: " + (superclass == null ? "" : superclass.toString()) + "\n");
- buffer.append("Name: " + getName() + "\n");
- buffer.append("Final: " + isFinal() + "\n");
- buffer.append("Static: " + isStatic() + "\n");
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -185,20 +185,8 @@
{
return toString;
}
-// toString = "Annotated annotation " + Names.annotation2String(getDelegate());
return toString;
}
-
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedConstructorImpl:\n");
- buffer.append(super.toString() + "\n");
- buffer.append("Class: " + clazz.toString() + "\n");
- buffer.append(Strings.collectionToString("Members: ", getMembers()));
- buffer.append(annotatedMembers == null ? "" : (annotatedMembers.toString() + "\n"));
- return buffer.toString();
- }
public Class<T> getDelegate()
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -532,23 +532,5 @@
toString = "Annotated class " + Names.class2String(getDelegate());
return toString;
}
-
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedConstructorImpl:\n");
- buffer.append(super.toString() + "\n");
- buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
- buffer.append("Class: " + clazz.toString() + "\n");
- buffer.append(Strings.collectionToString("Fields: ", getFields()));
- buffer.append(Strings.collectionToString("Methods: ", methods));
- buffer.append(Strings.collectionToString("Constructors: ", getConstructors()));
- buffer.append(annotatedConstructors == null ? "" : (annotatedConstructors.toString() + "\n"));
- buffer.append(annotatedFields == null ? "" : (annotatedFields.toString() + "\n"));
- buffer.append(annotatedMethods == null ? "" : (annotatedMethods.toString() + "\n"));
- buffer.append(constructorsByArgumentMap == null ? "" : (constructorsByArgumentMap.toString() + "\n"));
- buffer.append(metaAnnotatedFields == null ? "" : (metaAnnotatedFields.toString() + "\n"));
- return buffer.toString();
- }
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -22,12 +22,10 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.webbeans.ExecutionException;
-import javax.webbeans.IllegalProductException;
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
@@ -35,8 +33,6 @@
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
/**
* Represents an annotated constructor
@@ -270,19 +266,4 @@
return toString;
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedConstructorImpl:\n");
- buffer.append(super.toString() + "\n");
- buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
- buffer.append("Declaring class:\n");
- buffer.append(declaringClass.getName() + "[ " + declaringClass.getType() + "]" + "\n");
- buffer.append("Constructor:\n");
- buffer.append(constructor.toString() + "\n");
- buffer.append(Strings.collectionToString("Parameters: ", getParameters()));
- buffer.append(annotatedParameters.toString() + "\n");
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -20,7 +20,6 @@
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.Arrays;
import javax.webbeans.manager.Manager;
@@ -28,7 +27,6 @@
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
/**
* Represents an annotated field
@@ -178,16 +176,4 @@
return toString;
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedFieldImpl:\n");
- buffer.append(super.toString() + "\n");
- buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
- buffer.append("Declaring class:\n");
- buffer.append(declaringClass.getName() + "[ " + declaringClass.getType() + "]" + "\n");
- buffer.append("Field: " + field + "\n");
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -34,7 +34,6 @@
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
/**
* Represents an annotated method
@@ -321,20 +320,4 @@
return toString;
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedMethodImpl:\n");
- buffer.append(super.toString() + "\n");
- buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
- buffer.append(annotatedParameters == null ? "" : (annotatedParameters.toString() + "\n"));
- buffer.append("Declaring class:\n");
- buffer.append(declaringClass.getName() + "[ " + declaringClass.getType() + "]" + "\n");
- buffer.append("Method:\n");
- buffer.append(method.toString());
- buffer.append("Property name: " + propertyName + "\n");
- buffer.append(Strings.collectionToString("Parameters: ", getParameters()));
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -19,14 +19,11 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
-import java.util.Arrays;
import javax.webbeans.BindingType;
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Strings;
/**
* Represents a parameter
@@ -160,20 +157,8 @@
{
return toString;
}
- toString = toDetailedString();
return toString;
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotatedParameterImpl:\n");
- buffer.append("Type: " + type.toString() + "\n");
- buffer.append("Annotations: " + Names.annotations2String(this.getAnnotations().toArray(new Annotation[0])));
- buffer.append("Final: " + _final + "\n");
- buffer.append("Static: " + _static + "\n");
- buffer.append(Strings.collectionToString("Actual type arguments: ", Arrays.asList(getActualTypeArguments())));
- return buffer.toString();
- }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -123,13 +123,4 @@
return (isValid() ? "Valid" : "Invalid") + " annotation model for " + getType();
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("AnnotationModel:\n");
- buffer.append("Annotated annotation: " + getAnnotatedAnnotation().toString());
- buffer.append("Valid: " + isValid());
- return buffer.toString();
- }
-
}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/BindingTypeModel.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -26,7 +26,6 @@
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
/**
*
@@ -39,8 +38,6 @@
{
// The non-binding types
private Set<AnnotatedMethod<?>> nonBindingTypes;
- // The hash code
- private Integer hashCode;
/**
* Constructor
@@ -157,14 +154,4 @@
return (isValid() ? "Valid" : "Invalid") + " binding type model for " + getType() + " with non-binding types " + getNonBindingTypes();
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("BindingTypeModel:\n");
- buffer.append(super.toString());
- buffer.append("Hash code: " + hashCode);
- buffer.append(Strings.collectionToString("Non-binding types: ", getNonBindingTypes()));
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypes.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -23,7 +23,6 @@
import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
-import org.jboss.webbeans.util.Strings;
/**
* Meta model for the merged stereotype for a bean
@@ -162,21 +161,4 @@
", possible scopes " + possibleScopeTypes + " and supported scopes " + supportedScopes;
}
- /**
- * Gets a string representation of the merged stereotypes
- *
- * @return The string representation
- */
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Merged stereotypes:\n");
- buffer.append("Bean name defaulted: " + beanNameDefaulted + "\n");
- buffer.append("Possible deployment types: " + getPossibleDeploymentTypes().toString());
- buffer.append(Strings.collectionToString("Possible scope types: ", getPossibleScopeTypes()));
- buffer.append(Strings.collectionToString("Required types: ", getRequiredTypes()));
- buffer.append(Strings.collectionToString("Supported scopes: ", getSupportedScopes()));
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ScopeModel.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -85,15 +85,4 @@
return valid + normal + passivating + " scope model for " + getType();
}
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("ScopeModel:\n");
- buffer.append(super.toString());
- buffer.append("Normal: " + isNormal());
- buffer.append("Passivating: " + isPassivating());
- buffer.append("Meta-annotation: " + getMetaAnnotation().toString());
- return buffer.toString();
- }
-
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -30,8 +30,6 @@
import javax.webbeans.ScopeType;
import javax.webbeans.Stereotype;
-import org.jboss.webbeans.util.Strings;
-
/**
* A meta model for a stereotype, allows us to cache a stereotype and to
* validate it
@@ -245,21 +243,6 @@
{
return "Stereotype model with required types " + requiredTypes + " and supported scopes " + supportedScopes;
}
-
- public String toDetailedString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("StereotypeModel:\n");
- buffer.append(super.toString());
- buffer.append("Bean name defaulted: " + isBeanNameDefaulted());
- buffer.append("Default deployment type: " + getDefaultDeploymentType());
- buffer.append("Default scope type: " + getDefaultScopeType());
- buffer.append("Meta-annotation: " + getMetaAnnotation().toString());
- buffer.append(Strings.collectionToString("Interceptor bindings: ", getInterceptorBindings()));
- buffer.append(Strings.collectionToString("Required types: ", getRequiredTypes()));
- buffer.append(Strings.collectionToString("Supported scopes: ", getSupportedScopes()));
- return buffer.toString();
- }
/**
* Gets the meta-annotation type
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -10,7 +10,7 @@
public class Proxies
{
- private static class TypeInfo
+ public static class TypeInfo
{
private static final Class<?>[] EMPTY_INTERFACES_ARRAY = new Class<?>[0];
@@ -25,7 +25,7 @@
this.classes = new HashSet<Class<?>>();
}
- private Class<?> getSuperClass()
+ public Class<?> getSuperClass()
{
if (classes.isEmpty())
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -10,6 +10,9 @@
import javax.webbeans.Production;
import javax.webbeans.Standard;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.BeanFactory;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
import org.jboss.webbeans.test.mock.MockBootstrap;
@@ -31,7 +34,30 @@
manager = webBeansBootstrap.getManager();
addStandardDeploymentTypesForTests();
}
-
+
+ protected <T> AbstractClassBean<T> registerBean(Class<T> clazz)
+ {
+ AbstractClassBean<T> bean = null;
+ if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
+ {
+ bean = BeanFactory.createEnterpriseBean(clazz, manager);
+ }
+ else
+ {
+ bean = BeanFactory.createSimpleBean(clazz, manager);
+ }
+ CurrentManager.rootManager().addBean(bean);
+ return bean;
+ }
+
+ protected void registerBeans(Class<?>[] classes)
+ {
+ for (Class<?> clazz : classes)
+ {
+ registerBean(clazz);
+ }
+ }
+
@SuppressWarnings("unchecked")
protected void addStandardDeploymentTypesForTests()
{
@@ -42,17 +68,19 @@
{
manager.getEjbDescriptorCache().add(new MockEjbDescriptor<T>(clazz));
}
-
- protected byte[] serialize(Object instance) throws IOException {
+
+ protected byte[] serialize(Object instance) throws IOException
+ {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bytes);
out.writeObject(instance);
return bytes.toByteArray();
}
-
- protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
+
+ protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+ {
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
return in.readObject();
- }
-
+ }
+
}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -1,393 +0,0 @@
-package org.jboss.webbeans.test;
-
-import javax.webbeans.DefinitionException;
-
-import org.testng.annotations.Test;
-
-@SpecVersion("20081222")
-public class NewTest extends AbstractTest
-{
-
- /**
- * When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
- *
- * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
- * stereotypes, and such that � the implementation class is the
- * declared type of the injection point.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanIsDependentScoped()
- {
- assert false;
- }
-
- /**
- * When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
- *
- * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
- * stereotypes, and such that � the implementation class is the
- * declared type of the injection point.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanIsOfStandardDeploymentType()
- {
- assert false;
- }
-
- /**
- * When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
- *
- * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
- * stereotypes, and such that � the implementation class is the
- * declared type of the injection point.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanIsHasOnlyNewBinding()
- {
- assert false;
- }
-
- /**
- * When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
- *
- * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
- * stereotypes, and such that � the implementation class is the
- * declared type of the injection point.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasNoWebBeanName()
- {
- assert false;
- }
-
- /**
- * When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
- *
- * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
- * stereotypes, and such that � the implementation class is the
- * declared type of the injection point.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasNoStereotypes()
- {
- assert false;
- }
-
- /**
- * When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
- *
- * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
- * stereotypes, and such that � the implementation class is the
- * declared type of the injection point.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasImplementationClassOfInjectionPointType()
- {
- assert false;
- }
-
- /**
- * If the parameter type satisfies the definition of a simple Web Bean
- * implementation class, Section 3.2.1, �Which Java classes are simple Web
- * Beans?�, then the Web Bean is a simple Web Bean. If the parameter type
- * satisfies the definition of an enterprise Web Bean implementation class,
- * Section 3.3.2, �Which EJBs are enterprise Web Beans?�, then the Web Bean
- * is an enterprise Web Bean.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
- {
- // TODO: has to be?
- assert false;
- }
-
- /**
- * If the parameter type satisfies the definition of a simple Web Bean
- * implementation class, Section 3.2.1, �Which Java classes are simple Web
- * Beans?�, then the Web Bean is a simple Web Bean. If the parameter type
- * satisfies the definition of an enterprise Web Bean implementation class,
- * Section 3.3.2, �Which EJBs are enterprise Web Beans?�, then the Web Bean
- * is an enterprise Web Bean.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanIsEnterpriseWebBeanIfParameterTypeIsEnterpriseWebBean()
- {
- // TODO: has to be?
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasSameConstructorAsWrappedBean()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasNoObservers()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasNoProducerFields()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasNoProducerMethods()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasNoDisposalMethods()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasSameInterceptorMethodsAsWrappedBean()
- {
- assert false;
- }
-
- /**
- * Furthermore, this Web Bean: � has the same Web Bean constructor,
- * initializer methods and injected fields as a Web Bean defined using
- * annotations� that is, it has any Web Bean constructor, initializer method
- * or injected field declared by annotations that appear on the
- * implementation class, � has no observer methods, producer methods or
- * fields or disposal methods, � has the same interceptors as a Web Bean
- * defined using annotations�that is, it has all the interceptor binding
- * types declared by annotations that appear on the implementation class, and
- * � has no decorators.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewBeanHasNoDecorators()
- {
- assert false;
- }
-
- /**
- * The @New annotation or <New> element may be applied to any field of a Web
- * Bean implementation class or to any parameter of a producer method,
- * initializer method, disposal method or Web Bean constructor where the type
- * of the field or parameter is a concrete Java type which satisfies the
- * requirements of a simple Web Bean implementation class or enterprise Web
- * Bean implementation class.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewAnnotationMayBeAppliedToField()
- {
- assert false;
- }
-
- /**
- * The @New annotation or <New> element may be applied to any field of a Web
- * Bean implementation class or to any parameter of a producer method,
- * initializer method, disposal method or Web Bean constructor where the type
- * of the field or parameter is a concrete Java type which satisfies the
- * requirements of a simple Web Bean implementation class or enterprise Web
- * Bean implementation class.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewAnnotationMayBeAppliedToProducerMethodParameter()
- {
- assert false;
- }
-
- /**
- * The @New annotation or <New> element may be applied to any field of a Web
- * Bean implementation class or to any parameter of a producer method,
- * initializer method, disposal method or Web Bean constructor where the type
- * of the field or parameter is a concrete Java type which satisfies the
- * requirements of a simple Web Bean implementation class or enterprise Web
- * Bean implementation class.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewAnnotationMayBeAppliedToInitializerMethodParameter()
- {
- assert false;
- }
-
- /**
- * The @New annotation or <New> element may be applied to any field of a Web
- * Bean implementation class or to any parameter of a producer method,
- * initializer method, disposal method or Web Bean constructor where the type
- * of the field or parameter is a concrete Java type which satisfies the
- * requirements of a simple Web Bean implementation class or enterprise Web
- * Bean implementation class.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewAnnotationMayBeAppliedToConstructorMethodParameter()
- {
- assert false;
- }
-
- /**
- * If the @New binding type appears in conjunction with some other binding
- * type, or is specified for a field or parameter of a type which does not
- * satisfy the definition of a simple Web Bean implementation class or
- * enterprise Web Bean implementation class, a DefinitionException is thrown
- * by the container at deployment time.
- */
- @Test(groups = { "stub", "new" })
- @SpecAssertion(section = "3.9")
- public void testNewAnnotationCannotAppearInConjunctionWithOtherBindingType()
- {
- assert false;
- }
-
- /**
- * If the @New binding type appears in conjunction with some other binding
- * type, or is specified for a field or parameter of a type which does not
- * satisfy the definition of a simple Web Bean implementation class or
- * enterprise Web Bean implementation class, a DefinitionException is thrown
- * by the container at deployment time.
- */
- @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "3.9")
- public void testNewAnnotationCannotBeAppliedToNonWebBeanImplementationClass()
- {
- assert false;
- }
-
- /**
- * No Web Bean defined using annotations or XML may explicitly declare @New
- * as a binding type
- */
- @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
- @SpecAssertion(section = "3.9")
- public void testNewAnnotationCannotBeExplicitlyDeclared()
- {
- assert false;
- }
-}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -304,21 +304,6 @@
// System.out.println(instance.test());
}
- private void registerBeans(Class<?>[] classes)
- {
- for (Class<?> clazz : classes)
- {
- if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
- {
- CurrentManager.rootManager().addBean(BeanFactory.createEnterpriseBean(clazz, manager));
- }
- else
- {
- CurrentManager.rootManager().addBean(BeanFactory.createSimpleBean(clazz, manager));
- }
- }
- }
-
/**
* If a simple Web Bean of scope @Dependent and a non-serializable
* implementation class is injected into a stateful session bean, into a
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/LoopingProducer.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.contexts.invalid;
+
+import javax.webbeans.Current;
+import javax.webbeans.Produces;
+
+public class LoopingProducer
+{
+ @Current Violation violation;
+
+ @Produces
+ public Violation produceViolation(Violation violation) {
+ return violation;
+ }
+
+ public void ping() {
+ System.out.println(violation);
+ }
+}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/ScopeTest.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.contexts.invalid;
+
+import java.io.Serializable;
+
+import javax.webbeans.Produces;
+import javax.webbeans.SessionScoped;
+
+@SessionScoped
+public class ScopeTest implements Serializable
+{
+ public ScopeTest()
+ {
+ }
+
+ @Produces
+ public Violation makeViolation()
+ {
+ return new Violation();
+ }
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java (from rev 781, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NewTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,430 @@
+package org.jboss.webbeans.test.newbean;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.Dependent;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.bean.BeanFactory;
+import org.jboss.webbeans.bean.NewSimpleBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.binding.NewBinding;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
+import org.jboss.webbeans.test.newbean.valid.Sample;
+import org.jboss.webbeans.test.newbean.valid.WrappedBean;
+import org.jboss.webbeans.util.Proxies.TypeInfo;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081222")
+public class NewBeanTest extends AbstractTest
+{
+ private SimpleBean<WrappedBean> wrappedBean;
+ private NewSimpleBean<WrappedBean> newBean;
+
+ @BeforeMethod
+ public void initNewBean() {
+ wrappedBean = BeanFactory.createSimpleBean(WrappedBean.class, manager);
+ manager.addBean(wrappedBean);
+ newBean = BeanFactory.createNewSimpleBean(WrappedBean.class, manager);
+ manager.addBean(newBean);
+ }
+
+ /**
+ * When the built-in binding type @New is applied to an injection point, a
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
+ *
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
+ * declared type of the injection point.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanIsDependentScoped()
+ {
+ assert Dependent.class.equals(newBean.getScopeType());
+ }
+
+ /**
+ * When the built-in binding type @New is applied to an injection point, a
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
+ *
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
+ * declared type of the injection point.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanIsOfStandardDeploymentType()
+ {
+ assert Standard.class.equals(newBean.getDeploymentType());
+ }
+
+ /**
+ * When the built-in binding type @New is applied to an injection point, a
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
+ *
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
+ * declared type of the injection point.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanIsHasOnlyNewBinding()
+ {
+ assert newBean.getBindingTypes().size() == 1;
+ assert newBean.getBindingTypes().iterator().next().annotationType().equals(new NewBinding().annotationType());
+ }
+
+ /**
+ * When the built-in binding type @New is applied to an injection point, a
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
+ *
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
+ * declared type of the injection point.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasNoWebBeanName()
+ {
+ assert newBean.getName() == null;
+ }
+
+ /**
+ * When the built-in binding type @New is applied to an injection point, a
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
+ *
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
+ * declared type of the injection point.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasNoStereotypes()
+ {
+ assert false;
+ }
+
+ /**
+ * When the built-in binding type @New is applied to an injection point, a
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
+ *
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
+ * declared type of the injection point.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasImplementationClassOfInjectionPointType()
+ {
+ assert newBean.getType().equals(WrappedBean.class);
+ }
+
+ /**
+ * If the parameter type satisfies the definition of a simple Web Bean
+ * implementation class, Section 3.2.1, �Which Java classes are simple Web
+ * Beans?�, then the Web Bean is a simple Web Bean. If the parameter type
+ * satisfies the definition of an enterprise Web Bean implementation class,
+ * Section 3.3.2, �Which EJBs are enterprise Web Beans?�, then the Web Bean
+ * is an enterprise Web Bean.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
+ {
+ // TODO: has to be?
+ assert false;
+ }
+
+ /**
+ * If the parameter type satisfies the definition of a simple Web Bean
+ * implementation class, Section 3.2.1, �Which Java classes are simple Web
+ * Beans?�, then the Web Bean is a simple Web Bean. If the parameter type
+ * satisfies the definition of an enterprise Web Bean implementation class,
+ * Section 3.3.2, �Which EJBs are enterprise Web Beans?�, then the Web Bean
+ * is an enterprise Web Bean.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanIsEnterpriseWebBeanIfParameterTypeIsEnterpriseWebBean()
+ {
+ // TODO: has to be?
+ assert false;
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasSameConstructorAsWrappedBean()
+ {
+ assert wrappedBean.getConstructor().equals(newBean.getConstructor());
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
+ {
+ assert newBean.getInitializerMethods().equals(wrappedBean.getInitializerMethods());
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
+ {
+ Set<AnnotatedItem<?, ?>> wrappedBeanInjectionPoints = wrappedBean.getInjectionPoints();
+ Set<AnnotatedItem<?, ?>> newBeanInjectionPoints = newBean.getInjectionPoints();
+ assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = {"new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasNoObservers()
+ {
+ assert newBean.getObserverMethods().isEmpty();
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasNoProducerFields()
+ {
+ assert newBean.getProducerFields().isEmpty();
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasNoProducerMethods()
+ {
+ assert newBean.getProducerMethods().isEmpty();
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasNoDisposalMethods()
+ {
+ Class<?> type = TypeInfo.ofTypes(newBean.getTypes()).getSuperClass();
+ assert manager.resolveDisposalMethods(type, newBean.getBindingTypes().toArray(new Annotation[0])).isEmpty();
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasSameInterceptorMethodsAsWrappedBean()
+ {
+ assert false;
+ }
+
+ /**
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
+ * initializer methods and injected fields as a Web Bean defined using
+ * annotations� that is, it has any Web Bean constructor, initializer method
+ * or injected field declared by annotations that appear on the
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
+ * types declared by annotations that appear on the implementation class, and
+ * � has no decorators.
+ */
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewBeanHasNoDecorators()
+ {
+ Annotation[] bindingTypes = newBean.getBindingTypes().toArray(new Annotation[0]);
+ assert manager.resolveDecorators(newBean.getTypes(), bindingTypes).isEmpty();
+ }
+
+ /**
+ * The @New annotation or <New> element may be applied to any field of a Web
+ * Bean implementation class or to any parameter of a producer method,
+ * initializer method, disposal method or Web Bean constructor where the type
+ * of the field or parameter is a concrete Java type which satisfies the
+ * requirements of a simple Web Bean implementation class or enterprise Web
+ * Bean implementation class.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewAnnotationMayBeAppliedToField()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Sample.class));
+ webBeansBootstrap.boot();
+ assert manager.resolveByType(WrappedBean.class, new NewBinding()).size() == 1;
+ }
+
+ /**
+ * The @New annotation or <New> element may be applied to any field of a Web
+ * Bean implementation class or to any parameter of a producer method,
+ * initializer method, disposal method or Web Bean constructor where the type
+ * of the field or parameter is a concrete Java type which satisfies the
+ * requirements of a simple Web Bean implementation class or enterprise Web
+ * Bean implementation class.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewAnnotationMayBeAppliedToProducerMethodParameter()
+ {
+ assert false;
+ }
+
+ /**
+ * The @New annotation or <New> element may be applied to any field of a Web
+ * Bean implementation class or to any parameter of a producer method,
+ * initializer method, disposal method or Web Bean constructor where the type
+ * of the field or parameter is a concrete Java type which satisfies the
+ * requirements of a simple Web Bean implementation class or enterprise Web
+ * Bean implementation class.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewAnnotationMayBeAppliedToInitializerMethodParameter()
+ {
+ assert false;
+ }
+
+ /**
+ * The @New annotation or <New> element may be applied to any field of a Web
+ * Bean implementation class or to any parameter of a producer method,
+ * initializer method, disposal method or Web Bean constructor where the type
+ * of the field or parameter is a concrete Java type which satisfies the
+ * requirements of a simple Web Bean implementation class or enterprise Web
+ * Bean implementation class.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewAnnotationMayBeAppliedToConstructorMethodParameter()
+ {
+ assert false;
+ }
+
+ /**
+ * If the @New binding type appears in conjunction with some other binding
+ * type, or is specified for a field or parameter of a type which does not
+ * satisfy the definition of a simple Web Bean implementation class or
+ * enterprise Web Bean implementation class, a DefinitionException is thrown
+ * by the container at deployment time.
+ */
+ @Test(groups = { "stub", "new" })
+ @SpecAssertion(section = "3.9")
+ public void testNewAnnotationCannotAppearInConjunctionWithOtherBindingType()
+ {
+ assert false;
+ }
+
+ /**
+ * If the @New binding type appears in conjunction with some other binding
+ * type, or is specified for a field or parameter of a type which does not
+ * satisfy the definition of a simple Web Bean implementation class or
+ * enterprise Web Bean implementation class, a DefinitionException is thrown
+ * by the container at deployment time.
+ */
+ @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "3.9")
+ public void testNewAnnotationCannotBeAppliedToNonWebBeanImplementationClass()
+ {
+ assert false;
+ }
+
+ /**
+ * No Web Bean defined using annotations or XML may explicitly declare @New
+ * as a binding type
+ */
+ @Test(groups = { "stub", "new" }, expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "3.9")
+ public void testNewAnnotationCannotBeExplicitlyDeclared()
+ {
+ assert false;
+ }
+
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/NewBeanTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/Sample.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,28 @@
+package org.jboss.webbeans.test.newbean.valid;
+
+import javax.webbeans.Initializer;
+import javax.webbeans.New;
+import javax.webbeans.Produces;
+
+
+public class Sample
+{
+ @New
+ WrappedBean reference;
+
+ @Initializer
+ public Sample(@New WrappedBean reference)
+ {
+ }
+
+ @Initializer
+ public void init(@New WrappedBean reference)
+ {
+ }
+
+ @Produces
+ Object produce(@New WrappedBean reference)
+ {
+ return new Object();
+ }
+}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/WrappedBean.java 2009-01-06 22:43:56 UTC (rev 793)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.newbean.valid;
+
+import java.io.Serializable;
+
+import javax.webbeans.Named;
+import javax.webbeans.SessionScoped;
+
+@SessionScoped
+@Named("Fred")
+public class WrappedBean implements Serializable
+{
+ public WrappedBean() {
+
+ }
+}
Modified: ri/trunk/webbeans-ri/testng.xml
===================================================================
--- ri/trunk/webbeans-ri/testng.xml 2009-01-06 21:53:01 UTC (rev 792)
+++ ri/trunk/webbeans-ri/testng.xml 2009-01-06 22:43:56 UTC (rev 793)
@@ -37,6 +37,7 @@
<package name="org.jboss.webbeans.test.contexts"></package>
<package name="org.jboss.webbeans.examples"></package>
<package name="org.jboss.webbeans.test.ejb"></package>
+ <package name="org.jboss.webbeans.test.newbean"></package>
</packages>
</test>
16 years
[webbeans-commits] Webbeans SVN: r792 - ri/trunk.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 16:53:01 -0500 (Tue, 06 Jan 2009)
New Revision: 792
Modified:
ri/trunk/pom.xml
Log:
ws
Modified: ri/trunk/pom.xml
===================================================================
--- ri/trunk/pom.xml 2009-01-06 18:49:11 UTC (rev 791)
+++ ri/trunk/pom.xml 2009-01-06 21:53:01 UTC (rev 792)
@@ -70,7 +70,6 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
-
<version>5.8</version>
<classifier>jdk15</classifier>
</dependency>
@@ -78,7 +77,6 @@
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
-
<version>3.0</version>
</dependency>
@@ -86,7 +84,6 @@
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
-
</dependency>
<dependency>
@@ -103,7 +100,6 @@
<dependency>
<groupId>javax.servlet</groupId>
-
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
@@ -111,7 +107,6 @@
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
-
<version>1.0.1B</version>
</dependency>
@@ -137,7 +132,6 @@
<dependency>
<groupId>com.google.collections</groupId>
-
<artifactId>google-collections</artifactId>
<version>0.8</version>
</dependency>
@@ -164,7 +158,6 @@
<dependency>
<groupId>javax.el</groupId>
-
<artifactId>el-ri</artifactId>
<version>1.2</version>
</dependency>
@@ -199,7 +192,6 @@
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
-
</extensions>
<plugins>
<plugin>
@@ -208,7 +200,6 @@
<executions>
<execution>
<id>attach-sources</id>
-
<phase>verify</phase>
<goals>
<goal>jar</goal>
@@ -225,7 +216,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
-
<source>1.5</source>
<target>1.5</target>
</configuration>
@@ -233,7 +223,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
-
<version>2.2</version>
</plugin>
<plugin>
@@ -241,7 +230,6 @@
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
-
<manifest>
<addDefaultImplementationEntries>
true
@@ -262,7 +250,6 @@
<profile>
<id>coverage</id>
<activation>
-
<property>
<name>coverage</name>
</property>
@@ -271,7 +258,6 @@
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
-
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<inherited>true</inherited>
@@ -288,7 +274,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
-
<inherited>true</inherited>
<configuration>
<forkMode>once</forkMode>
@@ -307,7 +292,6 @@
<ciManagement>
<system>Hudson</system>
<url />
-
</ciManagement>
<issueManagement>
@@ -325,7 +309,6 @@
</licenses>
<scm>
-
<connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri</developerConnection>
<url>http://fisheye.jboss.org/browse/WebBeans/ri</url>
@@ -334,7 +317,6 @@
<distributionManagement>
<repository>
<!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
-
<!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
<!-- todo : replace this with direct svn access once the svnkit providers are available -->
<id>repository.jboss.org</id>
@@ -342,7 +324,6 @@
</repository>
<snapshotRepository>
<id>snapshots.jboss.org</id>
-
<name>JBoss Snapshot Repository</name>
<url>dav:https://snapshots.jboss.org/maven2</url>
</snapshotRepository>
@@ -351,7 +332,6 @@
<reporting>
<plugins>
<plugin>
-
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
@@ -359,7 +339,6 @@
<format>html</format>
<format>xml</format>
</formats>
-
<instrumentation>
<ignores>
<ignore>javax.webbeans.*</ignore>
16 years
[webbeans-commits] Webbeans SVN: r791 - ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-01-06 13:49:11 -0500 (Tue, 06 Jan 2009)
New Revision: 791
Modified:
ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java
Log:
minor rationalization
Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java 2009-01-06 18:23:50 UTC (rev 790)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java 2009-01-06 18:49:11 UTC (rev 791)
@@ -36,4 +36,14 @@
*/
public Object resolveEjb(String name, String beanName, Class<?> beanInterface, String mappedName);
+ /**
+ * Resolve the persistence unit for the given peristence unit name
+ *
+ * @param persistenceUnitName
+ * the name of the persistence unit to resolve, if null, the
+ * default persistence unit for the application should be resolved
+ * @return the resolved persistence unit
+ */
+ public Object resolvePersistenceUnit(String persistenceUnitName);
+
}
16 years