[webbeans-commits] Webbeans SVN: r554 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/servlet and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2008-12-18 15:46:57 -0500 (Thu, 18 Dec 2008)
New Revision: 554
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/GoodDoggie.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/Logging.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/UTTransaction.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java
Log:
minor stuff
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/Logging.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/Logging.java 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/log/Logging.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -24,7 +24,7 @@
return new LogImpl(category);
}
- public static Log getLog(Class clazz)
+ public static Log getLog(Class<?> clazz)
{
return new LogImpl(clazz.getName());
}
@@ -34,7 +34,7 @@
return isLog4JAvailable ? new Log4JProvider(category, wrapped) : new JDKProvider(category, wrapped);
}
- public static LogProvider getLogProvider(Class clazz)
+ public static LogProvider getLogProvider(Class<?> clazz)
{
return getLogProvider(clazz.getName(), false);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -69,7 +69,7 @@
}
/**
- * Called when the context is destroyed (application sopped)
+ * Called when the context is destroyed (application scoped)
*
* @param event The context event
*/
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/UTTransaction.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/UTTransaction.java 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/transaction/UTTransaction.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -43,11 +43,9 @@
HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
{
log.debug("committing JTA transaction");
- boolean success = false;
try
{
delegate.commit();
- success = true;
}
finally
{
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 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ConcurrentCache.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -35,19 +35,35 @@
public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
{
+ // The backing map with the value wrapped in a Future instance
private ConcurrentMap<K, Future<V>> map;
+ /**
+ * Constructor
+ */
public ConcurrentCache()
{
map = new ConcurrentHashMap<K, Future<V>>();
}
+ /**
+ * Gets the Future value from the map
+ *
+ * @param key The key to look for
+ * @return The Future instance of the value
+ */
@SuppressWarnings("unchecked")
public <T extends V> Future<T> getFuture(K key)
{
return (Future<T>) super.get(key);
}
+ /**
+ * Gets a value from the map. Blocks until it is available
+ *
+ * @param key The key to look for
+ * @return The value
+ */
@SuppressWarnings("unchecked")
public <T extends V> T getValue(K key)
{
@@ -80,6 +96,13 @@
}
}
+ /**
+ * Adds an item to the map if it's not already there
+
+ * @param key The key to place the item under
+ * @param callable The item, wrapped in a Callable instance
+ * @return The item added
+ */
@SuppressWarnings("unchecked")
public <E> E putIfAbsent(K key, Callable<E> callable)
{
@@ -119,12 +142,22 @@
}
}
+ /**
+ * Gets the delegate map
+ *
+ * @return The backing map
+ */
@Override
protected Map<K, Future<V>> delegate()
{
return map;
}
+ /**
+ * Examines and re-throws an exception
+ *
+ * @param e The exception that happened during execution
+ */
protected void rethrow(ExecutionException e)
{
if (e.getCause() instanceof RuntimeException)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -25,6 +25,7 @@
*
* @author Pete Muir
*/
+@SuppressWarnings("unchecked")
public class EnumerationIterator<T> implements Iterator<T>
{
// The enumeration
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Greyhound.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -1,9 +1,8 @@
package org.jboss.webbeans.test.ejb.invalid;
+import javax.ejb.Singleton;
import javax.webbeans.RequestScoped;
-import org.jboss.webbeans.test.annotations.Singleton;
-
@Singleton
@RequestScoped
public class Greyhound
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Husky.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -1,8 +1,8 @@
package org.jboss.webbeans.test.ejb.invalid;
+import javax.ejb.Singleton;
import javax.webbeans.ConversationScoped;
-import org.jboss.webbeans.test.annotations.Singleton;
@Singleton
@ConversationScoped
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/IrishTerrier.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -1,9 +1,8 @@
package org.jboss.webbeans.test.ejb.invalid;
+import javax.ejb.Singleton;
import javax.webbeans.SessionScoped;
-import org.jboss.webbeans.test.annotations.Singleton;
-
@Singleton
@SessionScoped
public class IrishTerrier
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/GoodDoggie.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/GoodDoggie.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/GoodDoggie.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Destructor;
+
+@Stateful
+public class GoodDoggie
+{
+ @Destructor @Remove
+ public void bye() {
+ }
+
+}
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 2008-12-18 20:35:15 UTC (rev 553)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java 2008-12-18 20:46:57 UTC (rev 554)
@@ -28,14 +28,15 @@
this.type = type;
this.ejbName = type.getSimpleName();
this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
- for (final Class<Object> clazz : type.getInterfaces())
+ for (final Class<?> clazz : type.getInterfaces())
{
localInterfaces.add(new BusinessInterfaceDescriptor<Object>()
{
+ @SuppressWarnings("unchecked")
public Class<Object> getInterface()
{
- return clazz;
+ return (Class<Object>) clazz;
}
public String getJndiName()
16 years, 1 month
[webbeans-commits] Webbeans SVN: r553 - in ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test: ejb/invalid and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2008-12-18 15:35:15 -0500 (Thu, 18 Dec 2008)
New Revision: 553
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/ejb/invalid/TibetanTerrier.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java
Log:
Fixed tests related to EJB web beans.
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 2008-12-18 19:48:16 UTC (rev 552)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java 2008-12-18 20:35:15 UTC (rev 553)
@@ -328,7 +328,7 @@
webBeansBootstrap.boot(new MockWebBeanDiscovery(Pomeranian.class));
List<Bean<?>> beans = manager.getBeans();
assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
- Set<Observer<MockManagerImpl>> observers = manager.resolveObservers(manager, new InitializedBinding());
+ Set<Observer<String>> observers = manager.resolveObservers("An event");
assert observers.size() == 2;
}
@@ -339,7 +339,7 @@
webBeansBootstrap.boot(new MockWebBeanDiscovery(TibetanTerrier.class));
List<Bean<?>> beans = manager.getBeans();
assert beans.size() == 1 + MockManagerImpl.BUILT_IN_BEANS;
- Set<Observer<MockManagerImpl>> observers = manager.resolveObservers(manager, new InitializedBinding());
+ Set<Observer<String>> observers = manager.resolveObservers("An event");
assert observers.size() == 1;
}
@@ -383,7 +383,7 @@
// Resolve registered observers with an event containing no binding types
Set<Observer<String>> resolvedObservers = manager.resolveObservers("A new event");
assert !resolvedObservers.isEmpty();
- assert resolvedObservers.size() == 1;
+ assert resolvedObservers.size() == 2;
}
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@@ -818,130 +818,130 @@
}
}
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testImplicitObserverBeanMatchesAPITypeOfInectionPoint()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testImplicitObserverBeanMatchesBindingAnnotationsOfInjectionPoint()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testImplicitObserverBeanHasStandardDeploymentType()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testImplicitObserverBeanHasDependentScope()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testFireMethodCallsManagerFireWithEventObject()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptObservable()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testFireMethodCallsManagerFireWithAllBindingAnnotationInstances()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testObserveMethodCallsManagerAddObserverWithObserverObject()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptObservable()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.6")
-// public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationInstance()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testEventObjectContainsTypeVariablesWhenResolvingFails()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testEventObjectContainsWildcardsWhenResolvingFails()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testDuplicateBindingTypesWhenResolvingFails()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testNonBindingTypeAnnotationWhenResolvingFails()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testResolvingChecksEventType()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testResolvingChecksTypeParameters()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testResolvingChecksBindingTypes()
-// {
-// assert false;
-// }
-//
-// @Test(groups = { "stub", "events" })
-// @SpecAssertion(section = "8.7")
-// public void testResolvingChecksBindingTypeMembers()
-// {
-// assert false;
-// }
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitObserverBeanMatchesAPITypeOfInectionPoint()
+ {
+ assert false;
+ }
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitObserverBeanMatchesBindingAnnotationsOfInjectionPoint()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitObserverBeanHasStandardDeploymentType()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testImplicitObserverBeanHasDependentScope()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testFireMethodCallsManagerFireWithEventObject()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptObservable()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testFireMethodCallsManagerFireWithAllBindingAnnotationInstances()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testObserveMethodCallsManagerAddObserverWithObserverObject()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptObservable()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.6")
+ public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationInstance()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testEventObjectContainsTypeVariablesWhenResolvingFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testEventObjectContainsWildcardsWhenResolvingFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testDuplicateBindingTypesWhenResolvingFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testNonBindingTypeAnnotationWhenResolvingFails()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksEventType()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksTypeParameters()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksBindingTypes()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "events" })
+ @SpecAssertion(section = "8.7")
+ public void testResolvingChecksBindingTypeMembers()
+ {
+ assert false;
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java 2008-12-18 19:48:16 UTC (rev 552)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/TibetanTerrier.java 2008-12-18 20:35:15 UTC (rev 553)
@@ -2,13 +2,11 @@
import javax.ejb.Stateless;
import javax.webbeans.Observes;
-import javax.webbeans.manager.Initialized;
-import javax.webbeans.manager.Manager;
@Stateless
public class TibetanTerrier implements Terrier
{
- public void observeInitialized(@Observes @Initialized Manager manager)
+ public void observeInitialized(@Observes String someEvent)
{
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java 2008-12-18 19:48:16 UTC (rev 552)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java 2008-12-18 20:35:15 UTC (rev 553)
@@ -3,8 +3,6 @@
import javax.ejb.Stateful;
import javax.webbeans.Named;
import javax.webbeans.Observes;
-import javax.webbeans.manager.Initialized;
-import javax.webbeans.manager.Manager;
import org.jboss.webbeans.test.annotations.Tame;
@@ -15,16 +13,12 @@
{
public static Thread notificationThread;
- public void observeInitialized(@Observes @Initialized Manager manager)
- {
- }
-
public void observeSimpleEvent(@Observes String someEvent)
{
notificationThread = Thread.currentThread();
}
- public static void staticallyObserveInitialized(@Observes @Initialized Manager manager)
+ public static void staticallyObserveEvent(@Observes String someEvent)
{
}
}
16 years, 1 month
[webbeans-commits] Webbeans SVN: r552 - in ri/trunk/webbeans-ri: src/main/java/org/jboss/webbeans and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-12-18 14:48:16 -0500 (Thu, 18 Dec 2008)
New Revision: 552
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Labrador.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/PomeranianInterface.java
Modified:
ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.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/DefaultEnterpriseBeanLookup.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/JNDI.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java
Log:
Bah, really commit
Modified: ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs 2008-12-18 19:48:16 UTC (rev 552)
@@ -1,4 +1,4 @@
-#Tue Dec 16 18:53:08 GMT 2008
+#Tue Dec 16 18:57:16 GMT 2008
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.5
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 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -49,6 +49,7 @@
import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.proxy.ProxyPool;
import org.jboss.webbeans.contexts.ContextMap;
+import org.jboss.webbeans.ejb.EjbDescriptorCache;
import org.jboss.webbeans.event.EventManager;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -87,6 +88,8 @@
private Set<Decorator> decorators;
// The registered interceptors
private Set<Interceptor> interceptors;
+
+ private EjbDescriptorCache ejbDescriptorCache;
/**
* Constructor
@@ -103,6 +106,7 @@
this.interceptors = new HashSet<Interceptor>();
this.contextMap = new ContextMap();
this.eventManager = new EventManager(this);
+ this.ejbDescriptorCache = new EjbDescriptorCache();
List<Class<? extends Annotation>> defaultEnabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
defaultEnabledDeploymentTypes.add(0, Standard.class);
@@ -629,6 +633,11 @@
{
return resolver;
}
+
+ public EjbDescriptorCache getEjbDescriptorCache()
+ {
+ return ejbDescriptorCache;
+ }
/**
* Gets a string representation
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 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -31,14 +31,13 @@
import javax.webbeans.Observes;
import javax.webbeans.Produces;
import javax.webbeans.Specializes;
-import javax.webbeans.manager.EnterpriseBeanLookup;
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.bootstrap.spi.MethodDescriptor;
import org.jboss.webbeans.contexts.DependentContext;
-import org.jboss.webbeans.ejb.EjbDescriptorCache;
+import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
@@ -83,7 +82,11 @@
protected void init()
{
super.init();
- Iterable<EjbDescriptor<T>> ejbDescriptors = EjbDescriptorCache.instance().get(getType());
+ Iterable<EjbDescriptor<T>> ejbDescriptors = manager.getEjbDescriptorCache().get(getType());
+ if (ejbDescriptors == null)
+ {
+ throw new DefinitionException("Not an EJB " + toString());
+ }
for (EjbDescriptor<T> ejbDescriptor : ejbDescriptors)
{
if (this.ejbDescriptor == null)
@@ -160,7 +163,8 @@
{
return;
}
- if (EjbDescriptorCache.instance().containsKey(getType().getSuperclass()))
+ // TODO Should also check the bean type it does contain!
+ if (!manager.getEjbDescriptorCache().containsKey(getType().getSuperclass()))
{
throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
}
@@ -171,18 +175,27 @@
*/
protected void initRemoveMethod()
{
- if (!ejbDescriptor.isStateful())
- {
- // Nothing to do for stateless enterprise beans;
- return;
- }
// >1 @Destructor
if (getAnnotatedItem().getAnnotatedMethods(Destructor.class).size() > 1)
{
throw new DefinitionException("Multiple @Destructor methods not allowed on " + getAnnotatedItem());
}
-
+
+ if (getAnnotatedItem().getAnnotatedMethods(Destructor.class).size() == 1)
+ {
+ AnnotatedMethod<?> destructorMethod = getAnnotatedItem().getAnnotatedMethods(Destructor.class).iterator().next();
+ for (MethodDescriptor removeMethod : ejbDescriptor.getRemoveMethods())
+ {
+ AnnotatedMethod<?> annotatedRemoveMethod = getAnnotatedItem().getMethod(removeMethod);
+ if (annotatedRemoveMethod != null && annotatedRemoveMethod.equals(destructorMethod))
+ {
+ this.removeMethod = destructorMethod;
+ return;
+ }
+ }
+ throw new DefinitionException("Method annotated @Destructor is not an EJB remove method on " + toString());
+ }
// <1 (0) @Destructors
Set<MethodDescriptor> noArgsRemoveMethods = getNoArgsRemoveMethods(ejbDescriptor);
if (noArgsRemoveMethods.size() == 1)
@@ -190,10 +203,10 @@
this.removeMethod = annotatedItem.getMethod(noArgsRemoveMethods.iterator().next());
return;
}
-
+
if (!getScopeType().equals(Dependent.class))
{
- throw new DefinitionException("Only @Dependent scoped enterprise beans can be without remove methods");
+ throw new DefinitionException("Only @Dependent scoped enterprise beans can be without remove methods " + toString());
}
}
@@ -210,16 +223,6 @@
}
return noArgsRemoveMethods;
}
-
- private void checkDestructorMethods()
- {
- // TODO Check that any method annotated @Destructor is actually in the remove method list
- /*
- if (removeMethod.isAnnotationPresent(Destructor.class) && !removeMethod.isAnnotationPresent(EJB.REMOVE_ANNOTATION))
- {
- throw new DefinitionException("Methods marked @Destructor must also be marked @Remove on " + removeMethod.getName());
- }*/
- }
/**
* Validates the remove method
@@ -230,7 +233,10 @@
{
return;
}
-
+ else if (ejbDescriptor.isStateless())
+ {
+ throw new DefinitionException("Can't define a remove method on SLSBs");
+ }
if (removeMethod.isAnnotationPresent(Initializer.class))
{
throw new DefinitionException("Remove methods cannot be initializers on " + removeMethod.getName());
@@ -261,7 +267,7 @@
try
{
DependentContext.INSTANCE.setActive(true);
- T instance = (T) manager.getInstanceByType(EnterpriseBeanLookup.class).lookup(ejbDescriptor.getEjbName());
+ T instance = (T) manager.getInstanceByType(DefaultEnterpriseBeanLookup.class).lookup(ejbDescriptor);
bindDecorators();
bindInterceptors();
injectEjbAndCommonFields();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/DefaultEnterpriseBeanLookup.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -18,9 +18,12 @@
package org.jboss.webbeans.ejb;
import javax.webbeans.CreationException;
+import javax.webbeans.Current;
+import javax.webbeans.Initializer;
import javax.webbeans.Standard;
import javax.webbeans.manager.EnterpriseBeanLookup;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.util.JNDI;
@@ -33,6 +36,14 @@
@Standard
public class DefaultEnterpriseBeanLookup implements EnterpriseBeanLookup
{
+
+ private ManagerImpl manager;
+
+ @Initializer
+ public DefaultEnterpriseBeanLookup(@Current ManagerImpl manager)
+ {
+ this.manager = manager;
+ }
/**
* Looks up and EJB based on the name
@@ -46,7 +57,7 @@
{
throw new NullPointerException("No EJB name supplied for lookup");
}
- return lookup(EjbDescriptorCache.instance().get(ejbName));
+ return lookup(manager.getEjbDescriptorCache().get(ejbName));
}
/**
@@ -59,9 +70,15 @@
@SuppressWarnings("unchecked")
public static <T> T lookup(EjbDescriptor<T> ejbDescriptor)
{
+ if (!ejbDescriptor.getLocalBusinessInterfaces().iterator().hasNext())
+ {
+ throw new RuntimeException("EJB must have local interface " + ejbDescriptor);
+ }
+ String jndiName = ejbDescriptor.getLocalBusinessInterfaces().iterator().next().getJndiName();
try
{
- return (T) JNDI.lookup(ejbDescriptor.getEjbName());
+ // TODO Implement enterprise proxies and select the correct jndiName
+ return (T) JNDI.lookup(jndiName);
}
catch (Exception e)
{
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 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -25,32 +25,14 @@
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
/**
- * Singleton for accessing EJB descriptors by EJB implementation class or name
+ * EJB descriptors by EJB implementation class or name
*
* @author Pete Muir
*
*/
public class EjbDescriptorCache
{
- // The singleton
- private static EjbDescriptorCache instance;
- /**
- * Accessor for the singleton
- *
- * @return The instance
- */
- public static EjbDescriptorCache instance()
- {
- return instance;
- }
-
- // Static initalizer block
- static
- {
- instance = new EjbDescriptorCache();
- }
-
// EJB name -> EJB descriptor map
private ConcurrentMap<String, EjbDescriptor<?>> ejbsByName;
// EJB implementation class -> EJB descriptors map
@@ -134,5 +116,17 @@
add(ejbDescriptor);
}
}
+
+ public void clear()
+ {
+ ejbsByBeanClass.clear();
+ ejbsByName.clear();
+ }
+
+ @Override
+ public String toString()
+ {
+ return ejbsByBeanClass + "\n" + ejbsByName;
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/JNDI.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/JNDI.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/JNDI.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -17,7 +17,16 @@
package org.jboss.webbeans.util;
+import java.util.Hashtable;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.webbeans.ExecutionException;
+
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+
/**
* Provides JNDI access abstraction
*
@@ -26,6 +35,62 @@
public class JNDI
{
+ private static final LogProvider log = Logging.getLogProvider(JNDI.class);
+ private static Hashtable initialContextProperties;
+
+ private static InitialContext initialContext;
+
+ public static InitialContext getInitialContext(Hashtable<String, String> props) throws NamingException
+ {
+ if (props==null)
+ {
+ throw new IllegalStateException("JNDI properties not initialized, Seam was not started correctly");
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("JNDI InitialContext properties:" + props);
+ }
+
+ try {
+ return props.size()==0 ?
+ new InitialContext() :
+ new InitialContext(props);
+ }
+ catch (NamingException e) {
+ log.debug("Could not obtain initial context", e);
+ throw e;
+ }
+
+ }
+
+ public static InitialContext getInitialContext() throws NamingException
+ {
+ if (initialContext == null) initInitialContext();
+
+ return initialContext;
+ }
+
+ private static synchronized void initInitialContext() throws NamingException
+ {
+ if (initialContext == null)
+ {
+ initialContext = getInitialContext(initialContextProperties);
+ }
+ }
+
+ public static void setInitialContextProperties(Hashtable initialContextProperties)
+ {
+ initialContextProperties = initialContextProperties;
+ initialContext = null;
+ }
+
+ public static Hashtable getInitialContextProperties()
+ {
+ return initialContextProperties;
+ }
+
+
/**
* Looks up a object in JNDI
*
@@ -47,7 +112,14 @@
*/
public static <T> T lookup(String name, Class<? extends T> expectedType)
{
- return null;
+ try
+ {
+ return (T) getInitialContext().lookup(name);
+ }
+ catch (NamingException e)
+ {
+ throw new ExecutionException("Error looking " + name + " up in JNDI", e);
+ }
}
public static void set(String key, Object value)
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanDeclarationTest.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -14,14 +14,16 @@
import org.jboss.webbeans.test.ejb.invalid.Boxer;
import org.jboss.webbeans.test.ejb.invalid.Bullmastiff;
import org.jboss.webbeans.test.ejb.invalid.Dachshund;
-import org.jboss.webbeans.test.ejb.invalid.GreatDane;
import org.jboss.webbeans.test.ejb.invalid.Greyhound;
import org.jboss.webbeans.test.ejb.invalid.Husky;
import org.jboss.webbeans.test.ejb.invalid.IrishTerrier;
import org.jboss.webbeans.test.ejb.invalid.Pekingese;
import org.jboss.webbeans.test.ejb.invalid.Pug;
+import org.jboss.webbeans.test.ejb.invalid.Saluki;
+import org.jboss.webbeans.test.ejb.valid.Labrador;
import org.jboss.webbeans.test.ejb.valid.Laika;
import org.jboss.webbeans.test.ejb.valid.Pitbull;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -39,6 +41,26 @@
@SuppressWarnings("unused")
public class EnterpriseBeanDeclarationTest extends AbstractTest
{
+
+ @BeforeMethod
+ public void setupEjbDescriptors()
+ {
+ addToEjbCache(Pug.class);
+ addToEjbCache(Giraffe.class);
+ addToEjbCache(Husky.class);
+ addToEjbCache(Pitbull.class);
+ addToEjbCache(IrishTerrier.class);
+ addToEjbCache(Laika.class);
+ addToEjbCache(Leopard.class);
+ addToEjbCache(Labrador.class);
+ addToEjbCache(Greyhound.class);
+ addToEjbCache(Dachshund.class);
+ addToEjbCache(Bullmastiff.class);
+ addToEjbCache(Pekingese.class);
+ addToEjbCache(Boxer.class);
+ addToEjbCache(Beagle.class);
+ addToEjbCache(Saluki.class);
+ }
/**
* An EJB stateless session bean must belong to the @Dependent pseudo-scope.
@@ -116,7 +138,7 @@
@SpecAssertion(section = "3.3")
public void testSingletonWithDependentScopeOK()
{
- EnterpriseBean<GreatDane> greatDane = BeanFactory.createEnterpriseBean(GreatDane.class, manager);
+ BeanFactory.createEnterpriseBean(Labrador.class, manager);
}
/**
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanRemoveMethodTest.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -13,7 +13,6 @@
import org.jboss.webbeans.test.ejb.invalid.Armant;
import org.jboss.webbeans.test.ejb.invalid.GoldenRetriever;
import org.jboss.webbeans.test.ejb.invalid.JackRussellTerrier;
-import org.jboss.webbeans.test.ejb.invalid.Poodle;
import org.jboss.webbeans.test.ejb.invalid.Pumi;
import org.jboss.webbeans.test.ejb.invalid.Rottweiler;
import org.jboss.webbeans.test.ejb.invalid.RussellTerrier;
@@ -22,6 +21,7 @@
import org.jboss.webbeans.test.ejb.valid.Koirus;
import org.jboss.webbeans.test.ejb.valid.Toller;
import org.jboss.webbeans.test.ejb.valid.WelshCorgie;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -38,6 +38,22 @@
@SuppressWarnings("unused")
public class EnterpriseBeanRemoveMethodTest extends AbstractTest
{
+
+ @BeforeMethod
+ public void setupEjbDescriptors()
+ {
+ addToEjbCache(JackRussellTerrier.class);
+ addToEjbCache(Pumi.class);
+ addToEjbCache(RussellTerrier.class);
+ addToEjbCache(Rottweiler.class);
+ addToEjbCache(GoldenRetriever.class);
+ addToEjbCache(Armant.class);
+ addToEjbCache(Spitz.class);
+ addToEjbCache(Toller.class);
+ addToEjbCache(WelshCorgie.class);
+ addToEjbCache(Koirus.class);
+ }
+
public static boolean visited = false;
/**
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/EnterpriseBeanSpecializationTest.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -11,6 +11,7 @@
import org.jboss.webbeans.test.ejb.invalid.GreaterDane;
import org.jboss.webbeans.test.ejb.valid.Hound;
import org.jboss.webbeans.test.ejb.valid.HoundOfBaskerville;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -23,6 +24,15 @@
@SpecVersion("20081206")
public class EnterpriseBeanSpecializationTest extends AbstractTest
{
+
+ @BeforeMethod
+ public void setupEjbDescriptors()
+ {
+ addToEjbCache(HoundOfBaskerville.class);
+ addToEjbCache(Hound.class);
+ addToEjbCache(GreaterDane.class);
+ }
+
/**
* If an implementation class of an enterprise Web Bean X defined using
* annotations is annotated @Specializes, then the implementation class of X
@@ -132,7 +142,7 @@
@SpecAssertion(section = "3.3.6")
public void testAnnotationDefinedSpecializingEnterpriseBeanNotDirectlyExtendingAnnotationDefinedEnterpriseBeanFails()
{
- EnterpriseBean<GreaterDane> greaterDane = BeanFactory.createEnterpriseBean(GreaterDane.class, manager);
+ BeanFactory.createEnterpriseBean(GreaterDane.class, manager);
}
@Test(expectedExceptions = DefinitionException.class, groups = { "stub", "specialization", "enterpriseBeans" })
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/Armant.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -1,12 +1,13 @@
package org.jboss.webbeans.test.ejb.invalid;
+import javax.ejb.Remove;
import javax.ejb.Stateless;
import javax.webbeans.Destructor;
@Stateless
public class Armant
{
- @Destructor
+ @Destructor @Remove
public void bye() {
}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Labrador.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Labrador.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Labrador.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+import javax.webbeans.Dependent;
+
+import org.jboss.webbeans.test.annotations.Singleton;
+
+@Singleton
+@Dependent
+public class Labrador
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Labrador.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Laika.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -1,5 +1,6 @@
package org.jboss.webbeans.test.ejb.valid;
+import javax.ejb.Remove;
import javax.webbeans.ApplicationScoped;
import org.jboss.webbeans.test.annotations.Singleton;
@@ -9,4 +10,10 @@
public class Laika
{
+ @Remove
+ public void remove()
+ {
+
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/Pomeranian.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -11,7 +11,7 @@
@Stateful
@Tame
@Named("Teddy")
-public class Pomeranian
+public class Pomeranian implements PomeranianInterface
{
public static Thread notificationThread;
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/PomeranianInterface.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/PomeranianInterface.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/PomeranianInterface.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.ejb.valid;
+
+public interface PomeranianInterface
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/PomeranianInterface.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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 2008-12-18 19:37:12 UTC (rev 551)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java 2008-12-18 19:48:16 UTC (rev 552)
@@ -1,9 +1,10 @@
package org.jboss.webbeans.test.mock;
import java.lang.reflect.Method;
-import java.util.Collection;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
+import java.util.List;
import javax.ejb.MessageDriven;
import javax.ejb.Remove;
@@ -13,36 +14,38 @@
import org.jboss.webbeans.bootstrap.spi.BusinessInterfaceDescriptor;
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.bootstrap.spi.MethodDescriptor;
+import org.jboss.webbeans.test.annotations.Singleton;
public class MockEjbDescriptor<T> implements EjbDescriptor<T>
{
- private Class<T> type;
- private String ejbName;
+ private final Class<T> type;
+ private final String ejbName;
+ private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
+ private final HashSet<MethodDescriptor> removeMethods;
- public MockEjbDescriptor(Class<T> type)
+ public MockEjbDescriptor(final Class<T> type)
{
this.type = type;
- this.ejbName = type.getSimpleName() + "/local";
- }
+ this.ejbName = type.getSimpleName();
+ this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
+ for (final Class<Object> clazz : type.getInterfaces())
+ {
+ localInterfaces.add(new BusinessInterfaceDescriptor<Object>()
+ {
- public String getEjbName()
- {
- return ejbName;
- }
+ public Class<Object> getInterface()
+ {
+ return clazz;
+ }
- public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
- {
- return Collections.emptyList();
- }
-
- public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
- {
- return Collections.emptyList();
- }
-
- public Iterable<MethodDescriptor> getRemoveMethods()
- {
- Collection<MethodDescriptor> removeMethods = new HashSet<MethodDescriptor>();
+ public String getJndiName()
+ {
+ return clazz.getSimpleName() + "/local";
+ }
+
+ });
+ }
+ this.removeMethods = new HashSet<MethodDescriptor>();
for (final Method method : type.getMethods())
{
if (method.isAnnotationPresent(Remove.class))
@@ -50,11 +53,6 @@
removeMethods.add(new MethodDescriptor()
{
- public Class<?> getDeclaringClass()
- {
- return type;
- }
-
public String getMethodName()
{
return method.getName();
@@ -65,9 +63,35 @@
return method.getParameterTypes();
}
+ @Override
+ public String toString()
+ {
+ return method.toString();
+ }
+
});
}
}
+ }
+
+ public String getEjbName()
+ {
+ return ejbName;
+ }
+
+ public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
+ {
+ return localInterfaces;
+ }
+
+ public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
+ {
+ return Collections.emptyList();
+ }
+
+ public Iterable<MethodDescriptor> getRemoveMethods()
+ {
+
return removeMethods;
}
@@ -83,8 +107,7 @@
public boolean isSingleton()
{
- return false;
- //return type.isAnnotationPresent(Singleton.class);
+ return type.isAnnotationPresent(Singleton.class);
}
public boolean isStateful()
@@ -118,6 +141,7 @@
{
builder.append(" (MDB)");
}
+ builder.append("remove methods; " + removeMethods + "; ");
builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
return builder.toString();
}
16 years, 1 month
[webbeans-commits] Webbeans SVN: r551 - in ri/trunk/webbeans-ri: src/main/java/org/jboss/webbeans/bootstrap and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-12-18 14:37:12 -0500 (Thu, 18 Dec 2008)
New Revision: 551
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.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/beans/Leopard.java
ri/trunk/webbeans-ri/testng.xml
Log:
Fix loads of enterprise bean tests and actually enable them!
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 2008-12-18 17:13:35 UTC (rev 550)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2008-12-18 19:37:12 UTC (rev 551)
@@ -58,7 +58,6 @@
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.contexts.DependentContext;
import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
-import org.jboss.webbeans.ejb.EjbDescriptorCache;
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
@@ -155,7 +154,7 @@
Set<AbstractBean<?, ?>> beans = new HashSet<AbstractBean<?, ?>>();
for (Class<?> clazz : classes)
{
- if (EjbDescriptorCache.instance().containsKey(clazz))
+ if (manager.getEjbDescriptorCache().containsKey(clazz))
{
createBean(createEnterpriseBean(clazz, manager), beans);
}
@@ -239,7 +238,7 @@
*
* @param webBeanDiscovery The discovery implementation
*/
- public void boot(WebBeanDiscovery webBeanDiscovery)
+ public synchronized void boot(WebBeanDiscovery webBeanDiscovery)
{
log.info("Starting Web Beans RI " + getVersion());
if (webBeanDiscovery == null)
@@ -247,7 +246,7 @@
throw new IllegalStateException("No WebBeanDiscovery provider found, you need to implement the org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery interface, and tell the RI to use it by specifying -D" + WebBeansBootstrap.WEB_BEAN_DISCOVERY_PROPERTY_NAME + "=<classname>");
}
// Must populate EJB cache first, as we need it to detect whether a bean is an EJB!
- EjbDescriptorCache.instance().addAll(webBeanDiscovery.discoverEjbs());
+ manager.getEjbDescriptorCache().addAll(webBeanDiscovery.discoverEjbs());
registerBeans(webBeanDiscovery.discoverWebBeanClasses());
log.info("Validing Web Bean injection points");
manager.getResolver().resolveInjectionPoints();
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 2008-12-18 17:13:35 UTC (rev 550)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-12-18 19:37:12 UTC (rev 551)
@@ -510,7 +510,7 @@
// TODO Cache?
for (AnnotatedMethod<Object> annotatedMethod : methods)
{
- if (annotatedMethod.getName().equals(methodDescriptor.getMethodName()) && annotatedMethod.getParameterTypesAsArray().equals(methodDescriptor.getMethodParameterTypes()))
+ if (annotatedMethod.getName().equals(methodDescriptor.getMethodName()) && Arrays.equals(annotatedMethod.getParameterTypesAsArray(), methodDescriptor.getMethodParameterTypes()))
{
return annotatedMethod;
}
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 2008-12-18 17:13:35 UTC (rev 550)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java 2008-12-18 19:37:12 UTC (rev 551)
@@ -12,6 +12,7 @@
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;
@@ -46,4 +47,9 @@
manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
}
+ protected <T> void addToEjbCache(Class<T> clazz)
+ {
+ manager.getEjbDescriptorCache().add(new MockEjbDescriptor<T>(clazz));
+ }
+
}
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 2008-12-18 17:13:35 UTC (rev 550)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BoostrapTest.java 2008-12-18 19:37:12 UTC (rev 551)
@@ -234,7 +234,7 @@
@Test(groups="bootstrap")
public void testDiscover()
{
- webBeansBootstrap.boot(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class)), null, new HashSet<Class<?>>()));
+ webBeansBootstrap.boot(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class))));
assert manager.getBeans().size() == 8 + MockManagerImpl.BUILT_IN_BEANS;
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
@@ -268,7 +268,7 @@
public void testInitializedEvent()
{
assert !InitializedObserver.observered;
- webBeansBootstrap.boot(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(InitializedObserver.class)), null, new HashSet<Class<?>>()));
+ webBeansBootstrap.boot(new MockWebBeanDiscovery(new HashSet<Class<?>>(Arrays.asList(InitializedObserver.class))));
assert InitializedObserver.observered;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Leopard.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Leopard.java 2008-12-18 17:13:35 UTC (rev 550)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Leopard.java 2008-12-18 19:37:12 UTC (rev 551)
@@ -1,9 +1,8 @@
package org.jboss.webbeans.test.beans;
+import javax.ejb.MessageDriven;
import javax.webbeans.Production;
-import org.jboss.webbeans.test.annotations.MessageDriven;
-
@Production
@MessageDriven
public class Leopard
Modified: ri/trunk/webbeans-ri/testng.xml
===================================================================
--- ri/trunk/webbeans-ri/testng.xml 2008-12-18 17:13:35 UTC (rev 550)
+++ ri/trunk/webbeans-ri/testng.xml 2008-12-18 19:37:12 UTC (rev 551)
@@ -1,6 +1,6 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-<suite name="WebBeans RI" verbose="1">
+<suite name="WebBeans RI" verbose="1" >
<test name="Web Beans RI">
<groups>
@@ -36,8 +36,7 @@
<package name="org.jboss.webbeans.test"></package>
<package name="org.jboss.webbeans.test.contexts"></package>
<package name="org.jboss.webbeans.examples"></package>
- <package name="org.jboss.webbeans.test.ejb.lifecycle"></package>
- <package name="org.jboss.webbeans.test.ejb.model"></package>
+ <package name="org.jboss.webbeans.test.ejb"></package>
</packages>
</test>
16 years, 1 month
[webbeans-commits] Webbeans SVN: r550 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/introspector and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2008-12-18 12:13:35 -0500 (Thu, 18 Dec 2008)
New Revision: 550
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/EuropeanGoldfinch.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.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/AnnotatedConstructorImpl.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/util/Names.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java
Log:
Fixed some bugs and implemented the rest of the section 8.6 tests.
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 2008-12-18 15:34:45 UTC (rev 549)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -63,6 +63,7 @@
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.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.transaction.Transaction;
@@ -184,15 +185,7 @@
ProducerMethodBean<?> producerMethodBean = createProducerMethodBean(producerMethod, bean, manager);
beans.add(producerMethodBean);
manager.getResolver().addInjectionPoints(producerMethodBean.getInjectionPoints());
- for (AnnotatedItem injectionPoint : producerMethodBean.getInjectionPoints())
- {
- if ( injectionPoint.isAnnotationPresent(Observable.class) )
- {
- EventBean<Object, Method> eventBean = createEventBean(injectionPoint, manager);
- beans.add(eventBean);
- log.info("Web Bean: " + eventBean);
- }
- }
+ registerEvents(producerMethodBean.getInjectionPoints(), beans);
log.info("Web Bean: " + producerMethodBean);
}
for (AnnotatedField<Object> producerField : bean.getProducerFields())
@@ -201,13 +194,18 @@
beans.add(producerFieldBean);
log.info("Web Bean: " + producerFieldBean);
}
+ for (AnnotatedMethod<Object> initializerMethod : bean.getInitializerMethods())
+ {
+ for (AnnotatedParameter<Object> parameter : initializerMethod.getAnnotatedParameters(Observable.class))
+ {
+ registerEvent(parameter, beans);
+ }
+ }
for (AnnotatedItem injectionPoint : bean.getInjectionPoints())
{
if ( injectionPoint.isAnnotationPresent(Observable.class) )
{
- EventBean<Object, Field> eventBean = createEventBean(injectionPoint, manager);
- beans.add(eventBean);
- log.info("Web Bean: " + eventBean);
+ registerEvent(injectionPoint, beans);
}
if ( injectionPoint.isAnnotationPresent(Obtainable.class) )
{
@@ -313,6 +311,32 @@
}
/**
+ * Iterates through the injection points and creates and registers any Event
+ * observables specified with the @Observable annotation
+ *
+ * @param injectionPoints A set of injection points to inspect
+ * @param beans A set of beans to add the Event beans to
+ */
+ @SuppressWarnings("unchecked")
+ private void registerEvents(Set<AnnotatedItem<?,?>> injectionPoints, Set<AbstractBean<?, ?>> beans)
+ {
+ for (AnnotatedItem injectionPoint : injectionPoints)
+ {
+ registerEvent(injectionPoint, beans);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void registerEvent(AnnotatedItem injectionPoint, Set<AbstractBean<?, ?>> beans)
+ {
+ if ( injectionPoint.isAnnotationPresent(Observable.class) )
+ {
+ EventBean<Object, Method> eventBean = createEventBean(injectionPoint, manager);
+ beans.add(eventBean);
+ log.info("Web Bean: " + eventBean);
+ }
+ }
+ /**
* Indicates if the type is a simple Web Bean
*
* @param type The type to inspect
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 2008-12-18 15:34:45 UTC (rev 549)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -30,6 +30,7 @@
import javax.webbeans.BeforeTransactionCompletion;
import javax.webbeans.Disposes;
import javax.webbeans.IfExists;
+import javax.webbeans.Observable;
import javax.webbeans.Observes;
import javax.webbeans.manager.Manager;
@@ -43,7 +44,7 @@
public interface AnnotatedMethod<T> extends AnnotatedItem<T, Method>
{
- public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Disposes.class, Observes.class, IfExists.class, BeforeTransactionCompletion.class, AfterTransactionCompletion.class, AfterTransactionFailure.class, AfterTransactionSuccess.class));
+ public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Disposes.class, Observes.class, Observable.class, IfExists.class, BeforeTransactionCompletion.class, AfterTransactionCompletion.class, AfterTransactionFailure.class, AfterTransactionSuccess.class));
/**
* Gets the abstracted parameters of the method
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 2008-12-18 15:34:45 UTC (rev 549)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -164,20 +164,6 @@
}
/**
- * Gets the parameter abstractions with a given annotation type
- *
- * if the annotated parameters map is null, it is initialized first.
- *
- * @param annotationType The annotation type to match
- * @return The list of parameter abstractions with given annotation type. An
- * empty list is returned if there are no matches.
- */
- public List<AnnotatedParameter<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
- {
- return Collections.unmodifiableList(annotatedParameters.get(annotationType));
- }
-
- /**
* Gets parameter abstractions with a given annotation type.
*
* If the parameters are null, they are initializes first.
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 2008-12-18 15:34:45 UTC (rev 549)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -160,7 +160,7 @@
{
return toString;
}
- toString = "Annotated parameter " + Names.type2String(getDelegate().getClass());
+ toString = toDetailedString();
return toString;
}
@@ -168,8 +168,8 @@
{
StringBuilder buffer = new StringBuilder();
buffer.append("AnnotatedParameterImpl:\n");
- buffer.append(super.toString() + "\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())));
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-18 15:34:45 UTC (rev 549)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -157,7 +157,7 @@
* @param annotations The annotations
* @return The string representation
*/
- private static String annotations2String(Annotation[] annotations)
+ public static String annotations2String(Annotation[] annotations)
{
StringBuilder buffer = new StringBuilder();
for (Annotation annotation : annotations)
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 2008-12-18 15:34:45 UTC (rev 549)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -13,9 +13,12 @@
import org.jboss.webbeans.bindings.InitializedBinding;
import org.jboss.webbeans.contexts.DependentContext;
+import org.jboss.webbeans.test.beans.AuroraFinch;
import org.jboss.webbeans.test.beans.BananaSpider;
import org.jboss.webbeans.test.beans.BirdCage;
import org.jboss.webbeans.test.beans.BlueFacedParrotFinch;
+import org.jboss.webbeans.test.beans.EuropeanGoldfinch;
+import org.jboss.webbeans.test.beans.OrangeCheekedWaxbill;
import org.jboss.webbeans.test.beans.FinchKeeper;
import org.jboss.webbeans.test.beans.RecluseSpider;
import org.jboss.webbeans.test.beans.StarFinch;
@@ -657,7 +660,7 @@
}
}
- @Test(groups = { "broken", "events" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "8.6")
public void testObservableAnnotationOnParameterOfProducerMethod()
{
@@ -679,13 +682,27 @@
}
}
- @Test(groups = { "stub", "events" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "8.6")
public void testObservableAnnotationOnParameterOfInitializerMethod()
{
- assert false;
+ webBeansBootstrap.boot(new MockWebBeanDiscovery(OrangeCheekedWaxbill.class, FinchKeeper.class));
+ try
+ {
+ DependentContext.INSTANCE.setActive(true);
+ OrangeCheekedWaxbill bird = manager.getInstanceByType(OrangeCheekedWaxbill.class);
+ FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
+ assert bird != null;
+ assert bird.getSomeMess() != null;
+ assert birdKeeper.isNewMessDetected();
+ }
+ finally
+ {
+ DependentContext.INSTANCE.setActive(false);
+ }
}
+ //TODO Implement once disposal methods are included
@Test(groups = { "stub", "events" })
@SpecAssertion(section = "8.6")
public void testObservableAnnotationOnParameterOfDisposalMethod()
@@ -693,18 +710,44 @@
assert false;
}
- @Test(groups = { "stub", "events" })
+ //TODO Make sure this test works once EJBs are fully supported
+ @Test(groups = { "broken", "events" })
@SpecAssertion(section = "8.6")
public void testObservableAnnotationOnParameterOfRemoveMethod()
{
- assert false;
+ webBeansBootstrap.boot(new MockWebBeanDiscovery(EuropeanGoldfinch.class, FinchKeeper.class));
+ try
+ {
+ DependentContext.INSTANCE.setActive(true);
+ EuropeanGoldfinch bird = manager.getInstanceByType(EuropeanGoldfinch.class);
+ FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
+ assert bird != null;
+
+ assert birdKeeper.isNewMessDetected();
+ }
+ finally
+ {
+ DependentContext.INSTANCE.setActive(false);
+ }
}
- @Test(groups = { "stub", "events" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "8.6")
public void testObservableAnnotationOnParameterOfConstructor()
{
- assert false;
+ webBeansBootstrap.boot(new MockWebBeanDiscovery(AuroraFinch.class, FinchKeeper.class));
+ try
+ {
+ DependentContext.INSTANCE.setActive(true);
+ AuroraFinch bird = manager.getInstanceByType(AuroraFinch.class);
+ FinchKeeper birdKeeper = manager.getInstanceByType(FinchKeeper.class);
+ assert bird != null;
+ assert birdKeeper.isNewMessDetected();
+ }
+ finally
+ {
+ DependentContext.INSTANCE.setActive(false);
+ }
}
@Test(groups = { "events" }, expectedExceptions = { DefinitionException.class })
@@ -775,130 +818,130 @@
}
}
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitObserverBeanMatchesAPITypeOfInectionPoint()
- {
- assert false;
- }
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testImplicitObserverBeanMatchesAPITypeOfInectionPoint()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testImplicitObserverBeanMatchesBindingAnnotationsOfInjectionPoint()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testImplicitObserverBeanHasStandardDeploymentType()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testImplicitObserverBeanHasDependentScope()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testFireMethodCallsManagerFireWithEventObject()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptObservable()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testFireMethodCallsManagerFireWithAllBindingAnnotationInstances()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testObserveMethodCallsManagerAddObserverWithObserverObject()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptObservable()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.6")
+// public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationInstance()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testEventObjectContainsTypeVariablesWhenResolvingFails()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testEventObjectContainsWildcardsWhenResolvingFails()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testDuplicateBindingTypesWhenResolvingFails()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testNonBindingTypeAnnotationWhenResolvingFails()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testResolvingChecksEventType()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testResolvingChecksTypeParameters()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testResolvingChecksBindingTypes()
+// {
+// assert false;
+// }
+//
+// @Test(groups = { "stub", "events" })
+// @SpecAssertion(section = "8.7")
+// public void testResolvingChecksBindingTypeMembers()
+// {
+// assert false;
+// }
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitObserverBeanMatchesBindingAnnotationsOfInjectionPoint()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitObserverBeanHasStandardDeploymentType()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testImplicitObserverBeanHasDependentScope()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testFireMethodCallsManagerFireWithEventObject()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testFireMethodCallsManagerFireWithBindingAnnotationsExceptObservable()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testFireMethodCallsManagerFireWithAllBindingAnnotationInstances()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testObserveMethodCallsManagerAddObserverWithObserverObject()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationsExceptObservable()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.6")
- public void testObserveMethodCallsManagerAddObserverWithAllBindingAnnotationInstance()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testEventObjectContainsTypeVariablesWhenResolvingFails()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testEventObjectContainsWildcardsWhenResolvingFails()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testDuplicateBindingTypesWhenResolvingFails()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testNonBindingTypeAnnotationWhenResolvingFails()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksEventType()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksTypeParameters()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksBindingTypes()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "8.7")
- public void testResolvingChecksBindingTypeMembers()
- {
- assert false;
- }
-
}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.test.beans;
+
+import javax.webbeans.Event;
+import javax.webbeans.Initializer;
+import javax.webbeans.Observable;
+import org.jboss.webbeans.test.beans.StarFinch.Mess;
+
+public class AuroraFinch
+{
+
+ private Mess someMess;
+
+ @Initializer
+ public AuroraFinch(@Observable Event<Mess> eventObject)
+ {
+ // Create a new mess and fire the event for it
+ someMess = new Mess();
+ eventObject.fire(someMess);
+ }
+
+ public Mess getSomeMess()
+ {
+ return someMess;
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/AuroraFinch.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/EuropeanGoldfinch.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/EuropeanGoldfinch.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/EuropeanGoldfinch.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -0,0 +1,29 @@
+package org.jboss.webbeans.test.beans;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.ConversationScoped;
+import javax.webbeans.Destructor;
+import javax.webbeans.Event;
+import javax.webbeans.Observable;
+import org.jboss.webbeans.test.beans.StarFinch.Mess;
+
+@ConversationScoped @Stateful
+public class EuropeanGoldfinch
+{
+ private Mess someMess;
+
+ public Mess getSomeMess()
+ {
+ return someMess;
+ }
+
+ @Destructor @Remove
+ public void remove(@Observable Event<Mess> eventObject)
+ {
+ // Create a new mess and fire the event for it
+ someMess = new Mess();
+ eventObject.fire(someMess);
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/EuropeanGoldfinch.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java 2008-12-18 17:13:35 UTC (rev 550)
@@ -0,0 +1,32 @@
+package org.jboss.webbeans.test.beans;
+
+import javax.webbeans.Event;
+import javax.webbeans.Initializer;
+import javax.webbeans.Observable;
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.test.beans.StarFinch.Mess;
+
+@RequestScoped
+public class OrangeCheekedWaxbill
+{
+
+ private Mess someMess;
+
+ public OrangeCheekedWaxbill()
+ {
+ }
+
+ @Initializer
+ public void theInitializerMethod(@Observable Event<Mess> eventObject)
+ {
+ // Create a new mess and fire the event for it
+ someMess = new Mess();
+ eventObject.fire(someMess);
+ }
+
+ public Mess getSomeMess()
+ {
+ return someMess;
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/OrangeCheekedWaxbill.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 1 month
[webbeans-commits] Webbeans SVN: r549 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/ejb and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-12-18 10:34:45 -0500 (Thu, 18 Dec 2008)
New Revision: 549
Modified:
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
Log:
minor
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 2008-12-18 15:07:57 UTC (rev 548)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-12-18 15:34:45 UTC (rev 549)
@@ -83,7 +83,18 @@
protected void init()
{
super.init();
- ejbDescriptor = (EjbDescriptor<T>) EjbDescriptorCache.instance().get(getType().getSimpleName() + "/local");
+ Iterable<EjbDescriptor<T>> ejbDescriptors = EjbDescriptorCache.instance().get(getType());
+ for (EjbDescriptor<T> ejbDescriptor : ejbDescriptors)
+ {
+ if (this.ejbDescriptor == null)
+ {
+ this.ejbDescriptor = ejbDescriptor;
+ }
+ else
+ {
+ throw new RuntimeException("TODO Multiple EJBs have the same bean class! " + getType() );
+ }
+ }
initRemoveMethod();
initInjectionPoints();
checkEnterpriseBeanTypeAllowed();
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 2008-12-18 15:07:57 UTC (rev 548)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbDescriptorCache.java 2008-12-18 15:34:45 UTC (rev 549)
@@ -82,9 +82,9 @@
* @param beanClass The EJB class
* @return An iterator
*/
- public Iterable<EjbDescriptor<?>> get(Class<?> beanClass)
+ public <T> Iterable<EjbDescriptor<T>> get(Class<T> beanClass)
{
- return ejbsByBeanClass.get(beanClass);
+ return (Iterable) ejbsByBeanClass.get(beanClass);
}
/**
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 2008-12-18 15:07:57 UTC (rev 548)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java 2008-12-18 15:34:45 UTC (rev 549)
@@ -96,5 +96,50 @@
{
return type.isAnnotationPresent(Stateless.class);
}
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getEjbName());
+ if (isStateful())
+ {
+ builder.append(" (SFSB)");
+ }
+ if (isStateless())
+ {
+ builder.append(" (SLSB)");
+ }
+ if (isSingleton())
+ {
+ builder.append(" (Singleton)");
+ }
+ if (isMessageDriven())
+ {
+ builder.append(" (MDB)");
+ }
+ builder.append("; BeanClass: " + getType() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
+ return builder.toString();
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof EjbDescriptor)
+ {
+ EjbDescriptor<T> that = (EjbDescriptor<T>) other;
+ return this.getEjbName().equals(that.getEjbName());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getEjbName().hashCode();
+ }
}
16 years, 1 month
[webbeans-commits] Webbeans SVN: r548 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/bootstrap/spi and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-12-18 10:07:57 -0500 (Thu, 18 Dec 2008)
New Revision: 548
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/MethodDescriptor.java
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/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.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/AnnotatedClassImpl.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/util/Reflections.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java
Log:
Wire remove methods through to discovery SPI
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 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -41,8 +41,6 @@
import org.jboss.webbeans.bindings.CurrentBinding;
import org.jboss.webbeans.ejb.DefaultEnterpriseBeanLookup;
import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -101,8 +99,6 @@
protected Class<? extends Annotation> deploymentType;
// The type
protected Class<T> type;
- // The remove method
- protected AnnotatedMethod<Object> removeMethod;
// The API types
protected Set<Class<?>> apiTypes;
// The injection points
@@ -217,14 +213,7 @@
*/
protected void initInjectionPoints()
{
- injectionPoints = new HashSet<AnnotatedItem<?, ?>>();
- if (removeMethod != null)
- {
- for (AnnotatedParameter<?> injectable : removeMethod.getParameters())
- {
- injectionPoints.add(injectable);
- }
- }
+ injectionPoints = new HashSet<AnnotatedItem<?,?>>();
}
/**
@@ -435,16 +424,6 @@
}
/**
- * Gets the remove method of the bean
- *
- * @return The remove method
- */
- public AnnotatedMethod<?> getRemoveMethod()
- {
- return removeMethod;
- }
-
- /**
* Gets the scope type of the bean
*
* @return The scope type
@@ -559,7 +538,6 @@
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("Remove method: " + (removeMethod == null ? "null" : removeMethod.toString()) + "\n");
buffer.append(Strings.collectionToString("Binding types: ", getBindingTypes()));
buffer.append(Strings.collectionToString("API types: ", getTypes()));
buffer.append(Strings.collectionToString("Injection points: ", getInjectionPoints()));
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 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -55,7 +55,7 @@
// Logger
private static final LogProvider log = Logging.getLogProvider(AbstractClassBean.class);
// The item representation
- private AnnotatedClass<T> annotatedItem;
+ protected AnnotatedClass<T> annotatedItem;
// The injectable fields
private Set<AnnotatedField<Object>> injectableFields;
// The initializer methods
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 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -36,6 +36,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+import org.jboss.webbeans.bootstrap.spi.MethodDescriptor;
import org.jboss.webbeans.contexts.DependentContext;
import org.jboss.webbeans.ejb.EjbDescriptorCache;
import org.jboss.webbeans.introspector.AnnotatedField;
@@ -57,6 +58,10 @@
// The EJB descriptor
private EjbDescriptor<T> ejbDescriptor;
+
+ // The remove method on the bean class (do not call!)
+ private AnnotatedMethod<?> removeMethod;
+
/**
* Constructor
@@ -168,10 +173,10 @@
}
// <1 (0) @Destructors
- Set<AnnotatedMethod<Object>> noArgsRemoveMethods = getNoArgsRemoveMethods();
+ Set<MethodDescriptor> noArgsRemoveMethods = getNoArgsRemoveMethods(ejbDescriptor);
if (noArgsRemoveMethods.size() == 1)
{
- super.removeMethod = noArgsRemoveMethods.iterator().next();
+ this.removeMethod = annotatedItem.getMethod(noArgsRemoveMethods.iterator().next());
return;
}
@@ -182,19 +187,29 @@
}
- private Set<AnnotatedMethod<Object>> getNoArgsRemoveMethods()
+ private static Set<MethodDescriptor> getNoArgsRemoveMethods(EjbDescriptor<?> ejbDescriptor)
{
- Set<AnnotatedMethod<Object>> noArgsRemoveMethods = new HashSet<AnnotatedMethod<Object>>();
- /*for (AnnotatedMethod<Object> removeMethod : getAnnotatedItem().getAnnotatedMethods(EJB.REMOVE_ANNOTATION))
+ Set<MethodDescriptor> noArgsRemoveMethods = new HashSet<MethodDescriptor>();
+ for (MethodDescriptor removeMethod : ejbDescriptor.getRemoveMethods())
{
- if (removeMethod.getParameters().isEmpty())
+ if (removeMethod.getMethodParameterTypes().length == 0)
{
noArgsRemoveMethods.add(removeMethod);
}
- }*/
+ }
return noArgsRemoveMethods;
}
+ private void checkDestructorMethods()
+ {
+ // TODO Check that any method annotated @Destructor is actually in the remove method list
+ /*
+ if (removeMethod.isAnnotationPresent(Destructor.class) && !removeMethod.isAnnotationPresent(EJB.REMOVE_ANNOTATION))
+ {
+ throw new DefinitionException("Methods marked @Destructor must also be marked @Remove on " + removeMethod.getName());
+ }*/
+ }
+
/**
* Validates the remove method
*/
@@ -205,12 +220,8 @@
return;
}
- /*if (removeMethod.isAnnotationPresent(Destructor.class) && !removeMethod.isAnnotationPresent(EJB.REMOVE_ANNOTATION))
+ if (removeMethod.isAnnotationPresent(Initializer.class))
{
- throw new DefinitionException("Methods marked @Destructor must also be marked @Remove on " + removeMethod.getName());
- }*/
- else if (removeMethod.isAnnotationPresent(Initializer.class))
- {
throw new DefinitionException("Remove methods cannot be initializers on " + removeMethod.getName());
}
else if (removeMethod.isAnnotationPresent(Produces.class))
@@ -264,7 +275,7 @@
try
{
DependentContext.INSTANCE.setActive(true);
- getRemoveMethod().invoke(instance);
+ removeMethod.invokeOnInstance(instance, manager);
}
catch (Exception e)
{
@@ -333,6 +344,11 @@
}
}
+
+ public AnnotatedMethod<?> getRemoveMethod()
+ {
+ return removeMethod;
+ }
/**
* Validates the bean type
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -44,6 +44,8 @@
{
// The underlying method
private AnnotatedMethod<T> method;
+
+ private AnnotatedMethod<?> disposalMethod;
/**
* Constructor
@@ -129,9 +131,9 @@
{
injectionPoints.add(parameter);
}
- if (removeMethod != null)
+ if (disposalMethod != null)
{
- for (AnnotatedParameter<?> injectable : removeMethod.getParameters())
+ for (AnnotatedParameter<?> injectable : disposalMethod.getParameters())
{
injectionPoints.add(injectable);
}
@@ -165,7 +167,7 @@
Set<AnnotatedMethod<Object>> disposalMethods = manager.resolveDisposalMethods(getType(), getBindingTypes().toArray(new Annotation[0]));
if (disposalMethods.size() == 1)
{
- removeMethod = disposalMethods.iterator().next();
+ this.disposalMethod = disposalMethods.iterator().next();
}
else if (disposalMethods.size() > 1)
{
@@ -204,7 +206,7 @@
*/
public AnnotatedMethod<?> getDisposalMethod()
{
- return removeMethod;
+ return disposalMethod;
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDescriptor.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -17,7 +17,6 @@
package org.jboss.webbeans.bootstrap.spi;
-import java.lang.reflect.Method;
/**
* EJB metadata from the EJB descriptor
@@ -55,7 +54,7 @@
*
* @return An iterator over the remove methods
*/
- public Iterable<Method> getRemoveMethods();
+ public Iterable<MethodDescriptor> getRemoveMethods();
/**
* Indicates if the bean is stateless
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/MethodDescriptor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/MethodDescriptor.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/MethodDescriptor.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.bootstrap.spi;
+
+public interface MethodDescriptor
+{
+
+ public String getMethodName();
+
+ public Class<?>[] getMethodParameterTypes();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/spi/MethodDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -21,6 +21,8 @@
import java.util.List;
import java.util.Set;
+import org.jboss.webbeans.bootstrap.spi.MethodDescriptor;
+
/**
* Represents a Class
*
@@ -90,6 +92,14 @@
public Set<AnnotatedMethod<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType);
/**
+ * Find the annotated method for a given methodDescriptor
+ *
+ * @param methodDescriptor
+ * @return
+ */
+ public AnnotatedMethod<Object> getMethod(MethodDescriptor methodDescriptor);
+
+ /**
* Gets all with parameters annotated with annotationType
*
* @param annotationType The annotation to match
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 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -61,6 +61,11 @@
* there are no matches.
*/
public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Get the parameter types as an array
+ */
+ public Class<?>[] getParameterTypesAsArray();
/**
* Invokes the method
@@ -70,6 +75,16 @@
* @return A reference to the instance
*/
public T invoke(Object instance, Manager manager);
+
+ /**
+ * Invokes the method on the class of the passed instance, not the declaring
+ * class. Useful with proxies
+ *
+ * @param instance The instance to invoke
+ * @param manager The Web Beans manager
+ * @return A reference to the instance
+ */
+ public T invokeOnInstance(Object instance, Manager manager);
/**
* Invokes the observer method
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 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -31,6 +31,7 @@
import java.util.Map;
import java.util.Set;
+import org.jboss.webbeans.bootstrap.spi.MethodDescriptor;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedField;
@@ -209,7 +210,7 @@
return Strings.mapToString("Annotation type -> constructor by arguments mappings: ", delegate);
}
}
-
+
// The implementing class
private final Class<T> clazz;
// The type arguments
@@ -503,6 +504,19 @@
{
return methodsByAnnotatedParameters.get(annotationType);
}
+
+ public AnnotatedMethod<Object> getMethod(MethodDescriptor methodDescriptor)
+ {
+ // TODO Cache?
+ for (AnnotatedMethod<Object> annotatedMethod : methods)
+ {
+ if (annotatedMethod.getName().equals(methodDescriptor.getMethodName()) && annotatedMethod.getParameterTypesAsArray().equals(methodDescriptor.getMethodParameterTypes()))
+ {
+ return annotatedMethod;
+ }
+ }
+ return null;
+ }
/**
* Gets a string representation of the class
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 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -184,6 +184,11 @@
{
return Collections.unmodifiableList(parameters);
}
+
+ public Class<?>[] getParameterTypesAsArray()
+ {
+ return method.getParameterTypes();
+ }
/**
* Gets the parameter abstractions with a given annotation type
@@ -243,6 +248,12 @@
{
return (T) Reflections.invokeAndWrap(getDelegate(), instance, getParameterValues(parameters, manager));
}
+
+ @SuppressWarnings("unchecked")
+ public T invokeOnInstance(Object instance, Manager manager)
+ {
+ return (T) Reflections.invokeAndWrap(getName(), getParameterTypesAsArray(), instance, getParameterValues(parameters, manager));
+ }
@SuppressWarnings("unchecked")
public T invokeWithSpecialValue(Object instance, Class<? extends Annotation> specialParam, Object specialVal, Manager manager)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -445,8 +445,6 @@
}
catch (IllegalArgumentException e)
{
- System.out.println(method.getDeclaringClass() + " " + instance.getClass());
- e.printStackTrace();
throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
}
catch (IllegalAccessException e)
@@ -458,6 +456,43 @@
throw new ExecutionException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
}
}
+
+ /**
+ * Invokes a method and wraps exceptions
+ *
+ * @param methodName The method name to find on the instance and invoke
+ * @param parameterTypes The method name to find on the instance and invoke
+ * @param instance The instance to invoke on
+ * @param parameterValues The parameters values
+ * @return The return value
+ */
+ public static Object invokeAndWrap(String methodName, Class<?>[] parameterTypes, Object instance, Object[] parameterValues)
+ {
+ try
+ {
+ return instance.getClass().getMethod(methodName, parameterTypes).invoke(instance, parameterValues);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ExecutionException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ExecutionException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new ExecutionException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ }
+ catch (SecurityException e)
+ {
+ throw new ExecutionException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new ExecutionException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ }
+ }
/**
* Sets value of a field and wraps exceptions
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 2008-12-17 18:46:34 UTC (rev 547)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockEjbDescriptor.java 2008-12-18 15:07:57 UTC (rev 548)
@@ -12,6 +12,7 @@
import org.jboss.webbeans.bootstrap.spi.BusinessInterfaceDescriptor;
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+import org.jboss.webbeans.bootstrap.spi.MethodDescriptor;
public class MockEjbDescriptor<T> implements EjbDescriptor<T>
{
@@ -39,14 +40,32 @@
return Collections.emptyList();
}
- public Iterable<Method> getRemoveMethods()
+ public Iterable<MethodDescriptor> getRemoveMethods()
{
- Collection<Method> removeMethods = new HashSet<Method>();
- for (Method method : type.getMethods())
+ Collection<MethodDescriptor> removeMethods = new HashSet<MethodDescriptor>();
+ for (final Method method : type.getMethods())
{
if (method.isAnnotationPresent(Remove.class))
{
- removeMethods.add(method);
+ removeMethods.add(new MethodDescriptor()
+ {
+
+ public Class<?> getDeclaringClass()
+ {
+ return type;
+ }
+
+ public String getMethodName()
+ {
+ return method.getName();
+ }
+
+ public Class<?>[] getMethodParameterTypes()
+ {
+ return method.getParameterTypes();
+ }
+
+ });
}
}
return removeMethods;
16 years, 1 month
[webbeans-commits] Webbeans SVN: r547 - in ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test: beans and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-12-17 13:46:34 -0500 (Wed, 17 Dec 2008)
New Revision: 547
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/beans/BirdCage.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinchKeeper.java
Log:
Fix David's test, showed an issue with public fields on client proxies
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 2008-12-17 18:13:28 UTC (rev 546)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventBusTest.java 2008-12-17 18:46:34 UTC (rev 547)
@@ -6,19 +6,13 @@
import javax.webbeans.DefinitionException;
import javax.webbeans.DuplicateBindingTypeException;
-import javax.webbeans.Event;
-import javax.webbeans.Observable;
import javax.webbeans.Observer;
import javax.webbeans.ObserverException;
import javax.webbeans.TypeLiteral;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.bean.BeanFactory;
-import org.jboss.webbeans.bean.EventBean;
-import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.bindings.InitializedBinding;
import org.jboss.webbeans.contexts.DependentContext;
-import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.test.beans.BananaSpider;
import org.jboss.webbeans.test.beans.BirdCage;
import org.jboss.webbeans.test.beans.BlueFacedParrotFinch;
@@ -676,8 +670,8 @@
BirdCage birdCage = manager.getInstanceByType(BirdCage.class);
assert starFinch != null;
assert birdCage != null;
- assert birdCage.someMess != null;
- assert birdKeeper.newMessDetected;
+ assert birdCage.getSomeMess() != null;
+ assert birdKeeper.isNewMessDetected();
}
finally
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BirdCage.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BirdCage.java 2008-12-17 18:13:28 UTC (rev 546)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BirdCage.java 2008-12-17 18:46:34 UTC (rev 547)
@@ -11,9 +11,14 @@
public class BirdCage
{
@Current
- public Mess someMess;
+ private Mess someMess;
public BirdCage()
{
}
+
+ public Mess getSomeMess()
+ {
+ return someMess;
+ }
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinchKeeper.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinchKeeper.java 2008-12-17 18:13:28 UTC (rev 546)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinchKeeper.java 2008-12-17 18:46:34 UTC (rev 547)
@@ -14,10 +14,15 @@
{
}
- public boolean newMessDetected = false;
+ private boolean newMessDetected = false;
public void observesMesses(@Observes Mess aNewMess)
{
newMessDetected = true;
}
+
+ public boolean isNewMessDetected()
+ {
+ return newMessDetected;
+ }
}
16 years, 1 month
[webbeans-commits] Webbeans SVN: r546 - in doc: en and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-12-17 13:13:28 -0500 (Wed, 17 Dec 2008)
New Revision: 546
Added:
doc/en/modules/part5.xml
doc/pom.xml
Modified:
doc/
doc/.project
doc/en/master.xml
Log:
Add brief intro to RI, add pom
Property changes on: doc
___________________________________________________________________
Name: svn:ignore
+ target
build
Introduction to Web Beans 20081217.pdf
Modified: doc/.project
===================================================================
--- doc/.project 2008-12-17 18:12:41 UTC (rev 545)
+++ doc/.project 2008-12-17 18:13:28 UTC (rev 546)
@@ -1,11 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>webbeans-intro</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- </buildSpec>
- <natures>
- </natures>
-</projectDescription>
+ <name>webbeans-reference-guide</name>
+ <comment/>
+ <projects/>
+ <buildSpec/>
+ <natures/>
+</projectDescription>
\ No newline at end of file
Modified: doc/en/master.xml
===================================================================
--- doc/en/master.xml 2008-12-17 18:12:41 UTC (rev 545)
+++ doc/en/master.xml 2008-12-17 18:13:28 UTC (rev 546)
@@ -7,6 +7,7 @@
<!ENTITY part2 SYSTEM "modules/part2.xml">
<!ENTITY part3 SYSTEM "modules/part3.xml">
<!ENTITY part4 SYSTEM "modules/part4.xml">
+<!ENTITY part5 SYSTEM "modules/part5.xml">
<!ENTITY intro SYSTEM "modules/intro.xml">
<!ENTITY example SYSTEM "modules/example.xml">
@@ -38,6 +39,14 @@
<orgname>Red Hat Middleware LLC</orgname>
</affiliation>
</author>
+ <author>
+ <firstname>Pete</firstname>
+ <surname>Muir</surname>
+ <affiliation>
+ <jobtitle>Web Beans (JSR-299) Reference Implementation lead</jobtitle>
+ <orgname>Red Hat Middleware LLC</orgname>
+ </affiliation>
+ </author>
</bookinfo>
<toc/>
@@ -86,6 +95,13 @@
&extend;
</part>
+
+ <part>
+ <title>The Web Beans Reference Implementation</title>
+
+ &part5;
+
+ </part>
&next;
Added: doc/en/modules/part5.xml
===================================================================
--- doc/en/modules/part5.xml (rev 0)
+++ doc/en/modules/part5.xml 2008-12-17 18:13:28 UTC (rev 546)
@@ -0,0 +1,54 @@
+<partintro>
+
+ <para>
+ The Web Beans RI currently comes with a two examples,
+ <literal>webbeans-numberguess</literal> (a war example, containing only
+ simple beans) and <literal>webbeans-translator</literal> (an ear example,
+ containing enterprise beans).
+ </para>
+
+ <para>
+ To run the example on JBoss AS 5.0.0.GA, you need to add the Web Beans RI
+ deployer to JBoss 5, and update JBoss EJB3. First, set the path to
+ JBoss 5 in <literal>build.properties</literal>. Make sure you have the
+ <literal>ANT_HOME</literal> environment variable set, and pointing to your
+ ant install. Then, run <literal>ant install-jboss5</literal>.
+ </para>
+
+ <para>
+ To deploy the example to JBoss AS 5, change into
+ <literal>examples/numberguess</literal> directory or the
+ <literal>examples/translator</literal> directory and choose between:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>ant restart</literal> - deploy the example in exploded
+ format
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>ant explode</literal> - update an exploded example, without
+ restarting the deployment
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>ant deploy</literal> - deploy the example in compressed jar format
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>ant undeploy</literal> - remove the example from the server
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>ant clean</literal> - clean the example
+ </para>
+ </listitem>
+ </itemizedlist>
+
+</partintro>
Property changes on: doc/en/modules/part5.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: doc/pom.xml
===================================================================
--- doc/pom.xml (rev 0)
+++ doc/pom.xml 2008-12-17 18:13:28 UTC (rev 546)
@@ -0,0 +1,150 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.webbeans.reference-guide</groupId>
+ <artifactId>webbeans-reference-guide</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+ <name>Web Beans Reference Guide</name>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-docbook-xslt</artifactId>
+ <version>1.1.0.GA</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.wst.css</groupId>
+ <artifactId>core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.wst.sse</groupId>
+ <artifactId>core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-jdocbook-style</artifactId>
+ <version>1.1.0.GA</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDirectory>${pom.basedir}</sourceDirectory>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <masterTranslation>en</masterTranslation>
+ <translations>
+ </translations>
+ <imageResource>
+ <directory>${pom.basedir}/en</directory>
+ <includes>
+ <include>images/*.png</include>
+ </includes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>
+ classpath:/xslt/org/jboss/seam/pdf.xsl
+ </stylesheetResource>
+ <finalName>webbeans_reference.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>
+ classpath:/xslt/org/jboss/seam/xhtml.xsl
+ </stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>
+ classpath:/xslt/org/jboss/seam/xhtml-single.xsl
+ </stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
+ <!-- could also locate the docbook dependency and inspect its version... -->
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <activation>
+ <property>
+ <name>build.translations</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>translate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Property changes on: doc/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 1 month
[webbeans-commits] Webbeans SVN: r545 - ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-12-17 13:12:41 -0500 (Wed, 17 Dec 2008)
New Revision: 545
Added:
ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java
ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorControllerBean.java
Removed:
ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java
Log:
Oops
Deleted: ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java
===================================================================
--- ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java 2008-12-17 15:58:20 UTC (rev 544)
+++ ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java 2008-12-17 18:12:41 UTC (rev 545)
@@ -1,40 +0,0 @@
-package org.jboss.webbeans.examples.translator;
-
-import javax.ejb.Stateful;
-import javax.webbeans.Current;
-import javax.webbeans.Named;
-import javax.webbeans.RequestScoped;
-
-@Stateful
-@RequestScoped
-@Named("translator")
-public class TranslatorController
-{
-
- @Current TextTranslator translator;
-
- private String inputText;
-
- private String translatedText;
-
- public String getText()
- {
- return inputText;
- }
-
- public void setText(String text)
- {
- this.inputText = text;
- }
-
- public void translate()
- {
- translatedText = translator.translate(inputText);
- }
-
- public String getTranslatedText()
- {
- return translatedText;
- }
-
-}
Added: ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java
===================================================================
--- ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java (rev 0)
+++ ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java 2008-12-17 18:12:41 UTC (rev 545)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.examples.translator;
+
+public interface TranslatorController
+{
+
+ public String getText();
+
+ public void setText(String text);
+
+ public void translate();
+
+ public String getTranslatedText();
+
+}
Copied: ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorControllerBean.java (from rev 544, ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorController.java)
===================================================================
--- ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorControllerBean.java (rev 0)
+++ ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorControllerBean.java 2008-12-17 18:12:41 UTC (rev 545)
@@ -0,0 +1,40 @@
+package org.jboss.webbeans.examples.translator;
+
+import javax.ejb.Stateful;
+import javax.webbeans.Current;
+import javax.webbeans.Named;
+import javax.webbeans.RequestScoped;
+
+@Stateful
+@RequestScoped
+@Named("translator")
+public class TranslatorControllerBean implements TranslatorController
+{
+
+ @Current TextTranslator translator;
+
+ private String inputText;
+
+ private String translatedText;
+
+ public String getText()
+ {
+ return inputText;
+ }
+
+ public void setText(String text)
+ {
+ this.inputText = text;
+ }
+
+ public void translate()
+ {
+ translatedText = translator.translate(inputText);
+ }
+
+ public String getTranslatedText()
+ {
+ return translatedText;
+ }
+
+}
Property changes on: ri/trunk/examples/translator/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/translator/TranslatorControllerBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 1 month