com.fatwire.gst.foundation.controller.action.support
Class AbstractActionLocator

java.lang.Object
  extended by com.fatwire.gst.foundation.controller.action.support.AbstractActionLocator
All Implemented Interfaces:
ActionLocator
Direct Known Subclasses:
BaseActionLocator, ClassActionLocator, GroovyActionLocator, RenderPageActionLocator, SingleActionLocator

public abstract class AbstractActionLocator
extends Object
implements ActionLocator

ActionLocator with support for Injector and a fall back ActionLocator in case this ActionLocator is not designed or configured to create an action for that name.

Objects are created via a Factory, that can be obtained via the FactoryFactory.

Since:
Apr 27, 2011
Author:
Dolf Dijkstra

Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
AbstractActionLocator()
           
AbstractActionLocator(ActionLocator fallbackActionLocator, Injector injector)
           
AbstractActionLocator(Injector injector)
           
 
Method Summary
protected abstract  Action doFindAction(COM.FutureTense.Interfaces.ICS ics, String name)
          Template Method for finding the Action for the custom ActionLocator.
 Action getAction(COM.FutureTense.Interfaces.ICS ics, String name)
          This method selects the Action by calling the doFindAction(ICS, String) method.
 ActionLocator getFallbackActionLocator()
           
 Injector getInjector()
           
protected  void injectDependencies(COM.FutureTense.Interfaces.ICS ics, Action action)
           
 void setFallbackActionLocator(ActionLocator fallbackActionLocator)
           
 void setInjector(Injector injector)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

AbstractActionLocator

public AbstractActionLocator()

AbstractActionLocator

public AbstractActionLocator(Injector injector)

AbstractActionLocator

public AbstractActionLocator(ActionLocator fallbackActionLocator,
                             Injector injector)
Method Detail

getAction

public final Action getAction(COM.FutureTense.Interfaces.ICS ics,
                              String name)
This method selects the Action by calling the doFindAction(ICS, String) method. If that method returns an Action, that Action will be dependency injected with the getInjector(), otherwise the getFallbackActionLocator() is called.

It is the fall back ActionLocator that should inject its Action with services.

Contract is that either the doFindAction(ICS, String) method or the getFallbackActionLocator() returns an Action, so that this method never returns null.

Specified by:
getAction in interface ActionLocator
Parameters:
ics - Content Server context object
name - the name of the action
Returns:
the located Action, never null
See Also:
ActionLocator.getAction(COM.FutureTense.Interfaces.ICS, java.lang.String)

doFindAction

protected abstract Action doFindAction(COM.FutureTense.Interfaces.ICS ics,
                                       String name)
Template Method for finding the Action for the custom ActionLocator. In case the Action is created through this method, it is expected to be fully injected and ready to use.

Parameters:
ics - the Content Server context
name - the name of the action
Returns:
the Action if found, null is valid.

injectDependencies

protected final void injectDependencies(COM.FutureTense.Interfaces.ICS ics,
                                        Action action)
Parameters:
ics -
action -

getInjector

public Injector getInjector()

getFallbackActionLocator

public ActionLocator getFallbackActionLocator()
Returns:
the fallbackActionLocator

setFallbackActionLocator

public void setFallbackActionLocator(ActionLocator fallbackActionLocator)
Parameters:
fallbackActionLocator - the fallbackActionLocator to set

setInjector

public void setInjector(Injector injector)


Copyright © 2010-2013 Oracle Corporation. All Rights Reserved.