org.eclipse.gemini.blueprint.service.importer.support.internal.collection
Class OsgiServiceCollection
java.lang.Object
org.eclipse.gemini.blueprint.service.importer.support.internal.collection.OsgiServiceCollection
- All Implemented Interfaces:
- Iterable, Collection, CollectionProxy, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
- OsgiServiceList, OsgiServiceSet
public class OsgiServiceCollection
- extends Object
- implements Collection, org.springframework.beans.factory.InitializingBean, CollectionProxy, org.springframework.beans.factory.DisposableBean
OSGi service dynamic collection - allows iterating while the underlying storage is being shrunk/expanded. This
collection is read-only - its content is being retrieved dynamically from the OSGi platform.
This collection and its iterators are thread-safe. That is, multiple threads can access the collection. However,
since the collection is read-only, it cannot be modified by the client.
- Author:
- Costin Leau
- See Also:
Collection
servicesIdMap
protected final Map<Long,ProxyPlusCallback> servicesIdMap
services
protected DynamicCollection<Object> services
- The dynamic collection.
OsgiServiceCollection
public OsgiServiceCollection(org.osgi.framework.Filter filter,
org.osgi.framework.BundleContext context,
ClassLoader classLoader,
ServiceProxyCreator proxyCreator,
boolean useServiceReference)
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
destroy
public void destroy()
- Specified by:
destroy
in interface org.springframework.beans.factory.DisposableBean
mandatoryServiceCheck
protected void mandatoryServiceCheck()
- Check to see whether at least one service is available.
isSatisfied
public boolean isSatisfied()
- Description copied from interface:
CollectionProxy
- Is the underlying proxy satisfied?
For dynamic, mandatory imports, this checks the service reference. For
optional imports, it always returns true.
- Specified by:
isSatisfied
in interface CollectionProxy
- Returns:
createInternalDynamicStorage
protected DynamicCollection<Object> createInternalDynamicStorage()
- Create the dynamic storage used internally. The storage has to be thread-safe.
setServiceImporter
public void setServiceImporter(Object importer)
setServiceImporterName
public void setServiceImporterName(String name)
iterator
public Iterator<Object> iterator()
- Specified by:
iterator
in interface Iterable
- Specified by:
iterator
in interface Collection
size
public int size()
- Specified by:
size
in interface Collection
toString
public String toString()
- Overrides:
toString
in class Object
remove
public boolean remove(Object o)
- Specified by:
remove
in interface Collection
removeAll
public boolean removeAll(Collection c)
- Specified by:
removeAll
in interface Collection
add
public boolean add(Object o)
- Specified by:
add
in interface Collection
addAll
public boolean addAll(Collection c)
- Specified by:
addAll
in interface Collection
clear
public void clear()
- Specified by:
clear
in interface Collection
retainAll
public boolean retainAll(Collection c)
- Specified by:
retainAll
in interface Collection
contains
public boolean contains(Object o)
- Specified by:
contains
in interface Collection
containsAll
public boolean containsAll(Collection c)
- Specified by:
containsAll
in interface Collection
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Collection
toArray
public Object[] toArray()
- Specified by:
toArray
in interface Collection
toArray
public Object[] toArray(Object[] array)
- Specified by:
toArray
in interface Collection
setListeners
public void setListeners(OsgiServiceLifecycleListener[] listeners)
- Parameters:
listeners
- The listeners to set.
setRequiredAtStartup
public void setRequiredAtStartup(boolean serviceRequiredAtStartup)
setStateListeners
public void setStateListeners(List<ImporterStateListener> stateListeners)
setUseBlueprintExceptions
public void setUseBlueprintExceptions(boolean useBlueprintExceptions)
Copyright © 2006-2013. All Rights Reserved.