Application services

The Doolin GUI framework is using a number of services for performing lots of tasks. Each service is defined by a service interface and the corresponding implementation is determined at runtime. Of course, the Doolin GUI framework is providing default implementations but those ones can be overriden if needed.

Service interfaces

Providing a custom implementation

Providing another implementation than the one by default is done at configuration level by declaring the implementation as a bean whose id is the service interface name.

For example, to declare a custom implementation for the property service:

   ...
   <bean
      id="net.sf.doolin.gui.service.PropertyService"
      class="my.custom.PropertyService">
      ...
   </bean>
   ...

Providing a custom service

Of course, any application could register and access its own service interfaces and implementations using this method.

Accessing a service

Internally, there are several methods to access a service:

  1. the root operation is the getService() method on the net.sf.doolin.gui.Application singleton. It takes the service interface as a parameter and returns the corresponding implementation.
  2. the net.sf.doolin.gui.core.support.GUIUtils.getService(java.lang.Class) operation wraps the call to the previous operation.
  3. the GUIUtils provides also several methods that give a direct access to the most used services. See its Javadoc for more details.
  4. the GUIUtils wraps also the most used service operations (like getIcon() for example).

Note that each wrapping or utility method is finally doing always the same thing, calling the Application.getService() operation.

 
app/application_services.txt · Last modified: 2007/09/26 09:55 by damien
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki