Package org.apache.turbine.modules
Class GenericLoader<T extends Assembler>
- java.lang.Object
-
- org.apache.turbine.modules.GenericLoader<T>
-
- Type Parameters:
T
- the specialized assembler type
- All Implemented Interfaces:
Loader<T>
- Direct Known Subclasses:
ActionLoader
,LayoutLoader
,NavigationLoader
,PageLoader
,ScheduledJobLoader
,ScreenLoader
public abstract class GenericLoader<T extends Assembler> extends Object implements Loader<T>
This is the base class for the loaders. It contains code that is used across all of the loaders. It also specifies the interface that is required to be called a Loader.
-
-
Field Summary
Fields Modifier and Type Field Description protected AssemblerBrokerService
ab
The Assembler Broker Service
-
Constructor Summary
Constructors Constructor Description GenericLoader(Class<T> assemblerClass, IntSupplier cacheSizeSupplier)
Basic constructor for creating a loader.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
exec(PipelineData pipelineData, String name)
Attempts to load and execute the external action that has been set.protected T
getAssembler(Class<T> type, String name)
Pulls out an instance of the object by name.T
getAssembler(String name)
Pulls out an instance of the object by name.static String
getBasePackage()
Gets the base package where Turbine should find its default modules.int
getCacheSize()
Get the size of a possibly configured cachestatic List<String>
getPackages()
Gets the package list where Turbine should find its modules.boolean
reload()
Returns whether or not this external action is reload itself.GenericLoader<T>
setReload(boolean reload)
Sets whether or not this external action is reload itself.
-
-
-
Field Detail
-
ab
protected AssemblerBrokerService ab
The Assembler Broker Service
-
-
Constructor Detail
-
GenericLoader
public GenericLoader(Class<T> assemblerClass, IntSupplier cacheSizeSupplier)
Basic constructor for creating a loader.- Parameters:
assemblerClass
- Class of loaded assemblercacheSizeSupplier
- Supplier of configured cache size for this assembler Class
-
-
Method Detail
-
exec
public abstract void exec(PipelineData pipelineData, String name) throws Exception
Attempts to load and execute the external action that has been set.- Parameters:
pipelineData
- the Turbine requestname
- the name of the assembler module- Throws:
Exception
- a generic exception.
-
reload
public boolean reload()
Returns whether or not this external action is reload itself. This is in cases where the Next button would be clicked, but since we are checking for that, we would go into an endless loop.- Returns:
- True if the action is reload.
-
setReload
public GenericLoader<T> setReload(boolean reload)
Sets whether or not this external action is reload itself. This is in cases where the Next button would be clicked, but since we are checking for that, we would go into an endless loop.- Parameters:
reload
- True if the action must be marked as reload.- Returns:
- Itself.
-
getBasePackage
public static String getBasePackage()
Gets the base package where Turbine should find its default modules.- Returns:
- A String with the base package name.
-
getPackages
public static List<String> getPackages()
Gets the package list where Turbine should find its modules.- Returns:
- A List with the package names (including the base package).
-
getAssembler
public T getAssembler(String name) throws Exception
Pulls out an instance of the object by name. Name is just the single name of the object.- Specified by:
getAssembler
in interfaceLoader<T extends Assembler>
- Parameters:
name
- Name of object instance.- Returns:
- An Action with the specified name, or null.
- Throws:
Exception
- a generic exception.
-
getAssembler
protected T getAssembler(Class<T> type, String name) throws Exception
Pulls out an instance of the object by name. Name is just the single name of the object.- Parameters:
type
- Type of the assembler.name
- Name of object instance.- Returns:
- A Screen with the specified name, or null.
- Throws:
Exception
- a generic exception.
-
getCacheSize
public int getCacheSize()
Description copied from interface:Loader
Get the size of a possibly configured cache- Specified by:
getCacheSize
in interfaceLoader<T extends Assembler>
- Returns:
- the size of the cache in bytes
- See Also:
Loader.getCacheSize()
-
-