mpoeschl 2003/07/28 16:27:57
Modified: src/java/org/apache/turbine/flux/modules/actions
FluxLogin.java FluxAction.java FluxLogout.java
src/java/org/apache/turbine/flux/modules/actions/permission
FluxPermissionAction.java
src/java/org/apache/turbine/flux/modules/screens
FluxIndex.java FluxScreen.java
src/java/org/apache/turbine/flux/modules/actions/role
FluxRoleAction.java
src/java/org/apache/turbine/flux/modules/actions/group
FluxGroupAction.java
src/java/org/apache/turbine/flux/tools FluxTool.java
Log:
style fixes
Revision Changes Path
1.7 +9 -20
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxLogin.java
Index: FluxLogin.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxLogin.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FluxLogin.java 25 Jul 2003 19:59:45 -0000 1.6
+++ FluxLogin.java 28 Jul 2003 23:27:57 -0000 1.7
@@ -71,15 +71,15 @@
*/
public class FluxLogin extends VelocityAction
{
- public void doPerform( RunData data, Context context ) throws Exception
+ public void doPerform(RunData data, Context context) throws Exception
{
- String username = data.getParameters().getString ( "username", "" );
- String password = data.getParameters().getString ( "password", "" );
+ String username = data.getParameters().getString("username", "");
+ String password = data.getParameters().getString("password", "");
User user = null;
try
{
// Authenticate the user and get the object.
- user = TurbineSecurity.getAuthenticatedUser( username, password );
+ user = TurbineSecurity.getAuthenticatedUser(username, password);
// Store the user object.
data.setUser(user);
@@ -91,32 +91,21 @@
user.updateLastLogin();
AccessControlList acl = data.getACL();
- if ( acl == null )
+ if (acl == null)
{
- acl = TurbineSecurity.getACL( data.getUser() );
- data.getSession().setAttribute( AccessControlList.SESSION_KEY,
- (Object)acl );
+ acl = TurbineSecurity.getACL(data.getUser());
+ data.getSession().setAttribute(AccessControlList.SESSION_KEY,
+ (Object)acl);
}
data.setACL(acl);
data.save();
data.setMessage(Turbine.getConfiguration().getString("login.welcome"));
}
- catch ( TurbineSecurityException e )
+ catch (TurbineSecurityException e)
{
data.setMessage(Turbine.getConfiguration().getString("login.error"));
data.setScreen(Turbine.getConfiguration().getString("screen.login"));
}
}
}
-
-
-
-
-
-
-
-
-
-
-
1.8 +10 -11
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxAction.java
Index: FluxAction.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxAction.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FluxAction.java 25 Jul 2003 19:59:45 -0000 1.7
+++ FluxAction.java 28 Jul 2003 23:27:57 -0000 1.8
@@ -67,6 +67,7 @@
* General Flux action.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
+ * @version $Id$
*/
public class FluxAction extends VelocityAction
{
@@ -75,23 +76,20 @@
*
* @param data Turbine information.
* @param context Context for web pages.
- * @exception Exception, a generic exception.
+ * @exception Exception a generic exception.
*/
- public void doPerform( RunData data,Context context )
- throws Exception
+ public void doPerform(RunData data,Context context) throws Exception
{
}
/**
- * This currently only checks to make sure that user is allowed to
- * view the storage area. If you create an action that requires more
- * security then override this method.
+ * This checks if the user has the <code>flux.admin.role</code>
*
* @param data Turbine information.
* @return True if the user is authorized to access the screen.
- * @exception Exception, a generic exception.
+ * @exception Exception a generic exception.
*/
- protected boolean isAuthorized( RunData data ) throws Exception
+ protected boolean isAuthorized(RunData data) throws Exception
{
boolean isAuthorized = false;
@@ -103,7 +101,8 @@
* file that is included in the the standard
* TurbineResources.properties file.
*/
- String fluxAdminRole =
Turbine.getConfiguration().getString("flux.admin.role");
+ String fluxAdminRole = Turbine.getConfiguration()
+ .getString("flux.admin.role");
/*
* This should be taken from a config file, this
@@ -111,11 +110,11 @@
* of the admin app. I think a permissions file
* would be better for the whole system.
*/
- if (acl==null || ! acl.hasRole(fluxAdminRole))
+ if (acl == null || !acl.hasRole(fluxAdminRole))
{
isAuthorized = false;
}
- else if(acl.hasPermission(fluxAdminRole))
+ else if (acl.hasPermission(fluxAdminRole))
{
isAuthorized = true;
}
1.7 +3 -3
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxLogout.java
Index: FluxLogout.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/FluxLogout.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FluxLogout.java 25 Jul 2003 19:59:45 -0000 1.6
+++ FluxLogout.java 28 Jul 2003 23:27:57 -0000 1.7
@@ -69,12 +69,12 @@
*/
public class FluxLogout extends VelocityAction
{
- public void doPerform( RunData data, Context context ) throws Exception
+ public void doPerform(RunData data, Context context) throws Exception
{
- if (data.getSession().getAttribute(AccessControlList.SESSION_KEY)!=null)
+ if (data.getSession().getAttribute(AccessControlList.SESSION_KEY) != null)
data.getSession().removeAttribute(AccessControlList.SESSION_KEY);
- if(data.getUser() != null)
+ if (data.getUser() != null)
{
data.getUser().setHasLoggedIn(new Boolean(false));
data.removeUserFromSession();
1.10 +23 -17
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/permission/FluxPermissionAction.java
Index: FluxPermissionAction.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/permission/FluxPermissionAction.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FluxPermissionAction.java 28 Jul 2003 21:59:10 -0000 1.9
+++ FluxPermissionAction.java 28 Jul 2003 23:27:57 -0000 1.10
@@ -78,11 +78,14 @@
private static Log log = LogFactory.getLog(FluxPermissionAction.class);
/**
- * ActionEvent responsible for inserting a new user
+ * ActionEvent responsible for inserting a new permission
* into the Turbine security system.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doInsert(RunData data, Context context)
- throws Exception
+ public void doInsert(RunData data, Context context) throws Exception
{
//Permission permission = new Permission();
Permission permission = TurbineSecurity.getPermissionInstance(null);
@@ -109,20 +112,21 @@
}
/**
- * ActionEvent responsible updating a user
- * in the Tambora system. Must check the input
- * for integrity before allowing the user info
- * to be update in the database.
+ * ActionEvent responsible updating a permission. Must check the input
+ * for integrity before allowing the user info to be update in the database.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doUpdate(RunData data, Context context)
- throws Exception
+ public void doUpdate(RunData data, Context context) throws Exception
{
Permission permission = TurbineSecurity.getPermissionByName(
data.getParameters().getString("oldname"));
try
{
TurbineSecurity.renamePermission(permission,
-
data.getParameters().getString("name"));
+ data.getParameters().getString("name"));
}
catch (UnknownEntityException uee)
{
@@ -136,11 +140,13 @@
}
/**
- * ActionEvent responsible for removing a user
- * from the Tambora system.
+ * ActionEvent responsible for removing a permission.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doDelete(RunData data, Context context)
- throws Exception
+ public void doDelete(RunData data, Context context) throws Exception
{
Permission permission = TurbineSecurity.getPermissionByName(
data.getParameters().getString("name"));
@@ -165,9 +171,9 @@
*
* @param data Turbine information.
* @param context Context for web pages.
- * @exception Exception, a generic exception.
+ * @exception Exception a generic exception.
*/
- public void doPerform( RunData data,Context context )
+ public void doPerform(RunData data,Context context)
throws Exception
{
log.info("Running do perform!");
1.11 +7 -17
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxIndex.java
Index: FluxIndex.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxIndex.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FluxIndex.java 25 Jul 2003 19:59:45 -0000 1.10
+++ FluxIndex.java 28 Jul 2003 23:27:57 -0000 1.11
@@ -75,7 +75,7 @@
* @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
{
}
@@ -87,11 +87,11 @@
* @param data Turbine information.
* @exception Exception, a generic exception.
*/
- protected void doBuildTemplate( RunData data ) throws Exception
+ protected void doBuildTemplate(RunData data) throws Exception
{
- if ( isAuthorized( data ) )
+ if (isAuthorized(data))
{
- doBuildTemplate( data, TurbineVelocity.getContext( data ) );
+ doBuildTemplate(data, TurbineVelocity.getContext(data));
}
}
@@ -102,7 +102,7 @@
* @return True if the user is authorized to access the screen.
* @exception Exception, a generic exception.
*/
- protected boolean isAuthorized( RunData data ) throws Exception
+ protected boolean isAuthorized(RunData data) throws Exception
{
String fluxAdminRole =
Turbine.getConfiguration().getString("flux.admin.role");
@@ -112,7 +112,7 @@
AccessControlList acl = data.getACL();
- if (acl==null || ! acl.hasRole(fluxAdminRole))
+ if (acl == null || !acl.hasRole(fluxAdminRole))
{
data.getTemplateInfo().setScreenTemplate(
Turbine.getConfiguration().getString("template.login"));
@@ -120,20 +120,10 @@
data.setScreen(Turbine.getConfiguration().getString("screen.login"));
isAuthorized = false;
}
- else if(acl.hasRole(fluxAdminRole))
+ else if (acl.hasRole(fluxAdminRole))
{
isAuthorized = true;
}
return isAuthorized;
}
}
-
-
-
-
-
-
-
-
-
-
1.10 +10 -10
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxScreen.java
Index: FluxScreen.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/screens/FluxScreen.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FluxScreen.java 25 Jul 2003 19:59:45 -0000 1.9
+++ FluxScreen.java 28 Jul 2003 23:27:57 -0000 1.10
@@ -76,9 +76,9 @@
*
* @param data Turbine information.
* @param context Context for web pages.
- * @exception Exception, a generic exception.
+ * @exception Exception a generic exception.
*/
- protected void doBuildTemplate( RunData data, Context context )
+ protected void doBuildTemplate(RunData data, Context context)
throws Exception
{
}
@@ -88,11 +88,11 @@
* perform a security check first.
*
* @param data Turbine information.
- * @exception Exception, a generic exception.
+ * @exception Exception a generic exception.
*/
- protected void doBuildTemplate( RunData data ) throws Exception
+ protected void doBuildTemplate(RunData data) throws Exception
{
- Context context = TurbineVelocity.getContext( data );
+ Context context = TurbineVelocity.getContext(data);
/*
* Check to see if the embedded menu should be
@@ -113,9 +113,9 @@
}
- if ( isAuthorized( data ) )
+ if (isAuthorized(data))
{
- doBuildTemplate( data, context );
+ doBuildTemplate(data, context);
}
}
@@ -126,7 +126,7 @@
* @return True if the user is authorized to access the screen.
* @exception Exception, a generic exception.
*/
- protected boolean isAuthorized( RunData data ) throws Exception
+ protected boolean isAuthorized(RunData data) throws Exception
{
boolean isAuthorized = false;
@@ -137,14 +137,14 @@
AccessControlList acl = data.getACL();
- if (acl==null || ! acl.hasRole(fluxAdminRole))
+ if (acl == null || !acl.hasRole(fluxAdminRole))
{
data.setScreenTemplate(
Turbine.getConfiguration().getString("template.login"));
isAuthorized = false;
}
- else if(acl.hasRole(fluxAdminRole))
+ else if (acl.hasRole(fluxAdminRole))
{
// Set the layout now that the user has
// gained access.
1.9 +23 -19
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/role/FluxRoleAction.java
Index: FluxRoleAction.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/role/FluxRoleAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FluxRoleAction.java 28 Jul 2003 21:59:11 -0000 1.8
+++ FluxRoleAction.java 28 Jul 2003 23:27:57 -0000 1.9
@@ -99,16 +99,17 @@
}
/**
- * ActionEvent responsible updating a user
- * in the Tambora system. Must check the input
- * for integrity before allowing the user info
- * to be update in the database.
+ * ActionEvent responsible updating a role. Must check the input for
+ * integrity before allowing the user info to be update in the database.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doUpdate(RunData data, Context context)
- throws Exception
+ public void doUpdate(RunData data, Context context) throws Exception
{
Role role = TurbineSecurity.getRoleByName(
- data.getParameters().getString("name"));
+ data.getParameters().getString("name"));
data.getParameters().setProperties(role);
@@ -127,14 +128,16 @@
}
/**
- * ActionEvent responsible for removing a user
- * from the Tambora system.
+ * ActionEvent responsible for removing a role.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doDelete(RunData data, Context context)
- throws Exception
+ public void doDelete(RunData data, Context context) throws Exception
{
Role role = TurbineSecurity.getRoleByName(
- data.getParameters().getString("name"));
+ data.getParameters().getString("name"));
try
{
@@ -151,11 +154,13 @@
}
/**
- * Update the roles that are to assigned to a user
- * for a project.
+ * Update the roles that are to assigned to a user for a project.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doPermissions(RunData data, Context context)
- throws Exception
+ public void doPermissions(RunData data, Context context) throws Exception
{
/*
* Grab the role we are trying to update.
@@ -216,10 +221,9 @@
*
* @param data Turbine information.
* @param context Context for web pages.
- * @exception Exception, a generic exception.
+ * @exception Exception a generic exception.
*/
- public void doPerform( RunData data,Context context )
- throws Exception
+ public void doPerform(RunData data,Context context) throws Exception
{
System.out.println("Running do perform!");
data.setMessage("Can't find the requested action!");
1.9 +25 -18
jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/group/FluxGroupAction.java
Index: FluxGroupAction.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/modules/actions/group/FluxGroupAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FluxGroupAction.java 28 Jul 2003 21:59:11 -0000 1.8
+++ FluxGroupAction.java 28 Jul 2003 23:27:57 -0000 1.9
@@ -70,8 +70,12 @@
public class FluxGroupAction extends FluxAction
{
/**
- * ActionEvent responsible for inserting a new user
- * into the Turbine security system.
+ * ActionEvent responsible for inserting a new user into the Turbine
+ * security system.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
public void doInsert(RunData data, Context context)
throws Exception
@@ -89,7 +93,8 @@
catch (EntityExistsException eee)
{
context.put("name", name);
- context.put("errorTemplate",
"/screens/admin/group/GroupAlreadyExists.vm");
+ context.put("errorTemplate",
+ "/screens/admin/group/GroupAlreadyExists.vm");
context.put("group", group);
/*
* We are still in insert mode. So keep this
@@ -101,16 +106,17 @@
}
/**
- * ActionEvent responsible updating a user
- * in the Tambora system. Must check the input
- * for integrity before allowing the user info
- * to be update in the database.
+ * ActionEvent responsible updating a user. Must check the input for
+ * integrity before allowing the user info to be update in the database.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doUpdate(RunData data, Context context)
- throws Exception
+ public void doUpdate(RunData data, Context context) throws Exception
{
Group group = TurbineSecurity.getGroupByName(
- data.getParameters().getString("name"));
+ data.getParameters().getString("name"));
data.getParameters().setProperties(group);
@@ -129,14 +135,16 @@
}
/**
- * ActionEvent responsible for removing a user
- * from the Tambora system.
+ * ActionEvent responsible for removing a user.
+ *
+ * @param data Turbine information.
+ * @param context Context for web pages.
+ * @exception Exception a generic exception.
*/
- public void doDelete(RunData data, Context context)
- throws Exception
+ public void doDelete(RunData data, Context context) throws Exception
{
Group group = TurbineSecurity.getGroupByName(
- data.getParameters().getString("name"));
+ data.getParameters().getString("name"));
try
{
@@ -157,10 +165,9 @@
*
* @param data Turbine information.
* @param context Context for web pages.
- * @exception Exception, a generic exception.
+ * @exception Exception a generic exception.
*/
- public void doPerform( RunData data,Context context )
- throws Exception
+ public void doPerform(RunData data,Context context) throws Exception
{
System.out.println("Running do perform!");
data.setMessage("Can't find the requested action!");
1.12 +27 -50
jakarta-turbine-flux/src/java/org/apache/turbine/flux/tools/FluxTool.java
Index: FluxTool.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-flux/src/java/org/apache/turbine/flux/tools/FluxTool.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- FluxTool.java 28 Jul 2003 21:59:11 -0000 1.11
+++ FluxTool.java 28 Jul 2003 23:27:57 -0000 1.12
@@ -73,32 +73,21 @@
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @version $Id$
*/
-public class FluxTool
- implements Recyclable, ApplicationTool
+public class FluxTool implements Recyclable, ApplicationTool
{
- /**
- * The object containing request specific data
- */
+ /** The object containing request specific data */
private RunData data;
- /**
- * A Group object for use within the Flux API.
- */
+ /** A Group object for use within the Flux API. */
private Group group = null;
- /**
- * A Issue object for use within the Flux API.
- */
+ /** A Issue object for use within the Flux API. */
private Role role = null;
- /**
- * A Permission object for use within the Flux API.
- */
+ /** A Permission object for use within the Flux API. */
private Permission permission = null;
- /**
- * A User object for use within the Flux API.
- */
+ /** A User object for use within the Flux API. */
private User user = null;
@@ -123,13 +112,12 @@
}
- public Group getGroup()
- throws Exception
+ public Group getGroup() throws Exception
{
if (group == null)
{
String name = data.getParameters().getString("name");
- if ( name == null || name.length() == 0)
+ if (name == null || name.length() == 0)
{
group = TurbineSecurity.getGroupInstance(null);
}
@@ -146,19 +134,17 @@
return data.getParameters().getString("mode");
}
- public Group[] getGroups()
- throws Exception
+ public Group[] getGroups() throws Exception
{
return TurbineSecurity.getAllGroups().getGroupsArray();
}
- public Role getRole()
- throws Exception
+ public Role getRole() throws Exception
{
if (role == null)
{
String name = data.getParameters().getString("name");
- if ( name == null || name.length() == 0)
+ if (name == null || name.length() == 0)
{
role = TurbineSecurity.getRoleInstance(null);
}
@@ -172,19 +158,17 @@
/**
*/
- public Role[] getRoles()
- throws Exception
+ public Role[] getRoles() throws Exception
{
return TurbineSecurity.getAllRoles().getRolesArray();
}
- public Permission getPermission()
- throws Exception
+ public Permission getPermission() throws Exception
{
if (permission == null)
{
String name = data.getParameters().getString("name");
- if ( name == null || name.length() == 0)
+ if (name == null || name.length() == 0)
{
permission = TurbineSecurity.getPermissionInstance(null);
}
@@ -199,19 +183,17 @@
/**
* Get all permissions.
*/
- public Permission[] getPermissions()
- throws Exception
+ public Permission[] getPermissions() throws Exception
{
return TurbineSecurity.getAllPermissions().getPermissionsArray();
}
- public User getUser()
- throws Exception
+ public User getUser() throws Exception
{
if (user == null)
{
String name = data.getParameters().getString("username");
- if ( name == null || name.length() == 0)
+ if (name == null || name.length() == 0)
{
user = TurbineSecurity.getUserInstance();
}
@@ -223,10 +205,9 @@
return user;
}
- public AccessControlList getACL()
- throws Exception
+ public AccessControlList getACL() throws Exception
{
- return TurbineSecurity.getACL(getUser());
+ return TurbineSecurity.getACL(getUser());
}
@@ -236,15 +217,14 @@
public SelectorBox getFieldList() throws Exception
{
Object[] names = {"username", "firstname", "middlename", "lastname"};
- Object[] values =
- { "Username", "First Name", "Middle Name", "Last Name" };
- return new SelectorBox("fieldList", names, values);
+ Object[] values
+ = { "Username", "First Name", "Middle Name", "Last Name" };
+ return new SelectorBox("fieldList", names, values);
}
/**
*/
- public SelectorBox getUserFieldList()
- throws Exception
+ public SelectorBox getUserFieldList() throws Exception
{
/**
* This is a tie to the DB implementation
@@ -266,15 +246,14 @@
"Last Name"
};
- return new SelectorBox("fieldList", names, values);
+ return new SelectorBox("fieldList", names, values);
}
/**
* Select all the users and place them in an array
* that can be used within the UserList.vm template.
*/
- public User[] getUsers()
- throws Exception
+ public User[] getUsers() throws Exception
{
Criteria criteria = new Criteria();
@@ -282,9 +261,7 @@
if (fieldList != null)
{
- /*
- * This is completely database centric.
- */
+ // This is completely database centric.
String searchField = data.getParameters().getString("searchField");
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]