[webbeans-commits] Webbeans SVN: r2300 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard and 7 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Sun Apr 5 08:54:51 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-04-05 08:54:49 -0400 (Sun, 05 Apr 2009)
New Revision: 2300
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/Test.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/ForwardingConcurrentMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextMap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/el/NamespaceManager.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
Log:
Big tidy up to concurrent multi-value data structures
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -65,11 +65,10 @@
import org.jboss.webbeans.bean.proxy.ClientProxyProvider;
import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.context.ApplicationContext;
-import org.jboss.webbeans.context.ContextMap;
import org.jboss.webbeans.context.CreationalContextImpl;
import org.jboss.webbeans.el.Namespace;
-import org.jboss.webbeans.el.NamespaceManager;
import org.jboss.webbeans.event.EventManager;
+import org.jboss.webbeans.event.EventObserver;
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.injection.NonContextualInjector;
import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass;
@@ -83,6 +82,10 @@
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.util.collections.multi.ConcurrentSetHashMultiMap;
+import org.jboss.webbeans.util.collections.multi.ConcurrentListHashMultiMap;
+import org.jboss.webbeans.util.collections.multi.ConcurrentListMultiMap;
+import org.jboss.webbeans.util.collections.multi.ConcurrentSetMultiMap;
/**
* Implementation of the Web Beans Manager.
@@ -95,54 +98,52 @@
*/
public class ManagerImpl implements WebBeansManager, Serializable
{
-
-
-
private static final Log log = Logging.getLog(ManagerImpl.class);
private static final long serialVersionUID = 3021562879133838561L;
// The JNDI key to place the manager under
public static final String JNDI_KEY = "java:app/Manager";
-
- // The enabled deployment types from web-beans.xml
- private transient List<Class<? extends Annotation>> enabledDeploymentTypes;
- // The Web Beans event manager
- private transient final EventManager eventManager;
-
- // An executor service for asynchronous tasks
+ /*
+ * Application scoped services
+ * ****************************
+ */
private transient final ExecutorService taskExecutor = Executors.newSingleThreadExecutor();
-
- // An injection point metadata beans factory
- private transient final ThreadLocal<Stack<InjectionPoint>> currentInjectionPoint;
-
- // The bean resolver
- private transient final Resolver resolver;
-
- // The registered contexts
- private transient final ContextMap contexts;
+ private transient final ServiceRegistry services;
- // The client proxy pool
+ /*
+ * Application scoped data structures
+ * ***********************************
+ */
+ private transient List<Class<? extends Annotation>> enabledDeploymentTypes;
+ private transient final ConcurrentListMultiMap<Class<? extends Annotation>, Context> contexts;
private transient final ClientProxyProvider clientProxyProvider;
-
- // The registered beans
- private transient List<Bean<?>> beans;
-
- // The registered beans, mapped by implementation class
private transient final Map<Class<?>, EnterpriseBean<?>> newEnterpriseBeans;
-
private transient final Map<String, RIBean<?>> riBeans;
+ private final transient Map<Bean<?>, Bean<?>> specializedBeans;
- private transient final ServiceRegistry services;
-
- private final transient Map<Bean<?>, Bean<?>> specializedBeans;
-
+
+ /*
+ * Activity scoped services
+ * *************************
+ */
+ private transient final EventManager eventManager;
+ private transient final Resolver resolver;
private final transient NonContextualInjector nonContextualInjector;
- private final transient NamespaceManager namespaceManager;
+ /*
+ * Activity scoped data structures
+ * ********************************
+ */
+ private transient final ThreadLocal<Stack<InjectionPoint>> currentInjectionPoint;
+ private transient List<Bean<?>> beans;
+ private final transient Namespace rootNamespace;
+ private final ConcurrentSetMultiMap<Type, EventObserver<?>> registeredObservers;
+
+
/**
* Create a new, root, manager
*
@@ -158,12 +159,14 @@
return new ManagerImpl(
serviceRegistry,
new CopyOnWriteArrayList<Bean<?>>(),
+ new ConcurrentSetHashMultiMap<Type, EventObserver<?>>(),
+ new Namespace(),
new ConcurrentHashMap<Class<?>, EnterpriseBean<?>>(),
new ConcurrentHashMap<String, RIBean<?>>(),
new ClientProxyProvider(),
- new ContextMap(),
+ new ConcurrentListHashMultiMap<Class<? extends Annotation>, Context>(),
new HashMap<Bean<?>, Bean<?>>(),
- new NamespaceManager(new Namespace()),
+
defaultEnabledDeploymentTypes);
}
@@ -178,17 +181,20 @@
List<Bean<?>> beans = new CopyOnWriteArrayList<Bean<?>>();
beans.addAll(parentManager.getBeans());
- NamespaceManager namespaceManager = new NamespaceManager(new Namespace(parentManager.getNamespaceManager().getRoot()));
+ ConcurrentSetMultiMap<Type, EventObserver<?>> registeredObservers = new ConcurrentSetHashMultiMap<Type, EventObserver<?>>();
+ registeredObservers.putAll(parentManager.getRegisteredObservers());
+ Namespace rootNamespace = new Namespace(parentManager.getRootNamespace());
return new ManagerImpl(
parentManager.getServices(),
- beans,
+ beans,
+ registeredObservers,
+ rootNamespace,
parentManager.getNewEnterpriseBeanMap(),
- parentManager.getRiBeans(),
+ parentManager.getRiBeans(),
parentManager.getClientProxyProvider(),
parentManager.getContexts(),
parentManager.getSpecializedBeans(),
- namespaceManager,
parentManager.getEnabledDeploymentTypes());
}
@@ -199,13 +205,14 @@
*/
private ManagerImpl(
ServiceRegistry serviceRegistry,
- List<Bean<?>> beans,
+ List<Bean<?>> beans,
+ ConcurrentSetMultiMap<Type, EventObserver<?>> registeredObservers,
+ Namespace rootNamespace,
Map<Class<?>, EnterpriseBean<?>> newEnterpriseBeans,
Map<String, RIBean<?>> riBeans,
ClientProxyProvider clientProxyProvider,
- ContextMap contexts,
+ ConcurrentListMultiMap<Class<? extends Annotation>, Context> contexts,
Map<Bean<?>, Bean<?>> specializedBeans,
- NamespaceManager namespaceManager,
List<Class<? extends Annotation>> enabledDeploymentTypes
)
{
@@ -213,13 +220,12 @@
this.beans = beans;
this.newEnterpriseBeans = newEnterpriseBeans;
this.riBeans = riBeans;
-
this.clientProxyProvider = clientProxyProvider;
this.contexts = contexts;
this.specializedBeans = specializedBeans;
-
- this.namespaceManager = namespaceManager;
+ this.registeredObservers = registeredObservers;
setEnabledDeploymentTypes(enabledDeploymentTypes);
+ this.rootNamespace = rootNamespace;
this.resolver = new Resolver(this);
this.eventManager = new EventManager(this);
@@ -273,7 +279,7 @@
}
resolver.clear();
beans.add(bean);
- namespaceManager.register(bean);
+ registerBeanNamespace(bean);
return this;
}
@@ -466,11 +472,25 @@
newEnterpriseBeans.put(bean.getType(), (EnterpriseBean<?>) bean);
}
riBeans.put(bean.getId(), bean);
- namespaceManager.register(bean);
+ registerBeanNamespace(bean);
}
resolver.clear();
}
}
+
+ protected void registerBeanNamespace(Bean<?> bean)
+ {
+ if (bean.getName() != null && bean.getName().indexOf('.') > 0)
+ {
+ String name = bean.getName().substring(0, bean.getName().lastIndexOf('.'));
+ String[] hierarchy = name.split("\\.");
+ Namespace namespace = getRootNamespace();
+ for (String s : hierarchy)
+ {
+ namespace = namespace.putIfAbsent(s);
+ }
+ }
+ }
/**
* Gets the class-mapped beans. For internal use.
@@ -507,7 +527,7 @@
*/
public Manager addContext(Context context)
{
- contexts.add(context);
+ contexts.put(context.getScopeType(), context);
return this;
}
@@ -622,7 +642,7 @@
public Context getContext(Class<? extends Annotation> scopeType)
{
List<Context> activeContexts = new ArrayList<Context>();
- for (Context context : contexts.getContext(scopeType))
+ for (Context context : contexts.get(scopeType))
{
if (context.isActive())
{
@@ -641,17 +661,6 @@
}
/**
- * Direct access to built in contexts. For internal use.
- *
- * @param scopeType The scope type of the context
- * @return The context
- */
- public Context getBuiltInContext(Class<? extends Annotation> scopeType)
- {
- return contexts.getBuiltInContext(scopeType);
- }
-
- /**
* Returns an instance of a bean
*
* @param bean The bean to instantiate
@@ -936,11 +945,6 @@
{
return resolver;
}
-
- public NamespaceManager getNamespaceManager()
- {
- return namespaceManager;
- }
/**
* Gets a string representation
@@ -1067,9 +1071,19 @@
return clientProxyProvider;
}
- protected ContextMap getContexts()
+ protected ConcurrentListMultiMap<Class<? extends Annotation>, Context> getContexts()
{
return contexts;
}
+
+ public ConcurrentSetMultiMap<Type, EventObserver<?>> getRegisteredObservers()
+ {
+ return registeredObservers;
+ }
+
+ public Namespace getRootNamespace()
+ {
+ return rootNamespace;
+ }
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/Test.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Test.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Test.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -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;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class Test
+{
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -12,6 +12,12 @@
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
+/**
+ * AnnotatedItem transformer which can be used for FacadeBeans
+ *
+ * @author Pete Muir
+ *
+ */
public class FacadeBeanAnnotatedItemTransformer implements AnnotatedItemTransformer
{
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextMap.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -1,113 +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.context;
-
-import java.lang.annotation.Annotation;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.context.Context;
-
-import org.jboss.webbeans.util.collections.ForwardingMap;
-
-/**
- * A map from a scope to a list of contexts
- *
- * @author Nicklas Karlsson
- * @author Pete Muir
- *
- */
-public class ContextMap extends ForwardingMap<Class<? extends Annotation>, List<Context>>
-{
- private Map<Class<? extends Annotation>, List<Context>> delegate;
-
- public ContextMap() {
- delegate = new ConcurrentHashMap<Class<? extends Annotation>, List<Context>>();
- }
-
- /**
- * Gets the dependent context
- *
- * @param scopeType The scope type to get
- * @return The dependent context
- */
- public AbstractContext getBuiltInContext(Class<? extends Annotation> scopeType)
- {
- if (getContext(scopeType) != null)
- {
- return (AbstractContext) getContext(scopeType).get(0);
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Gets the list of context with the given scope type
- *
- * @param scopeType The scope type to match
- * @return A list of matching contexts. An empty list is returned if there
- * are no matches
- */
- public List<Context> getContext(Class<? extends Annotation> scopeType)
- {
- List<Context> contexts = get(scopeType);
- if (contexts == null)
- {
- return Collections.emptyList();
- }
- else
- {
- return contexts;
- }
- }
-
- /**
- * Adds a context under a scope type
- *
- * Creates the list of contexts if it doesn't exist
- *
- * @param context The new context
- */
- public void add(Context context)
- {
- List<Context> contexts = get(context.getScopeType());
- if (contexts == null) {
- contexts = new CopyOnWriteArrayList<Context>();
- put(context.getScopeType(), contexts);
- }
- contexts.add(context);
- }
-
- @Override
- protected Map<Class<? extends Annotation>, List<Context>> delegate()
- {
- return delegate;
- }
-
- @Override
- public String toString()
- {
- return "ContextMap holding " + delegate().size() + " contexts: " + delegate().keySet();
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/el/NamespaceManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/NamespaceManager.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/el/NamespaceManager.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -1,34 +0,0 @@
-package org.jboss.webbeans.el;
-
-import javax.inject.manager.Bean;
-
-public class NamespaceManager
-{
-
- private final Namespace root;
-
- public NamespaceManager(Namespace root)
- {
- this.root = root;
- }
-
- public void register(Bean<?> bean)
- {
- if (bean.getName() != null && bean.getName().indexOf('.') > 0)
- {
- String name = bean.getName().substring(0, bean.getName().lastIndexOf('.'));
- String[] hierarchy = name.split("\\.");
- Namespace namespace = root;
- for (String s : hierarchy)
- {
- namespace = namespace.putIfAbsent(s);
- }
- }
- }
-
- public Namespace getRoot()
- {
- return root;
- }
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -90,10 +90,10 @@
Namespace namespace = null;
if (base == null)
{
- if (CurrentManager.rootManager().getNamespaceManager().getRoot().contains(propertyString))
+ if (CurrentManager.rootManager().getRootNamespace().contains(propertyString))
{
context.setPropertyResolved(true);
- return CurrentManager.rootManager().getNamespaceManager().getRoot().get(propertyString);
+ return CurrentManager.rootManager().getRootNamespace().get(propertyString);
}
}
else if (base instanceof Namespace)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -19,12 +19,9 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.Collection;
import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
import javax.event.Observer;
@@ -32,9 +29,7 @@
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Strings;
import org.jboss.webbeans.util.Reflections.HierarchyDiscovery;
-import org.jboss.webbeans.util.collections.ForwardingMap;
/**
* The event bus is where observers are registered and events are fired.
@@ -46,86 +41,6 @@
{
private static Log log = Logging.getLog(EventManager.class);
- /**
- * An event type -> observer list map
- */
- private class RegisteredObserversMap extends ForwardingMap<Type, List<EventObserver<?>>>
- {
-
- // The map delegate
- private ConcurrentHashMap<Type, List<EventObserver<?>>> delegate;
-
- /**
- * Constructor. Initializes the delegate
- */
- public RegisteredObserversMap()
- {
- delegate = new ConcurrentHashMap<Type, List<EventObserver<?>>>();
- }
-
- /**
- * Returns the delegate for the ForwardingMap
- *
- * @return The delegate
- */
- @Override
- protected Map<Type, List<EventObserver<?>>> delegate()
- {
- return delegate;
- }
-
- /**
- * Gets the list of observers for a given event type
- *
- * @param eventType The event type
- * @return The list of interested observers. An empty list is returned if
- * there are no matches.
- */
- @Override
- public CopyOnWriteArrayList<EventObserver<?>> get(Object eventType)
- {
- CopyOnWriteArrayList<EventObserver<?>> observers = (CopyOnWriteArrayList<EventObserver<?>>) super.get(eventType);
- return observers != null ? observers : new CopyOnWriteArrayList<EventObserver<?>>();
- }
-
- /**
- * Adds an observer for a given event type
- *
- * Implicitly creates a new list if there is none for the event type. Only adds the observer if
- * it is not already present
- *
- * @param eventType The event type
- * @param observer The observer to add
- */
- public void put(Type eventType, EventObserver<?> observer)
- {
- List<EventObserver<?>> observers = super.get(eventType);
- if (observers == null)
- {
- observers = new CopyOnWriteArrayList<EventObserver<?>>();
- super.put(eventType, observers);
- }
- if (!observers.contains(observer))
- {
- observers.add(observer);
- }
- }
-
- /**
- * Gets a string representation of the map
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- return Strings.mapToString("RegisteredObserversMap (event type -> observers list): ", delegate);
- }
-
- }
-
- // The map of registered observers for a give
- private final RegisteredObserversMap registeredObservers;
private final ManagerImpl manager;
@@ -134,7 +49,6 @@
*/
public EventManager(ManagerImpl manager)
{
- registeredObservers = new RegisteredObserversMap();
this.manager = manager;
}
@@ -148,7 +62,7 @@
public <T> void addObserver(Observer<T> observer, Type eventType, Annotation... bindings)
{
EventObserver<T> eventObserver = new EventObserver<T>(observer, eventType, manager, bindings);
- registeredObservers.put(eventType, eventObserver);
+ manager.getRegisteredObservers().put(eventType, eventObserver);
log.debug("Added observer " + observer + " observing event type " + eventType);
}
@@ -167,7 +81,7 @@
Set<Type> types = new HierarchyDiscovery(event.getClass()).getFlattenedTypes();
for (Type type : types)
{
- for (EventObserver<?> observer : registeredObservers.get(type))
+ for (EventObserver<?> observer : manager.getRegisteredObservers().get(type))
{
log.debug("Checking observer " + observer + " to see if it is interested in event [" + event + "]");
if (observer.isObserverInterested(bindings))
@@ -215,7 +129,7 @@
*/
public <T> void removeObserver(Observer<T> observer, Class<T> eventType, Annotation... bindings)
{
- List<EventObserver<?>> observers = registeredObservers.get(eventType);
+ Collection<EventObserver<?>> observers = manager.getRegisteredObservers().get(eventType);
EventObserver<T> eventObserver = new EventObserver<T>(observer, eventType, manager, bindings);
observers.remove(eventObserver);
}
@@ -225,7 +139,7 @@
{
StringBuilder buffer = new StringBuilder();
buffer.append("Event manager\n");
- buffer.append(registeredObservers.toString());
+ buffer.append(manager.getRegisteredObservers().toString());
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -17,25 +17,17 @@
package org.jboss.webbeans.introspector.jlr;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import javax.inject.BindingType;
import javax.inject.manager.Manager;
import org.jboss.webbeans.introspector.AnnotatedMember;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.ForwardingAnnotatedMember;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
-import org.jboss.webbeans.util.collections.ForwardingMap;
/**
* Represents an abstract annotated memeber (field, method or constructor)
@@ -54,50 +46,7 @@
{
}
-
- /**
- * An annotation type -> list of annotations map
- */
- protected class AnnotatedParameterMap extends ForwardingMap<Class<? extends Annotation>, List<AnnotatedParameter<?>>>
- {
- private Map<Class<? extends Annotation>, List<AnnotatedParameter<?>>> delegate;
- public AnnotatedParameterMap()
- {
- delegate = new HashMap<Class<? extends Annotation>, List<AnnotatedParameter<?>>>();
- }
-
- @Override
- protected Map<Class<? extends Annotation>, List<AnnotatedParameter<?>>> delegate()
- {
- return delegate;
- }
-
- public void put(Class<? extends Annotation> key, AnnotatedParameter<?> value)
- {
- List<AnnotatedParameter<?>> parameters = super.get(key);
- if (parameters == null)
- {
- parameters = new ArrayList<AnnotatedParameter<?>>();
- super.put(key, parameters);
- }
- parameters.add(value);
- }
-
- @Override
- public String toString()
- {
- return Strings.mapToString("AnnotatedParameterMap (annotation type -> parameter abstraction list): ", delegate);
- }
-
- @Override
- public List<AnnotatedParameter<?>> get(Object key)
- {
- List<AnnotatedParameter<?>> parameters = super.get(key);
- return parameters != null ? parameters : new ArrayList<AnnotatedParameter<?>>();
- }
- }
-
// The name of the member
private final String name;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -30,8 +30,8 @@
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Strings;
-import org.jboss.webbeans.util.collections.ForwardingMap;
+import org.jboss.webbeans.util.collections.multi.SetHashMultiMap;
+import org.jboss.webbeans.util.collections.multi.SetMultiMap;
/**
* Represents an annotated annotation
@@ -44,52 +44,9 @@
*/
public class AnnotatedAnnotationImpl<T extends Annotation> extends AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>
{
-
- /**
- * A (annotation type -> set of method abstractions with annotation) map
- */
- private class AnnotatedMemberMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>
- {
- private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate;
- public AnnotatedMemberMap()
- {
- delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>();
- }
-
- @Override
- protected Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate()
- {
- return delegate;
- }
-
- @Override
- public String toString()
- {
- return Strings.mapToString("AnnotatedMemberMap (annotation type -> set of member abstractions: ", delegate);
- }
-
- @Override
- public Set<AnnotatedMethod<?>> get(Object key)
- {
- Set<AnnotatedMethod<?>> methods = super.get(key);
- return methods != null ? methods : new HashSet<AnnotatedMethod<?>>();
- }
-
- public void put(Class<? extends Annotation> key, AnnotatedMethod<?> value)
- {
- Set<AnnotatedMethod<?>> members = super.get(key);
- if (members == null)
- {
- members = new HashSet<AnnotatedMethod<?>>();
- super.put(key, members);
- }
- members.add(value);
- }
- }
-
// The annotated members map (annotation -> member with annotation)
- private final AnnotatedMemberMap annotatedMembers;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>> annotatedMembers;
// The implementation class of the annotation
private final Class<T> clazz;
// The set of abstracted members
@@ -117,7 +74,7 @@
super(AnnotationStore.of(annotationType), annotationType, annotationType, classTransformer);
this.clazz = annotationType;
members = new HashSet<AnnotatedMethod<?>>();
- annotatedMembers = new AnnotatedMemberMap();
+ annotatedMembers = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>>();
this.namedMembers = new HashMap<String, AnnotatedMethod<?>>();
for (Method member : clazz.getDeclaredMethods())
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -40,8 +40,8 @@
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
-import org.jboss.webbeans.util.collections.ForwardingMap;
+import org.jboss.webbeans.util.collections.multi.SetHashMultiMap;
+import org.jboss.webbeans.util.collections.multi.SetMultiMap;
/**
* Represents an annotated class
@@ -57,203 +57,43 @@
private static List<Class<?>> NO_ARGUMENTS = Collections.emptyList();
- /**
- * A (annotation type -> set of field abstractions with annotation/meta
- * annotation) map
- */
- private static class AnnotatedFieldMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedField<?>>>
- {
- private Map<Class<? extends Annotation>, Set<AnnotatedField<?>>> delegate;
-
- public AnnotatedFieldMap()
- {
- delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<?>>>();
- }
-
- @Override
- protected Map<Class<? extends Annotation>, Set<AnnotatedField<?>>> delegate()
- {
- return delegate;
- }
-
- @Override
- public String toString()
- {
- return Strings.mapToString("AnnotatedFieldMap (annotation type -> field abstraction set): ", delegate);
- }
-
- @Override
- public Set<AnnotatedField<?>> get(Object key)
- {
- Set<AnnotatedField<?>> fields = super.get(key);
- return fields != null ? fields : new HashSet<AnnotatedField<?>>();
- }
-
- public void put(Class<? extends Annotation> key, AnnotatedField<?> value)
- {
- Set<AnnotatedField<?>> fields = super.get(key);
- if (fields == null)
- {
- fields = new HashSet<AnnotatedField<?>>();
- super.put(key, fields);
- }
- fields.add(value);
- }
-
- }
-
- /**
- * A (annotation type -> set of method abstractions with annotation) map
- */
- private class AnnotatedMethodMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>
- {
- private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate;
-
- public AnnotatedMethodMap()
- {
- delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>();
- }
-
- @Override
- protected Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> delegate()
- {
- return delegate;
- }
-
- @Override
- public String toString()
- {
- return Strings.mapToString("AnnotatedMethodMap (annotation type -> method abstraction set): ", delegate);
- }
-
- @Override
- public Set<AnnotatedMethod<?>> get(Object key)
- {
- Set<AnnotatedMethod<?>> methods = super.get(key);
- return methods != null ? methods : new HashSet<AnnotatedMethod<?>>();
- }
-
- public void put(Class<? extends Annotation> key, AnnotatedMethod<?> value)
- {
- Set<AnnotatedMethod<?>> methods = super.get(key);
- if (methods == null)
- {
- methods = new HashSet<AnnotatedMethod<?>>();
- super.put(key, methods);
- }
- methods.add(value);
- }
-
- }
-
- /**
- * A (annotation type -> set of constructor abstractions with annotation) map
- */
- private class AnnotatedConstructorMap extends ForwardingMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>
- {
- private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate;
-
- public AnnotatedConstructorMap()
- {
- delegate = new HashMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>();
- }
-
- @Override
- protected Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> delegate()
- {
- return delegate;
- }
-
- @Override
- public String toString()
- {
- return Strings.mapToString("AnnotatedConstructorMap (annotation type -> constructor abstraction set): ", delegate);
- }
-
- @Override
- public Set<AnnotatedConstructor<T>> get(Object key)
- {
- Set<AnnotatedConstructor<T>> constructors = super.get(key);
- return constructors != null ? constructors : new HashSet<AnnotatedConstructor<T>>();
- }
-
- public void add(Class<? extends Annotation> key, AnnotatedConstructor<T> value)
- {
- Set<AnnotatedConstructor<T>> constructors = super.get(key);
- if (constructors == null)
- {
- constructors = new HashSet<AnnotatedConstructor<T>>();
- super.put(key, constructors);
- }
- constructors.add(value);
- }
- }
-
- /**
- * A (class list -> set of constructor abstractions with matching parameters)
- * map
- */
- private class ConstructorsByArgumentMap extends ForwardingMap<List<Class<?>>, AnnotatedConstructor<T>>
- {
- private Map<List<Class<?>>, AnnotatedConstructor<T>> delegate;
-
- public ConstructorsByArgumentMap()
- {
- delegate = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
- }
-
- @Override
- protected Map<List<Class<?>>, AnnotatedConstructor<T>> delegate()
- {
- return delegate;
- }
-
- @Override
- public String toString()
- {
- return Strings.mapToString("Annotation type -> constructor by arguments mappings: ", delegate);
- }
- }
-
-
-
// The set of abstracted fields
private final Set<AnnotatedField<?>> fields;
// The map from annotation type to abstracted field with annotation
- private final AnnotatedFieldMap annotatedFields;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedField<?>> annotatedFields;
// The map from annotation type to abstracted field with meta-annotation
- private final AnnotatedFieldMap metaAnnotatedFields;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedField<?>> metaAnnotatedFields;
// The set of abstracted fields
private final Set<AnnotatedField<?>> declaredFields;
private final Map<String, AnnotatedField<?>> declaredFieldsByName;
// The map from annotation type to abstracted field with annotation
- private final AnnotatedFieldMap declaredAnnotatedFields;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedField<?>> declaredAnnotatedFields;
// The map from annotation type to abstracted field with meta-annotation
- private final AnnotatedFieldMap declaredMetaAnnotatedFields;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedField<?>> declaredMetaAnnotatedFields;
// The set of abstracted methods
private final Set<AnnotatedMethod<?>> methods;
private final Map<MethodSignature, AnnotatedMethod<?>> declaredMethodsBySignature;
// The map from annotation type to abstracted method with annotation
- private final AnnotatedMethodMap annotatedMethods;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>> annotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final AnnotatedMethodMap methodsByAnnotatedParameters;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>> methodsByAnnotatedParameters;
// The set of abstracted methods
private final Set<AnnotatedMethod<?>> declaredMethods;
// The map from annotation type to abstracted method with annotation
- private final AnnotatedMethodMap declaredAnnotatedMethods;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>> declaredAnnotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final AnnotatedMethodMap declaredMethodsByAnnotatedParameters;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>> declaredMethodsByAnnotatedParameters;
// The set of abstracted constructors
private final Set<AnnotatedConstructor<T>> constructors;
private final Map<ConstructorSignature, AnnotatedConstructor<?>> declaredConstructorsBySignature;
// The map from annotation type to abstracted constructor with annotation
- private final AnnotatedConstructorMap annotatedConstructors;
+ private final SetMultiMap<Class<? extends Annotation>, AnnotatedConstructor<T>> annotatedConstructors;
// The map from class list to abstracted constructor
- private final ConstructorsByArgumentMap constructorsByArgumentMap;
+ private final Map<List<Class<?>>, AnnotatedConstructor<T>> constructorsByArgumentMap;
// Cached string representation
private String toString;
@@ -273,12 +113,12 @@
super(AnnotationStore.of(annotations, declaredAnnotations), rawType, type, classTransformer);
this.fields = new HashSet<AnnotatedField<?>>();
- this.annotatedFields = new AnnotatedFieldMap();
- this.metaAnnotatedFields = new AnnotatedFieldMap();
+ this.annotatedFields = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedField<?>>();
+ this.metaAnnotatedFields = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedField<?>>();
this.declaredFields = new HashSet<AnnotatedField<?>>();
this.declaredFieldsByName = new HashMap<String, AnnotatedField<?>>();
- this.declaredAnnotatedFields = new AnnotatedFieldMap();
- this.declaredMetaAnnotatedFields = new AnnotatedFieldMap();
+ this.declaredAnnotatedFields = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedField<?>>();
+ this.declaredMetaAnnotatedFields = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedField<?>>();
this._nonStaticMemberClass = Reflections.isNonMemberInnerClass(rawType);
this._abstract = Reflections.isAbstract(rawType);
this._enum = rawType.isEnum();
@@ -318,8 +158,8 @@
}
this.constructors = new HashSet<AnnotatedConstructor<T>>();
- this.constructorsByArgumentMap = new ConstructorsByArgumentMap();
- this.annotatedConstructors = new AnnotatedConstructorMap();
+ this.constructorsByArgumentMap = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
+ this.annotatedConstructors = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedConstructor<T>>();
this.declaredConstructorsBySignature = new HashMap<ConstructorSignature, AnnotatedConstructor<?>>();
for (Constructor<?> constructor : rawType.getDeclaredConstructors())
{
@@ -346,11 +186,11 @@
}
this.methods = new HashSet<AnnotatedMethod<?>>();
- this.annotatedMethods = new AnnotatedMethodMap();
- this.methodsByAnnotatedParameters = new AnnotatedMethodMap();
+ this.annotatedMethods = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>>();
+ this.methodsByAnnotatedParameters = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>>();
this.declaredMethods = new HashSet<AnnotatedMethod<?>>();
- this.declaredAnnotatedMethods = new AnnotatedMethodMap();
- this.declaredMethodsByAnnotatedParameters = new AnnotatedMethodMap();
+ this.declaredAnnotatedMethods = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>>();
+ this.declaredMethodsByAnnotatedParameters = new SetHashMultiMap<Class<? extends Annotation>, AnnotatedMethod<?>>();
this.declaredMethodsBySignature = new HashMap<MethodSignature, AnnotatedMethod<?>>();
for (Class<?> c = rawType; c != Object.class && c != null; c = c.getSuperclass())
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -32,6 +32,8 @@
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.ConstructorSignature;
import org.jboss.webbeans.util.Names;
+import org.jboss.webbeans.util.collections.multi.ListHashMultiMap;
+import org.jboss.webbeans.util.collections.multi.ListMultiMap;
/**
* Represents an annotated constructor
@@ -51,7 +53,7 @@
// The list of parameter abstractions
private final List<AnnotatedParameter<?>> parameters;
// The mapping of annotation -> parameter abstraction
- private final AnnotatedParameterMap annotatedParameters;
+ private final ListMultiMap<Class<? extends Annotation>, AnnotatedParameter<?>> annotatedParameters;
// The declaring class abstraction
private final AnnotatedType<T> declaringClass;
@@ -81,7 +83,7 @@
this.declaringClass = declaringClass;
this.parameters = new ArrayList<AnnotatedParameter<?>>();
- annotatedParameters = new AnnotatedParameterMap();
+ annotatedParameters = new ListHashMultiMap<Class<? extends Annotation>, AnnotatedParameter<?>>();
for (int i = 0; i < constructor.getParameterTypes().length; i++)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -33,6 +33,8 @@
import org.jboss.webbeans.introspector.MethodSignature;
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;
/**
* Represents an annotated method
@@ -53,7 +55,7 @@
private final List<AnnotatedParameter<?>> parameters;
// A mapping from annotation type to parameter abstraction with that
// annotation present
- private final AnnotatedParameterMap annotatedParameters;
+ private final ListMultiMap<Class<? extends Annotation>, AnnotatedParameter<?>> annotatedParameters;
// The property name
private final String propertyName;
@@ -88,7 +90,7 @@
this.method.setAccessible(true);
this.declaringClass = declaringClass;
this.parameters = new ArrayList<AnnotatedParameter<?>>();
- this.annotatedParameters = new AnnotatedParameterMap();
+ this.annotatedParameters = new ListHashMultiMap<Class<? extends Annotation>, AnnotatedParameter<?>>();
for (int i = 0; i < method.getParameterTypes().length; i++)
{
Added: 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 (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCollection.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,54 @@
+/*
+ * 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);
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCollection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.collections;
+
+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;
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingConcurrentMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,56 @@
+/*
+ * 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);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ForwardingConcurrentMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.collections.multi;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.jboss.webbeans.util.collections.ConcurrentList;
+import org.jboss.webbeans.util.collections.ForwardingConcurrentMap;
+
+/**
+ * An concurrent multimap which is internally backed by a a ConcurrentHashMap
+ * and a CopyOnWriteArrayList
+ *
+ * @author Pete Muir
+ */
+public class ConcurrentListHashMultiMap<K, V> extends ForwardingConcurrentMap<K, ConcurrentList<V>> implements ConcurrentListMultiMap<K, V>
+{
+
+ private final ConcurrentList<V> EMPTY_LIST = ConcurrentList.emptyList();
+
+ // The map delegate
+ private ConcurrentHashMap<K, ConcurrentList<V>> delegate;
+
+ /**
+ * Constructor.
+ */
+ public ConcurrentListHashMultiMap()
+ {
+ delegate = new ConcurrentHashMap<K, ConcurrentList<V>>();
+ }
+
+ @Override
+ protected ConcurrentMap<K, ConcurrentList<V>> delegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * Gets the list of values for a given key
+ *
+ * @param key
+ * the key
+ * @return The list of values. An empty list is returned if there are no
+ * matches.
+ */
+ @Override
+ public ConcurrentList<V> get(Object key)
+ {
+ ConcurrentList<V> values = super.get(key);
+ return values != null ? values : EMPTY_LIST;
+ }
+
+ public void put(K key, V value)
+ {
+ delegate.putIfAbsent(key, new ConcurrentList<V>());
+ get(key).add(value);
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListHashMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,40 @@
+/*
+ * 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.multi;
+
+import java.util.concurrent.ConcurrentMap;
+
+import org.jboss.webbeans.util.collections.ConcurrentList;
+
+/**
+ * A concurrent multimap, in which the multi-values are stored in a list
+ *
+ * @author Pete Muir
+ *
+ */
+public interface ConcurrentListMultiMap<K, V> extends ConcurrentMap<K, ConcurrentList<V>>
+{
+
+ /**
+ * Add a value, creating the list if it doesn't exist
+ *
+ * @param key the key to store the value under
+ * @param value the value to add
+ */
+ public void put(K key, V value);
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentListMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,74 @@
+package org.jboss.webbeans.util.collections.multi;
+/*
+ * 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.
+ */
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.jboss.webbeans.util.collections.ConcurrentCollection;
+import org.jboss.webbeans.util.collections.ConcurrentList;
+import org.jboss.webbeans.util.collections.ForwardingConcurrentMap;
+
+/**
+ * An concurrent multimap which is internally backed by a a ConcurrentHashMap
+ * and a CopyOnWriteArrayList
+ *
+ * @author Pete Muir
+ */
+public class ConcurrentSetHashMultiMap<K, V> extends ForwardingConcurrentMap<K, ConcurrentCollection<V>> implements ConcurrentSetMultiMap<K, V>
+{
+
+ private final ConcurrentCollection<V> EMPTY_COLLECTION = ConcurrentList.emptyList();
+
+ // The map delegate
+ private ConcurrentMap<K, ConcurrentCollection<V>> delegate;
+
+ /**
+ * Constructor.
+ */
+ public ConcurrentSetHashMultiMap()
+ {
+ delegate = new ConcurrentHashMap<K, ConcurrentCollection<V>>();
+ }
+
+ @Override
+ protected ConcurrentMap<K, ConcurrentCollection<V>> delegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * Gets the list of values for a given key
+ *
+ * @param key
+ * the key
+ * @return The list of values. An empty list is returned if there are no
+ * matches.
+ */
+ @Override
+ public ConcurrentCollection<V> get(Object key)
+ {
+ ConcurrentCollection<V> values = super.get(key);
+ return values != null ? values : EMPTY_COLLECTION;
+ }
+
+ public void put(K key, V value)
+ {
+ delegate().putIfAbsent(key, new ConcurrentList<V>());
+ get(key).addIfAbsent(value);
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetHashMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.collections.multi;
+
+import java.util.concurrent.ConcurrentMap;
+
+import org.jboss.webbeans.util.collections.ConcurrentCollection;
+
+/**
+ * A concurrent multimap, in which the multi-values are stored with Set
+ * semantics for {@link #put(Object, Object)} operations
+ *
+ * @author Pete Muir
+ *
+ */
+public interface ConcurrentSetMultiMap<K, V> extends ConcurrentMap<K, ConcurrentCollection<V>>
+{
+
+ /**
+ * Add a value. The collection is automatically created. If the value already
+ * exists, it isn't added
+ *
+ * @param key the key to add the value to
+ * @param value the value to add
+ */
+ public void put(K key, V value);
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ConcurrentSetMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,87 @@
+/*
+ * 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.multi;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.webbeans.util.collections.ForwardingMap;
+
+/**
+ * An multimap which is internally backed by a HashMap and a ArrayList
+ *
+ * @author Pete Muir
+ */
+public class ListHashMultiMap<K, V> extends ForwardingMap<K, List<V>> implements ListMultiMap<K, V>
+{
+
+ private final List<V> EMPTY_COLLECTION = Collections.emptyList();
+
+ // The map delegate
+ private Map<K, List<V>> delegate;
+
+ /**
+ * Constructor.
+ */
+ public ListHashMultiMap()
+ {
+ delegate = new HashMap<K, List<V>>();
+ }
+
+ @Override
+ protected Map<K, List<V>> delegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * Gets the list of values for a given key
+ *
+ * @param key
+ * the key
+ * @return The list of values. An empty list is returned if there are no
+ * matches.
+ */
+ @Override
+ public List<V> get(Object key)
+ {
+ List<V> values = super.get(key);
+ return values != null ? values : EMPTY_COLLECTION;
+ }
+
+ /**
+ * Adds an value for a given key
+ *
+ * Implicitly creates a new list if there is none for the key. Only adds
+ * the value if it is not already present
+ *
+ * @param key the key
+ * @param value the value
+ */
+ public void put(K key, V value)
+ {
+ if (!containsKey(key))
+ {
+ put(key, new ArrayList<V>());
+ }
+ get(key).add(value);
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListHashMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,38 @@
+/*
+ * 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.multi;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A concurrent multimap, in which the multi-values are stored in a list
+ * @author Pete Muir
+ *
+ */
+public interface ListMultiMap<K, V> extends Map<K, List<V>>
+{
+
+ /**
+ * Add a value, creating the list if it doesn't exist
+ *
+ * @param key the key to store the value under
+ * @param value the value to add
+ */
+ public void put(K key, V value);
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/ListMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,82 @@
+/*
+ * 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.multi;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.webbeans.util.collections.ForwardingMap;
+
+/**
+ * An multimap which is internally backed by a HashMap and a HashSet
+ *
+ * @author Pete Muir
+ */
+public class SetHashMultiMap<K, V> extends ForwardingMap<K, Set<V>> implements SetMultiMap<K, V>
+{
+
+ private final Set<V> EMPTY_COLLECTION = Collections.emptySet();
+
+ // The map delegate
+ private Map<K, Set<V>> delegate;
+
+ /**
+ * Constructor.
+ */
+ public SetHashMultiMap()
+ {
+ delegate = new HashMap<K, Set<V>>();
+ }
+
+ @Override
+ protected Map<K, Set<V>> delegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * Gets the list of values for a given key
+ *
+ * @param key
+ * the key
+ * @return The list of values. An empty list is returned if there are no
+ * matches.
+ */
+ @Override
+ public Set<V> get(Object key)
+ {
+ Set<V> values = super.get(key);
+ return values != null ? values : EMPTY_COLLECTION;
+ }
+
+ public void put(K key, V value)
+ {
+ if (!containsKey(key))
+ {
+ put(key, new HashSet<V>());
+ }
+ Set<V> values = get(key);
+ if (!values.contains(value))
+ {
+ values.add(value);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetHashMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util.collections.multi;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A concurrent multimap, in which the multi-values are stored with Set
+ * semantics for {@link #put(Object, Object)} operations
+ *
+ * @author Pete Muir
+ *
+ */
+public interface SetMultiMap<K, V> extends Map<K, Set<V>>
+{
+
+ /**
+ * Add a value. The collection is automatically created. If the value already
+ * exists, it isn't added
+ *
+ * @param key the key to add the value to
+ * @param value the value to add
+ */
+ public void put(K key, V value);
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/multi/SetMultiMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java 2009-04-04 18:25:00 UTC (rev 2299)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java 2009-04-05 12:54:49 UTC (rev 2300)
@@ -200,7 +200,7 @@
assert childActivity.getInstanceToInject(dummyBean.getInjectionPoints().iterator().next()) != null;
}
- @Test(groups="ri-broken")
+ @Test
@SpecAssertions({
@SpecAssertion(section="11.6", id="j"),
@SpecAssertion(section="11.6", id="n")
More information about the weld-commits
mailing list