[webbeans-commits] Webbeans SVN: r2962 - ri/trunk/version-matrix.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-03 06:06:32 -0400 (Fri, 03 Jul 2009)
New Revision: 2962
Modified:
ri/trunk/version-matrix/pom.xml
Log:
prep for release
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-07-03 10:02:24 UTC (rev 2961)
+++ ri/trunk/version-matrix/pom.xml 2009-07-03 10:06:32 UTC (rev 2962)
@@ -50,8 +50,8 @@
<jsr299.tck.version>1.0.0.BETA3</jsr299.tck.version>
<webbeans.version>1.0.0.PREVIEW2</webbeans.version>
<webbeans.servlet.version>1.0.0.CR1</webbeans.servlet.version>
- <webbeans.se.version>1.0.0-SNAPSHOT</webbeans.se.version>
- <jboss.test.harness.version>1.0.0-SNAPSHOT</jboss.test.harness.version>
+ <webbeans.se.version>1.0.0.BETA1<webbeans.se.version>
+ <jboss.test.harness.version>1.0.0.BETA3</jboss.test.harness.version>
</properties>
<dependencyManagement>
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2961 - ri/trunk/version-matrix.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-03 06:02:24 -0400 (Fri, 03 Jul 2009)
New Revision: 2961
Modified:
ri/trunk/version-matrix/pom.xml
Log:
update to newer release plugin to fix svn bug
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-07-03 10:01:32 UTC (rev 2960)
+++ ri/trunk/version-matrix/pom.xml 2009-07-03 10:02:24 UTC (rev 2961)
@@ -47,8 +47,8 @@
</pluginRepositories>
<properties>
- <jsr299.tck.version>1.0.0-SNAPSHOT</jsr299.tck.version>
- <webbeans.version>1.0.0-SNAPSHOT</webbeans.version>
+ <jsr299.tck.version>1.0.0.BETA3</jsr299.tck.version>
+ <webbeans.version>1.0.0.PREVIEW2</webbeans.version>
<webbeans.servlet.version>1.0.0.CR1</webbeans.servlet.version>
<webbeans.se.version>1.0.0-SNAPSHOT</webbeans.se.version>
<jboss.test.harness.version>1.0.0-SNAPSHOT</jboss.test.harness.version>
@@ -371,7 +371,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-8</version>
+ <version>2.0-beta-9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2960 - tck/trunk.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-03 06:01:32 -0400 (Fri, 03 Jul 2009)
New Revision: 2960
Modified:
tck/trunk/pom.xml
Log:
update to newer release plugin to fix svn bug
Modified: tck/trunk/pom.xml
===================================================================
--- tck/trunk/pom.xml 2009-07-02 23:03:33 UTC (rev 2959)
+++ tck/trunk/pom.xml 2009-07-03 10:01:32 UTC (rev 2960)
@@ -349,7 +349,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-8</version>
+ <version>2.0-beta-9</version>
</plugin>
</plugins>
</pluginManagement>
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2959 - ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-02 19:03:33 -0400 (Thu, 02 Jul 2009)
New Revision: 2959
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java
Log:
make tests pass :-/
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java 2009-07-02 22:55:20 UTC (rev 2958)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java 2009-07-02 23:03:33 UTC (rev 2959)
@@ -1,5 +1,6 @@
package org.jboss.webbeans.test.unit.deployment.structure;
+import org.jboss.webbeans.BeanIdStore;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.SimpleBean;
@@ -27,7 +28,7 @@
this.classTransformer = new ClassTransformer(new TypeStore());
this.services = new SimpleServiceRegistry();
this.services.add(MetaAnnotationStore.class, new MetaAnnotationStore(classTransformer));
-
+ this.services.add(BeanIdStore.class, new BeanIdStore());
}
private void addBean(BeanManagerImpl manager, Class<?> c)
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2958 - ri/trunk/api/src/main/java/javax/enterprise/inject/spi.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-02 18:55:20 -0400 (Thu, 02 Jul 2009)
New Revision: 2958
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
Log:
ws
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java 2009-07-02 22:41:54 UTC (rev 2957)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java 2009-07-02 22:55:20 UTC (rev 2958)
@@ -7,11 +7,17 @@
import javax.enterprise.event.Notify;
import javax.enterprise.event.TransactionPhase;
-public interface ObserverMethod<X, T> {
- public Bean<X> getBean();
- public Type getObservedType();
- public Set<Annotation> getObservedBindings();
- public Notify getNotify();
- public TransactionPhase getTransactionPhase();
- public void notify(T event);
+public interface ObserverMethod<X, T>
+{
+ public Bean<X> getBean();
+
+ public Type getObservedType();
+
+ public Set<Annotation> getObservedBindings();
+
+ public Notify getNotify();
+
+ public TransactionPhase getTransactionPhase();
+
+ public void notify(T event);
}
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2957 - ri/trunk/impl/src/main/java/org/jboss/webbeans.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-02 18:41:54 -0400 (Thu, 02 Jul 2009)
New Revision: 2957
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
Log:
unify addBean, finish BeanIdStore
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java 2009-07-02 19:14:00 UTC (rev 2956)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java 2009-07-02 22:41:54 UTC (rev 2957)
@@ -103,7 +103,7 @@
return beans.containsKey(id);
}
- public Integer get(Bean<?> bean, BeanManagerImpl manager)
+ public Integer put(Bean<?> bean, BeanManagerImpl manager)
{
if (beans.inverse().containsKey(bean))
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-02 19:14:00 UTC (rev 2956)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-02 22:41:54 UTC (rev 2957)
@@ -528,21 +528,32 @@
public void addBean(Bean<?> bean)
{
- synchronized (bean)
- {
if (beans.contains(bean))
{
return;
}
- beanResolver.clear();
- beans.add(bean);
+ if (bean instanceof NewEnterpriseBean)
+ {
+ NewEnterpriseBean<?> newEnterpriseBean = (NewEnterpriseBean<?>) bean;
+ newEnterpriseBeans.put(newEnterpriseBean.getType(), newEnterpriseBean);
+ }
+ else if (bean instanceof DecoratorBean)
+ {
+ decorators.add((DecoratorBean<?>) bean);
+ }
+ if (bean instanceof RIBean)
+ {
+ RIBean<?> riBean = (RIBean<?>) bean;
+ riBeans.put(riBean.getId(), riBean);
+ }
+ getServices().get(BeanIdStore.class).put(bean, this);
registerBeanNamespace(bean);
for (BeanManagerImpl childActivity : childActivities)
{
childActivity.addBean(bean);
}
- return;
- }
+ this.beans.add(bean);
+ beanResolver.clear();
}
public <T> Set<Observer<T>> resolveObservers(T event, Annotation... bindings)
@@ -720,22 +731,6 @@
}
}
- public void addRIBean(RIBean<?> bean)
- {
- if (bean instanceof NewEnterpriseBean)
- {
- newEnterpriseBeans.put(bean.getType(), (EnterpriseBean<?>) bean);
- }
- if (bean instanceof DecoratorBean)
- {
- decorators.add((DecoratorBean<?>) bean);
- }
- riBeans.put(bean.getId(), bean);
- registerBeanNamespace(bean);
- this.beans.add(bean);
- beanResolver.clear();
- }
-
protected void registerBeanNamespace(Bean<?> bean)
{
if (bean.getName() != null && bean.getName().indexOf('.') > 0)
@@ -1377,4 +1372,12 @@
return sortedBeans.last();
}
+ /**
+ * @param bean
+ */
+ public void addRIBean(RIBean<?> bean)
+ {
+ addBean(bean);
+ }
+
}
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2956 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: bootstrap and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-02 15:14:00 -0400 (Thu, 02 Jul 2009)
New Revision: 2956
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
Log:
Add BeanIdStore service
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java 2009-07-02 19:14:00 UTC (rev 2956)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.webbeans.bootstrap.api.Service;
+
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+
+/**
+ * Application wide bean identifier service which allows a serializable
+ * reference to a bean to be obtained, and the bean object to be got for a given
+ * id. Note that this allows a Bean object to be loaded regardless of the bean's
+ * accessiblity from the current module, and should not be abused as a way to
+ * ignore accessibility rules enforced during resolution.
+ *
+ * @author Pete Muir
+ *
+ */
+public class BeanIdStore implements Service
+{
+
+ private static class BeanHolder<T>
+ {
+ public static <T> BeanHolder<T> of(Bean<T> bean, BeanManagerImpl manager)
+ {
+ return new BeanHolder<T>(bean, manager);
+ }
+
+ private final Bean<T> bean;
+ private final BeanManagerImpl manager;
+
+ public BeanHolder(Bean<T> bean, BeanManagerImpl manager)
+ {
+ this.bean = bean;
+ this.manager = manager;
+ }
+
+ public Bean<T> getBean()
+ {
+ return bean;
+ }
+
+ public BeanManagerImpl getManager()
+ {
+ return manager;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return bean.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof BeanHolder)
+ {
+ return (this.bean.equals(((BeanHolder<?>) obj).getBean()));
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ private final BiMap<Integer, BeanHolder<?>> beans;
+ private final AtomicInteger idGenerator;
+
+ public BeanIdStore()
+ {
+ this.idGenerator = new AtomicInteger(0);
+ this.beans = HashBiMap.create();
+ }
+
+ public <T> Bean<T> get(Integer id)
+ {
+ return (Bean<T>) beans.get(id).getBean();
+ }
+
+ public boolean contains(Integer id)
+ {
+ return beans.containsKey(id);
+ }
+
+ public Integer get(Bean<?> bean, BeanManagerImpl manager)
+ {
+ if (beans.inverse().containsKey(bean))
+ {
+ return beans.inverse().get(bean);
+ }
+ else
+ {
+ Integer id = idGenerator.incrementAndGet();
+ beans.put(id, BeanHolder.of(bean, manager));
+ return id;
+ }
+ }
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanIdStore.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-07-02 18:46:59 UTC (rev 2955)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-07-02 19:14:00 UTC (rev 2956)
@@ -23,6 +23,7 @@
import javax.enterprise.inject.spi.BeforeShutdown;
import javax.enterprise.inject.spi.Extension;
+import org.jboss.webbeans.BeanIdStore;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.DefinitionException;
@@ -214,6 +215,7 @@
getServices().add(TypeStore.class, new TypeStore());
getServices().add(ClassTransformer.class, new ClassTransformer(getServices().get(TypeStore.class)));
getServices().add(MetaAnnotationStore.class, new MetaAnnotationStore(getServices().get(ClassTransformer.class)));
+ getServices().add(BeanIdStore.class, new BeanIdStore());
}
public BeanManagerImpl getManager()
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2955 - in ri/trunk: impl/src/main/java/org/jboss/webbeans and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-02 14:46:59 -0400 (Thu, 02 Jul 2009)
New Revision: 2955
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCollection.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationVector.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingCollection.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingConcurrentMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingObject.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingSet.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/UnmodifiableIterator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/
Modified:
ri/trunk/impl/pom.xml
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCache.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterable.java
ri/trunk/version-matrix/pom.xml
Log:
switch to using google collections
Modified: ri/trunk/impl/pom.xml
===================================================================
--- ri/trunk/impl/pom.xml 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/pom.xml 2009-07-02 18:46:59 UTC (rev 2955)
@@ -79,6 +79,11 @@
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ </dependency>
<dependency>
<groupId>javax.jms</groupId>
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -98,12 +98,14 @@
import org.jboss.webbeans.util.Observers;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.collections.ForwardingIterable;
-import org.jboss.webbeans.util.collections.Iterables;
-import org.jboss.webbeans.util.collections.Iterators;
-import org.jboss.webbeans.util.collections.multi.ConcurrentListHashMultiMap;
-import org.jboss.webbeans.util.collections.multi.ConcurrentListMultiMap;
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Multimaps;
+
/**
* Implementation of the Web Beans Manager.
*
@@ -184,7 +186,7 @@
*/
// Contexts are shared across the application
- private transient final ConcurrentListMultiMap<Class<? extends Annotation>, Context> contexts;
+ private transient final ListMultimap<Class<? extends Annotation>, Context> contexts;
// Client proxies can be used application wide
private transient final ClientProxyProvider clientProxyProvider;
@@ -278,6 +280,16 @@
defaultEnabledDeploymentTypes.add(1, Production.class);
List<Class<?>> defaultEnabledDecoratorClasses = new ArrayList<Class<?>>();
+
+ ListMultimap<Class<? extends Annotation>, Context> contexts = Multimaps.newListMultimap(new ConcurrentHashMap<Class<? extends Annotation>, Collection<Context>>(), new Supplier<List<Context>>()
+ {
+
+ public List<Context> get()
+ {
+ return new CopyOnWriteArrayList<Context>();
+ }
+
+ });
return new BeanManagerImpl(
serviceRegistry,
@@ -288,7 +300,7 @@
new ConcurrentHashMap<Class<?>, EnterpriseBean<?>>(),
new ConcurrentHashMap<String, RIBean<?>>(),
new ClientProxyProvider(),
- new ConcurrentListHashMultiMap<Class<? extends Annotation>, Context>(),
+ contexts,
new CopyOnWriteArraySet<CurrentActivity>(),
new HashMap<Contextual<?>, Contextual<?>>(), defaultEnabledDeploymentTypes, defaultEnabledDecoratorClasses,
new AtomicInteger());
@@ -342,8 +354,7 @@
Map<Class<?>, EnterpriseBean<?>> newEnterpriseBeans,
Map<String, RIBean<?>> riBeans,
ClientProxyProvider clientProxyProvider,
- ConcurrentListMultiMap<Class<? extends Annotation>,
- Context> contexts,
+ ListMultimap<Class<? extends Annotation>, Context> contexts,
Set<CurrentActivity> currentActivities,
Map<Contextual<?>, Contextual<?>> specializedBeans,
List<Class<? extends Annotation>> enabledDeploymentTypes,
@@ -409,11 +420,21 @@
{
return new Iterable<T>()
{
+
+ private Function<Iterable<T>, Iterator<T>> function = new Function<Iterable<T>, Iterator<T>>()
+ {
+ public Iterator<T> apply(Iterable<T> iterable)
+ {
+ return iterable.iterator();
+ }
+
+ };
+
public Iterator<T> iterator()
{
Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
- return Iterators.concat(Iterators.transform(iterable.iterator(), Iterables.<T>iteratorTransform()));
+ return Iterators.concat(Iterators.transform(iterable.iterator(), function));
}
};
@@ -477,31 +498,6 @@
accessibleManagers.add(accessibleBeanManager);
}
- private static class ManagerAttachedIterable<X> extends ForwardingIterable<X>
- {
-
- private final BeanManagerImpl beanManager;
- private final Iterable<X> iterable;
-
- public ManagerAttachedIterable(BeanManagerImpl beanManager, Iterable<X> iterable)
- {
- this.beanManager = beanManager;
- this.iterable = iterable;
- }
-
- public BeanManagerImpl getBeanManager()
- {
- return beanManager;
- }
-
- @Override
- protected Iterable<X> delegate()
- {
- return iterable;
- }
-
- }
-
protected Set<BeanManagerImpl> getAccessibleManagers()
{
return accessibleManagers;
@@ -1216,7 +1212,7 @@
return clientProxyProvider;
}
- protected ConcurrentListMultiMap<Class<? extends Annotation>, Context> getContexts()
+ protected ListMultimap<Class<? extends Annotation>, Context> getContexts()
{
return contexts;
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans;
-
-import org.jboss.webbeans.util.collections.ForwardingIterable;
-
-class ManagerAttachedIterable<X> extends ForwardingIterable<X>
-{
-
- private final BeanManagerImpl beanManager;
- private final Iterable<X> iterable;
-
- public ManagerAttachedIterable(BeanManagerImpl beanManager, Iterable<X> iterable)
- {
- this.beanManager = beanManager;
- this.iterable = iterable;
- }
-
- public BeanManagerImpl getBeanManager()
- {
- return beanManager;
- }
-
- @Override
- protected Iterable<X> delegate()
- {
- return iterable;
- }
-
-}
\ No newline at end of file
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -21,6 +21,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -31,9 +32,11 @@
import org.jboss.webbeans.literal.CurrentLiteral;
import org.jboss.webbeans.metadata.TypeStore;
-import org.jboss.webbeans.util.collections.multi.SetHashMultiMap;
-import org.jboss.webbeans.util.collections.multi.SetMultiMap;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+
public class AnnotationStore
{
@@ -127,7 +130,7 @@
private final Map<Class<? extends Annotation>, Annotation> annotationMap;
// The meta-annotation map (annotation type -> set of annotations containing
// meta-annotation) of the item
- private final SetMultiMap<Class<? extends Annotation>, Annotation> metaAnnotationMap;
+ private final SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap;
// The set of all annotations on the item
private final Set<Annotation> annotationSet;
@@ -135,7 +138,7 @@
private final Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap;
// The meta-annotation map (annotation type -> set of annotations containing
// meta-annotation) of the item
- private final SetMultiMap<Class<? extends Annotation>, Annotation> declaredMetaAnnotationMap;
+ private final SetMultimap<Class<? extends Annotation>, Annotation> declaredMetaAnnotationMap;
// The set of all annotations on the item
private final Set<Annotation> declaredAnnotationSet;
@@ -156,7 +159,14 @@
}
this.annotationMap = annotationMap;
this.annotationSet = new HashSet<Annotation>();
- this.metaAnnotationMap = new SetHashMultiMap<Class<? extends Annotation>, Annotation>();
+ this.metaAnnotationMap = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), new Supplier<Set<Annotation>>()
+ {
+
+ public Set<Annotation> get()
+ {
+ return new HashSet<Annotation>();
+ }
+ });
for (Annotation annotation : annotationMap.values())
{
addMetaAnnotations(metaAnnotationMap, annotation, annotation.annotationType().getAnnotations());
@@ -170,7 +180,14 @@
}
this.declaredAnnotationMap = declaredAnnotationMap;
this.declaredAnnotationSet = new HashSet<Annotation>();
- this.declaredMetaAnnotationMap = new SetHashMultiMap<Class<? extends Annotation>, Annotation>();
+ this.declaredMetaAnnotationMap = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), new Supplier<Set<Annotation>>()
+ {
+
+ public Set<Annotation> get()
+ {
+ return new HashSet<Annotation>();
+ }
+ });
for (Annotation declaredAnnotation : declaredAnnotationMap.values())
{
addMetaAnnotations(declaredMetaAnnotationMap, declaredAnnotation, declaredAnnotation.annotationType().getAnnotations());
@@ -179,7 +196,7 @@
}
}
- private static void addMetaAnnotations(SetMultiMap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Annotation[] metaAnnotations)
+ private static void addMetaAnnotations(SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Annotation[] metaAnnotations)
{
for (Annotation metaAnnotation : metaAnnotations)
{
@@ -187,7 +204,7 @@
}
}
- private static void addMetaAnnotations(SetMultiMap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Iterable<Annotation> metaAnnotations)
+ private static void addMetaAnnotations(SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Iterable<Annotation> metaAnnotations)
{
for (Annotation metaAnnotation : metaAnnotations)
{
@@ -195,7 +212,7 @@
}
}
- private static void addMetaAnnotation(SetMultiMap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Class<? extends Annotation> metaAnnotationType)
+ private static void addMetaAnnotation(SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Class<? extends Annotation> metaAnnotationType)
{
// Only map meta-annotations we are interested in
if (MAPPED_METAANNOTATIONS.contains(metaAnnotationType))
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -18,6 +18,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -29,9 +30,11 @@
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBMethod;
import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.collections.multi.SetHashMultiMap;
-import org.jboss.webbeans.util.collections.multi.SetMultiMap;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+
/**
* Represents an annotated annotation
*
@@ -45,7 +48,7 @@
{
// The annotated members map (annotation -> member with annotation)
- private final SetMultiMap<Class<? extends Annotation>, WBMethod<?>> annotatedMembers;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> annotatedMembers;
// The implementation class of the annotation
private final Class<T> clazz;
// The set of abstracted members
@@ -73,7 +76,15 @@
super(AnnotationStore.of(annotationType, classTransformer.getTypeStore().get(annotationType), classTransformer.getTypeStore().get(annotationType), classTransformer.getTypeStore()), annotationType, annotationType, classTransformer);
this.clazz = annotationType;
members = new HashSet<WBMethod<?>>();
- annotatedMembers = new SetHashMultiMap<Class<? extends Annotation>, WBMethod<?>>();
+ annotatedMembers = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier<Set<WBMethod<?>>>()
+ {
+
+ public Set<WBMethod<?>> get()
+ {
+ return new HashSet<WBMethod<?>>();
+ }
+
+ });
this.namedMembers = new HashMap<String, WBMethod<?>>();
for (Method member : clazz.getDeclaredMethods())
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -22,6 +22,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -41,9 +42,11 @@
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.collections.multi.SetHashMultiMap;
-import org.jboss.webbeans.util.collections.multi.SetMultiMap;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+
/**
* Represents an annotated class
*
@@ -61,43 +64,43 @@
// The set of abstracted fields
private final Set<WBField<?>> fields;
// The map from annotation type to abstracted field with annotation
- private final SetMultiMap<Class<? extends Annotation>, WBField<?>> annotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?>> annotatedFields;
// The map from annotation type to abstracted field with meta-annotation
- private final SetMultiMap<Class<? extends Annotation>, WBField<?>> metaAnnotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?>> metaAnnotatedFields;
// The set of abstracted fields
private final Set<WBField<?>> declaredFields;
private final Map<String, WBField<?>> declaredFieldsByName;
// The map from annotation type to abstracted field with annotation
- private final SetMultiMap<Class<? extends Annotation>, WBField<?>> declaredAnnotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?>> declaredAnnotatedFields;
// The map from annotation type to abstracted field with meta-annotation
- private final SetMultiMap<Class<? extends Annotation>, WBField<?>> declaredMetaAnnotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?>> declaredMetaAnnotatedFields;
// The set of abstracted methods
private final Set<WBMethod<?>> methods;
private final Map<MethodSignature, WBMethod<?>> declaredMethodsBySignature;
private final Map<MethodSignature, WBMethod<?>> methodsBySignature;
// The map from annotation type to abstracted method with annotation
- private final SetMultiMap<Class<? extends Annotation>, WBMethod<?>> annotatedMethods;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> annotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final SetMultiMap<Class<? extends Annotation>, WBMethod<?>> methodsByAnnotatedParameters;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> methodsByAnnotatedParameters;
// The set of abstracted methods
private final Set<WBMethod<?>> declaredMethods;
// The map from annotation type to abstracted method with annotation
- private final SetMultiMap<Class<? extends Annotation>, WBMethod<?>> declaredAnnotatedMethods;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> declaredAnnotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final SetMultiMap<Class<? extends Annotation>, WBMethod<?>> declaredMethodsByAnnotatedParameters;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> declaredMethodsByAnnotatedParameters;
// The set of abstracted constructors
private final Set<WBConstructor<T>> constructors;
private final Map<ConstructorSignature, WBConstructor<?>> declaredConstructorsBySignature;
// The map from annotation type to abstracted constructor with annotation
- private final SetMultiMap<Class<? extends Annotation>, WBConstructor<T>> annotatedConstructors;
+ private final SetMultimap<Class<? extends Annotation>, WBConstructor<T>> annotatedConstructors;
// The map from class list to abstracted constructor
private final Map<List<Class<?>>, WBConstructor<T>> constructorsByArgumentMap;
- private final SetMultiMap<Class<? extends Annotation>, WBConstructor<?>> constructorsByAnnotatedParameters;
+ private final SetMultimap<Class<? extends Annotation>, WBConstructor<?>> constructorsByAnnotatedParameters;
// Cached string representation
private String toString;
@@ -123,12 +126,44 @@
super(annotationStore, rawType, type, classTransformer);
this.fields = new HashSet<WBField<?>>();
- this.annotatedFields = new SetHashMultiMap<Class<? extends Annotation>, WBField<?>>();
- this.metaAnnotatedFields = new SetHashMultiMap<Class<? extends Annotation>, WBField<?>>();
+ this.annotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ {
+
+ public Set<WBField<?>> get()
+ {
+ return new HashSet<WBField<?>>();
+ }
+
+ });
+ this.metaAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ {
+
+ public Set<WBField<?>> get()
+ {
+ return new HashSet<WBField<?>>();
+ }
+
+ });
this.declaredFields = new HashSet<WBField<?>>();
this.declaredFieldsByName = new HashMap<String, WBField<?>>();
- this.declaredAnnotatedFields = new SetHashMultiMap<Class<? extends Annotation>, WBField<?>>();
- this.declaredMetaAnnotatedFields = new SetHashMultiMap<Class<? extends Annotation>, WBField<?>>();
+ this.declaredAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ {
+
+ public Set<WBField<?>> get()
+ {
+ return new HashSet<WBField<?>>();
+ }
+
+ });
+ this.declaredMetaAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ {
+
+ public Set<WBField<?>> get()
+ {
+ return new HashSet<WBField<?>>();
+ }
+
+ });
this._nonStaticMemberClass = Reflections.isNonStaticInnerClass(rawType);
this._abstract = Reflections.isAbstract(rawType);
this._enum = rawType.isEnum();
@@ -169,8 +204,24 @@
this.constructors = new HashSet<WBConstructor<T>>();
this.constructorsByArgumentMap = new HashMap<List<Class<?>>, WBConstructor<T>>();
- this.annotatedConstructors = new SetHashMultiMap<Class<? extends Annotation>, WBConstructor<T>>();
- this.constructorsByAnnotatedParameters = new SetHashMultiMap<Class<? extends Annotation>, WBConstructor<?>>();
+ this.annotatedConstructors = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBConstructor<T>>>(), new Supplier< Set<WBConstructor<T>>>()
+ {
+
+ public Set<WBConstructor<T>> get()
+ {
+ return new HashSet<WBConstructor<T>>();
+ }
+
+ });
+ this.constructorsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBConstructor<?>>>(), new Supplier< Set<WBConstructor<?>>>()
+ {
+
+ public Set<WBConstructor<?>> get()
+ {
+ return new HashSet<WBConstructor<?>>();
+ }
+
+ });
this.declaredConstructorsBySignature = new HashMap<ConstructorSignature, WBConstructor<?>>();
for (Constructor<?> constructor : rawType.getDeclaredConstructors())
{
@@ -190,7 +241,7 @@
{
if (!annotatedConstructors.containsKey(annotation.annotationType()))
{
- annotatedConstructors.put(annotation.annotationType(), new HashSet<WBConstructor<T>>());
+ annotatedConstructors.putAll(annotation.annotationType(), new HashSet<WBConstructor<T>>());
}
annotatedConstructors.get(annotation.annotationType()).add(annotatedConstructor);
}
@@ -205,11 +256,43 @@
}
this.methods = new HashSet<WBMethod<?>>();
- this.annotatedMethods = new SetHashMultiMap<Class<? extends Annotation>, WBMethod<?>>();
- this.methodsByAnnotatedParameters = new SetHashMultiMap<Class<? extends Annotation>, WBMethod<?>>();
+ this.annotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ {
+
+ public Set<WBMethod<?>> get()
+ {
+ return new HashSet<WBMethod<?>>();
+ }
+
+ });
+ this.methodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ {
+
+ public Set<WBMethod<?>> get()
+ {
+ return new HashSet<WBMethod<?>>();
+ }
+
+ });
this.declaredMethods = new HashSet<WBMethod<?>>();
- this.declaredAnnotatedMethods = new SetHashMultiMap<Class<? extends Annotation>, WBMethod<?>>();
- this.declaredMethodsByAnnotatedParameters = new SetHashMultiMap<Class<? extends Annotation>, WBMethod<?>>();
+ this.declaredAnnotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ {
+
+ public Set<WBMethod<?>> get()
+ {
+ return new HashSet<WBMethod<?>>();
+ }
+
+ });
+ this.declaredMethodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ {
+
+ public Set<WBMethod<?>> get()
+ {
+ return new HashSet<WBMethod<?>>();
+ }
+
+ });
this.declaredMethodsBySignature = new HashMap<MethodSignature, WBMethod<?>>();
this.methodsBySignature = new HashMap<MethodSignature, WBMethod<?>>();
for (Class<?> c = rawType; c != Object.class && c != null; c = c.getSuperclass())
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -21,7 +21,9 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import org.jboss.webbeans.BeanManagerImpl;
@@ -32,9 +34,11 @@
import org.jboss.webbeans.introspector.WBType;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.collections.multi.ListHashMultiMap;
-import org.jboss.webbeans.util.collections.multi.ListMultiMap;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Multimaps;
+
/**
* Represents an annotated constructor
*
@@ -53,7 +57,7 @@
// The list of parameter abstractions
private final List<WBParameter<?>> parameters;
// The mapping of annotation -> parameter abstraction
- private final ListMultiMap<Class<? extends Annotation>, WBParameter<?>> annotatedParameters;
+ private final ListMultimap<Class<? extends Annotation>, WBParameter<?>> annotatedParameters;
// The declaring class abstraction
private final WBType<T> declaringClass;
@@ -83,7 +87,15 @@
this.declaringClass = declaringClass;
this.parameters = new ArrayList<WBParameter<?>>();
- annotatedParameters = new ListHashMultiMap<Class<? extends Annotation>, WBParameter<?>>();
+ annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends Annotation>, Collection<WBParameter<?>>>(), new Supplier< List<WBParameter<?>>>()
+ {
+
+ public List<WBParameter<?>> get()
+ {
+ return new ArrayList<WBParameter<?>>();
+ }
+
+ });
for (int i = 0; i < constructor.getParameterTypes().length; i++)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -22,7 +22,9 @@
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import org.jboss.webbeans.introspector.AnnotationStore;
@@ -33,9 +35,11 @@
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.collections.multi.ListHashMultiMap;
-import org.jboss.webbeans.util.collections.multi.ListMultiMap;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Multimaps;
+
/**
* Represents an annotated method
*
@@ -55,7 +59,7 @@
private final List<WBParameter<?>> parameters;
// A mapping from annotation type to parameter abstraction with that
// annotation present
- private final ListMultiMap<Class<? extends Annotation>, WBParameter<?>> annotatedParameters;
+ private final ListMultimap<Class<? extends Annotation>, WBParameter<?>> annotatedParameters;
// The property name
private final String propertyName;
@@ -90,7 +94,15 @@
this.method.setAccessible(true);
this.declaringClass = declaringClass;
this.parameters = new ArrayList<WBParameter<?>>();
- this.annotatedParameters = new ListHashMultiMap<Class<? extends Annotation>, WBParameter<?>>();
+ this.annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends Annotation>, Collection<WBParameter<?>>>(), new Supplier< List<WBParameter<?>>>()
+ {
+
+ public List<WBParameter<?>> get()
+ {
+ return new ArrayList<WBParameter<?>>();
+ }
+
+ });
for (int i = 0; i < method.getParameterTypes().length; i++)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -17,13 +17,17 @@
package org.jboss.webbeans.metadata;
import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.util.collections.multi.ConcurrentSetHashMultiMap;
-import org.jboss.webbeans.util.collections.multi.ConcurrentSetMultiMap;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+
/**
* @author pmuir
*
@@ -31,11 +35,19 @@
public class TypeStore implements Service
{
- private final ConcurrentSetMultiMap<Class<? extends Annotation>, Annotation> extraAnnotations;
+ private final SetMultimap<Class<? extends Annotation>, Annotation> extraAnnotations;
public TypeStore()
{
- this.extraAnnotations = new ConcurrentSetHashMultiMap<Class<? extends Annotation>, Annotation>();
+ this.extraAnnotations = Multimaps.synchronizedSetMultimap(Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), new Supplier<Set<Annotation>>()
+ {
+
+ public Set<Annotation> get()
+ {
+ return new HashSet<Annotation>();
+ }
+
+ }));
}
public Set<Annotation> get(Class<? extends Annotation> annotationType)
@@ -50,7 +62,6 @@
public void addAll(Class<? extends Annotation> annotationType, Set<Annotation> annotations)
{
- this.extraAnnotations.putIfAbsent(annotationType, new CopyOnWriteArraySet<Annotation>());
this.extraAnnotations.get(annotationType).addAll(annotations);
}
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.util.collections;
-
-import java.util.NoSuchElementException;
-
-/**
- * This class provides a skeletal implementation of the {@code Iterator}
- * interface, to make this interface easier to implement for certain types of
- * data sources.
- *
- * <p>
- * {@code Iterator} requires its implementations to support querying the
- * end-of-data status!
without changing the iterator's state, using the
- * {@link #hasNext} method. But many data sources, such as
- * {@link java.io.Reader#read()}), do not expose this information; the only way
- * to discover whether there is any data left is by trying to retrieve it. These
- * types of data sources are ordinarily difficult to write iterators for. But
- * using this class, one must implement only the {@link #computeNext} method,
- * and invoke the {@link #endOfData} method when appropriate.
- *
- * <p>
- * Another example is an iterator that skips over null elements in a backing
- * iterator. This could be implemented as:
- *
- * <pre>
- * @code
- * public static Iterator<String> skipNulls(final Iterator<String> in) {
- * return new AbstractIterator<String>() {
- * protected String computeNext() {
- * while (in.hasNext()) {
- * String s = in.next();
- * if (s != null) {
- * return s;
- * }
!
- * }
- * return endOfData();
- * }
- * !
};
-
* }}
- * </pre>
- *
- * This class supports iterators that include null elements.
- *
- * @author Kevin Bourrillion
- */
-public abstract class AbstractIterator<T> extends UnmodifiableIterator<T>
-{
- private State state = State.NOT_READY;
-
- private enum State
- {
- /** We have computed the next element and haven't returned it yet. */
- READY,
-
- /** We haven't yet computed or have already returned the element. */
- NOT_READY,
-
- /** We have reached the end of the data and are finished. */
- DONE,
-
- /** We've suffered an exception and are kaput. */
- FAILED,
- }
-
- private T next;
-
- /**
- * Returns the next element. <b>Note:</b> the implementation must call
- * {@link #endOfData()} when there are no elements left in the iteration.
- * Failure to do so could result in an infinite loop.
- *
- * <p>
- * The initial invocation of {@link #hasNext()} or {@link #next()} calls this
- * method, as!
does the first invocation of {@code hasNext} or {@code next}
- * following each successful call to {@code next}. Once the implementation
- * either invokes {@code endOfData} or throws an exception, {@code
- * computeNext} is guaranteed to never be called again.
- *
- * <p>
- * If this method throws an exception, it will propagate outward to the
- * {@code hasNext} or {@code next} invocation that invoked this method. Any
- * further attempts to use the iterator will result in an
- * {@link IllegalStateException}.
- *
- * <p>
- * The implementation of this method many not invoke the {@code hasNext},
- * {@code next}, or {@link #peek()} methods on this instance; if it does, an
- * {@code IllegalStateException} will result.
- *
- * @return the next element if there was one. If {@code endOfData} was called
- * during execution, the return value will be ignored.
- * @throws RuntimeException if any unrecoverable err!
or happens. This
- * exception will propagate ou!
tward to
the {@code hasNext()},
- * {@code next()}, or {@code peek()} invocation that invoked this
- * method. Any further attempts to use the iterator will result in
- * an {@link IllegalStateException}.
- */
- protected abstract T computeNext();
-
- /**
- * Implementations of {@code computeNext} <b>must</b> invoke this method when
- * there are no elements left in the iteration.
- *
- * @return {@code null}; a convenience so your {@link #computeNext}
- * implementation can use the simple statement {@code return
- * endOfData();}
- */
- protected final T endOfData()
- {
- state = State.DONE;
- return null;
- }
-
- public final boolean hasNext()
- {
- if (state == State.FAILED)
- {
- throw new IllegalStateException();
- }
- switch (state)
- {
- case DONE:
- return false;
- case READY:
- return true;
- default:
- !
}
- return tryToComputeNext();
- }
-
- private boolean tryToComputeNext()
- {
- state = State.FAILED; // temporary pessimism
- next = computeNext();
- if (state != State.DONE)
- {
- state = State.READY;
- return true;
- }
- return false;
- }
-
- public final T next()
- {
- if (!hasNext())
- {
- throw new NoSuchElementException();
- }
- state = State.NOT_READY;
- return next;
- }
-
- /**
- * Returns the next element in the iteration without advancing the iteration,
- * according to the contract of {@link PeekingIterator#peek()}.
- *
- * <p>
- * Implementations of {@code AbstractIterator} that wish to expose this
- * functionality should implement {@code PeekingIterator}.
- */
- public final T peek()
- {
- if (!hasNext())
- {
- throw new NoSuchElementException();
- }
- return next;
- }
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCache.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCache.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCache.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -23,6 +23,8 @@
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
+import com.google.common.collect.ForwardingMap;
+
/**
* Represents a thread safe map
*
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCollection.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCollection.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCollection.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
-import java.util.Collection;
-import java.util.concurrent.CopyOnWriteArrayList;
-e @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Collection;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/**
- * Adds concurrent add operations to the collection interface. Signatures and
- * javadoc taken from {@link CopyOnWriteArrayList}.
- *
- * @author Pete Muir
- *
- */
-public interface ConcurrentCollection<E> extends Collection<E>
-{
- /**
- * Appends all of the elements in the specified collection that are not
- * already contained in this list, to the end of this list, in the order that
- * they are returned by the specified collection's iterator.
- *
- * @param c
- * collection containing elements to be added to this list
- * @return the number of elements added
- * @throws NullPointerException
- * if the specified collection is null
- */
- public int addAllAbsent(Collection<? extends E> c);
-
- /**
- * Append the element if not present.
- *
- * @param e
- * element to be added to this list, if absent
- * @return true if the element was added
- */
- public boolean addIfAbsent(E e);
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Collection;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/**
- * Implementation of {@link ConcurrentCollection} using a
- * {@link CopyOnWriteArrayList}
- *
- * @author Pete Muir
- *
- */
-public class ConcurrentList<E> extends CopyOnWriteArrayList<E> implements ConcurrentCollection<E>
-{
-
- @SuppressWarnings("unchecked")
- private static final ConcurrentList EMPTY_LIST = new ConcurrentList();
-
- @SuppressWarnings("unchecked")
- public static <E> ConcurrentList<E> emptyList()
- {
- return EMPTY_LIST;
- }
-
- private static final long serialVersionUID = -7489797765014324457L;
-
- public ConcurrentList()
- {
- super();
- }
-
- public ConcurrentList(Collection<? extends E> collection)
- {
- super(collection);
- }
-
- public ConcurrentList(E[] array)
- {
- super(array);
- }
-
-
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterable.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterable.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -17,11 +17,13 @@
package org.jboss.webbeans.util.collections;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
+import com.google.common.collect.Iterables;
+
+
/**
* An Enumeration -> Iteratble adaptor
*
@@ -53,7 +55,7 @@
*/
public Iterator<T> iterator()
{
- return Collections.unmodifiableList(list).iterator();
+ return Iterables.unmodifiableIterable(list).iterator();
}
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterator.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationIterator.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Enumeration;
-import java.util.Iterator;
-
-/**
- * An enumeration -> iterator adapter
- *
- * @author Pete Muir
- */
-public class EnumerationIterator<T> implements Iterator<T>
-{
- // The enumeration
- private Enumeration<T> e;
-
- /**
- * Constructor
- *
- * @param e The enumeration
- */
- public EnumerationIterator(Enumeration<T> e)
- {
- this.e = e;
- }
-
- /**
- * Indicates if there are more items to iterate
- *
- * @return True if more, false otherwise
- */
- public boolean hasNext()
- {
- return e.hasMoreElements();
- }
-
- /**
- * Gets the next item
- *
- * @return The next items
- */
- public T next()
- {
- return (T) e.nextElement();
- }
-
- /**
- * Removes an item. Not supported
- */
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationVector.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationVector.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationVector.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,19 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingCollection.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingCollection.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingCollection.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * A collection which forwards all its method calls to another collection.
- * Subclasses should override one or more methods to modify the behavior of the
- * backing collection as desired per the <a
- * href="http://en.wikipedia.org/wiki/Decorator_pattern">decora!
tor pattern</a>.
- *
- * @see ForwardingObject
- * @author Kevin Bourrillion
- * @author Pete Muir
- */
-public abstract class ForwardingCollection<E> extends ForwardingObject implements Collection<E>
-{
-
- @Override
- protected abstract Collection<E> delegate();
-
- public Iterator<E> iterator()
- {
- return delegate().iterator();
- }
-
- public int size()
- {
- return delegate().size();
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * This method always throws a {@link NullPointerException} when {@code
- * collection} is null.
- */
- public boolean removeAll(Collection<?> collection)
- {
- return delegate().removeAll(checkNotNull(collection));
- }
-
- public boolean isEmpty()
- {
- return delegate().isEmpty();
- }
-
- public boolean contains(Object object)
- {
- return delegate().contains(object);
- }
-
- public Object[] toArray()
- {
- return delegate().toArray();!
- }
-
- public <T> T[] toArray(T[] array)
- {
- !
return
delegate().toArray(array);
- }
-
- public boolean add(E element)
- {
- return delegate().add(element);
- }
-
- public boolean remove(Object object)
- {
- return delegate().remove(object);
- }
-
- public boolean containsAll(Collection<?> collection)
- {
- return delegate().containsAll(collection);
- }
-
- public boolean addAll(Collection<? extends E> collection)
- {
- return delegate().addAll(collection);
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * This method always throws a {@link NullPointerException} when {@code
- * collection} is null.
- */
- public boolean retainAll(Collection<?> collection)
- {
- return delegate().retainAll(checkNotNull(collection));
- }
-
- public void clear()
- {
- delegate().clear();
- }
-
- /**
- * Ensures that an object reference passed as a parameter to the calling
- * method is not null.
- *
- * @param reference
- * !
an object reference
- * @return the non-null reference that was validated
- * @throws NullPointerException
- * if {@code reference} is null
- */
- public static <T> T checkNotNull(T reference)
- {
- if (reference == null)
- {
- throw new NullPointerException();
- }
- return reference;
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingConcurrentMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingConcurrentMap.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingConcurrentMap.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * A concurrent map which forwards all its method calls to another concurrent
- * map. Subclasses should override one or more methods to modify the behavior of
- * the backing map as desired per the <a
- * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</!
a>.
- *
- * @see ForwardingObject
- * @author Charles Fry
- */
-public abstract class ForwardingConcurrentMap<K, V> extends ForwardingMap<K, V> implements ConcurrentMap<K, V>
-{
-
- @Override
- protected abstract ConcurrentMap<K, V> delegate();
-
- public V putIfAbsent(K key, V value)
- {
- return delegate().putIfAbsent(key, value);
- }
-
- public boolean remove(Object key, Object value)
- {
- return delegate().remove(key, value);
- }
-
- public V replace(K key, V value)
- {
- return delegate().replace(key, value);
- }
-
- public boolean replace(K key, V oldValue, V newValue)
- {
- return delegate().replace(key, oldValue, newValue);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Iterator;
-
-/**
- * @author pmuir
- *
- */
-public abstract class ForwardingIterable<T> implements java.lang.Iterable<T>
-{
-
- public Iterator<T> iterator()
- {
- return delegate().iterator();
- }
-
- protected abstract Iterable<T> delegate();
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Iterator;
-
-/**
- * @author pmuir
- *
- */
-public abstract class ForwardingIterator<E> implements Iterator<E>
-{
-
- protected abstract Iterator<E> delegate();
-
- public boolean hasNext()
- {
- return hasNext();
- }
-
- public E next()
- {
- return next();
- }
-
- public void remove()
- {
- remove();
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate().equals(obj);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingMap.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingMap.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A map which forwards all its method calls to another map. Subclasses should
- * override one or more methods to modify the behavior of the backing map as
- * desired per the <a
- * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator!
pattern</a>.
- *
- * @see ForwardingObject
- * @author Kevin Bourrillion
- * @author Jared Levy
- */
-public abstract class ForwardingMap<K, V> extends ForwardingObject implements Map<K, V>
-{
-
- @Override
- protected abstract Map<K, V> delegate();
-
- public int size()
- {
- return delegate().size();
- }
-
- public boolean isEmpty()
- {
- return delegate().isEmpty();
- }
-
- public V remove(Object object)
- {
- return delegate().remove(object);
- }
-
- public void clear()
- {
- delegate().clear();
- }
-
- public boolean containsKey(Object key)
- {
- return delegate().containsKey(key);
- }
-
- public boolean containsValue(Object value)
- {
- return delegate().containsValue(value);
- }
-
- public V get(Object key)
- {
- return delegate().get(key);
- }
-
- public V put(K key, V value)
- {
- return delegate().put(key, value);
- }
-
- public void putAll!
(Map<? extends K, ? extends V> map)
- {
- delegate().pu!
tAll(map
);
- }
-
- private transient Set<K> keySet;
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * The returned set's {@code removeAll} and {@code retainAll} methods always
- * throw a {@link NullPointerException} when given a null collection.
- */
- public Set<K> keySet()
- {
- return (keySet == null) ? keySet = createKeySet() : keySet;
- }
-
- /**
- * Generates a {@link Set} for use by {@link #keySet()}.
- *
- * <p>
- * ForwardingMap's implementation of keySet() calls this method to generate a
- * collection of values, and then reuses that Set for subsequent invocations.
- * By default, this Set is essentially the result of invoking keySet() on the
- * delegate. Override this method if you want to provide another
- * implementation.
- *
- * @return A set for use by keySet().
- */
- protected Set<K> createKeySet()
- {
- final Set<K> delegate = delegate().keySet();
- return new ForwardingSet<K!
>()
- {
- @Override
- protected Set<K> delegate()
- {
- return delegate;
- }
- };
- }
-
- private transient Collection<V> values;
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * The returned collection's {@code removeAll} and {@code retainAll} methods
- * always throw a {@link NullPointerException} when given a null collection.
- */
- public Collection<V> values()
- {
- return (values == null) ? values = createValues() : values;
- }
-
- /**
- * Generates a {@link Collection} for use by {@link #values()}.
- *
- * <p>
- * ForwardingMap's implementation of {@code values()} calls this method to
- * generate a collection of values, and then reuses that collection for
- * subsequent invocations. By default, this collection is essentially the
- * result of invoking values() on the delegate. Override this method if you
- * want to provide another implementation.
- !
*
- * @return A set for use by values().
- */
- pr!
otected
Collection<V> createValues()
- {
- final Collection<V> delegate = delegate().values();
- return new ForwardingCollection<V>()
- {
- @Override
- protected Collection<V> delegate()
- {
- return delegate;
- }
- };
- }
-
- private transient Set<Entry<K, V>> entrySet;
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * The returned set's {@code removeAll} and {@code retainAll} methods always
- * throw a {@link NullPointerException} when given a null collection.
- */
- public Set<Entry<K, V>> entrySet()
- {
- return (entrySet == null) ? entrySet = createEntrySet() : entrySet;
- }
-
- /**
- * Generates a {@link Set} for use by {@link #entrySet()}.
- *
- * <p>
- * ForwardingMap's implementation of entrySet() calls this method to generate
- * a set of entries, and then reuses that set for subsequent invocations. By
- * default, this set is essentially the result of!
invoking entrySet() on the
- * delegate. Override this method if you want to provide another
- * implementation.
- *
- * @return A set for use by entrySet().
- */
- protected Set<Entry<K, V>> createEntrySet()
- {
- final Set<Entry<K, V>> delegate = delegate().entrySet();
- return new ForwardingSet<Entry<K, V>>()
- {
- @Override
- protected Set<Entry<K, V>> delegate()
- {
- return delegate;
- }
- };
- }
-
- @Override
- public boolean equals(Object object)
- {
- return object == this || delegate().equals(object);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingObject.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingObject.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingObject.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.io.Serializable;
-
-/**
- * An abstract base class for implementing the <a
- * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
- * The {@link #delegate()} method must be overridden to return the instance
- * being decorated.
- *
- * This class does <i>not</i> forward the {@code hashCode}!
and {@code equals}
- * methods through to the backing object, but relies on {@code Object}'s
- * implementation. This is necessary to preserve the symmetry of {@code equals}.
- * Custom definitions of equality are usually based on an interface, such as
- * {@code Set} or {@code List}, so that the implementation of {@code equals} can
- * cast the object being tested for equality to the custom interface. {@code
- * ForwardingObject} implements no such custom interfaces directly; they are
- * implemented only in subclasses. Therefore, forwarding {@code equals} would
- * break symmetry, as the forwarding object might consider itself equal to the
- * object being tested, but the reverse could not be true. This behavior is
- * consistent with the JDK's collection wrappers, such as
- * {@link java.util.Collections#unmodifiableCollection}. Use an
- * interface-specific subclass of {@code ForwardingObject}, such as
- * {@link ForwardingList}, to preserve equality behavior, or overr!
ide {@code
- * equals} directly.
- *
- * <p>
- * The {@code t!
oString}
method is forwarded to the delegate. Although this class
- * does not implement {@link Serializable}, a serializable subclass may be
- * created since this class has a parameter-less constructor.
- *
- * @author Mike Bostock
- */
-public abstract class ForwardingObject
-{
-
- /** Sole constructor. */
- protected ForwardingObject()
- {
- }
-
- /**
- * Returns the backing delegate instance that methods are forwarded to.
- * Abstract subclasses generally override the {@link ForwardingObject} method
- * with an abstract method that has a more specific return type, such as
- * {@link ForwardingSet#delegate}. Concrete subclasses override this method
- * to supply the instance being decorated.
- */
- protected abstract Object delegate();
-
- /**
- * Returns the string representation generated by the delegate's {@code
- * toString} method.
- */
- @Override
- public String toString()
- {
- return delegate().toString();
- !
}
-
- /* No equals or hashCode. See class comments for details. */
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingSet.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingSet.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingSet.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Set;
-
-/**
- * A set which forwards all its method calls to another set. Subclasses should
- * override one or more methods to modify the behavior of the backing set as
- * desired per the <a
- * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
- *
- * @see ForwardingObject
- * @aut!
hor Kevin Bourrillion
- */
-public abstract class ForwardingSet<E> extends ForwardingCollection<E> implements Set<E>
-{
-
- @Override
- protected abstract Set<E> delegate();
-
- @Override
- public boolean equals(Object object)
- {
- return object == this || delegate().equals(object);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Iterator;
-
-/**
- * @author pmuir
- *
- */
-public class Iterables
-{
-
- private Iterables() {}
-
- public static <T> Iterators.Function<Iterable<? extends T>, Iterator<? extends T>> iteratorTransform()
- {
- return new Iterators.Function<Iterable<? extends T>, Iterator<? extends T>>()
- {
-
- public Iterator<? extends T> apply(Iterable<? extends T> from)
- {
- return from.iterator();
- }
-
- };
- }
-
- public static <T> Iterable<T> concat(final Iterable<? extends Iterable<? extends T>> inputs)
- {
- return new Iterable<T>()
- {
-
- public Iterator<T> iterator()
- {
- return Iterators.concat(Iterators.transform(inputs.iterator(), Iterables.<T>iteratorTransform()));
- }
-
- };
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,140 +0,0 @@
-/*
- *
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Copyright (C) 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util.collections;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * @author Pete Muir
- * @author Kevin Bourrillion
- * @author Scott Bonneau
- *
- */
-public class Iterators
-{
-
- static final UnmodifiableIterator<Object> EMPTY_ITERATOR = new UnmodifiableIterator<Object>()
- {
- public boolean hasNext()
- {
- return false;
- }
-
- public Object next()
- {
- throw new NoSuchElementException();
- }
- };
-
- /** Returns the empty {@code Iterator}. */
- // Casting to any type is safe since there are no actual elements.
- @SuppressWarnings("unchecked")
- public static <T> UnmodifiableIterator<T> emptyIterator()
- {
- return (UnmodifiableIterator<T>) EMPTY_ITERATOR;
- }
-
- /**
- * Combines multiple iterators into a single iterator. The returned iterator
- * iterates across the elements of each iterator in {@code inputs}. The input
- * iterators are not polled until necessary.
- *
- * <p>
- * The returned iterator supports {@code remove()} when the corresponding
- * input iterator supports it. The methods of the returned iterator may throw
- * {@code NullPointerException} if any of the input iterators are null.
- */
- public static <E> Iterator<E> concat(final Iterator<? extends Iterator<? extends E>> inputs)
- {
- if (inputs == null)
- {
- throw new NullPointerException();
- }
-
- return new Iterator<E>()
- {
- Iterator<? extends E> current = emptyIterator();
- Iterator<? extends E> removeFrom;
-
- public boolean hasNext()
- {
- boolean currentHasNext;
- while (!(currentHasNext = current.hasNext()) && inputs.hasNext())
- {
- current = inputs.next();
- }
- return currentHasNext;
- }
-
- public E next()
- {
- if (!hasNext())
- {
- throw new NoSuchElementException();
- }
- removeFrom = current;
- return current.next();
- }
-
- public void remove()
- {
- if (removeFrom == null)
- {
- throw new IllegalStateException("no calls to next() since last call to remove()");
- }
- removeFrom.remove();
- removeFrom = null;
- }
- };
- }
-
- public static interface Function<F, T>
- {
- public T apply(F from);
- }
-
- public static <F, T> Iterator<T> transform(final Iterator<F> fromIterator, final Function<? super F, ? extends T> function)
- {
- if (function == null)
- {
- throw new IllegalStateException();
- }
- return new Iterator<T>()
- {
- public boolean hasNext()
- {
- return fromIterator.hasNext();
- }
-
- public T next()
- {
- F from = fromIterator.next();
- return function.apply(from);
- }
-
- public void remove()
- {
- fromIterator.remove();
- }
- };
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/UnmodifiableIterator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/UnmodifiableIterator.java 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/UnmodifiableIterator.java 2009-07-02 18:46:59 UTC (rev 2955)
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans.util.collections;
-
-import java.util.Iterator;
-
-/**
- * An iterator that does not support {@link #remove}.
- *
- * @author Jared Levy
- */
-public abstract class UnmodifiableIterator<E> implements Iterator<E> {
- /**
- * Guaranteed to throw an exception and leave the underlying data unmodified.
- *
- * @throws UnsupportedOperationExcepti!
on always
- */
- public final void remove() {
- throw new UnsupportedOperationException();
- }
-}
-
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-07-02 16:19:34 UTC (rev 2954)
+++ ri/trunk/version-matrix/pom.xml 2009-07-02 18:46:59 UTC (rev 2955)
@@ -93,6 +93,12 @@
<artifactId>scannotation</artifactId>
<version>1.0.2</version>
</dependency>
+
+ <dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0-rc2</version>
+ </dependency>
<dependency>
<groupId>javassist</groupId>
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2954 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-02 12:19:34 -0400 (Thu, 02 Jul 2009)
New Revision: 2954
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/jms/
Log:
Remove uneeded classes for EE resources
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceBean.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,233 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javassist.util.proxy.MethodHandler;
-import javassist.util.proxy.ProxyFactory;
-import javassist.util.proxy.ProxyObject;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.deployment.Production;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.injection.WBInjectionPoint;
-import org.jboss.webbeans.literal.CurrentLiteral;
-import org.jboss.webbeans.util.Proxies;
-
-/**
- * Representation of a Java EE Resource bean
- *
- * @author Pete Muir
- *
- */
-public abstract class AbstractJavaEEResourceBean<T> extends RIBean<T>
-{
-
- private static final Set<Annotation> DEFAULT_BINDINGS = new HashSet<Annotation>();
-
- static
- {
- DEFAULT_BINDINGS.add(new CurrentLiteral());
- }
-
- private final Class<? extends Annotation> deploymentType;
- private final Set<Annotation> bindings;
- private final Class<T> type;
- private final Set<Type> types;
- private final Class<T> proxyClass;
-
- /**
- * @param manager the manager used to create this bean
- * @param deploymentType the deployment type of the bean
- * @param bindings the bindings of bean
- * @param type the concrete type of the bean
- */
- protected AbstractJavaEEResourceBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type)
- {
- this(manager, deploymentType, bindings, type, type);
- }
-
- /**
- * @param manager the manager used to create this bean
- * @param deploymentType the deployment type of the bean
- * @param bindings the bindings of bean
- * @param type the concrete type of the bean
- */
- protected AbstractJavaEEResourceBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, Type... types)
- {
- super(manager);
- if (deploymentType != null)
- {
- this.deploymentType = deploymentType;
- }
- else
- {
- this.deploymentType = Production.class;
- }
- if (bindings != null)
- {
- this.bindings = bindings;
- }
- else
- {
- this.bindings = DEFAULT_BINDINGS;
- }
- if (type == null)
- {
- throw new IllegalStateException("Type must be specified");
- }
- if (types == null || types.length == 0)
- {
- throw new IllegalStateException("Types must be specified");
- }
- this.type = type;
- this.types = new HashSet<Type>();
- this.types.addAll(Arrays.asList(types));
- ProxyFactory proxyFactory = Proxies.getProxyFactory(this.types);
-
- @SuppressWarnings("unchecked")
- Class<T> proxyClass = proxyFactory.createClass();
-
- this.proxyClass = proxyClass;
- }
-
- public Set<Annotation> getBindings()
- {
- return bindings;
- }
-
- public Class<? extends Annotation> getScopeType()
- {
- return Dependent.class;
- }
-
- public String getName()
- {
- return null;
- }
-
- public Class<? extends Annotation> getDeploymentType()
- {
- return deploymentType;
- }
-
- @Override
- public Class<T> getType()
- {
- return type;
- }
-
- public Set<Type> getTypes()
- {
- return Collections.unmodifiableSet(types);
- }
-
- @Override
- public boolean isSpecializing()
- {
- return false;
- }
-
- @Override
- public RIBean<?> getSpecializedBean()
- {
- return null;
- }
-
- @Override
- public boolean isDependent()
- {
- return true;
- }
-
- @Override
- public Set<WBInjectionPoint<?, ?>> getAnnotatedInjectionPoints()
- {
- return Collections.emptySet();
- }
-
- public boolean isNullable()
- {
- return true;
- }
-
- @Override
- public boolean isPrimitive()
- {
- return false;
- }
-
- public boolean isSerializable()
- {
- return true;
- }
-
- @Override
- public boolean isProxyable()
- {
- return false;
- }
-
- protected Class<T> getProxyClass()
- {
- return proxyClass;
- }
-
- public T create(CreationalContext<T> creationalContext)
- {
- T instance;
- try
- {
- instance = getProxyClass().newInstance();
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException("Error creating proxy for " + this, e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException("Error creating proxy for " + this, e);
- }
- ((ProxyObject) instance).setHandler(newMethodHandler());
- return instance;
- }
-
- protected abstract MethodHandler newMethodHandler();
-
- @Override
- public void initialize(BeanDeployerEnvironment environment)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void destroy(T instance, CreationalContext<T> creationalContext)
- {
-
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractJavaEEResourceMethodHandler.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-
-import javassist.util.proxy.MethodHandler;
-
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * Abstract method handler which invokes the a method on a proxied instance
- *
- * @author Pete Muir
- *
- */
-public abstract class AbstractJavaEEResourceMethodHandler implements MethodHandler, Serializable
-{
-
- private static final long serialVersionUID = -3171683636451762591L;
-
- private static final Log log = Logging.getLog(AbstractJavaEEResourceMethodHandler.class);
-
- /**
- *
- */
- public AbstractJavaEEResourceMethodHandler()
- {
- super();
- }
-
- /**
- * Lookup the execute the method on the proxied instance obtained from the
- * container
- *
- * @param self the proxy instance.
- * @param method the overridden method declared in the super class or
- * interface.
- * @param proceed the forwarder method for invoking the overridden method. It
- * is null if the overridden method is abstract or declared in the
- * interface.
- * @param args an array of objects containing the values of the arguments
- * passed in the method invocation on the proxy instance. If a
- * parameter type is a primitive type, the type of the array
- * element is a wrapper class.
- * @return the resulting value of the method invocation.
- *
- * @throws Throwable if the method invocation fails.
- */
- public Object invoke(Object self, Method method, Method proceed, Object[] args) throws Throwable
- {
- Object proxiedInstance = getProxiedInstance(null);
- Object returnValue = Reflections.invokeAndWrap(method, proxiedInstance, args);
- log.trace("Executed {0} on {1} with parameters {2} and got return value {3}", method, proxiedInstance, args, returnValue);
- return returnValue;
- }
-
- protected abstract Object getProxiedInstance(Class<?> declaringClass);
-
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceBean.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceBean.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * @author Pete Muir
- */
-public abstract class AbstractResourceBean<T> extends AbstractJavaEEResourceBean<T>
-{
-
- private final String jndiName;
- private final String mappedName;
-
- protected AbstractResourceBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, String jndiName, String mappedName, Type... types)
- {
- super(manager, deploymentType, bindings, type, types);
- this.jndiName = jndiName;
- this.mappedName = mappedName;
- }
-
- public String getJndiName()
- {
- return jndiName;
- }
-
- public String getMappedName()
- {
- return mappedName;
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceMethodHandler.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/AbstractResourceMethodHandler.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-/**
- * @author Pete Muir
- *
- */
-public abstract class AbstractResourceMethodHandler extends AbstractJavaEEResourceMethodHandler
-{
-
- private static final long serialVersionUID = 8977780996027839558L;
-
- private final String mappedName;
- private final String jndiName;
-
- public AbstractResourceMethodHandler(String jndiName, String mappedName)
- {
- this.mappedName = mappedName;
- this.jndiName = jndiName;
- }
-
- protected String getMappedName()
- {
- return mappedName;
- }
-
- protected String getJndiName()
- {
- return jndiName;
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextBean.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javassist.util.proxy.MethodHandler;
-
-import javax.persistence.EntityManager;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * @author Pete Muir
- *
- */
-public class PersistenceContextBean extends AbstractJavaEEResourceBean<EntityManager>
-{
-
- private final String id;
- private final String unitName;
-
- public PersistenceContextBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, String unitName)
- {
- super(manager, deploymentType, bindings, EntityManager.class);
- this.unitName = unitName;
- this.id = createId("PersistenceContext - " + unitName);
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- public String getUnitName()
- {
- return unitName;
- }
-
- @Override
- protected MethodHandler newMethodHandler()
- {
- return new PersistenceContextMethodHandler(getUnitName());
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextMethodHandler.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.persistence.spi.JpaServices;
-
-/**
- * Proxy for persistence context Java EE resources
- *
- * @author Pete Muir
- *
- */
-public class PersistenceContextMethodHandler extends AbstractJavaEEResourceMethodHandler
-{
-
- private static final long serialVersionUID = 6111824732958101382L;
-
- private final String unitName;
-
- public PersistenceContextMethodHandler(String unitName)
- {
- this.unitName = unitName;
- }
-
- @Override
- protected Object getProxiedInstance(Class<?> declaringClass)
- {
- return CurrentManager.rootManager().getServices().get(JpaServices.class).resolvePersistenceContext(unitName);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitBean.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javassist.util.proxy.MethodHandler;
-
-import javax.persistence.EntityManagerFactory;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * @author Pete Muir
- *
- */
-public class PersistenceUnitBean extends AbstractJavaEEResourceBean<EntityManagerFactory>
-{
-
- private final String id;
- private final String unitName;
-
- public PersistenceUnitBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, String unitName)
- {
- super(manager, deploymentType, bindings, EntityManagerFactory.class);
- this.unitName = unitName;
- this.id = createId("PersistenceUnit - " + unitName);
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- public String getUnitName()
- {
- return unitName;
- }
-
- @Override
- protected MethodHandler newMethodHandler()
- {
- return new PersistenceUnitMethodHandler(getUnitName());
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceUnitMethodHandler.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.persistence.spi.JpaServices;
-
-/**
- * Proxy for persistence unit Java EE resources
- *
- * @author Pete Muir
- *
- */
-public class PersistenceUnitMethodHandler extends AbstractJavaEEResourceMethodHandler
-{
-
- private static final long serialVersionUID = -7936320009903622051L;
-
- private final String unitName;
-
- public PersistenceUnitMethodHandler(String unitName)
- {
- this.unitName = unitName;
- }
-
- @Override
- protected Object getProxiedInstance(Class<?> declaringClass)
- {
- return CurrentManager.rootManager().getServices().get(JpaServices.class).resolvePersistenceUnit(unitName);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbBean.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javassist.util.proxy.MethodHandler;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * @author Pete Muir
- *
- */
-public class RemoteEjbBean<T> extends AbstractResourceBean<T>
-{
-
- private final String id;
- private final String ejbLink;
-
- public RemoteEjbBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, String jndiName, String mappedName, String ejbLink)
- {
- super(manager, deploymentType, bindings, type, jndiName, mappedName, type);
- this.ejbLink = ejbLink;
- this.id = createId("RemoteEjb - " );
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- public String getEjbLink()
- {
- return ejbLink;
- }
-
- @Override
- protected MethodHandler newMethodHandler()
- {
- return new RemoteEjbMethodHandler(getJndiName(), getMappedName(), getEjbLink());
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/RemoteEjbMethodHandler.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ejb.spi.EjbServices;
-
-/**
- * Proxy for persistence unit Java EE resources
- *
- * @author Pete Muir
- *
- */
-public class RemoteEjbMethodHandler extends AbstractResourceMethodHandler
-{
-
- private static final long serialVersionUID = 8192691377739747596L;
-
- private final String ejbLink;
-
- public RemoteEjbMethodHandler(String jndiName, String mappedName, String ejbLink)
- {
- super(jndiName, mappedName);
- this.ejbLink = ejbLink;
- }
-
- @Override
- protected Object getProxiedInstance(Class<?> declaringClass)
- {
- return CurrentManager.rootManager().getServices().get(EjbServices.class).resolveRemoteEjb(getJndiName(), getMappedName(), ejbLink);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceBean.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javassist.util.proxy.MethodHandler;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * @author Pete Muir
- *
- */
-public class ResourceBean<T> extends AbstractResourceBean<T>
-{
-
- private final String id;
-
- public ResourceBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, String jndiName, String mappedName)
- {
- super(manager, deploymentType, bindings, type, jndiName, mappedName, type);
- this.id = createId("Resource-");
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- @Override
- protected MethodHandler newMethodHandler()
- {
- return new ResourceMethodHandler(getJndiName(), getMappedName());
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/ResourceMethodHandler.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.resources.spi.ResourceServices;
-
-/**
- * Proxy for persistence unit Java EE resources
- *
- * @author Pete Muir
- *
- */
-public class ResourceMethodHandler extends AbstractResourceMethodHandler
-{
-
- private static final long serialVersionUID = -8835529913294253208L;
-
- public ResourceMethodHandler(String jndiName, String mappedName)
- {
- super(jndiName, mappedName);
- }
-
- @Override
- protected Object getProxiedInstance(Class<?> declaringClass)
- {
- return CurrentManager.rootManager().getServices().get(ResourceServices.class).resolveResource(getJndiName(), getMappedName());
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceBean.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javassist.util.proxy.MethodHandler;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * @author Pete Muir
- *
- */
-public class WebServiceBean<T> extends AbstractResourceBean<T>
-{
-
- private final String id;
- private final String wsdlLocation;
-
- public WebServiceBean(BeanManagerImpl manager, Class<? extends Annotation> deploymentType, Set<Annotation> bindings, Class<T> type, String jndiName, String mappedName, String wsdlLocation)
- {
- super(manager, deploymentType, bindings, type, jndiName, mappedName, type);
- this.wsdlLocation = wsdlLocation;
- this.id = createId("WebService - " );
- }
-
- @Override
- public String getId()
- {
- return id;
- }
-
- public String getWsdlLocation()
- {
- return wsdlLocation;
- }
-
- @Override
- protected MethodHandler newMethodHandler()
- {
- return new WebServiceMethodHandler(getJndiName(), getMappedName());
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java 2009-07-02 15:27:32 UTC (rev 2953)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/WebServiceMethodHandler.java 2009-07-02 16:19:34 UTC (rev 2954)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.ee;
-
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ws.spi.WebServices;
-
-/**
- * Proxy for persistence unit Java EE web services
- *
- * @author Pete Muir
- *
- */
-public class WebServiceMethodHandler extends AbstractResourceMethodHandler
-{
-
- private static final long serialVersionUID = 6719454070840346045L;
-
- public WebServiceMethodHandler(String jndiName, String mappedName)
- {
- super(jndiName, mappedName);
- }
-
- @Override
- protected Object getProxiedInstance(Class<?> declaringClass)
- {
- return CurrentManager.rootManager().getServices().get(WebServices.class).resolveResource(getJndiName(), getMappedName());
- }
-
-}
14 years, 10 months
[webbeans-commits] Webbeans SVN: r2953 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/util/collections and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-02 11:27:32 -0400 (Thu, 02 Jul 2009)
New Revision: 2953
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Cat.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Horse.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java
Log:
Support ignoring cyclic dependencies in accessible archives
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-02 03:53:41 UTC (rev 2952)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -29,6 +29,7 @@
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -97,6 +98,8 @@
import org.jboss.webbeans.util.Observers;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.util.collections.ForwardingIterable;
+import org.jboss.webbeans.util.collections.Iterables;
import org.jboss.webbeans.util.collections.Iterators;
import org.jboss.webbeans.util.collections.multi.ConcurrentListHashMultiMap;
import org.jboss.webbeans.util.collections.multi.ConcurrentListMultiMap;
@@ -243,14 +246,10 @@
private transient final List<EventObserver<?>> observers;
/*
- * These data structures represent the beans, decorators, interceptors,
- * namespaces and observers *accessible* from this bean deployment archive
- * activity
+ * These data structures represent the managers *accessible* from this bean
+ * deployment archive activity
*/
- private transient final Set<Iterable<Iterable<Bean<?>>>> accessibleBeans;
- private transient final Set<Iterable<Iterable<DecoratorBean<?>>>> accessibleDecorators;
- private transient final Set<Iterable<Iterable<String>>> accessibleNamespaces;
- private transient final Set<Iterable<Iterable<EventObserver<?>>>> accessibleObservers;
+ private transient final HashSet<BeanManagerImpl> accessibleManagers;
/*
* This data structures represents child activities for this activity, it is
@@ -367,23 +366,16 @@
this.ids = ids;
this.id = ids.incrementAndGet();
- // Set up the structures to store accessible beans etc.
+ // Set up the structure to store accessible managers in
+ this.accessibleManagers = new HashSet<BeanManagerImpl>();
- this.accessibleBeans = new HashSet<Iterable<Iterable<Bean<?>>>>();
- this.accessibleDecorators = new HashSet<Iterable<Iterable<DecoratorBean<?>>>>();
- this.accessibleNamespaces = new HashSet<Iterable<Iterable<String>>>();
- this.accessibleObservers = new HashSet<Iterable<Iterable<EventObserver<?>>>>();
- // Add this bean deployment archvies beans etc. to the accessible
- add(accessibleBeans, beans);
- add(accessibleDecorators, decorators);
- add(accessibleNamespaces, namespaces);
- add(accessibleObservers, observers);
- this.beanResolver = new TypeSafeBeanResolver<Bean<?>>(this, Iterators.concat(getAccessibleBeans()));
- this.decoratorResolver = new TypeSafeDecoratorResolver(this, Iterators.concat(getAccessibleDecorators()));
- this.observerResolver = new TypeSafeObserverResolver(this, Iterators.concat(getAccessibleObservers()));
- this.nameBasedResolver = new NameBasedResolver(this, Iterators.concat(getAccessibleBeans()));
+ // TODO Currently we build the accessible bean list on the fly, we need to set it in stone once bootstrap is finished...
+ this.beanResolver = new TypeSafeBeanResolver<Bean<?>>(this, createDynamicAccessibleIterable(Transform.BEAN));
+ this.decoratorResolver = new TypeSafeDecoratorResolver(this, createDynamicAccessibleIterable(Transform.DECORATOR_BEAN));
+ this.observerResolver = new TypeSafeObserverResolver(this, createDynamicAccessibleIterable(Transform.EVENT_OBSERVER));
+ this.nameBasedResolver = new NameBasedResolver(this, createDynamicAccessibleIterable(Transform.BEAN));
this.webbeansELResolver = new WebBeansELResolverImpl(this);
this.childActivities = new CopyOnWriteArraySet<BeanManagerImpl>();
@@ -397,40 +389,123 @@
};
}
- private static <X> void add(Collection<Iterable<Iterable<X>>> collection, Iterable<X> instance)
+ private <T> Set<Iterable<T>> buildAccessibleClosure(Collection<BeanManagerImpl> hierarchy, Transform<T> transform)
{
- Collection<Iterable<X>> c = new ArrayList<Iterable<X>>();
- c.add(instance);
- collection.add(c);
+ Set<Iterable<T>> result = new HashSet<Iterable<T>>();
+ hierarchy.add(this);
+ result.add(transform.transform(this));
+ for (BeanManagerImpl beanManager : accessibleManagers)
+ {
+ // Only add if we aren't already in the tree (remove cycles)
+ if (!hierarchy.contains(beanManager))
+ {
+ result.addAll(beanManager.buildAccessibleClosure(new ArrayList<BeanManagerImpl>(hierarchy), transform));
+ }
+ }
+ return result;
}
- public void addAccessibleBeanManager(BeanManagerImpl accessibleBeanManager)
+ private <T> Iterable<T> createDynamicAccessibleIterable(final Transform<T> transform)
{
- accessibleBeans.add(accessibleBeanManager.getAccessibleBeans());
- accessibleDecorators.add(accessibleBeanManager.getAccessibleDecorators());
- accessibleNamespaces.add(accessibleBeanManager.getAccessibleNamespaces());
- accessibleObservers.add(accessibleBeanManager.getAccessibleObservers());
+ return new Iterable<T>()
+ {
+
+ public Iterator<T> iterator()
+ {
+ Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
+ return Iterators.concat(Iterators.transform(iterable.iterator(), Iterables.<T>iteratorTransform()));
+ }
+
+ };
}
- protected Iterable<Iterable<Bean<?>>> getAccessibleBeans()
+ private <T> Iterable<T> createStaticAccessibleIterable(final Transform<T> transform)
{
- return Iterators.concat(accessibleBeans);
+ Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
+ return Iterables.concat(iterable);
}
- protected Iterable<Iterable<String>> getAccessibleNamespaces()
+ private static interface Transform<T>
{
- return Iterators.concat(accessibleNamespaces);
+
+ public static Transform<Bean<?>> BEAN = new Transform<Bean<?>>()
+ {
+
+ public Iterable<Bean<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getBeans();
+ }
+
+ };
+
+ public static Transform<DecoratorBean<?>> DECORATOR_BEAN = new Transform<DecoratorBean<?>>()
+ {
+
+ public Iterable<DecoratorBean<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getDecorators();
+ }
+
+ };
+
+ public static Transform<EventObserver<?>> EVENT_OBSERVER = new Transform<EventObserver<?>>()
+ {
+
+ public Iterable<EventObserver<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getObservers();
+ }
+
+ };
+
+ public static Transform<String> NAMESPACE = new Transform<String>()
+ {
+
+ public Iterable<String> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getNamespaces();
+ }
+
+ };
+
+ public Iterable<T> transform(BeanManagerImpl beanManager);
+
}
- protected Iterable<Iterable<DecoratorBean<?>>> getAccessibleDecorators()
+ public void addAccessibleBeanManager(BeanManagerImpl accessibleBeanManager)
{
- return Iterators.concat(accessibleDecorators);
+ accessibleManagers.add(accessibleBeanManager);
}
- protected Iterable<Iterable<EventObserver<?>>> getAccessibleObservers()
+ private static class ManagerAttachedIterable<X> extends ForwardingIterable<X>
{
- return Iterators.concat(accessibleObservers);
+
+ private final BeanManagerImpl beanManager;
+ private final Iterable<X> iterable;
+
+ public ManagerAttachedIterable(BeanManagerImpl beanManager, Iterable<X> iterable)
+ {
+ this.beanManager = beanManager;
+ this.iterable = iterable;
+ }
+
+ public BeanManagerImpl getBeanManager()
+ {
+ return beanManager;
+ }
+
+ @Override
+ protected Iterable<X> delegate()
+ {
+ return iterable;
+ }
+
}
+
+ protected Set<BeanManagerImpl> getAccessibleManagers()
+ {
+ return accessibleManagers;
+ }
/**
* Set up the enabled deployment types, if none are specified by the user,
@@ -1179,7 +1254,7 @@
// TODO I don't like this lazy init
if (rootNamespace == null)
{
- rootNamespace = new Namespace(Iterators.concat(getAccessibleNamespaces()));
+ rootNamespace = new Namespace(createDynamicAccessibleIterable(Transform.NAMESPACE));
}
return rootNamespace;
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans;
+
+import org.jboss.webbeans.util.collections.ForwardingIterable;
+
+class ManagerAttachedIterable<X> extends ForwardingIterable<X>
+{
+
+ private final BeanManagerImpl beanManager;
+ private final Iterable<X> iterable;
+
+ public ManagerAttachedIterable(BeanManagerImpl beanManager, Iterable<X> iterable)
+ {
+ this.beanManager = beanManager;
+ this.iterable = iterable;
+ }
+
+ public BeanManagerImpl getBeanManager()
+ {
+ return beanManager;
+ }
+
+ @Override
+ protected Iterable<X> delegate()
+ {
+ return iterable;
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerAttachedIterable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2007 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.util.collections;
+
+import java.util.NoSuchElementException;
+
+/**
+ * This class provides a skeletal implementation of the {@code Iterator}
+ * interface, to make this interface easier to implement for certain types of
+ * data sources.
+ *
+ * <p>
+ * {@code Iterator} requires its implementations to support querying the
+ * end-of-data status!
without changing the iterator's state, using the
+ * {@link #hasNext} method. But many data sources, such as
+ * {@link java.io.Reader#read()}), do not expose this information; the only way
+ * to discover whether there is any data left is by trying to retrieve it. These
+ * types of data sources are ordinarily difficult to write iterators for. But
+ * using this class, one must implement only the {@link #computeNext} method,
+ * and invoke the {@link #endOfData} method when appropriate.
+ *
+ * <p>
+ * Another example is an iterator that skips over null elements in a backing
+ * iterator. This could be implemented as:
+ *
+ * <pre>
+ * @code
+ * public static Iterator<String> skipNulls(final Iterator<String> in) {
+ * return new AbstractIterator<String>() {
+ * protected String computeNext() {
+ * while (in.hasNext()) {
+ * String s = in.next();
+ * if (s != null) {
+ * return s;
+ * }
!
+ * }
+ * return endOfData();
+ * }
+ * !
};
+
* }}
+ * </pre>
+ *
+ * This class supports iterators that include null elements.
+ *
+ * @author Kevin Bourrillion
+ */
+public abstract class AbstractIterator<T> extends UnmodifiableIterator<T>
+{
+ private State state = State.NOT_READY;
+
+ private enum State
+ {
+ /** We have computed the next element and haven't returned it yet. */
+ READY,
+
+ /** We haven't yet computed or have already returned the element. */
+ NOT_READY,
+
+ /** We have reached the end of the data and are finished. */
+ DONE,
+
+ /** We've suffered an exception and are kaput. */
+ FAILED,
+ }
+
+ private T next;
+
+ /**
+ * Returns the next element. <b>Note:</b> the implementation must call
+ * {@link #endOfData()} when there are no elements left in the iteration.
+ * Failure to do so could result in an infinite loop.
+ *
+ * <p>
+ * The initial invocation of {@link #hasNext()} or {@link #next()} calls this
+ * method, as!
does the first invocation of {@code hasNext} or {@code next}
+ * following each successful call to {@code next}. Once the implementation
+ * either invokes {@code endOfData} or throws an exception, {@code
+ * computeNext} is guaranteed to never be called again.
+ *
+ * <p>
+ * If this method throws an exception, it will propagate outward to the
+ * {@code hasNext} or {@code next} invocation that invoked this method. Any
+ * further attempts to use the iterator will result in an
+ * {@link IllegalStateException}.
+ *
+ * <p>
+ * The implementation of this method many not invoke the {@code hasNext},
+ * {@code next}, or {@link #peek()} methods on this instance; if it does, an
+ * {@code IllegalStateException} will result.
+ *
+ * @return the next element if there was one. If {@code endOfData} was called
+ * during execution, the return value will be ignored.
+ * @throws RuntimeException if any unrecoverable err!
or happens. This
+ * exception will propagate ou!
tward to
the {@code hasNext()},
+ * {@code next()}, or {@code peek()} invocation that invoked this
+ * method. Any further attempts to use the iterator will result in
+ * an {@link IllegalStateException}.
+ */
+ protected abstract T computeNext();
+
+ /**
+ * Implementations of {@code computeNext} <b>must</b> invoke this method when
+ * there are no elements left in the iteration.
+ *
+ * @return {@code null}; a convenience so your {@link #computeNext}
+ * implementation can use the simple statement {@code return
+ * endOfData();}
+ */
+ protected final T endOfData()
+ {
+ state = State.DONE;
+ return null;
+ }
+
+ public final boolean hasNext()
+ {
+ if (state == State.FAILED)
+ {
+ throw new IllegalStateException();
+ }
+ switch (state)
+ {
+ case DONE:
+ return false;
+ case READY:
+ return true;
+ default:
+ !
}
+ return tryToComputeNext();
+ }
+
+ private boolean tryToComputeNext()
+ {
+ state = State.FAILED; // temporary pessimism
+ next = computeNext();
+ if (state != State.DONE)
+ {
+ state = State.READY;
+ return true;
+ }
+ return false;
+ }
+
+ public final T next()
+ {
+ if (!hasNext())
+ {
+ throw new NoSuchElementException();
+ }
+ state = State.NOT_READY;
+ return next;
+ }
+
+ /**
+ * Returns the next element in the iteration without advancing the iteration,
+ * according to the contract of {@link PeekingIterator#peek()}.
+ *
+ * <p>
+ * Implementations of {@code AbstractIterator} that wish to expose this
+ * functionality should implement {@code PeekingIterator}.
+ */
+ public final T peek()
+ {
+ if (!hasNext())
+ {
+ throw new NoSuchElementException();
+ }
+ return next;
+ }
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/AbstractIterator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.collections;
+
+import java.util.Iterator;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingIterable<T> implements java.lang.Iterable<T>
+{
+
+ public Iterator<T> iterator()
+ {
+ return delegate().iterator();
+ }
+
+ protected abstract Iterable<T> delegate();
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.collections;
+
+import java.util.Iterator;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingIterator<E> implements Iterator<E>
+{
+
+ protected abstract Iterator<E> delegate();
+
+ public boolean hasNext()
+ {
+ return hasNext();
+ }
+
+ public E next()
+ {
+ return next();
+ }
+
+ public void remove()
+ {
+ remove();
+ }
+
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingIterator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.collections;
+
+import java.util.Iterator;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Iterables
+{
+
+ private Iterables() {}
+
+ public static <T> Iterators.Function<Iterable<? extends T>, Iterator<? extends T>> iteratorTransform()
+ {
+ return new Iterators.Function<Iterable<? extends T>, Iterator<? extends T>>()
+ {
+
+ public Iterator<? extends T> apply(Iterable<? extends T> from)
+ {
+ return from.iterator();
+ }
+
+ };
+ }
+
+ public static <T> Iterable<T> concat(final Iterable<? extends Iterable<? extends T>> inputs)
+ {
+ return new Iterable<T>()
+ {
+
+ public Iterator<T> iterator()
+ {
+ return Iterators.concat(Iterators.transform(inputs.iterator(), Iterables.<T>iteratorTransform()));
+ }
+
+ };
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterables.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java 2009-07-02 03:53:41 UTC (rev 2952)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Iterators.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -51,20 +51,7 @@
{
return (UnmodifiableIterator<T>) EMPTY_ITERATOR;
}
-
- public static <T> Iterable<T> concat(final Iterable<? extends Iterable<? extends T>> inputs)
- {
- return new Iterable<T>()
- {
- public Iterator<T> iterator()
- {
- return concat(inputs.iterator());
- }
-
- };
- }
-
/**
* Combines multiple iterators into a single iterator. The returned iterator
* iterates across the elements of each iterator in {@code inputs}. The input
@@ -75,29 +62,29 @@
* input iterator supports it. The methods of the returned iterator may throw
* {@code NullPointerException} if any of the input iterators are null.
*/
- public static <T> Iterator<T> concat(final Iterator<? extends Iterable<? extends T>> inputs)
+ public static <E> Iterator<E> concat(final Iterator<? extends Iterator<? extends E>> inputs)
{
if (inputs == null)
{
throw new NullPointerException();
}
- return new Iterator<T>()
+ return new Iterator<E>()
{
- Iterator<? extends T> current = emptyIterator();
- Iterator<? extends T> removeFrom;
+ Iterator<? extends E> current = emptyIterator();
+ Iterator<? extends E> removeFrom;
public boolean hasNext()
{
boolean currentHasNext;
while (!(currentHasNext = current.hasNext()) && inputs.hasNext())
{
- current = inputs.next().iterator();
+ current = inputs.next();
}
return currentHasNext;
}
- public T next()
+ public E next()
{
if (!hasNext())
{
@@ -119,4 +106,35 @@
};
}
+ public static interface Function<F, T>
+ {
+ public T apply(F from);
+ }
+
+ public static <F, T> Iterator<T> transform(final Iterator<F> fromIterator, final Function<? super F, ? extends T> function)
+ {
+ if (function == null)
+ {
+ throw new IllegalStateException();
+ }
+ return new Iterator<T>()
+ {
+ public boolean hasNext()
+ {
+ return fromIterator.hasNext();
+ }
+
+ public T next()
+ {
+ F from = fromIterator.next();
+ return function.apply(from);
+ }
+
+ public void remove()
+ {
+ fromIterator.remove();
+ }
+ };
+ }
+
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java 2009-07-02 03:53:41 UTC (rev 2952)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/AccessibleManagerResolutionTest.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -55,25 +55,44 @@
}
@Test
- public void testAccessibleTwoLevels()
+ public void testAccessibleThreeLevelsWithMultiple()
{
BeanManagerImpl root = BeanManagerImpl.newRootManager(services);
BeanManagerImpl child = BeanManagerImpl.newRootManager(services);
+ BeanManagerImpl child1 = BeanManagerImpl.newRootManager(services);
BeanManagerImpl grandchild = BeanManagerImpl.newRootManager(services);
+ BeanManagerImpl greatGrandchild = BeanManagerImpl.newRootManager(services);
+ child.addAccessibleBeanManager(root);
+ grandchild.addAccessibleBeanManager(child1);
grandchild.addAccessibleBeanManager(child);
- child.addAccessibleBeanManager(root);
+ addBean(greatGrandchild, Cat.class);
+ greatGrandchild.addAccessibleBeanManager(grandchild);
addBean(root, Cow.class);
addBean(child, Chicken.class);
addBean(grandchild, Pig.class);
+ addBean(child1, Horse.class);
assert root.getBeans(Pig.class).size() == 0;
assert root.getBeans(Chicken.class).size() == 0;
assert root.getBeans(Cow.class).size() == 1;
+ assert root.getBeans(Horse.class).size() == 0;
+ assert root.getBeans(Cat.class).size() == 0;
assert child.getBeans(Pig.class).size() == 0;
assert child.getBeans(Chicken.class).size() == 1;
assert child.getBeans(Cow.class).size() == 1;
+ assert child.getBeans(Horse.class).size() == 0;
+ assert child.getBeans(Cat.class).size() == 0;
+ assert child1.getBeans(Cow.class).size() == 0;
+ assert child1.getBeans(Horse.class).size() == 1;
assert grandchild.getBeans(Pig.class).size() == 1;
assert grandchild.getBeans(Chicken.class).size() == 1;
assert grandchild.getBeans(Cow.class).size() == 1;
+ assert grandchild.getBeans(Horse.class).size() ==1;
+ assert grandchild.getBeans(Cat.class).size() == 0;
+ assert greatGrandchild.getBeans(Pig.class).size() == 1;
+ assert greatGrandchild.getBeans(Chicken.class).size() == 1;
+ assert greatGrandchild.getBeans(Cow.class).size() == 1;
+ assert greatGrandchild.getBeans(Horse.class).size() ==1;
+ assert greatGrandchild.getBeans(Cat.class).size() == 1;
}
@Test
@@ -99,4 +118,28 @@
assert grandchild.getBeans(Cow.class).size() == 1;
}
+ @Test
+ public void testCircular()
+ {
+ BeanManagerImpl root = BeanManagerImpl.newRootManager(services);
+ BeanManagerImpl child = BeanManagerImpl.newRootManager(services);
+ BeanManagerImpl grandchild = BeanManagerImpl.newRootManager(services);
+ grandchild.addAccessibleBeanManager(child);
+ child.addAccessibleBeanManager(root);
+ grandchild.addAccessibleBeanManager(root);
+ root.addAccessibleBeanManager(grandchild);
+ addBean(root, Cow.class);
+ addBean(child, Chicken.class);
+ addBean(grandchild, Pig.class);
+ assert root.getBeans(Pig.class).size() == 1;
+ assert root.getBeans(Chicken.class).size() == 1;
+ assert root.getBeans(Cow.class).size() == 1;
+ assert child.getBeans(Pig.class).size() == 1;
+ assert child.getBeans(Chicken.class).size() == 1;
+ assert child.getBeans(Cow.class).size() == 1;
+ assert grandchild.getBeans(Pig.class).size() == 1;
+ assert grandchild.getBeans(Chicken.class).size() == 1;
+ assert grandchild.getBeans(Cow.class).size() == 1;
+ }
+
}
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Cat.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Cat.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Cat.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.test.unit.deployment.structure;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Cat
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Cat.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Horse.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Horse.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Horse.java 2009-07-02 15:27:32 UTC (rev 2953)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.test.unit.deployment.structure;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Horse
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/deployment/structure/Horse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 10 months