You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2008/11/15 22:48:48 UTC
svn commit: r717934 - in /turbine/core/trunk: src/java/org/apache/turbine/
src/java/org/apache/turbine/modules/
src/java/org/apache/turbine/modules/layouts/
src/java/org/apache/turbine/modules/navigations/
src/java/org/apache/turbine/modules/screens/ s...
Author: tv
Date: Sat Nov 15 13:48:47 2008
New Revision: 717934
URL: http://svn.apache.org/viewvc?rev=717934&view=rev
Log:
Removed the references to the different module types from TurbineConstants
and tried to reduce the number of inter-dependencies in the module, loader
and broker-classes. This should lead to a transparent module configuration
without any hard-wired module types.
Modified:
turbine/core/trunk/src/java/org/apache/turbine/TurbineConstants.java
turbine/core/trunk/src/java/org/apache/turbine/modules/Action.java
turbine/core/trunk/src/java/org/apache/turbine/modules/ActionLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/Assembler.java
turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/Layout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/LayoutLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/Loader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/Navigation.java
turbine/core/trunk/src/java/org/apache/turbine/modules/NavigationLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/Page.java
turbine/core/trunk/src/java/org/apache/turbine/modules/PageLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJob.java
turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJobLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/Screen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/ScreenLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/DirectResponseLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/JspLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/BaseJspNavigation.java
turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaLayoutFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaNavigationFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaPageFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScheduledJobFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScreenFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonLayoutFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonNavigationFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonPageFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonScreenFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
turbine/core/trunk/xdocs/changes.xml
Modified: turbine/core/trunk/src/java/org/apache/turbine/TurbineConstants.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/TurbineConstants.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/TurbineConstants.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/TurbineConstants.java Sat Nov 15 13:48:47 2008
@@ -74,42 +74,6 @@
/** Default value of the Turbine Module Caching */
boolean MODULE_CACHE_DEFAULT = true;
- /** Property for the size of the action cache if caching is on */
- String ACTION_CACHE_SIZE_KEY = "action.cache.size";
-
- /** The default size for the action cache */
- int ACTION_CACHE_SIZE_DEFAULT = 20;
-
- /** Property for the size of the layout cache if caching is on */
- String LAYOUT_CACHE_SIZE_KEY = "layout.cache.size";
-
- /** The default size for the layout cache */
- int LAYOUT_CACHE_SIZE_DEFAULT = 10;
-
- /** Property for the size of the navigation cache if caching is on */
- String NAVIGATION_CACHE_SIZE_KEY = "navigation.cache.size";
-
- /** The default size for the navigation cache */
- int NAVIGATION_CACHE_SIZE_DEFAULT = 10;
-
- /** Property for the size of the page cache if caching is on */
- String PAGE_CACHE_SIZE_KEY = "page.cache.size";
-
- /** The default size for the page cache */
- int PAGE_CACHE_SIZE_DEFAULT = 5;
-
- /** Property for the size of the screen cache if caching is on */
- String SCREEN_CACHE_SIZE_KEY = "screen.cache.size";
-
- /** The default size for the screen cache */
- int SCREEN_CACHE_SIZE_DEFAULT = 50;
-
- /** The key for the schedulder job cache size if module caching is on. */
- String SCHEDULED_JOB_CACHE_SIZE_KEY = "scheduledjob.cache.size";
-
- /** The default size of the schedulder job cache if module caching is on. */
- int SCHEDULED_JOB_CACHE_SIZE_DEFAULT = 10;
-
/** The packages where Turbine will look for modules. */
String MODULE_PACKAGES = "module.packages";
@@ -315,24 +279,6 @@
/** Context Key for the Stack Trace */
String STACK_TRACE_PLACEHOLDER = "stackTrace";
- /** Prefix for layout related classes and templates */
- String LAYOUT_PREFIX = "layouts";
-
- /** Prefix for screen related classes and templates */
- String SCREEN_PREFIX = "screens";
-
- /** Prefix for navigation related classes and templates */
- String NAVIGATION_PREFIX = "navigations";
-
- /** Prefix for action related classes and templates */
- String ACTION_PREFIX = "actions";
-
- /** Prefix for page related classes and templates */
- String PAGE_PREFIX = "pages";
-
- /** Prefix for scheduler job related classes */
- String SCHEDULEDJOB_PREFIX = "scheduledjobs";
-
/**
* The fully qualified class name of the default {@link
* org.apache.turbine.Pipeline} implementation to use in the
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/Action.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/Action.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/Action.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/Action.java Sat Nov 15 13:48:47 2008
@@ -31,6 +31,26 @@
*/
public abstract class Action extends Assembler
{
+ /** Prefix for action related classes and templates */
+ public static final String PREFIX = "actions";
+
+ /** Property for the size of the module cache if caching is on */
+ public static final String CACHE_SIZE_KEY = "action.cache.size";
+
+ /** The default size for the action cache */
+ public static final int CACHE_SIZE_DEFAULT = 20;
+
+ /** Represents Action Objects */
+ public static final String NAME = "action";
+
+ /**
+ * @see org.apache.turbine.modules.Assembler#getPrefix()
+ */
+ public String getPrefix()
+ {
+ return PREFIX;
+ }
+
/**
* A subclass must override this method to perform itself. The
* Action can also set the screen that is associated with RunData.
@@ -63,7 +83,7 @@
*/
public void doPerform(PipelineData pipelineData) throws Exception
{
- RunData data = (RunData)getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doPerform(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/ActionLoader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/ActionLoader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/ActionLoader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/ActionLoader.java Sat Nov 15 13:48:47 2008
@@ -28,7 +28,6 @@
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
import org.apache.turbine.services.assemblerbroker.TurbineAssemblerBroker;
-import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.RunData;
/**
@@ -42,14 +41,13 @@
*/
public class ActionLoader
extends GenericLoader
+ implements Loader
{
/** Logging */
private static Log log = LogFactory.getLog(ActionLoader.class);
/** The single instance of this class. */
- private static ActionLoader instance = new ActionLoader(
- Turbine.getConfiguration().getInt(TurbineConstants.ACTION_CACHE_SIZE_KEY,
- TurbineConstants.ACTION_CACHE_SIZE_DEFAULT));
+ private static ActionLoader instance = new ActionLoader(getConfiguredCacheSize());
/** The Assembler Broker Service */
private static AssemblerBrokerService ab = TurbineAssemblerBroker.getService();
@@ -113,6 +111,29 @@
getInstance(name).perform(pipelineData);
}
+ /**
+ * Pulls out an instance of the object by name. Name is just the
+ * single name of the object. This is equal to getInstance but
+ * returns an Assembler object and is needed to fulfil the Loader
+ * interface.
+ *
+ * @param name Name of object instance.
+ * @return An Action with the specified name, or null.
+ * @exception Exception a generic exception.
+ */
+ public Assembler getAssembler(String name)
+ throws Exception
+ {
+ return getInstance(name);
+ }
+
+ /**
+ * @see org.apache.turbine.modules.Loader#getCacheSize()
+ */
+ public int getCacheSize()
+ {
+ return ActionLoader.getConfiguredCacheSize();
+ }
/**
* Pulls out an instance of the object by name. Name is just the
@@ -140,8 +161,7 @@
try
{
// Attempt to load the screen
- action = (Action) ab.getAssembler(
- AssemblerBrokerService.ACTION_TYPE, name);
+ action = (Action) ab.getAssembler(Action.NAME, name);
}
catch (ClassCastException cce)
{
@@ -160,8 +180,12 @@
List packages = Turbine.getConfiguration()
.getList(TurbineConstants.MODULE_PACKAGES);
- ObjectUtils.addOnce(packages,
- GenericLoader.getBasePackage());
+ String basePackage = GenericLoader.getBasePackage();
+
+ if (!packages.contains(basePackage))
+ {
+ packages.add(basePackage);
+ }
throw new ClassNotFoundException(
"\n\n\tRequested Action not found: " + name +
@@ -186,4 +210,15 @@
{
return instance;
}
+
+ /**
+ * Helper method to get the configured cache size for this module
+ *
+ * @return the configure cache size
+ */
+ private static int getConfiguredCacheSize()
+ {
+ return Turbine.getConfiguration().getInt(Action.CACHE_SIZE_KEY,
+ Action.CACHE_SIZE_DEFAULT);
+ }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/Assembler.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/Assembler.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/Assembler.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/Assembler.java Sat Nov 15 13:48:47 2008
@@ -44,6 +44,11 @@
}
return (RunData)pipelineData;
}
-
-
+
+ /**
+ * Abstract method to provide the prefix for module related classes and templates
+ *
+ * @return the prefix
+ */
+ public abstract String getPrefix();
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java Sat Nov 15 13:48:47 2008
@@ -89,7 +89,7 @@
public void exec(PipelineData pipelineData, String name)
throws Exception
{
- RunData data = (RunData)getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
exec(data, name);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/Layout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/Layout.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/Layout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/Layout.java Sat Nov 15 13:48:47 2008
@@ -32,6 +32,26 @@
public abstract class Layout
extends Assembler
{
+ /** Prefix for layout related classes and templates */
+ public static final String PREFIX = "layouts";
+
+ /** Property for the size of the layout cache if caching is on */
+ public static final String CACHE_SIZE_KEY = "layout.cache.size";
+
+ /** The default size for the layout cache */
+ public static final int CACHE_SIZE_DEFAULT = 10;
+
+ /** Represents Layout Objects */
+ public static final String NAME = "layout";
+
+ /**
+ * @see org.apache.turbine.modules.Assembler#getPrefix()
+ */
+ public String getPrefix()
+ {
+ return PREFIX;
+ }
+
/**
* A subclass must override this method to build itself.
* Subclasses override this method to store the layout in RunData
@@ -69,7 +89,7 @@
*/
protected void doBuild(PipelineData pipelineData) throws Exception
{
- RunData data = (RunData)getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doBuild(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/LayoutLoader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/LayoutLoader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/LayoutLoader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/LayoutLoader.java Sat Nov 15 13:48:47 2008
@@ -48,10 +48,7 @@
private static Log log = LogFactory.getLog(LayoutLoader.class);
/** The single instance of this class. */
- private static LayoutLoader instance =
- new LayoutLoader(Turbine.getConfiguration()
- .getInt(TurbineConstants.LAYOUT_CACHE_SIZE_KEY,
- TurbineConstants.LAYOUT_CACHE_SIZE_DEFAULT));
+ private static LayoutLoader instance = new LayoutLoader(getConfiguredCacheSize());
/** The Assembler Broker Service */
private static AssemblerBrokerService ab = TurbineAssemblerBroker.getService();
@@ -116,8 +113,6 @@
getInstance(name).build(pipelineData);
}
-
-
/**
* Pulls out an instance of the object by name. Name is just the
* single name of the object. This is equal to getInstance but
@@ -135,6 +130,14 @@
}
/**
+ * @see org.apache.turbine.modules.Loader#getCacheSize()
+ */
+ public int getCacheSize()
+ {
+ return LayoutLoader.getConfiguredCacheSize();
+ }
+
+ /**
* Pulls out an instance of the Layout by name. Name is just the
* single name of the Layout.
*
@@ -162,8 +165,7 @@
if (ab != null)
{
// Attempt to load the layout
- layout = (Layout) ab.getAssembler(
- AssemblerBrokerService.LAYOUT_TYPE, name);
+ layout = (Layout) ab.getAssembler(Layout.NAME, name);
}
}
catch (ClassCastException cce)
@@ -209,4 +211,15 @@
{
return instance;
}
+
+ /**
+ * Helper method to get the configured cache size for this module
+ *
+ * @return the configure cache size
+ */
+ private static int getConfiguredCacheSize()
+ {
+ return Turbine.getConfiguration().getInt(Layout.CACHE_SIZE_KEY,
+ Layout.CACHE_SIZE_DEFAULT);
+ }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/Loader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/Loader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/Loader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/Loader.java Sat Nov 15 13:48:47 2008
@@ -37,4 +37,11 @@
*/
public Assembler getAssembler(String name)
throws Exception;
+
+ /**
+ * Get the size of a possibly configured cache
+ *
+ * @return the size of the cache in bytes
+ */
+ public int getCacheSize();
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/Navigation.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/Navigation.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/Navigation.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/Navigation.java Sat Nov 15 13:48:47 2008
@@ -36,6 +36,26 @@
public abstract class Navigation
extends Assembler
{
+ /** Prefix for navigation related classes and templates */
+ public static final String PREFIX = "navigations";
+
+ /** Property for the size of the navigation cache if caching is on */
+ public static final String CACHE_SIZE_KEY = "navigation.cache.size";
+
+ /** The default size for the navigation cache */
+ public static final int CACHE_SIZE_DEFAULT = 10;
+
+ /** Represents Navigation Objects */
+ public static final String NAME = "navigation";
+
+ /**
+ * @see org.apache.turbine.modules.Assembler#getPrefix()
+ */
+ public String getPrefix()
+ {
+ return PREFIX;
+ }
+
/**
* A subclass must override this method to build itself.
* Subclasses override this method to store the navigation in
@@ -75,7 +95,7 @@
protected ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData)getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return doBuild(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/NavigationLoader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/NavigationLoader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/NavigationLoader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/NavigationLoader.java Sat Nov 15 13:48:47 2008
@@ -49,10 +49,7 @@
private static Log log = LogFactory.getLog(NavigationLoader.class);
/** The single instance of this class. */
- private static NavigationLoader instance =
- new NavigationLoader(Turbine.getConfiguration()
- .getInt(TurbineConstants.NAVIGATION_CACHE_SIZE_KEY,
- TurbineConstants.NAVIGATION_CACHE_SIZE_DEFAULT));
+ private static NavigationLoader instance = new NavigationLoader(getConfiguredCacheSize());
/** The Assembler Broker Service */
private static AssemblerBrokerService ab = TurbineAssemblerBroker.getService();
@@ -171,6 +168,14 @@
}
/**
+ * @see org.apache.turbine.modules.Loader#getCacheSize()
+ */
+ public int getCacheSize()
+ {
+ return NavigationLoader.getConfiguredCacheSize();
+ }
+
+ /**
* Pulls out an instance of the Navigation by name. Name is just the
* single name of the Navigation.
*
@@ -198,8 +203,7 @@
if (ab != null)
{
// Attempt to load the navigation
- navigation = (Navigation) ab.getAssembler(
- AssemblerBrokerService.NAVIGATION_TYPE, name);
+ navigation = (Navigation) ab.getAssembler(Navigation.NAME, name);
}
}
catch (ClassCastException cce)
@@ -245,4 +249,15 @@
{
return instance;
}
+
+ /**
+ * Helper method to get the configured cache size for this module
+ *
+ * @return the configure cache size
+ */
+ private static int getConfiguredCacheSize()
+ {
+ return Turbine.getConfiguration().getInt(Navigation.CACHE_SIZE_KEY,
+ Navigation.CACHE_SIZE_DEFAULT);
+ }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/Page.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/Page.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/Page.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/Page.java Sat Nov 15 13:48:47 2008
@@ -33,6 +33,26 @@
public abstract class Page
extends Assembler
{
+ /** Prefix for page related classes and templates */
+ public static final String PREFIX = "pages";
+
+ /** Property for the size of the page cache if caching is on */
+ public static final String CACHE_SIZE_KEY = "page.cache.size";
+
+ /** The default size for the page cache */
+ public static final int CACHE_SIZE_DEFAULT = 5;
+
+ /** Represents Page Objects */
+ public static final String NAME = "page";
+
+ /**
+ * @see org.apache.turbine.modules.Assembler#getPrefix()
+ */
+ public String getPrefix()
+ {
+ return PREFIX;
+ }
+
/**
* A subclass must override this method to build itself.
* Subclasses override this method to store the page in RunData or
@@ -56,7 +76,7 @@
protected void doBuild(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData)getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doBuild(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/PageLoader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/PageLoader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/PageLoader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/PageLoader.java Sat Nov 15 13:48:47 2008
@@ -48,10 +48,7 @@
private static Log log = LogFactory.getLog(PageLoader.class);
/** The single instance of this class. */
- private static PageLoader instance =
- new PageLoader(Turbine.getConfiguration()
- .getInt(TurbineConstants.PAGE_CACHE_SIZE_KEY,
- TurbineConstants.PAGE_CACHE_SIZE_DEFAULT));
+ private static PageLoader instance = new PageLoader(getConfiguredCacheSize());
/** The Assembler Broker Service */
private static AssemblerBrokerService ab = TurbineAssemblerBroker.getService();
@@ -135,6 +132,14 @@
}
/**
+ * @see org.apache.turbine.modules.Loader#getCacheSize()
+ */
+ public int getCacheSize()
+ {
+ return PageLoader.getConfiguredCacheSize();
+ }
+
+ /**
* Pulls out an instance of the page by name. Name is just the
* single name of the page.
*
@@ -162,8 +167,7 @@
if (ab != null)
{
// Attempt to load the screen
- page = (Page) ab.getAssembler(
- AssemblerBrokerService.PAGE_TYPE, name);
+ page = (Page) ab.getAssembler(Page.NAME, name);
}
}
catch (ClassCastException cce)
@@ -209,4 +213,15 @@
{
return instance;
}
+
+ /**
+ * Helper method to get the configured cache size for this module
+ *
+ * @return the configure cache size
+ */
+ private static int getConfiguredCacheSize()
+ {
+ return Turbine.getConfiguration().getInt(Page.CACHE_SIZE_KEY,
+ Page.CACHE_SIZE_DEFAULT);
+ }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJob.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJob.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJob.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJob.java Sat Nov 15 13:48:47 2008
@@ -36,6 +36,26 @@
*/
public abstract class ScheduledJob extends Assembler
{
+ /** Prefix for scheduler job related classes */
+ public static final String PREFIX = "scheduledjobs";
+
+ /** The key for the schedulder job cache size if module caching is on. */
+ public static final String CACHE_SIZE_KEY = "scheduledjob.cache.size";
+
+ /** The default size of the schedulder job cache if module caching is on. */
+ public static final int CACHE_SIZE_DEFAULT = 10;
+
+ /** Represents Scheduled Job Objects */
+ public static final String NAME = "scheduledjob";
+
+ /**
+ * @see org.apache.turbine.modules.Assembler#getPrefix()
+ */
+ public String getPrefix()
+ {
+ return PREFIX;
+ }
+
/**
* Run the Jobentry from the scheduler queue.
*
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJobLoader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJobLoader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJobLoader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/ScheduledJobLoader.java Sat Nov 15 13:48:47 2008
@@ -42,15 +42,14 @@
*/
public class ScheduledJobLoader
extends GenericLoader
+ implements Loader
{
/** Logging */
private static Log log = LogFactory.getLog(ScheduledJobLoader.class);
/** The single instance of this class. */
private static ScheduledJobLoader instance =
- new ScheduledJobLoader(Turbine.getConfiguration()
- .getInt(TurbineConstants.SCHEDULED_JOB_CACHE_SIZE_KEY,
- TurbineConstants.SCHEDULED_JOB_CACHE_SIZE_DEFAULT));
+ new ScheduledJobLoader(getConfiguredCacheSize());
/** The Assembler Broker Service */
private static AssemblerBrokerService ab = TurbineAssemblerBroker.getService();
@@ -123,6 +122,30 @@
/**
* Pulls out an instance of the object by name. Name is just the
+ * single name of the object. This is equal to getInstance but
+ * returns an Assembler object and is needed to fulfil the Loader
+ * interface.
+ *
+ * @param name Name of object instance.
+ * @return A ScheduledJob with the specified name, or null.
+ * @exception Exception a generic exception.
+ */
+ public Assembler getAssembler(String name)
+ throws Exception
+ {
+ return getInstance(name);
+ }
+
+ /**
+ * @see org.apache.turbine.modules.Loader#getCacheSize()
+ */
+ public int getCacheSize()
+ {
+ return ScheduledJobLoader.getConfiguredCacheSize();
+ }
+
+ /**
+ * Pulls out an instance of the object by name. Name is just the
* single name of the object.
*
* @param name Name of object instance.
@@ -149,8 +172,7 @@
if (ab != null)
{
// Attempt to load the job
- job = (ScheduledJob) ab.getAssembler(
- AssemblerBrokerService.SCHEDULEDJOB_TYPE, name);
+ job = (ScheduledJob) ab.getAssembler(ScheduledJob.NAME, name);
}
}
catch (ClassCastException cce)
@@ -195,4 +217,15 @@
{
return instance;
}
+
+ /**
+ * Helper method to get the configured cache size for this module
+ *
+ * @return the configure cache size
+ */
+ private static int getConfiguredCacheSize()
+ {
+ return Turbine.getConfiguration().getInt(ScheduledJob.CACHE_SIZE_KEY,
+ ScheduledJob.CACHE_SIZE_DEFAULT);
+ }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/Screen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/Screen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/Screen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/Screen.java Sat Nov 15 13:48:47 2008
@@ -38,6 +38,26 @@
public abstract class Screen
extends Assembler
{
+ /** Prefix for screen related classes and templates */
+ public static final String PREFIX = "screens";
+
+ /** Property for the size of the screen cache if caching is on */
+ public static final String CACHE_SIZE_KEY = "screen.cache.size";
+
+ /** The default size for the screen cache */
+ public static final int CACHE_SIZE_DEFAULT = 50;
+
+ /** Represents Screen Objects */
+ public static final String NAME = "screen";
+
+ /**
+ * @see org.apache.turbine.modules.Assembler#getPrefix()
+ */
+ public String getPrefix()
+ {
+ return PREFIX;
+ }
+
/**
* A subclass must override this method to build itself.
* Subclasses override this method to store the screen in RunData
@@ -50,7 +70,7 @@
protected ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return doBuild(data);
}
@@ -84,7 +104,7 @@
*/
public String getLayout(PipelineData pipelineData)
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return data.getLayout();
}
@@ -96,14 +116,10 @@
*/
public void setLayout(PipelineData pipelineData, String layout)
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
data.setLayout(layout);
}
-
-
-
-
/**
* A subclass must override this method to build itself.
* Subclasses override this method to store the screen in RunData
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/ScreenLoader.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/ScreenLoader.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/ScreenLoader.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/ScreenLoader.java Sat Nov 15 13:48:47 2008
@@ -51,10 +51,7 @@
private static Log log = LogFactory.getLog(ScreenLoader.class);
/** The single instance of this class. */
- private static ScreenLoader instance =
- new ScreenLoader(Turbine.getConfiguration()
- .getInt(TurbineConstants.SCREEN_CACHE_SIZE_KEY,
- TurbineConstants.SCREEN_CACHE_SIZE_DEFAULT));
+ private static ScreenLoader instance = new ScreenLoader(getConfiguredCacheSize());
/** The Assembler Broker Service */
private static AssemblerBrokerService ab = TurbineAssemblerBroker.getService();
@@ -173,6 +170,14 @@
}
/**
+ * @see org.apache.turbine.modules.Loader#getCacheSize()
+ */
+ public int getCacheSize()
+ {
+ return ScreenLoader.getConfiguredCacheSize();
+ }
+
+ /**
* Pulls out an instance of the Screen by name. Name is just the
* single name of the Screen.
*
@@ -200,8 +205,7 @@
if (ab != null)
{
// Attempt to load the screen
- screen = (Screen) ab.getAssembler(
- AssemblerBrokerService.SCREEN_TYPE, name);
+ screen = (Screen) ab.getAssembler(Screen.NAME, name);
}
}
catch (ClassCastException cce)
@@ -247,4 +251,15 @@
{
return instance;
}
+
+ /**
+ * Helper method to get the configured cache size for this module
+ *
+ * @return the configure cache size
+ */
+ private static int getConfiguredCacheSize()
+ {
+ return Turbine.getConfiguration().getInt(Screen.CACHE_SIZE_KEY,
+ Screen.CACHE_SIZE_DEFAULT);
+ }
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/DirectResponseLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/DirectResponseLayout.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/DirectResponseLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/DirectResponseLayout.java Sat Nov 15 13:48:47 2008
@@ -62,7 +62,7 @@
public void doBuild(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doBuild(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/JspLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/JspLayout.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/JspLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/JspLayout.java Sat Nov 15 13:48:47 2008
@@ -42,7 +42,7 @@
extends Layout
{
/** The prefix for lookup up layout pages */
- private String prefix = TurbineConstants.LAYOUT_PREFIX + "/";
+ private String prefix = Layout.PREFIX + "/";
/**
* Method called by LayoutLoader.
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java Sat Nov 15 13:48:47 2008
@@ -55,7 +55,7 @@
private static Log log = LogFactory.getLog(VelocityDirectLayout.class);
/** The prefix for lookup up layout pages */
- private String prefix = TurbineConstants.LAYOUT_PREFIX + "/";
+ private String prefix = Layout.PREFIX + "/";
/**
* Method called by LayoutLoader.
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java Sat Nov 15 13:48:47 2008
@@ -75,7 +75,7 @@
private static Log log = LogFactory.getLog(VelocityOnlyLayout.class);
/** The prefix for lookup up layout pages */
- private String prefix = TurbineConstants.LAYOUT_PREFIX + "/";
+ private String prefix = Layout.PREFIX + "/";
/**
* Build the layout. Also sets the ContentType and Locale headers
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java Sat Nov 15 13:48:47 2008
@@ -64,7 +64,7 @@
private static Log log = LogFactory.getLog(VelocityXslLayout.class);
/** The prefix for lookup up layout pages */
- private String prefix = TurbineConstants.LAYOUT_PREFIX + "/";
+ private String prefix = Layout.PREFIX + "/";
/**
* Build the layout. Also sets the ContentType and Locale headers
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/BaseJspNavigation.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/BaseJspNavigation.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/BaseJspNavigation.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/BaseJspNavigation.java Sat Nov 15 13:48:47 2008
@@ -23,8 +23,8 @@
import org.apache.ecs.ConcreteElement;
-import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.modules.Navigation;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.jsp.TurbineJsp;
@@ -43,7 +43,7 @@
extends TemplateNavigation
{
/** The prefix for lookup up navigation pages */
- private String prefix = TurbineConstants.NAVIGATION_PREFIX + "/";
+ private String prefix = Navigation.PREFIX + "/";
/**
* Method to be overidden by subclasses to include data in beans, etc.
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/navigations/VelocityNavigation.java Sat Nov 15 13:48:47 2008
@@ -24,7 +24,7 @@
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.StringElement;
-import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.modules.Navigation;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.template.TurbineTemplate;
import org.apache.turbine.services.velocity.TurbineVelocity;
@@ -49,7 +49,7 @@
extends TemplateNavigation
{
/** The prefix for lookup up navigation pages */
- private String prefix = TurbineConstants.NAVIGATION_PREFIX + "/";
+ private String prefix = Navigation.PREFIX + "/";
/**
* Velocity Navigations extending this class should overide this
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java Sat Nov 15 13:48:47 2008
@@ -22,10 +22,7 @@
import org.apache.commons.lang.StringUtils;
-
import org.apache.ecs.ConcreteElement;
-
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.jsp.TurbineJsp;
import org.apache.turbine.services.template.TurbineTemplate;
@@ -45,7 +42,7 @@
extends TemplateScreen
{
/** The prefix for lookup up screen pages */
- private String prefix = TurbineConstants.SCREEN_PREFIX + "/";
+ private String prefix = getPrefix() + "/";
/**
* Method that sets up beans and forward the request to the JSP.
@@ -87,7 +84,7 @@
public ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
String screenTemplate = data.getTemplateInfo().getScreenTemplate();
// get the name of the JSP we want to use
String templateName
@@ -117,6 +114,7 @@
protected void doBuildTemplate(RunData data)
throws Exception
{
+ // abstract method
}
/**
@@ -128,6 +126,7 @@
protected void doBuildTemplate(PipelineData pipelineData)
throws Exception
{
+ // abstract method
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java Sat Nov 15 13:48:47 2008
@@ -131,7 +131,7 @@
*/
public ConcreteElement doBuild(PipelineData pipelineData) throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return doBuild(data);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/JspErrorScreen.java Sat Nov 15 13:48:47 2008
@@ -60,7 +60,7 @@
protected void doBuildTemplate(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doBuildTemplate(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/RawScreen.java Sat Nov 15 13:48:47 2008
@@ -75,7 +75,7 @@
protected final ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return doBuild(data);
}
@@ -99,7 +99,7 @@
*/
protected String getContentType(PipelineData pipelineData)
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return getContentType(data);
}
@@ -127,7 +127,7 @@
protected void doOutput(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doOutput(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/TemplateScreen.java Sat Nov 15 13:48:47 2008
@@ -78,7 +78,7 @@
protected void doBuildTemplate(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doBuildTemplate(data);
}
@@ -108,7 +108,7 @@
public ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return buildTemplate(data);
}
@@ -289,14 +289,13 @@
public void doRedirect(PipelineData pipelineData, String screen, String template)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
log.debug("doRedirect(data, " + screen + ", " + template + ")");
setTemplate(data, template);
ScreenLoader.getInstance().exec(pipelineData, screen);
}
-
/**
* You can call this within a Screen to cause an internal redirect
* to happen. It essentially allows you to stop execution in one
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java Sat Nov 15 13:48:47 2008
@@ -23,16 +23,13 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
-
import org.apache.ecs.ConcreteElement;
-
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.template.TurbineTemplate;
import org.apache.turbine.services.velocity.TurbineVelocity;
import org.apache.turbine.util.RunData;
-
import org.apache.velocity.context.Context;
/**
@@ -50,7 +47,7 @@
extends VelocityScreen
{
/** The prefix for lookup up screen pages */
- private String prefix = TurbineConstants.SCREEN_PREFIX + "/";
+ private String prefix = getPrefix() + "/";
/**
* This builds the Velocity template.
@@ -113,7 +110,7 @@
public ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
Context context = TurbineVelocity.getContext(pipelineData);
String screenTemplate = data.getTemplateInfo().getScreenTemplate();
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java Sat Nov 15 13:48:47 2008
@@ -74,7 +74,7 @@
protected void doBuildTemplate(PipelineData pipelineData, Context context)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doBuildTemplate(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocityScreen.java Sat Nov 15 13:48:47 2008
@@ -22,22 +22,15 @@
import org.apache.commons.lang.StringUtils;
-
import org.apache.commons.lang.exception.ExceptionUtils;
-
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.StringElement;
-
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
-
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.template.TurbineTemplate;
-
import org.apache.turbine.services.velocity.TurbineVelocity;
-
import org.apache.turbine.util.RunData;
-
import org.apache.velocity.context.Context;
/**
@@ -59,7 +52,7 @@
extends TemplateScreen
{
/** The prefix for lookup up screen pages */
- private String prefix = TurbineConstants.SCREEN_PREFIX + "/";
+ private String prefix = getPrefix() + "/";
/**
* Velocity Screens extending this class should overide this
@@ -203,7 +196,7 @@
public ConcreteElement buildTemplate(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
String screenData = null;
Context context = TurbineVelocity.getContext(pipelineData);
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/VelocitySecureScreen.java Sat Nov 15 13:48:47 2008
@@ -68,7 +68,7 @@
Context context)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
doBuildTemplate(data);
}
@@ -135,7 +135,7 @@
protected boolean isAuthorized(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return isAuthorized(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/error/InvalidState.java Sat Nov 15 13:48:47 2008
@@ -90,13 +90,13 @@
/**
* Build the Screen.
*
- * @param data Turbine information.
+ * @param pipelineData Turbine information.
* @exception Exception, a generic exception.
*/
public ConcreteElement doBuild(PipelineData pipelineData)
throws Exception
{
- RunData data = (RunData) getRunData(pipelineData);
+ RunData data = getRunData(pipelineData);
return doBuild(data);
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java Sat Nov 15 13:48:47 2008
@@ -40,24 +40,6 @@
/** Name of the Service */
String SERVICE_NAME = "AssemblerBrokerService";
- /** Predefined types for Turbine built-in assemblers: Actions */
- String ACTION_TYPE = "action";
-
- /** Predefined types for Turbine built-in assemblers: Screens */
- String SCREEN_TYPE = "screen";
-
- /** Predefined types for Turbine built-in assemblers: Navigations */
- String NAVIGATION_TYPE = "navigation";
-
- /** Predefined types for Turbine built-in assemblers: Layouts */
- String LAYOUT_TYPE = "layout";
-
- /** Predefined types for Turbine built-in assemblers: Pages */
- String PAGE_TYPE = "page";
-
- /** Predefined types for Turbine built-in assemblers: Scheduler Jobs */
- String SCHEDULEDJOB_TYPE = "scheduledjob";
-
/**
* Register an AssemblerFactory class for a given type
*
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java Sat Nov 15 13:48:47 2008
@@ -27,9 +27,9 @@
import java.util.Map;
import java.util.Vector;
+import org.apache.commons.configuration.Configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.turbine.modules.Assembler;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineBaseService;
@@ -124,12 +124,17 @@
factories = new HashMap();
try
{
- registerFactories(AssemblerBrokerService.ACTION_TYPE);
- registerFactories(AssemblerBrokerService.SCREEN_TYPE);
- registerFactories(AssemblerBrokerService.NAVIGATION_TYPE);
- registerFactories(AssemblerBrokerService.LAYOUT_TYPE);
- registerFactories(AssemblerBrokerService.PAGE_TYPE);
- registerFactories(AssemblerBrokerService.SCHEDULEDJOB_TYPE);
+ Configuration conf = getConfiguration();
+
+ for (Iterator i = conf.getKeys(); i.hasNext();)
+ {
+ String type = (String)i.next();
+
+ if (!"classname".equalsIgnoreCase(type))
+ {
+ registerFactories(type);
+ }
+ }
}
catch (TurbineException e)
{
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java Sat Nov 15 13:48:47 2008
@@ -21,7 +21,7 @@
*/
-import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.modules.Action;
import org.apache.turbine.modules.Assembler;
/**
@@ -43,6 +43,6 @@
*/
public Assembler getAssembler(String name)
{
- return getAssembler(TurbineConstants.ACTION_PREFIX, name);
+ return getAssembler(Action.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaLayoutFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaLayoutFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaLayoutFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaLayoutFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Layout;
/**
* A screen factory that attempts to load a java class from
@@ -43,6 +43,6 @@
*/
public Assembler getAssembler(String name)
{
- return getAssembler(TurbineConstants.LAYOUT_PREFIX, name);
+ return getAssembler(Layout.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaNavigationFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaNavigationFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaNavigationFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaNavigationFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Navigation;
/**
* A screen factory that attempts to load a java class from
@@ -43,6 +43,6 @@
*/
public Assembler getAssembler(String name)
{
- return getAssembler(TurbineConstants.NAVIGATION_PREFIX, name);
+ return getAssembler(Navigation.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaPageFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaPageFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaPageFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaPageFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Page;
/**
* A screen factory that attempts to load a java class from
@@ -43,6 +43,6 @@
*/
public Assembler getAssembler(String name)
{
- return getAssembler(TurbineConstants.PAGE_PREFIX, name);
+ return getAssembler(Page.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScheduledJobFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScheduledJobFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScheduledJobFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScheduledJobFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.ScheduledJob;
/**
* A screen factory that attempts to load a java class from
@@ -43,6 +43,6 @@
*/
public Assembler getAssembler(String name)
{
- return getAssembler(TurbineConstants.SCHEDULEDJOB_PREFIX, name);
+ return getAssembler(ScheduledJob.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScreenFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScreenFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScreenFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScreenFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Screen;
/**
* A screen factory that attempts to load a java class from
@@ -43,6 +43,6 @@
*/
public Assembler getAssembler(String name)
{
- return getAssembler(TurbineConstants.SCREEN_PREFIX, name);
+ return getAssembler(Screen.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java Sat Nov 15 13:48:47 2008
@@ -21,7 +21,7 @@
*/
-import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.modules.Action;
import org.apache.turbine.modules.Assembler;
/**
@@ -47,6 +47,6 @@
public Assembler getAssembler(String name)
throws Exception
{
- return getAssembler(TurbineConstants.ACTION_PREFIX, name);
+ return getAssembler(Action.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonLayoutFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonLayoutFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonLayoutFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonLayoutFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Layout;
/**
* A screen factory that attempts to load a python class in the
@@ -47,6 +47,6 @@
public Assembler getAssembler(String name)
throws Exception
{
- return getAssembler(TurbineConstants.LAYOUT_PREFIX, name);
+ return getAssembler(Layout.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonNavigationFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonNavigationFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonNavigationFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonNavigationFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Navigation;
/**
* A screen factory that attempts to load a python class in the
@@ -47,6 +47,6 @@
public Assembler getAssembler(String name)
throws Exception
{
- return getAssembler(TurbineConstants.NAVIGATION_PREFIX, name);
+ return getAssembler(Navigation.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonPageFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonPageFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonPageFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonPageFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Page;
/**
* A screen factory that attempts to load a python class in the
@@ -47,6 +47,6 @@
public Assembler getAssembler(String name)
throws Exception
{
- return getAssembler(TurbineConstants.PAGE_PREFIX, name);
+ return getAssembler(Page.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonScreenFactory.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonScreenFactory.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonScreenFactory.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonScreenFactory.java Sat Nov 15 13:48:47 2008
@@ -21,8 +21,8 @@
*/
-import org.apache.turbine.TurbineConstants;
import org.apache.turbine.modules.Assembler;
+import org.apache.turbine.modules.Screen;
/**
* A screen factory that attempts to load a python class in the
@@ -47,6 +47,6 @@
public Assembler getAssembler(String name)
throws Exception
{
- return getAssembler(TurbineConstants.SCREEN_PREFIX, name);
+ return getAssembler(Screen.PREFIX, name);
}
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java Sat Nov 15 13:48:47 2008
@@ -22,33 +22,30 @@
import java.io.File;
-
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.avalon.framework.service.ServiceException;
import org.apache.commons.configuration.Configuration;
-
import org.apache.commons.lang.StringUtils;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fulcrum.factory.FactoryException;
import org.apache.fulcrum.factory.FactoryService;
-import org.apache.fulcrum.pool.PoolService;
-
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.modules.Layout;
import org.apache.turbine.modules.LayoutLoader;
import org.apache.turbine.modules.Loader;
+import org.apache.turbine.modules.Navigation;
import org.apache.turbine.modules.NavigationLoader;
+import org.apache.turbine.modules.Page;
import org.apache.turbine.modules.PageLoader;
+import org.apache.turbine.modules.Screen;
import org.apache.turbine.modules.ScreenLoader;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.TurbineServices;
-import org.apache.turbine.services.avaloncomponent.AvalonComponentService;
import org.apache.turbine.services.servlet.TurbineServlet;
import org.apache.turbine.services.template.mapper.BaseTemplateMapper;
import org.apache.turbine.services.template.mapper.ClassMapper;
@@ -58,7 +55,6 @@
import org.apache.turbine.services.template.mapper.Mapper;
import org.apache.turbine.services.template.mapper.ScreenTemplateMapper;
import org.apache.turbine.util.RunData;
-import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.uri.URIConstants;
/**
@@ -191,27 +187,15 @@
/** Represents Page Objects */
public static final int PAGE_KEY = 0;
- /** Represents Page Objects */
- public static final String PAGE_NAME = "page";
-
/** Represents Screen Objects */
public static final int SCREEN_KEY = 1;
- /** Represents Screen Objects */
- public static final String SCREEN_NAME = "screen";
-
/** Represents Layout Objects */
public static final int LAYOUT_KEY = 2;
- /** Represents Layout Objects */
- public static final String LAYOUT_NAME = "layout";
-
/** Represents Navigation Objects */
public static final int NAVIGATION_KEY = 3;
- /** Represents Navigation Objects */
- public static final String NAVIGATION_NAME = "navigation";
-
/** Represents Layout Template Objects */
public static final int LAYOUT_TEMPLATE_KEY = 4;
@@ -269,6 +253,7 @@
*/
public TurbineTemplateService()
{
+ // empty
}
/**
@@ -430,7 +415,7 @@
*/
public String getDefaultPageName(String template)
{
- return ((Mapper) mapperRegistry[PAGE_KEY]).getDefaultName(template);
+ return (mapperRegistry[PAGE_KEY]).getDefaultName(template);
}
/**
@@ -443,7 +428,7 @@
*/
public String getDefaultScreenName(String template)
{
- return ((Mapper) mapperRegistry[SCREEN_KEY]).getDefaultName(template);
+ return (mapperRegistry[SCREEN_KEY]).getDefaultName(template);
}
/**
@@ -456,7 +441,7 @@
*/
public String getDefaultLayoutName(String template)
{
- return ((Mapper) mapperRegistry[LAYOUT_KEY]).getDefaultName(template);
+ return (mapperRegistry[LAYOUT_KEY]).getDefaultName(template);
}
/**
@@ -469,7 +454,7 @@
*/
public String getDefaultNavigationName(String template)
{
- return ((Mapper) mapperRegistry[NAVIGATION_KEY]).getDefaultName(template);
+ return (mapperRegistry[NAVIGATION_KEY]).getDefaultName(template);
}
/**
@@ -482,7 +467,7 @@
*/
public String getDefaultLayoutTemplateName(String template)
{
- return ((Mapper) mapperRegistry[LAYOUT_TEMPLATE_KEY]).getDefaultName(template);
+ return (mapperRegistry[LAYOUT_TEMPLATE_KEY]).getDefaultName(template);
}
/**
@@ -524,7 +509,7 @@
public String getScreenName(String template)
throws Exception
{
- return ((Mapper) mapperRegistry[SCREEN_KEY]).getMappedName(template);
+ return (mapperRegistry[SCREEN_KEY]).getMappedName(template);
}
/**
@@ -538,7 +523,7 @@
public String getLayoutName(String template)
throws Exception
{
- return ((Mapper) mapperRegistry[LAYOUT_KEY]).getMappedName(template);
+ return (mapperRegistry[LAYOUT_KEY]).getMappedName(template);
}
/**
@@ -552,7 +537,7 @@
public String getNavigationName(String template)
throws Exception
{
- return ((Mapper) mapperRegistry[NAVIGATION_KEY]).getMappedName(template);
+ return (mapperRegistry[NAVIGATION_KEY]).getMappedName(template);
}
/**
@@ -567,7 +552,7 @@
public String getScreenTemplateName(String template)
throws Exception
{
- return ((Mapper) mapperRegistry[SCREEN_TEMPLATE_KEY]).getMappedName(template);
+ return (mapperRegistry[SCREEN_TEMPLATE_KEY]).getMappedName(template);
}
/**
@@ -581,7 +566,7 @@
public String getLayoutTemplateName(String template)
throws Exception
{
- return ((Mapper) mapperRegistry[LAYOUT_TEMPLATE_KEY]).getMappedName(template);
+ return (mapperRegistry[LAYOUT_TEMPLATE_KEY]).getMappedName(template);
}
/**
@@ -596,7 +581,7 @@
public String getNavigationTemplateName(String template)
throws Exception
{
- return ((Mapper) mapperRegistry[NAVIGATION_TEMPLATE_KEY]).getMappedName(template);
+ return (mapperRegistry[NAVIGATION_TEMPLATE_KEY]).getMappedName(template);
}
/**
@@ -700,8 +685,8 @@
mapperRegistry = new Mapper [TEMPLATE_TYPES];
String [] mapperNames = new String [] {
- PAGE_NAME,SCREEN_NAME, LAYOUT_NAME,
- NAVIGATION_NAME, LAYOUT_TEMPLATE_NAME, SCREEN_TEMPLATE_NAME, NAVIGATION_TEMPLATE_NAME
+ Page.NAME,Screen.NAME, Layout.NAME,
+ Navigation.NAME, LAYOUT_TEMPLATE_NAME, SCREEN_TEMPLATE_NAME, NAVIGATION_TEMPLATE_NAME
};
String [] mapperClasses = new String [] {
@@ -715,25 +700,13 @@
};
int [] mapperCacheSize = new int [] {
- 0,
- conf.getInt(
- TurbineConstants.SCREEN_CACHE_SIZE_KEY,
- TurbineConstants.SCREEN_CACHE_SIZE_DEFAULT),
- conf.getInt(
- TurbineConstants.LAYOUT_CACHE_SIZE_KEY,
- TurbineConstants.LAYOUT_CACHE_SIZE_DEFAULT),
- conf.getInt(
- TurbineConstants.NAVIGATION_CACHE_SIZE_KEY,
- TurbineConstants.NAVIGATION_CACHE_SIZE_DEFAULT),
- conf.getInt(
- TurbineConstants.LAYOUT_CACHE_SIZE_KEY,
- TurbineConstants.LAYOUT_CACHE_SIZE_DEFAULT),
- conf.getInt(
- TurbineConstants.SCREEN_CACHE_SIZE_KEY,
- TurbineConstants.SCREEN_CACHE_SIZE_DEFAULT),
- conf.getInt(
- TurbineConstants.NAVIGATION_CACHE_SIZE_KEY,
- TurbineConstants.NAVIGATION_CACHE_SIZE_DEFAULT)
+ PageLoader.getInstance().getCacheSize(),
+ ScreenLoader.getInstance().getCacheSize(),
+ LayoutLoader.getInstance().getCacheSize(),
+ NavigationLoader.getInstance().getCacheSize(),
+ LayoutLoader.getInstance().getCacheSize(),
+ ScreenLoader.getInstance().getCacheSize(),
+ NavigationLoader.getInstance().getCacheSize()
};
String [] mapperDefaultProperty = new String [] {
@@ -757,9 +730,9 @@
String [] mapperPrefix = new String [] {
null, null, null, null,
- TurbineConstants.LAYOUT_PREFIX,
- TurbineConstants.SCREEN_PREFIX,
- TurbineConstants.NAVIGATION_PREFIX };
+ Layout.PREFIX,
+ Screen.PREFIX,
+ Navigation.PREFIX };
for (int i = 0; i < TEMPLATE_TYPES; i++)
{
@@ -777,16 +750,13 @@
try
{
- AvalonComponentService acs = (AvalonComponentService) TurbineServices.getInstance().getService(AvalonComponentService.SERVICE_NAME);
- FactoryService factory = (FactoryService)acs.lookup(FactoryService.ROLE);
- tm = (Mapper) factory.getInstance(mapperClass);
+ FactoryService factory = (FactoryService)TurbineServices.getInstance().getService(FactoryService.ROLE);
+ tm = (Mapper) factory.getInstance(mapperClass);
}
- catch (FactoryException e) {
- throw new InitializationException("", e);
+ catch (FactoryException e)
+ {
+ throw new InitializationException("", e);
}
- catch (ServiceException se) {
- throw new InitializationException("Problem looking up Factory service",se);
- }
tm.setUseCache(useCache);
tm.setCacheSize(mapperCacheSize[i]);
Modified: turbine/core/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/turbine/core/trunk/xdocs/changes.xml?rev=717934&r1=717933&r2=717934&view=diff
==============================================================================
--- turbine/core/trunk/xdocs/changes.xml (original)
+++ turbine/core/trunk/xdocs/changes.xml Sat Nov 15 13:48:47 2008
@@ -26,6 +26,12 @@
<body>
<release version="2.4-M2" date="in Subversion">
<action type="update" dev="tv">
+ Removed the references to the different module types from TurbineConstants
+ and tried to reduce the number of inter-dependencies in the module, loader
+ and broker-classes. This should lead to a transparent module configuration
+ without any hard-wired module types.
+ </action>
+ <action type="update" dev="tv">
Ported the class cache for JavaBaseFactory from Turbine 2.3
</action>
<action type="update" dev="tv">