henning 2002/12/08 06:25:55
Modified: src/java/org/apache/turbine/modules ActionLoader.java
GenericLoader.java LayoutLoader.java
NavigationLoader.java PageLoader.java
ScreenLoader.java
src/java/org/apache/turbine/modules/actions
AccessController.java InitContextsAction.java
LoginUser.java LogoutUser.java
src/java/org/apache/turbine/modules/actions/sessionvalidator
DefaultSessionValidator.java
TemplateSecureSessionValidator.java
TemplateSessionValidator.java
src/java/org/apache/turbine/modules/pages DefaultPage.java
src/java/org/apache/turbine/modules/screens
VelocityDirectScreen.java VelocityErrorScreen.java
VelocityScreen.java
src/java/org/apache/turbine/modules/screens/error
InvalidState.java
Log:
Checkstyle and Doc fixes. No functional changes. Just pushing some cleanups
from our CVS repository to Jakarta.
Revision Changes Path
1.2 +17 -13
jakarta-turbine-2/src/java/org/apache/turbine/modules/ActionLoader.java
Index: ActionLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/ActionLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ActionLoader.java 16 Aug 2001 05:08:29 -0000 1.1
+++ ActionLoader.java 8 Dec 2002 14:25:54 -0000 1.2
@@ -54,14 +54,16 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.util.Vector;
-// Turbine Utility Classes
import org.apache.turbine.TurbineConstants;
+
import org.apache.turbine.services.TurbineServices;
+
import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
+
import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.RunData;
@@ -102,10 +104,12 @@
* @param name Name of object.
* @param action Action to be associated with name.
*/
- private void addInstance( String name, Action action )
+ private void addInstance(String name, Action action)
{
- if ( cache() )
- this.put( name, (Action) action );
+ if (cache())
+ {
+ this.put(name, (Action) action);
+ }
}
/**
@@ -115,7 +119,7 @@
* @param name Name of object that will execute the action.
* @exception Exception a generic exception.
*/
- public void exec( RunData data, String name )
+ public void exec(RunData data, String name)
throws Exception
{
// Execute action
@@ -135,9 +139,9 @@
{
Action action = null;
- if ( cache() && this.containsKey( name ) )
+ if (cache() && this.containsKey(name))
{
- action = (Action) this.get( name );
+ action = (Action) this.get(name);
}
else
{
@@ -168,18 +172,18 @@
// string here...
Vector packages = TurbineResources.getVector(
TurbineConstants.MODULE_PACKAGES);
- ObjectUtils.addOnce( packages,
- GenericLoader.getBasePackage() );
+ ObjectUtils.addOnce(packages,
+ GenericLoader.getBasePackage());
throw new ClassNotFoundException(
"\n\n\tRequested Action not found: " + name + "\n" +
"\tTurbine looked in the following modules.packages " +
"path: \n\t" + packages.toString() + "\n");
}
- else if ( cache() )
+ else if (cache())
{
// The new instance is added to the cache
- addInstance( name, action );
+ addInstance(name, action);
}
}
return action;
1.2 +7 -7
jakarta-turbine-2/src/java/org/apache/turbine/modules/GenericLoader.java
Index: GenericLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/GenericLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GenericLoader.java 16 Aug 2001 05:08:29 -0000 1.1
+++ GenericLoader.java 8 Dec 2002 14:25:54 -0000 1.2
@@ -54,14 +54,14 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.util.Hashtable;
-// Turbine Utility Classes
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.util.RunData;
+
import org.apache.turbine.services.resources.TurbineResources;
+import org.apache.turbine.util.RunData;
+
/**
* This is the base class for the loaders. It contains code that is
* used across all of the loaders. It also specifies the interface
@@ -94,7 +94,7 @@
*/
public GenericLoader(int i)
{
- super ( i );
+ super (i);
CACHE = TurbineResources
.getBoolean(TurbineConstants.MODULE_CACHE, true);
}
@@ -115,7 +115,7 @@
*
* @exception Exception a generic exception.
*/
- public abstract void exec( RunData data, String name )
+ public abstract void exec(RunData data, String name)
throws Exception;
/**
@@ -150,7 +150,7 @@
* @param reload True if the action must be marked as reload.
* @return Itself.
*/
- public GenericLoader setReload( boolean reload )
+ public GenericLoader setReload(boolean reload)
{
this.reload = reload;
return this;
1.2 +17 -16
jakarta-turbine-2/src/java/org/apache/turbine/modules/LayoutLoader.java
Index: LayoutLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/LayoutLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LayoutLoader.java 16 Aug 2001 05:08:30 -0000 1.1
+++ LayoutLoader.java 8 Dec 2002 14:25:54 -0000 1.2
@@ -54,18 +54,19 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.util.Vector;
-// Turbine Utility Classes
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
+
import org.apache.turbine.services.TurbineServices;
+
+import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
+
+import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.RunData;
-
/**
* The purpose of this class is to allow one to load and execute
* Layout modules.
@@ -103,10 +104,10 @@
* @param name Name of object.
* @param layout Layout to be associated with name.
*/
- private void addInstance( String name, Layout layout )
+ private void addInstance(String name, Layout layout)
{
- if ( cache() )
- this.put( name, (Layout) layout );
+ if (cache())
+ this.put(name, (Layout) layout);
}
/**
@@ -116,7 +117,7 @@
* @param name Name of object that will execute the layout.
* @exception Exception a generic exception.
*/
- public void exec( RunData data, String name )
+ public void exec(RunData data, String name)
throws Exception
{
// Execute layout
@@ -136,9 +137,9 @@
{
Layout layout = null;
- if ( cache() && this.containsKey( name ) )
+ if (cache() && this.containsKey(name))
{
- layout = (Layout) this.get ( name );
+ layout = (Layout) this.get (name);
}
else
{
@@ -169,18 +170,18 @@
// string here...
Vector packages = TurbineResources.getVector(
TurbineConstants.MODULE_PACKAGES);
- ObjectUtils.addOnce( packages,
- GenericLoader.getBasePackage() );
+ ObjectUtils.addOnce(packages,
+ GenericLoader.getBasePackage());
throw new ClassNotFoundException(
"\n\n\tRequested Layout not found: " + name + "\n" +
"\tTurbine looked in the following modules.packages " +
"path: \n\t" + packages.toString() + "\n");
}
- else if ( cache() )
+ else if (cache())
{
// The new instance is added to the cache
- addInstance( name, layout );
+ addInstance(name, layout);
}
}
return layout;
1.2 +22 -19
jakarta-turbine-2/src/java/org/apache/turbine/modules/NavigationLoader.java
Index: NavigationLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/NavigationLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NavigationLoader.java 16 Aug 2001 05:08:29 -0000 1.1
+++ NavigationLoader.java 8 Dec 2002 14:25:54 -0000 1.2
@@ -54,20 +54,21 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.util.Vector;
-// Turbine Utility Classes
+import org.apache.ecs.ConcreteElement;
+
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.services.TurbineServices;
+
import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
+
+import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.RunData;
-// ECS
-import org.apache.ecs.ConcreteElement;
-
/**
* The purpose of this class is to allow one to load and execute
* Navigation modules.
@@ -105,10 +106,12 @@
* @param name Name of object.
* @param navigation Navigation to be associated with name.
*/
- private void addInstance( String name, Navigation navigation )
+ private void addInstance(String name, Navigation navigation)
{
- if ( cache() )
- this.put ( name, (Navigation) navigation );
+ if (cache())
+ {
+ this.put (name, (Navigation) navigation);
+ }
}
/**
@@ -122,7 +125,7 @@
* @param name Name of object that will execute the navigation.
* @exception Exception a generic exception.
*/
- public ConcreteElement eval( RunData data, String name )
+ public ConcreteElement eval(RunData data, String name)
throws Exception
{
// Execute Navigation
@@ -136,10 +139,10 @@
* @param name Name of object instance.
* @exception Exception a generic exception.
*/
- public void exec( RunData data, String name )
+ public void exec(RunData data, String name)
throws Exception
{
- this.eval( data, name );
+ this.eval(data, name);
}
/**
@@ -155,9 +158,9 @@
{
Navigation navigation = null;
- if ( cache() && this.containsKey( name ) )
+ if (cache() && this.containsKey(name))
{
- navigation = (Navigation) this.get( name );
+ navigation = (Navigation) this.get(name);
}
else
{
@@ -188,18 +191,18 @@
// string here...
Vector packages = TurbineResources.getVector(
TurbineConstants.MODULE_PACKAGES);
- ObjectUtils.addOnce( packages,
- GenericLoader.getBasePackage() );
+ ObjectUtils.addOnce(packages,
+ GenericLoader.getBasePackage());
throw new ClassNotFoundException(
"\n\n\tRequested Navigation not found: " + name + "\n" +
"\tTurbine looked in the following modules.packages " +
"path: \n\t" + packages.toString() + "\n");
}
- else if ( cache() )
+ else if (cache())
{
// The new instance is added to the cache
- addInstance( name, navigation );
+ addInstance(name, navigation);
}
}
return navigation;
1.2 +18 -15
jakarta-turbine-2/src/java/org/apache/turbine/modules/PageLoader.java
Index: PageLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/PageLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PageLoader.java 16 Aug 2001 05:08:30 -0000 1.1
+++ PageLoader.java 8 Dec 2002 14:25:54 -0000 1.2
@@ -54,18 +54,19 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.util.Vector;
-// Turbine Utility Clases
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.services.TurbineServices;
+
import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
+
+import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.RunData;
-
/**
* The purpose of this class is to allow one to load and execute Page
* modules.
@@ -103,10 +104,12 @@
* @param name Name of object.
* @param page Page to be associated with name.
*/
- private void addInstance( String name, Page page )
+ private void addInstance(String name, Page page)
{
- if ( cache() )
- this.put( name, (Page) page );
+ if (cache())
+ {
+ this.put(name, (Page) page);
+ }
}
/**
@@ -116,7 +119,7 @@
* @param name Name of object that will execute the page.
* @exception Exception a generic exception.
*/
- public void exec( RunData data, String name )
+ public void exec(RunData data, String name)
throws Exception
{
// Execute page
@@ -136,9 +139,9 @@
{
Page page = null;
- if ( cache() && this.containsKey( name ) )
+ if (cache() && this.containsKey(name))
{
- page = (Page) this.get( name );
+ page = (Page) this.get(name);
}
else
{
@@ -169,18 +172,18 @@
// it's own string here...
Vector packages = TurbineResources.getVector(
TurbineConstants.MODULE_PACKAGES);
- ObjectUtils.addOnce( packages,
- GenericLoader.getBasePackage() );
+ ObjectUtils.addOnce(packages,
+ GenericLoader.getBasePackage());
throw new ClassNotFoundException(
"\n\n\tRequested Page not found: " + name + "\n" +
"\tTurbine looked in the following modules.packages " +
"path: \n\t" + packages.toString() + "\n");
}
- else if ( cache() )
+ else if (cache())
{
// The new instance is added to the cache
- addInstance( name, page );
+ addInstance(name, page);
}
}
return page;
1.2 +22 -19
jakarta-turbine-2/src/java/org/apache/turbine/modules/ScreenLoader.java
Index: ScreenLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/ScreenLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ScreenLoader.java 16 Aug 2001 05:08:31 -0000 1.1
+++ ScreenLoader.java 8 Dec 2002 14:25:54 -0000 1.2
@@ -54,20 +54,21 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.util.Vector;
-// Turbine Utility Classes
+import org.apache.ecs.ConcreteElement;
+
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.services.TurbineServices;
+
import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
+
+import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.RunData;
-// ECS
-import org.apache.ecs.ConcreteElement;
-
/**
* The purpose of this class is to allow one to load and execute
* Screen modules.
@@ -105,10 +106,12 @@
* @param name Name of object.
* @param screen Screen to be associated with name.
*/
- private void addInstance( String name, Screen screen )
+ private void addInstance(String name, Screen screen)
{
- if ( cache() )
- this.put( name, (Screen) screen );
+ if (cache())
+ {
+ this.put(name, (Screen) screen);
+ }
}
/**
@@ -122,7 +125,7 @@
* @param name Name of object that will execute the screen.
* @exception Exception a generic exception.
*/
- public ConcreteElement eval( RunData data, String name )
+ public ConcreteElement eval(RunData data, String name)
throws Exception
{
// Execute screen
@@ -138,10 +141,10 @@
* @param name Name of object that will execute the screen.
* @exception Exception a generic exception.
*/
- public void exec( RunData data, String name )
+ public void exec(RunData data, String name)
throws Exception
{
- this.eval( data, name );
+ this.eval(data, name);
}
/**
@@ -158,9 +161,9 @@
Screen screen = null;
// Check if the screen is already in the cache
- if ( cache() && this.containsKey( name ) )
+ if (cache() && this.containsKey(name))
{
- screen = (Screen) this.get( name );
+ screen = (Screen) this.get(name);
}
else
{
@@ -191,18 +194,18 @@
// own string here...
Vector packages = TurbineResources
.getVector(TurbineConstants.MODULE_PACKAGES);
- ObjectUtils.addOnce( packages,
- GenericLoader.getBasePackage() );
+ ObjectUtils.addOnce(packages,
+ GenericLoader.getBasePackage());
throw new ClassNotFoundException (
"\n\n\tRequested Screen not found: " + name +
"\n\tTurbine looked in the following " +
"modules.packages path: \n\t" + packages.toString() + "\n");
}
- else if ( cache() )
+ else if (cache())
{
// The new instance is added to the cache
- addInstance( name, screen );
+ addInstance(name, screen);
}
}
return screen;
1.5 +10 -10
jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/AccessController.java
Index: AccessController.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/AccessController.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AccessController.java 22 Aug 2002 12:12:41 -0000 1.4
+++ AccessController.java 8 Dec 2002 14:25:55 -0000 1.5
@@ -54,13 +54,13 @@
* <http://www.apache.org/>.
*/
-// Turbine Utility Classes
import org.apache.turbine.modules.Action;
+
import org.apache.turbine.services.security.TurbineSecurity;
+
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.security.AccessControlList;
-
/**
* This action doPerforms an Access Control List and places it into
* the RunData object, so it is easily available to modules. The ACL
@@ -106,20 +106,20 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data )
+ public void doPerform(RunData data)
throws Exception
{
- if ( data.getUser() != null
+ if (data.getUser() != null
// && data.getUser().getName().length() > 0
- && data.getUser().hasLoggedIn() )
+ && data.getUser().hasLoggedIn())
{
AccessControlList acl = (AccessControlList)
data.getSession().getValue(AccessControlList.SESSION_KEY);
- if ( acl == null )
+ if (acl == null)
{
- acl = TurbineSecurity.getACL( data.getUser() );
- data.getSession().putValue( AccessControlList.SESSION_KEY,
- (Object)acl );
+ acl = TurbineSecurity.getACL(data.getUser());
+ data.getSession().putValue(AccessControlList.SESSION_KEY,
+ (Object)acl);
}
data.setACL(acl);
}
1.2 +6 -10
jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/InitContextsAction.java
Index: InitContextsAction.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/InitContextsAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InitContextsAction.java 16 Aug 2001 05:08:32 -0000 1.1
+++ InitContextsAction.java 8 Dec 2002 14:25:55 -0000 1.2
@@ -54,22 +54,18 @@
* <http://www.apache.org/>.
*/
-// Java Core Classes
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Properties;
-// Java Naming and Directory Interface Classes
import javax.naming.InitialContext;
-// Turbine Modules
import org.apache.turbine.modules.Action;
-// Turbine Utility Classes
-import org.apache.turbine.util.RunData;
import org.apache.turbine.services.resources.TurbineResources;
+import org.apache.turbine.util.RunData;
/**
* Used to initialize JNDI contexts.
@@ -87,7 +83,7 @@
* @param data The RunData object for the current request.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data )
+ public void doPerform(RunData data)
throws Exception
{
// Context properties are specified in lines in the properties
@@ -99,14 +95,14 @@
Iterator contextKeys = TurbineResources.getKeys("context.");
Hashtable contextPropsList = new Hashtable();
- while( contextKeys.hasNext() )
+ while (contextKeys.hasNext())
{
String key = (String) contextKeys.next();
int start = key.indexOf(".") + 1;
int end = key.indexOf(".", start);
String contextName = key.substring(start, end);
Properties contextProps = null;
- if( contextPropsList.containsKey(contextName) )
+ if (contextPropsList.containsKey(contextName))
{
contextProps =
(Properties) contextPropsList.get(contextName);
@@ -120,7 +116,7 @@
contextPropsList.put(contextName, contextProps);
}
Enumeration contextPropsKeys = contextPropsList.keys();
- while( contextPropsKeys.hasMoreElements() )
+ while (contextPropsKeys.hasMoreElements())
{
String key = (String) contextPropsKeys.nextElement();
Properties contextProps =
1.3 +10 -5
jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/LoginUser.java
Index: LoginUser.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/LoginUser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LoginUser.java 22 Aug 2002 11:45:52 -0000 1.2
+++ LoginUser.java 8 Dec 2002 14:25:55 -0000 1.3
@@ -54,14 +54,19 @@
* <http://www.apache.org/>.
*/
-// Turbine Classes
import org.apache.turbine.TurbineConstants;
+
import org.apache.turbine.modules.Action;
-import org.apache.turbine.util.Log;
-import org.apache.turbine.util.RunData;
+
+import org.apache.turbine.om.security.User;
+
import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.services.security.TurbineSecurity;
-import org.apache.turbine.om.security.User;
+
+import org.apache.turbine.util.Log;
+import org.apache.turbine.util.RunData;
+
import org.apache.turbine.util.security.DataBackendException;
import org.apache.turbine.util.security.TurbineSecurityException;
1.4 +7 -2
jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/LogoutUser.java
Index: LogoutUser.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/LogoutUser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LogoutUser.java 22 Aug 2002 11:45:52 -0000 1.3
+++ LogoutUser.java 8 Dec 2002 14:25:55 -0000 1.4
@@ -54,13 +54,18 @@
* <http://www.apache.org/>.
*/
-// Turbine Classes
import org.apache.turbine.TurbineConstants;
+
import org.apache.turbine.modules.Action;
+
import org.apache.turbine.om.security.User;
+
import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.services.security.TurbineSecurity;
+
import org.apache.turbine.util.RunData;
+
import org.apache.turbine.util.security.AccessControlList;
/**
1.5 +12 -10
jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java
Index: DefaultSessionValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultSessionValidator.java 11 Jul 2002 16:53:29 -0000 1.4
+++ DefaultSessionValidator.java 8 Dec 2002 14:25:55 -0000 1.5
@@ -55,7 +55,9 @@
*/
import org.apache.turbine.TurbineConstants;
+
import org.apache.turbine.services.resources.TurbineResources;
+
import org.apache.turbine.util.RunData;
/**
@@ -91,7 +93,7 @@
* @see org.apache.turbine.modules.screens.error.InvalidState
* @param data Turbine RunData context information. * @exception Exception,
a generic exception.
*/
- public void doPerform( RunData data ) throws Exception
+ public void doPerform(RunData data) throws Exception
{
/*
* Pull user from session.
@@ -100,7 +102,7 @@
// Make sure the User object exists in the Session and that
// the user has logged into the system.
- if ( (data.getUser() == null) || (! data.getUser().hasLoggedIn()) )
+ if ((data.getUser() == null) || (!data.getUser().hasLoggedIn()))
{
// only set the message if nothing else has already set it
// (e.g. the LogoutUser action)
@@ -114,25 +116,25 @@
// will have been performed already)
data.setAction(null);
}
- else if ( ! data.hasScreen() )
+ else if (!data.hasScreen())
{
data.setMessage(TurbineResources.getString(
TurbineConstants.LOGIN_MESSAGE_NOSCREEN));
data.setScreen(TurbineResources.getString(
TurbineConstants.SCREEN_HOMEPAGE));
}
- else if ( data.getParameters().containsKey("_session_access_counter") )
+ else if (data.getParameters().containsKey("_session_access_counter"))
{
// See comments in screens.error.InvalidState.
- if ( data.getParameters().getInt("_session_access_counter") <
+ if (data.getParameters().getInt("_session_access_counter") <
(((Integer)data.getUser().getTemp("_session_access_counter"))
- .intValue()-1) )
+ .intValue() - 1))
{
data.getUser().setTemp("prev_screen", data.getScreen());
data.getUser().setTemp("prev_parameters", data.getParameters());
- data.setScreen( TurbineResources.getString(
- TurbineConstants.SCREEN_INVALID_STATE) );
- data.setAction( "" );
+ data.setScreen(TurbineResources.getString(
+ TurbineConstants.SCREEN_INVALID_STATE));
+ data.setAction("");
}
}
}
1.5 +30 -28
jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSecureSessionValidator.java
Index: TemplateSecureSessionValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSecureSessionValidator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TemplateSecureSessionValidator.java 29 Mar 2002 15:57:04 -0000 1.4
+++ TemplateSecureSessionValidator.java 8 Dec 2002 14:25:55 -0000 1.5
@@ -54,22 +54,23 @@
* <http://www.apache.org/>.
*/
-// Turbine Classes
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.util.RunData;
+
import org.apache.turbine.services.resources.TurbineResources;
+import org.apache.turbine.util.RunData;
+
/**
- * SessionValidator that requires login for use with the WebMacroSite
- * Service.
+ * SessionValidator that requires login for use with Template Services
+ * like Velocity or WebMacro.
*
* <br>
*
- * The WebMacroSite Service requires a different Session Validator
- * because of the way it handles screens. If you use the WebMacroSite
- * Service with the DefaultSessionValidator, users will be able to
+ * Templating services requires a different Session Validator
+ * because of the way it handles screens. If you use the WebMacro or
+ * Velocity Service with the DefaultSessionValidator, users will be able to
* bypass login by directly addressing the template using
- * template/index.wm. This is because WebMacroSitePage looks for the
+ * template/index.wm. This is because the Page class looks for the
* keyword "template" in the Path information and if it finds it will
* reset the screen using it's lookup mechanism and thereby bypass
* Login.
@@ -79,6 +80,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Dave Bryson</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
* @version $Id$
*/
public class TemplateSecureSessionValidator extends SessionValidator
@@ -88,12 +90,12 @@
* except that it calls template methods instead of bare screen
* methods. For example, it uses <code>setScreenTemplate</code> to
* load the tr.props TEMPLATE_LOGIN instead of the default's
- * setScreen to TurbineContants.SCREEN_LOGIN.
+ * setScreen to TurbineConstants.SCREEN_LOGIN.
*
* @see DefaultSessionValidator * @param data Turbine information.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data ) throws Exception
+ public void doPerform(RunData data) throws Exception
{
/*
* Pull user from session.
@@ -103,7 +105,7 @@
/*
* This is the secure sessionvalidator, so user must be logged in.
*/
- if ( (data.getUser() == null) || (! data.getUser().hasLoggedIn()) )
+ if ((data.getUser() == null) || (!data.getUser().hasLoggedIn()))
{
/*
* Only set the message if nothing else has already set it
@@ -119,7 +121,7 @@
* Set the screen template to the login page.
*/
data.getTemplateInfo().setScreenTemplate(
- TurbineResources.getString(TurbineConstants.TEMPLATE_LOGIN) );
+ TurbineResources.getString(TurbineConstants.TEMPLATE_LOGIN));
/*
* We're not doing any actions buddy! (except action.login which
@@ -131,8 +133,8 @@
/*
* Make sure we have some way to return a response.
*/
- if ( !data.hasScreen() &&
- data.getTemplateInfo().getScreenTemplate() == null )
+ if (!data.hasScreen() &&
+ data.getTemplateInfo().getScreenTemplate() == null)
{
String template = TurbineResources.getString(
TurbineConstants.TEMPLATE_HOMEPAGE);
@@ -154,33 +156,33 @@
* browsers back button and submitting stale data.
* FIXME!! a template needs to be written to use this with templates.
*/
- else if ( data.getParameters().containsKey("_session_access_counter") )
+ else if (data.getParameters().containsKey("_session_access_counter"))
{
/*
* See comments in screens.error.InvalidState.
*/
- if ( data.getParameters().getInt("_session_access_counter") <
+ if (data.getParameters().getInt("_session_access_counter") <
(((Integer)data.getUser().getTemp("_session_access_counter"))
- .intValue()-1) )
+ .intValue() - 1))
{
if (data.getTemplateInfo().getScreenTemplate() != null)
{
- data.getUser().setTemp( "prev_template",
- data.getTemplateInfo().getScreenTemplate() );
+ data.getUser().setTemp("prev_template",
+ data.getTemplateInfo().getScreenTemplate());
data.getTemplateInfo().setScreenTemplate(
TurbineResources.getString(
- TurbineConstants.TEMPLATE_INVALID_STATE) );
+ TurbineConstants.TEMPLATE_INVALID_STATE));
}
else
{
- data.getUser().setTemp( "prev_screen",
- data.getScreen().replace('/', ',') );
- data.setScreen( TurbineResources.getString(
- TurbineConstants.SCREEN_INVALID_STATE) );
+ data.getUser().setTemp("prev_screen",
+ data.getScreen().replace('/', ','));
+ data.setScreen(TurbineResources.getString(
+ TurbineConstants.SCREEN_INVALID_STATE));
}
data.getUser()
- .setTemp( "prev_parameters", data.getParameters() );
- data.setAction( "" );
+ .setTemp("prev_parameters", data.getParameters());
+ data.setAction("");
}
}
@@ -188,7 +190,7 @@
* We do not want to allow both a screen and template parameter.
* The template parameter is dominant.
*/
- if ( data.getTemplateInfo().getScreenTemplate() != null )
+ if (data.getTemplateInfo().getScreenTemplate() != null)
{
data.setScreen(null);
}
1.5 +25 -20
jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java
Index: TemplateSessionValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/actions/sessionvalidator/TemplateSessionValidator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TemplateSessionValidator.java 29 Mar 2002 15:57:04 -0000 1.4
+++ TemplateSessionValidator.java 8 Dec 2002 14:25:55 -0000 1.5
@@ -54,24 +54,29 @@
* <http://www.apache.org/>.
*/
-// Turbine Classes
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.util.RunData;
+
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.services.security.TurbineSecurity;
+import org.apache.turbine.util.RunData;
+
/**
* SessionValidator for use with the Template Service, the
* TemplateSessionValidator is virtually identical to the
- * TemplateSecureValidator except that it does not tranfer to the
+ * TemplateSecureValidator except that it does not transfer to the
* login page when it detects a null user (or a user not logged in).
*
* <p>The Template Service requires a different Session Validator
* because of the way it handles screens.
*
+ * <p>Note that you will need to set the template.login property to the
+ * login template.
+ *
* @see TemplateSecureSessionValidator
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Dave Bryson</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
* @version $Id$
*/
public class TemplateSessionValidator extends SessionValidator
@@ -82,7 +87,7 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- public void doPerform( RunData data ) throws Exception
+ public void doPerform(RunData data) throws Exception
{
/*
* Pull user from session.
@@ -90,15 +95,15 @@
data.populate();
// The user may have not logged in, so create a "guest" user.
- if ( data.getUser() == null )
+ if (data.getUser() == null)
{
data.setUser(TurbineSecurity.getAnonymousUser());
data.save();
}
// make sure we have some way to return a response
- if ( !data.hasScreen() &&
- data.getTemplateInfo().getScreenTemplate() == null )
+ if (!data.hasScreen() &&
+ data.getTemplateInfo().getScreenTemplate() == null)
{
String template = TurbineResources.getString(
TurbineConstants.TEMPLATE_HOMEPAGE);
@@ -116,37 +121,37 @@
// the session_access_counter can be placed as a hidden field in
// forms. This can be used to prevent a user from using the
// browsers back button and submitting stale data.
- else if ( data.getParameters().containsKey("_session_access_counter") )
+ else if (data.getParameters().containsKey("_session_access_counter"))
{
// See comments in screens.error.InvalidState.
- if ( data.getParameters().getInt("_session_access_counter") <
+ if (data.getParameters().getInt("_session_access_counter") <
(((Integer)data.getUser().getTemp("_session_access_counter"))
- .intValue()-1) )
+ .intValue() - 1))
{
if (data.getTemplateInfo().getScreenTemplate() != null)
{
- data.getUser().setTemp( "prev_template",
+ data.getUser().setTemp("prev_template",
data.getTemplateInfo().getScreenTemplate()
- .replace('/', ',') );
+ .replace('/', ','));
data.getTemplateInfo().setScreenTemplate(
TurbineResources.getString(
- TurbineConstants.TEMPLATE_INVALID_STATE) );
+ TurbineConstants.TEMPLATE_INVALID_STATE));
}
else
{
- data.getUser().setTemp( "prev_screen",
- data.getScreen().replace('/', ',') );
- data.setScreen( TurbineResources.getString(
- TurbineConstants.SCREEN_INVALID_STATE) );
+ data.getUser().setTemp("prev_screen",
+ data.getScreen().replace('/', ','));
+ data.setScreen(TurbineResources.getString(
+ TurbineConstants.SCREEN_INVALID_STATE));
}
data.getUser().setTemp("prev_parameters", data.getParameters());
- data.setAction( "" );
+ data.setAction("");
}
}
// we do not want to allow both a screen and template parameter.
// The template parameter is dominant.
- if ( data.getTemplateInfo().getScreenTemplate() != null )
+ if (data.getTemplateInfo().getScreenTemplate() != null)
{
data.setScreen(null);
}
1.3 +12 -13
jakarta-turbine-2/src/java/org/apache/turbine/modules/pages/DefaultPage.java
Index: DefaultPage.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/pages/DefaultPage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultPage.java 29 Mar 2002 02:00:02 -0000 1.2
+++ DefaultPage.java 8 Dec 2002 14:25:55 -0000 1.3
@@ -56,18 +56,17 @@
import java.util.Vector;
-// Turbine Classes
+import org.apache.ecs.Doctype;
+
import org.apache.turbine.modules.ActionLoader;
import org.apache.turbine.modules.LayoutLoader;
import org.apache.turbine.modules.Page;
import org.apache.turbine.modules.Screen;
import org.apache.turbine.modules.ScreenLoader;
-import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.turbine.util.RunData;
-// ECS Stuff
-import org.apache.ecs.Doctype;
+import org.apache.turbine.services.resources.TurbineResources;
+import org.apache.turbine.util.RunData;
/**
* When building sites using templates, Screens need only be defined
@@ -129,7 +128,7 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- public void doBuild( RunData data )
+ public void doBuild(RunData data)
throws Exception
{
// Template pages can use this to set up the context, so it is
@@ -138,9 +137,9 @@
// If an action has been defined, execute it here. Actions
// can re-define the template definition.
- if ( data.hasAction() )
+ if (data.hasAction())
{
- ActionLoader.getInstance().exec ( data, data.getAction() );
+ ActionLoader.getInstance().exec (data, data.getAction());
}
// if a redirect was setup in data, don't do anything else
@@ -164,13 +163,13 @@
// If the Layout has been set to be null, attempt to execute
// the Screen that has been defined.
- if ( layout != null )
+ if (layout != null)
{
- LayoutLoader.getInstance().exec ( data, layout );
+ LayoutLoader.getInstance().exec (data, layout);
}
else
{
- ScreenLoader.getInstance().exec ( data, data.getScreen() );
+ ScreenLoader.getInstance().exec (data, data.getScreen());
}
// Do any post build actions (overridable by subclasses -
@@ -225,7 +224,7 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- private void setDefaultDoctype( RunData data )
+ private void setDefaultDoctype(RunData data)
throws Exception
{
String errMsg =
1.2 +5 -5
jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java
Index: VelocityDirectScreen.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/VelocityDirectScreen.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- VelocityDirectScreen.java 19 Aug 2001 17:59:18 -0000 1.1
+++ VelocityDirectScreen.java 8 Dec 2002 14:25:55 -0000 1.2
@@ -90,7 +90,7 @@
* @return A ConcreteElement.
* @exception Exception, a generic exception.
*/
- public ConcreteElement buildTemplate( RunData data ) throws Exception
+ public ConcreteElement buildTemplate(RunData data) throws Exception
{
StringElement output = new StringElement();
String screenData = null;
@@ -99,7 +99,7 @@
// This will already be properly set and will not be null
// because of TemplateSessionValidator.
String templateName = TurbineTemplate.getScreenTemplateName(
- data.getTemplateInfo().getScreenTemplate() );
+ data.getTemplateInfo().getScreenTemplate());
// Template service adds the leading slash, but make it sure.
if ((templateName.length() > 0) &&
@@ -130,8 +130,8 @@
// If there is an error, build a $processingException and
// attempt to call the error.vm template in the screens
// directory.
- context.put ( "processingException", e.toString() );
- context.put ( "stackTrace", StringUtils.stackTrace(e) );
+ context.put ("processingException", e.toString());
+ context.put ("stackTrace", StringUtils.stackTrace(e));
templateName = TurbineResources.getString(
"template.error", "/error.vm");
if ((templateName.length() > 0) &&
1.3 +6 -6
jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java
Index: VelocityErrorScreen.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/VelocityErrorScreen.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- VelocityErrorScreen.java 16 Jul 2002 15:50:50 -0000 1.2
+++ VelocityErrorScreen.java 8 Dec 2002 14:25:55 -0000 1.3
@@ -54,12 +54,12 @@
* <http://www.apache.org/>.
*/
-// Turbine
import org.apache.turbine.TurbineConstants;
-import org.apache.turbine.util.RunData;
+
import org.apache.turbine.services.resources.TurbineResources;
-// Velocity
+import org.apache.turbine.util.RunData;
+
import org.apache.velocity.context.Context;
/**
@@ -78,8 +78,8 @@
* @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- protected void doBuildTemplate( RunData data,
- Context context )
+ protected void doBuildTemplate(RunData data,
+ Context context)
throws Exception
{
context.put("processingException",
1.2 +15 -14
jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/VelocityScreen.java
Index: VelocityScreen.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/VelocityScreen.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- VelocityScreen.java 16 Aug 2001 05:08:37 -0000 1.1
+++ VelocityScreen.java 8 Dec 2002 14:25:55 -0000 1.2
@@ -54,18 +54,19 @@
* <http://www.apache.org/>.
*/
-// Turbine/ECS Imports
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.StringElement;
-import org.apache.turbine.util.RunData;
-import org.apache.turbine.util.StringUtils;
+
import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.turbine.services.velocity.TurbineVelocity;
+
import org.apache.turbine.services.template.TurbineTemplate;
-// Velocity Stuff
-import org.apache.velocity.context.Context;
+import org.apache.turbine.services.velocity.TurbineVelocity;
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.StringUtils;
+
+import org.apache.velocity.context.Context;
/**
* Base Velocity Screen. The buildTemplate() assumes the template
@@ -91,8 +92,8 @@
* @param context Context for web pages.
* @exception Exception, a generic exception.
*/
- protected void doBuildTemplate( RunData data,
- Context context )
+ protected void doBuildTemplate(RunData data,
+ Context context)
throws Exception
{
}
@@ -105,7 +106,7 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- protected void doBuildTemplate( RunData data )
+ protected void doBuildTemplate(RunData data)
throws Exception
{
doBuildTemplate(data, TurbineVelocity.getContext(data));
@@ -118,7 +119,7 @@
* @return A ConcreteElement.
* @exception Exception, a generic exception.
*/
- public ConcreteElement buildTemplate( RunData data ) throws Exception
+ public ConcreteElement buildTemplate(RunData data) throws Exception
{
StringElement output = null;
String screenData = null;
@@ -127,7 +128,7 @@
// This will already be properly set and will not be null
// because of TemplateSessionValidator.
String templateName = TurbineTemplate.getScreenTemplateName(
- data.getTemplateInfo().getScreenTemplate() );
+ data.getTemplateInfo().getScreenTemplate());
// Template service adds the leading slash, but make it sure.
if ((templateName.length() > 0) &&
@@ -157,8 +158,8 @@
// If there is an error, build a $processingException and
// attempt to call the error.vm template in the screens
// directory.
- context.put ( "processingException", e.toString() );
- context.put ( "stackTrace", StringUtils.stackTrace(e) );
+ context.put ("processingException", e.toString());
+ context.put ("stackTrace", StringUtils.stackTrace(e));
templateName = TurbineResources.getString(
"template.error", "/error.vm");
if ((templateName.length() > 0) &&
1.2 +16 -17
jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/error/InvalidState.java
Index: InvalidState.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/error/InvalidState.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InvalidState.java 16 Aug 2001 05:08:38 -0000 1.1
+++ InvalidState.java 8 Dec 2002 14:25:55 -0000 1.2
@@ -54,18 +54,17 @@
* <http://www.apache.org/>.
*/
-// ECS
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.ElementContainer;
+
import org.apache.ecs.html.A;
-// Turbine
import org.apache.turbine.modules.Screen;
+
import org.apache.turbine.util.DynamicURI;
import org.apache.turbine.util.ParameterParser;
import org.apache.turbine.util.RunData;
-
/**
* Users will get this screen if the screen on their browser is in an
* invalid state. For example, if they hit "Back" or "Reload" and
@@ -88,31 +87,31 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- public ConcreteElement doBuild( RunData data )
+ public ConcreteElement doBuild(RunData data)
throws Exception
{
ElementContainer body = new ElementContainer();
ElementContainer message = new ElementContainer();
StringBuffer sb = new StringBuffer();
- sb.append( "<b>There has been an error.</b>" )
- .append( "<p>" )
- .append( "- If you used the browser \"Back\" or \"Reload\"" )
- .append( " buttons please use the navigation buttons we provide" )
- .append( " within the screen." )
- .append( "<p>" )
- .append( "Please click " );
+ sb.append("<b>There has been an error.</b>")
+ .append("<p>")
+ .append("- If you used the browser \"Back\" or \"Reload\"")
+ .append(" buttons please use the navigation buttons we provide")
+ .append(" within the screen.")
+ .append("<p>")
+ .append("Please click ");
- message.addElement( sb.toString() );
+ message.addElement(sb.toString());
ParameterParser pp;
pp = (ParameterParser)data.getUser().getTemp("prev_parameters");
pp.remove("_session_access_counter");
- message.addElement( new A().setHref(
+ message.addElement(new A().setHref(
new DynamicURI(data,(String)data.getUser().getTemp("prev_screen"))
- .addPathInfo( pp ).toString()).addElement("here") );
- message.addElement( " to return the the screen you were working on." );
+ .addPathInfo(pp).toString()).addElement("here"));
+ message.addElement(" to return the the screen you were working on.");
- body.addElement( message );
+ body.addElement(message);
return body;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>