org.springframework.webflow.definition.registry
Class ExternalizedFlowDefinitionRegistrar

java.lang.Object
  extended by org.springframework.webflow.definition.registry.ExternalizedFlowDefinitionRegistrar
All Implemented Interfaces:
FlowDefinitionRegistrar
Direct Known Subclasses:
XmlFlowRegistrar

public abstract class ExternalizedFlowDefinitionRegistrar
extends java.lang.Object
implements FlowDefinitionRegistrar

A flow definition registrar that populates a flow definition registry from flow definitions defined within externalized resources. Encapsulates registration behavior common to all externalized registrars and is not tied to a specific flow definition format (e.g. xml).

Concrete subclasses are expected to derive from this class to provide knowledge about a particular kind of definition format by implementing the abstract template methods in this class.

By default, when configuring the locations property, flow definitions at those locations will be assigned a registry identifier equal to the filename of the underlying definition resource, minus the filename extension. For example, a XML-based flow definition defined in the file "flow1.xml" will be identified as "flow1" when registered in a registry.

For full control over the assignment of flow identifiers and flow properties, configure formal FlowDefinitionResource instances using the setResources(FlowDefinitionResource[] resources) property.

Author:
Keith Donald
See Also:
FlowDefinitionResource, FlowDefinitionRegistry

Constructor Summary
ExternalizedFlowDefinitionRegistrar()
           
 
Method Summary
 boolean addLocation(org.springframework.core.io.Resource location)
          Adds a flow location pointing to an externalized flow resource.
 boolean addLocations(org.springframework.core.io.Resource[] locations)
          Adds the flow locations pointing to externalized flow resources.
 boolean addResource(FlowDefinitionResource resource)
          Adds an externalized flow definition specification pointing to an externalized flow resource.
 boolean addResources(FlowDefinitionResource[] resources)
          Adds the externalized flow definitions pointing to externalized flow resources.
protected abstract  FlowDefinitionHolder createFlowDefinitionHolder(FlowDefinitionResource resource)
          Template factory method subclasses must override to return the holder for the flow definition to be registered loaded from the specified resource.
protected  FlowDefinitionResource createFlowDefinitionResource(org.springframework.core.io.Resource location)
          Factory method that creates a flow definition from an externalized resource location.
protected  boolean isFlowDefinitionResource(org.springframework.core.io.Resource resource)
          Template method that calculates if the given file resource is actually a flow definition resource.
protected  void register(FlowDefinitionResource resource, FlowDefinitionRegistry registry)
          Helper method to register the flow built from an externalized resource in the registry.
 void registerFlowDefinitions(FlowDefinitionRegistry registry)
          Register flow definition resources managed by this registrar in the registry provided.
 void setLocations(org.springframework.core.io.Resource[] locations)
          Sets the locations (file paths) pointing to externalized flow definitions.
 void setResources(FlowDefinitionResource[] resources)
          Sets the formal set of externalized flow definitions this registrar will register.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExternalizedFlowDefinitionRegistrar

public ExternalizedFlowDefinitionRegistrar()
Method Detail

setLocations

public void setLocations(org.springframework.core.io.Resource[] locations)
Sets the locations (file paths) pointing to externalized flow definitions.

Flows registered from this set will be automatically assigned an id based on the filename of the flow resource.

Parameters:
locations - the resource locations

setResources

public void setResources(FlowDefinitionResource[] resources)
Sets the formal set of externalized flow definitions this registrar will register.

Use this method when you want full control over the assigned flow id and the set of properties applied to the externalized flow resources.

Parameters:
resources - the externalized flow definition specifications

addLocation

public boolean addLocation(org.springframework.core.io.Resource location)
Adds a flow location pointing to an externalized flow resource.

The flow registered from this location will automatically assigned an id based on the filename of the flow resource.

Parameters:
location - the definition location

addLocations

public boolean addLocations(org.springframework.core.io.Resource[] locations)
Adds the flow locations pointing to externalized flow resources.

The flow registered from this location will automatically assigned an id based on the filename of the flow resource.

Parameters:
locations - the definition locations

addResource

public boolean addResource(FlowDefinitionResource resource)
Adds an externalized flow definition specification pointing to an externalized flow resource.

Use this method when you want full control over the assigned flow id and the set of properties applied to the externalized flow resource.

Parameters:
resource - the definition the definition resource

addResources

public boolean addResources(FlowDefinitionResource[] resources)
Adds the externalized flow definitions pointing to externalized flow resources.

Use this method when you want full control over the assigned flow id and the set of properties applied to the externalized flow resources.

Parameters:
resources - the definitions

registerFlowDefinitions

public void registerFlowDefinitions(FlowDefinitionRegistry registry)
Description copied from interface: FlowDefinitionRegistrar
Register flow definition resources managed by this registrar in the registry provided.

Specified by:
registerFlowDefinitions in interface FlowDefinitionRegistrar
Parameters:
registry - the registry to register flow definitions in

register

protected final void register(FlowDefinitionResource resource,
                              FlowDefinitionRegistry registry)
Helper method to register the flow built from an externalized resource in the registry.

Parameters:
resource - representation of the externalized flow definition resource
registry - the flow registry to register the flow in

isFlowDefinitionResource

protected boolean isFlowDefinitionResource(org.springframework.core.io.Resource resource)
Template method that calculates if the given file resource is actually a flow definition resource. Resources that aren't flow definitions will be ignored. Subclasses may override; this implementation simply returns true.

Parameters:
resource - the underlying resource
Returns:
true if yes, false otherwise

createFlowDefinitionResource

protected FlowDefinitionResource createFlowDefinitionResource(org.springframework.core.io.Resource location)
Factory method that creates a flow definition from an externalized resource location.

Parameters:
location - the location of the resource
Returns:
the externalized flow definition pointer

createFlowDefinitionHolder

protected abstract FlowDefinitionHolder createFlowDefinitionHolder(FlowDefinitionResource resource)
Template factory method subclasses must override to return the holder for the flow definition to be registered loaded from the specified resource.

Parameters:
resource - the externalized resource
Returns:
the flow definition holder

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2007. All Rights Reserved.