Class ApplicationContext

java.lang.Object
com.groiss.component.ApplicationContext

public class ApplicationContext extends Object
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 Details

    • getService

      public static Object getService(String serviceid)
      Get a service by id.
    • registerService

      public static void registerService(String serviceid, Object service, int preference)
      Register a service.