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:
- 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: 1352904 $, $Date: 2012-06-22 15:36:37 +0100 (Fri, 22 Jun 2012) $
| Methods inherited from class org.apache.aries.blueprint.di.AbstractRecipe |
addPartialObject, canConvert, convert, convert, create, destroy, getName, internalCreate, isPrototype, loadClass, loadType, setPrototype, toString |
blueprintContainer
protected final ExtendedBlueprintContainer blueprintContainer
metadata
protected final org.osgi.service.blueprint.reflect.ServiceReferenceMetadata metadata
listenersRecipe
protected final CollectionRecipe listenersRecipe
explicitDependencies
protected final List<Recipe> explicitDependencies
optional
protected final boolean optional
filter
protected final String filter
- The OSGi filter for tracking references
listeners
protected List<AbstractServiceReferenceRecipe.Listener> listeners
- The list of listeners for this reference. This list will be lazy created
AbstractServiceReferenceRecipe
protected AbstractServiceReferenceRecipe(String name,
ExtendedBlueprintContainer blueprintContainer,
org.osgi.service.blueprint.reflect.ServiceReferenceMetadata metadata,
CollectionRecipe listenersRecipe,
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 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 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 String getOsgiFilter()
- Specified by:
getOsgiFilter in interface SatisfiableRecipe
getServiceSecurely
protected Object getServiceSecurely(org.osgi.framework.ServiceReference serviceReference)
createListeners
protected void createListeners()
loadAllClasses
protected List<Class<?>> loadAllClasses(Iterable<String> interfaceNames)
loadType
protected org.osgi.service.blueprint.container.ReifiedType loadType(String typeName,
ClassLoader fromClassLoader)
- Overrides:
loadType in class AbstractRecipe
createProxy
protected Object createProxy(Callable<Object> dispatcher,
Set<Class<?>> interfaces)
throws Exception
- Throws:
Exception
serviceChanged
public void serviceChanged(org.osgi.framework.ServiceEvent event)
- Specified by:
serviceChanged in interface org.osgi.framework.ServiceListener
getInterfaceClass
protected Class getInterfaceClass()
getRuntimeClass
protected static Class getRuntimeClass(org.osgi.service.blueprint.reflect.ServiceReferenceMetadata metadata)
getBundleContextForServiceLookup
protected org.osgi.framework.BundleContext getBundleContextForServiceLookup()
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,
Object service)
unbind
protected void unbind(org.osgi.framework.ServiceReference reference,
Object service)
getServiceReferences
public List<org.osgi.framework.ServiceReference> getServiceReferences()
getBestServiceReference
public org.osgi.framework.ServiceReference getBestServiceReference()
Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.