Package com.groiss.component
Class ApplicationContext
java.lang.Object
com.groiss.component.ApplicationContext
Handling dependencies between applications. Register and retrieve
services.
Register a service with the method registerService, retrieve it with getService.
Services can be objects containing data or methods, urls. etc.
More than one application can register the same service. A preference value is
used to select the "best" implementation - the one with the highest number.
Normally, not more than two registrations of a service should exist: A default value
in the application that needs the service and a full implementation in another application.
It is a convention to give the default implementation the preference 10, the full implementation
the preference 100.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getService
(String serviceid) Get a service by id.static void
registerService
(String serviceid, Object service, int preference) Register a service.
-
Method Details
-
getService
Get a service by id. -
registerService
Register a service.
-