|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tapestry5.ioc.internal.RegistryImpl
public class RegistryImpl
| Constructor Summary | |
|---|---|
RegistryImpl(Collection<ModuleDef> moduleDefs,
ClassFactory classFactory,
LoggerSource loggerSource)
Constructs the registry from a set of module definitions and other resources. |
|
| Method Summary | ||
|---|---|---|
void |
addRegistryShutdownListener(RegistryShutdownListener listener)
Adds a listener for eventual notification. |
|
|
autobuild(Class<T> clazz)
Autobuilds a class by finding the public constructor with the most parameters. |
|
void |
cleanupThread()
Invoked at the end of a request to discard any thread-specific information accumulated during the current request. |
|
String |
expandSymbols(String input)
Given an input string that may contain symbols, returns the string with any and all symbols fully expanded. |
|
List<ServiceAdvisor> |
findAdvisorsForService(ServiceDef serviceDef)
Searches for advisors for a particular service, returning them in order of application. |
|
List<ServiceDecorator> |
findDecoratorsForService(ServiceDef serviceDef)
Searches for decorators for a particular service. |
|
|
getMappedConfiguration(ServiceDef serviceDef,
Class<K> keyType,
Class<V> objectType)
Builds up a map of key/value pairs by invoking service contribution methods that tharget the service (from any module, unless the service is private). |
|
|
getObject(Class<T> objectType,
AnnotationProvider annotationProvider)
Obtains an object indirectly, using the MasterObjectProvider service. |
|
|
getObject(Class<T> objectType,
AnnotationProvider annotationProvider,
ObjectLocator locator,
Module localModule)
As with ObjectLocator.getObject(Class, org.apache.tapestry5.ioc.AnnotationProvider),
but handles the Local annotation. |
|
|
getOrderedConfiguration(ServiceDef serviceDef,
Class<T> objectType)
Builds up an ordered collection by invoking service contributor methods that target the service (from any module, unless the service is private). |
|
|
getService(Class<T> serviceInterface)
Locates a service given just a service interface. |
|
|
getService(String serviceId,
Class<T> serviceInterface)
Obtains a service via its unique service id. |
|
ServiceLifecycle2 |
getServiceLifecycle(String scope)
Returns a service lifecycle by service scope name. |
|
org.slf4j.Logger |
getServiceLogger(String serviceId)
Returns a logger for the service, which consists of the Module's log name suffixed
with a period and the service id. |
|
|
getUnorderedConfiguration(ServiceDef serviceDef,
Class<T> objectType)
Builds up an unordered collection by invoking service contributor methods that target the service (from any module, unless the service is private). |
|
|
invoke(String description,
Invokable<T> operation)
Executes the operation, returning its value. |
|
ClassFab |
newClass(Class serviceInterface)
Convieience for creating a new ClassFab instance using a ClassFactory. |
|
void |
performRegistryStartup()
It's not unreasonable for an eagerly-loaded service to decide to start a thread, at which point we raise issues about improper publishing of the Registry instance from the RegistryImpl constructor. |
|
Object |
provideServiceProxy(String serviceId)
Look up the service and return it's proxy. |
|
|
proxy(Class<T> interfaceClass,
Class<? extends T> implementationClass)
Creates a proxy. |
|
void |
run(String description,
Runnable operation)
Executes the operation. |
|
void |
shutdown()
Shuts down a Registry instance. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RegistryImpl(Collection<ModuleDef> moduleDefs,
ClassFactory classFactory,
LoggerSource loggerSource)
moduleDefs - defines the modules (and builders, decorators, etc., within)classFactory - TODOloggerSource - used to obtain Logger instances| Method Detail |
|---|
public void performRegistryStartup()
performRegistryStartup in interface Registrypublic org.slf4j.Logger getServiceLogger(String serviceId)
InternalRegistrylog name suffixed
with a period and the service id.
getServiceLogger in interface InternalRegistrypublic void shutdown()
Registry
shutdown in interface RegistryRegistryShutdownHub,
RegistryShutdownListener
public <T> T getService(String serviceId,
Class<T> serviceInterface)
ObjectLocator
getService in interface ObjectLocatorserviceId - unique Service id used to locate the service object (may contain symbols, which
will be expanded), case is ignoredserviceInterface - the interface implemented by the service (or an interface extended by the service
interface)
public void cleanupThread()
Registry
cleanupThread in interface RegistryPerthreadManager,
ThreadCleanupListener
public <T> Collection<T> getUnorderedConfiguration(ServiceDef serviceDef,
Class<T> objectType)
InternalRegistry
getUnorderedConfiguration in interface InternalRegistryserviceDef - defines the service for which configuration data is being assembledobjectType - identifies the type of object allowed into the collection
public <T> List<T> getOrderedConfiguration(ServiceDef serviceDef,
Class<T> objectType)
InternalRegistry
getOrderedConfiguration in interface InternalRegistryserviceDef - defines the service for which configuration data is being assembledobjectType - identifies the type of object allowed into the collection
public <K,V> Map<K,V> getMappedConfiguration(ServiceDef serviceDef,
Class<K> keyType,
Class<V> objectType)
InternalRegistry
getMappedConfiguration in interface InternalRegistryserviceDef - defines the service for which configuration data is being assembledkeyType - identifies the type of key object allowed into the mapobjectType - identifies the type of value object allowed into the map
public <T> T getService(Class<T> serviceInterface)
ObjectLocator
getService in interface ObjectLocatorserviceInterface - the interface the service implements
public ServiceLifecycle2 getServiceLifecycle(String scope)
InternalRegistry
getServiceLifecycle in interface InternalRegistryscope - the name of the service scope (case insensitive)
public List<ServiceDecorator> findDecoratorsForService(ServiceDef serviceDef)
InternalRegistryDecoratorDefs
are ordered, then converted into ServiceDecorators.
findDecoratorsForService in interface InternalRegistrypublic List<ServiceAdvisor> findAdvisorsForService(ServiceDef serviceDef)
InternalRegistry
findAdvisorsForService in interface InternalRegistrypublic ClassFab newClass(Class serviceInterface)
InternalRegistryClassFab instance using a ClassFactory.
newClass in interface InternalRegistryserviceInterface - the interface to be implemented by the provided class
public <T> T getObject(Class<T> objectType,
AnnotationProvider annotationProvider,
ObjectLocator locator,
Module localModule)
InternalRegistryObjectLocator.getObject(Class, org.apache.tapestry5.ioc.AnnotationProvider),
but handles the Local annotation.
getObject in interface InternalRegistryobjectType - type of object o be injectedannotationProvider - access to annotations at point of injectionlocator - used to resolve any subsequent injectionslocalModule - module to limit services to, if Local annotaton present
public <T> T getObject(Class<T> objectType,
AnnotationProvider annotationProvider)
ObjectLocatorMasterObjectProvider service.
getObject in interface ObjectLocatorobjectType - the type of object to be returnedannotationProvider - provides access to annotations on the field or parameter for which a value is to be
obtained, which may be utilized in selecting an appropriate object, use
null when annotations are not available (in which case, selection will
be based only on the object type)
ObjectProviderpublic void addRegistryShutdownListener(RegistryShutdownListener listener)
RegistryShutdownHub
addRegistryShutdownListener in interface RegistryShutdownHubpublic String expandSymbols(String input)
InternalRegistry
expandSymbols in interface InternalRegistrypublic <T> T autobuild(Class<T> clazz)
ObjectLocator
autobuild in interface ObjectLocatorclazz - the type of object to instantiate
MasterObjectProvider
public <T> T proxy(Class<T> interfaceClass,
Class<? extends T> implementationClass)
ObjectLocatorObjectLocator.autobuild(Class) until just-in-time (that is, first
method invocation). In a limited number of cases, it is necessary to use such a proxy to prevent service
construction cycles, particularly when contributing (directly or indirectly) to the MasterObjectProvider (which is itself at the heart of autobuilding).
proxy in interface ObjectLocatorinterfaceClass - the interface implemented by the proxyimplementationClass - a concrete class that implements the interface
public Object provideServiceProxy(String serviceId)
ServiceProxyProvider
provideServiceProxy in interface ServiceProxyProviderserviceId - the id of the service to obtain
public void run(String description,
Runnable operation)
OperationTracker
run in interface OperationTrackerdescription - used if there is an exceptionoperation - to execute
public <T> T invoke(String description,
Invokable<T> operation)
OperationTracker
invoke in interface OperationTrackerdescription - used if there is an exceptionoperation - to invoke
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||