org.chorem.pollen.ui.services
Class AppModule

java.lang.Object
  extended by org.chorem.pollen.ui.services.AppModule

public class AppModule
extends java.lang.Object

This module is automatically included as part of the Tapestry IoC Registry, it's a good place to configure and extend Tapestry, or to place your own service definitions.

Version:
$Id: AppModule.java 2762 2009-08-27 15:51:09Z nrannou $

Constructor Summary
AppModule()
           
 
Method Summary
static void bind(org.apache.tapestry5.ioc.ServiceBinder binder)
           
static BackgroundWorker buildBackgroundWorker(org.apache.tapestry5.services.ComponentSource componentSource, Configuration configuration, ServicePoll servicePoll)
          This is the BackgroundWorker service definition.
 PropertiesFileSymbolProvider buildConfigPropertiesFileSymbolProvider(org.slf4j.Logger logger)
          Make configuration from a Properties file available as symbols.
static Configuration buildConfiguration()
          This is the Configuration service definition.
 org.apache.tapestry5.ioc.services.RegistryShutdownListener buildPollenShutdown(org.apache.tapestry5.ioc.services.RegistryShutdownHub hub)
          This is the Shutdown service definition.
 org.apache.tapestry5.services.RequestFilter buildTimingFilter(org.slf4j.Logger log)
          This is a service definition, the service will be named "TimingFilter".
static void contributeApplicationDefaults(org.apache.tapestry5.ioc.MappedConfiguration<java.lang.String,java.lang.String> configuration)
           
 void contributeRequestHandler(org.apache.tapestry5.ioc.OrderedConfiguration<org.apache.tapestry5.services.RequestFilter> configuration, org.apache.tapestry5.services.RequestFilter filter)
          This is a contribution to the RequestHandler service configuration.
static void contributeSymbolSource(org.apache.tapestry5.ioc.OrderedConfiguration<org.apache.tapestry5.ioc.services.SymbolProvider> configuration, org.apache.tapestry5.ioc.services.SymbolProvider configPropertiesFileSymbolProvider)
          Contribution SymbolSource service so that we can access our configuration symbols from our services, pages and components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppModule

public AppModule()
Method Detail

bind

public static void bind(org.apache.tapestry5.ioc.ServiceBinder binder)

contributeApplicationDefaults

public static void contributeApplicationDefaults(org.apache.tapestry5.ioc.MappedConfiguration<java.lang.String,java.lang.String> configuration)

buildTimingFilter

public org.apache.tapestry5.services.RequestFilter buildTimingFilter(org.slf4j.Logger log)
This is a service definition, the service will be named "TimingFilter". The interface, RequestFilter, is used within the RequestHandler service pipeline, which is built from the RequestHandler service configuration. Tapestry IoC is responsible for passing in an appropriate Logger instance. Requests for static resources are handled at a higher level, so this filter will only be invoked for Tapestry related requests.

Service builder methods are useful when the implementation is inline as an inner class (as here) or require some other kind of special initialization. In most cases, use the static bind() method instead.

If this method was named "build", then the service id would be taken from the service interface and would be "RequestFilter". Since Tapestry already defines a service named "RequestFilter" we use an explicit service id that we can reference inside the contribution method.


buildPollenShutdown

@EagerLoad
public org.apache.tapestry5.ioc.services.RegistryShutdownListener buildPollenShutdown(@InjectService(value="RegistryShutdownHub")
                                                                                                org.apache.tapestry5.ioc.services.RegistryShutdownHub hub)
This is the Shutdown service definition. This service is used when the server shutdown. It detects the Tapestry registry shutdown.


buildConfiguration

public static Configuration buildConfiguration()
This is the Configuration service definition. It manage the file properties.


buildBackgroundWorker

@EagerLoad
public static BackgroundWorker buildBackgroundWorker(org.apache.tapestry5.services.ComponentSource componentSource,
                                                               Configuration configuration,
                                                               ServicePoll servicePoll)
This is the BackgroundWorker service definition. It build the service giving a Messages object for localization in the service.


buildConfigPropertiesFileSymbolProvider

public PropertiesFileSymbolProvider buildConfigPropertiesFileSymbolProvider(org.slf4j.Logger logger)
Make configuration from a Properties file available as symbols.


contributeSymbolSource

public static void contributeSymbolSource(org.apache.tapestry5.ioc.OrderedConfiguration<org.apache.tapestry5.ioc.services.SymbolProvider> configuration,
                                          @InjectService(value="ConfigPropertiesFileSymbolProvider")
                                          org.apache.tapestry5.ioc.services.SymbolProvider configPropertiesFileSymbolProvider)
Contribution SymbolSource service so that we can access our configuration symbols from our services, pages and components.


contributeRequestHandler

public void contributeRequestHandler(org.apache.tapestry5.ioc.OrderedConfiguration<org.apache.tapestry5.services.RequestFilter> configuration,
                                     @Local
                                     org.apache.tapestry5.services.RequestFilter filter)
This is a contribution to the RequestHandler service configuration. This is how we extend Tapestry using the timing filter. A common use for this kind of filter is transaction management or security. The @Local annotation selects the desired service by type, but only from the same module. Without @Local, there would be an error due to the other service(s) that implement RequestFilter (defined in other modules).



Copyright © 2009 CodeLutin. All Rights Reserved.