Package org.apache.tapestry5.internal.spring

# Class SpringModuleDef

java.lang.Object
org.apache.tapestry5.internal.spring.SpringModuleDef

All Implemented Interfaces:
  `ModuleDef`

public class SpringModuleDef extends Object implements ModuleDef
A wrapper that converts a Spring `ApplicationContext` into a set of service definitions, compatible with Tapestry 5 IoC, for the beans defined in the context, as well as the context itself.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpringModuleDef(javax.servlet.ServletContext servletContext)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Class`
  `getBuilderClass()`
  Returns the class that will be instantiated.
  `Set<ContributionDef>`
  `getContributionDefs()`
  Returns a contribution, "SpringBean", to the MasterObjectProvider service.
  `Set<DecoratorDef>`
  `getDecoratorDefs()`
  Returns an empty set.
  `String`
  `getLoggerName()`
  Returns the name used to create a `Logger` instance.
  `ServiceDef`
  `getServiceDef(String serviceId)`
  Returns a service definition via the service's id.
  `Set<String>`
  `getServiceIds()`
  Returns the ids of the services built/provided by the module.
  `protected org.springframework.context.ApplicationContext`
  `locateApplicationContext(javax.servlet.ServletContext servletContext)`
  Invoked to obtain the Spring ApplicationContext, presumably stored in the ServletContext.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SpringModuleDef

    public SpringModuleDef(javax.servlet.ServletContext servletContext)

- ## Method Details

  - ### locateApplicationContext

    protected org.springframework.context.ApplicationContext locateApplicationContext(javax.servlet.ServletContext servletContext)
    Invoked to obtain the Spring ApplicationContext, presumably stored in the ServletContext. This method is only used in Tapestry 5.0 compatibility mode (in Tapestry 5.1 and above, the default is for Tapestry to create the ApplicationContext).
    Parameters:
      `servletContext` - used to locate the ApplicationContext
    Returns:
      the ApplicationContext itself
    Throws:
      `RuntimeException` - if the ApplicationContext could not be located or is otherwise invalid
    Since:
      5.2.0

  - ### getBuilderClass

    public Class getBuilderClass()
    Description copied from interface: `ModuleDef`
    Returns the class that will be instantiated. Annotated instance methods of this class are invoked to build services, to decorate/intercept services, and make contributions to other services. Note: this name is maintained for compatibilty; the term "module builder" is now just "module class".
    Specified by:
      `getBuilderClass` in interface `ModuleDef`

  - ### getContributionDefs

    public Set<ContributionDef> getContributionDefs()
    Returns a contribution, "SpringBean", to the MasterObjectProvider service. It is ordered after the built-in contributions.
    Specified by:
      `getContributionDefs` in interface `ModuleDef`

  - ### getDecoratorDefs

    public Set<DecoratorDef> getDecoratorDefs()
    Returns an empty set.
    Specified by:
      `getDecoratorDefs` in interface `ModuleDef`

  - ### getLoggerName

    public String getLoggerName()
    Description copied from interface: `ModuleDef`
    Returns the name used to create a `Logger` instance. This is typically the builder class name.
    Specified by:
      `getLoggerName` in interface `ModuleDef`

  - ### getServiceDef

    public ServiceDef getServiceDef(String serviceId)
    Description copied from interface: `ModuleDef`
    Returns a service definition via the service's id. Ideally, the returned value should be an instance of `ServiceDef2`, and will be converted to such if necessary.
    Specified by:
      `getServiceDef` in interface `ModuleDef`
    Parameters:
      `serviceId` - the id of the service to retrieve (case is ignored)
    Returns:
      service definition or null if it doesn't exist

  - ### getServiceIds

    public Set<String> getServiceIds()
    Description copied from interface: `ModuleDef`
    Returns the ids of the services built/provided by the module.
    Specified by:
      `getServiceIds` in interface `ModuleDef`