org.apache.aries.blueprint.container
Class AbstractServiceReferenceRecipe
java.lang.Object
org.apache.aries.blueprint.di.AbstractRecipe
org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe
- All Implemented Interfaces:
- java.util.EventListener, SatisfiableRecipe, Recipe, org.osgi.framework.ServiceListener
- Direct Known Subclasses:
- ReferenceListRecipe, ReferenceRecipe
public abstract class AbstractServiceReferenceRecipe
- extends AbstractRecipe
- implements org.osgi.framework.ServiceListener, SatisfiableRecipe
Abstract class for service reference recipes.
TODO: if we have a single interface (which is the standard behavior), then we should be able to get rid of
the proxyClassloader and just use this interface classloader to define the proxy
TODO: it is allowed to have no interface defined at all, which should result in an empty proxy
- Version:
- $Rev: 1030761 $, $Date: 2010-11-03 23:48:47 +0000 (Wed, 03 Nov 2010) $
Methods inherited from class org.apache.aries.blueprint.di.AbstractRecipe |
addPartialObject, convert, convert, create, destroy, getName, internalCreate, isPrototype, loadClass, loadType, setPrototype, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
blueprintContainer
protected final ExtendedBlueprintContainer blueprintContainer
metadata
protected final ServiceReferenceMetadata metadata
listenersRecipe
protected final CollectionRecipe listenersRecipe
explicitDependencies
protected final java.util.List<Recipe> explicitDependencies
optional
protected final boolean optional
filter
protected final java.lang.String filter
- The OSGi filter for tracking references
listeners
protected java.util.List<AbstractServiceReferenceRecipe.Listener> listeners
- The list of listeners for this reference. This list will be lazy created
AbstractServiceReferenceRecipe
protected AbstractServiceReferenceRecipe(java.lang.String name,
ExtendedBlueprintContainer blueprintContainer,
ServiceReferenceMetadata metadata,
CollectionRecipe listenersRecipe,
java.util.List<Recipe> explicitDependencies)
getListenersRecipe
public CollectionRecipe getListenersRecipe()
start
public void start(SatisfiableRecipe.SatisfactionListener listener)
- Specified by:
start
in interface SatisfiableRecipe
stop
public void stop()
- Specified by:
stop
in interface SatisfiableRecipe
doStop
protected void doStop()
isStarted
protected boolean isStarted()
isSatisfied
public boolean isSatisfied()
- Specified by:
isSatisfied
in interface SatisfiableRecipe
getConstructorDependencies
public java.util.List<Recipe> getConstructorDependencies()
- Description copied from interface:
Recipe
- Get the list of constructor dependencies, i.e. explicit and
argument dependencies. These dependencies must be satisfied
before the an object can be created.
- Specified by:
getConstructorDependencies
in interface Recipe
- Overrides:
getConstructorDependencies
in class AbstractRecipe
- Returns:
- a list of constructor dependencies
getDependencies
public java.util.List<Recipe> getDependencies()
- Description copied from interface:
Recipe
- Get the list of nested recipes, i.e. all dependencies including
constructor dependencies.
- Specified by:
getDependencies
in interface Recipe
- Returns:
- a list of dependencies
getOsgiFilter
public java.lang.String getOsgiFilter()
- Specified by:
getOsgiFilter
in interface SatisfiableRecipe
createListeners
protected void createListeners()
loadAllClasses
protected java.util.List<java.lang.Class<?>> loadAllClasses(java.lang.Iterable<java.lang.String> interfaceNames)
loadType
protected ReifiedType loadType(java.lang.String typeName,
java.lang.ClassLoader fromClassLoader)
- Overrides:
loadType
in class AbstractRecipe
createProxy
protected java.lang.Object createProxy(java.util.concurrent.Callable<java.lang.Object> dispatcher,
java.util.Set<java.lang.Class<?>> interfaces)
throws java.lang.Exception
- Throws:
java.lang.Exception
serviceChanged
public void serviceChanged(org.osgi.framework.ServiceEvent event)
- Specified by:
serviceChanged
in interface org.osgi.framework.ServiceListener
getInterfaceClass
protected java.lang.Class getInterfaceClass()
getRuntimeClass
protected static java.lang.Class getRuntimeClass(ServiceReferenceMetadata metadata)
setSatisfied
protected void setSatisfied(boolean s)
track
protected abstract void track(org.osgi.framework.ServiceReference reference)
untrack
protected abstract void untrack(org.osgi.framework.ServiceReference reference)
retrack
protected abstract void retrack()
updateListeners
protected void updateListeners()
bind
protected void bind(org.osgi.framework.ServiceReference reference,
java.lang.Object service)
unbind
protected void unbind(org.osgi.framework.ServiceReference reference,
java.lang.Object service)
getServiceReferences
public java.util.List<org.osgi.framework.ServiceReference> getServiceReferences()
getBestServiceReference
public org.osgi.framework.ServiceReference getBestServiceReference()
Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.