org.edg.security.voms.operation
Class ActionHelper

java.lang.Object
  |
  +--org.edg.security.voms.operation.ActionHelper
All Implemented Interfaces:
Action, java.io.Serializable
Direct Known Subclasses:
AddACLEntryAction, AddCapabilityAction, AddDefaultACLEntryAction, AddGroupMemberAction, AddRoleMemberAction, CreateCapabilityAction, CreateGroupAction, CreateRoleAction, CreateUserAction, DeleteCapabilityAction, DeleteGroupAction, DeleteRoleAction, DeleteUserAction, ExpireCompleteRequestsAction, IncompleteRequestTimeoutAction, PurgeDeletedRequestsAction, RemoveACLEntryAction, RemoveCapabilityAction, RemoveDefaultACLEntryAction, RemoveGroupMemberAction, RemoveRoleMemberAction, SetACLAction, SetDefaultACLAction, SetUserAction

public abstract class ActionHelper
extends java.lang.Object
implements Action

A helper class for writing classes implementing the Action interface. This is the place to store static attributes and methods which are shared between a lot of action types.

At the moment, ActionHelper contains only a reference to the current container naming scheme, which would otherwise have to be included in most of the individual actions. It is expected that new attributes and/or methods will be later added to this class, most notably those associated with the notification mechanism. All action types should be derived from ActionHelper in order to work without source code changes when the Action interface is extended with new methods.

Version:
$Name: v0_7_0 $
Author:
Karoly Lorentey
See Also:
Serialized Form

Field Summary
protected static ContainerNamingScheme cns
          The container naming scheme for this instance of VOMS.
private static org.apache.log4j.Logger log
          Logger.
 
Constructor Summary
ActionHelper()
           
 
Method Summary
 void checkPermission()
          Check that the current client (as specified by the current security context) has the right to perform this action.
 java.util.List getAdminUsers()
          Return the list of User objects, who are allowed to perform the action.
 java.lang.String getContainerName()
          Return the FQCN of the container that this action changes.
 java.lang.String getDescription()
          Return a human-readable description of this action.
 java.util.Map getParameters()
          Return the parameters of the requested action as an array of strings.
 void perform()
          Do the operation that this action represents, without ACL checks.
 java.lang.Object performWithResult()
          Do the operation that this action represents, without ACL checks, and return a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cns

protected static final ContainerNamingScheme cns
The container naming scheme for this instance of VOMS.


log

private static final org.apache.log4j.Logger log
Logger.

Constructor Detail

ActionHelper

public ActionHelper()
Method Detail

checkPermission

public void checkPermission()
                     throws VOMSException
Description copied from interface: Action
Check that the current client (as specified by the current security context) has the right to perform this action. The method returns normally when the access is granted. Otherwise, it throws a VOMSSecurityException.

Specified by:
checkPermission in interface Action
VOMSException
See Also:
SecurityContext

getAdminUsers

public java.util.List getAdminUsers()
                             throws VOMSException
Description copied from interface: Action
Return the list of User objects, who are allowed to perform the action. The method only returns the users, who are also members of the Virtual Organization, thus there is a user object associated with them.

Actions that are not part of a requests need not implement this method.

Specified by:
getAdminUsers in interface Action
VOMSException
See Also:
DBACL

perform

public void perform()
             throws VOMSException
Description copied from interface: Action
Do the operation that this action represents, without ACL checks. Any errors must be signalled by throwing an exception. This is essentially a shorthand for Action.performWithResult(), for actions that do not need a return value. Most actions are like this, so the elimination of the extra return statement seems worthwhile.

Specified by:
perform in interface Action
VOMSException

performWithResult

public java.lang.Object performWithResult()
                                   throws VOMSException
Description copied from interface: Action
Do the operation that this action represents, without ACL checks, and return a value. This is the more general version of Action.perform() for use when the action must return a value. A typical scenario when this is needed is the creation of a new request: performing the action must return the id of the newly created request.

Specified by:
performWithResult in interface Action
VOMSException

getDescription

public java.lang.String getDescription()
Return a human-readable description of this action. By default, this just returns the class name.

Specified by:
getDescription in interface Action

getContainerName

public java.lang.String getContainerName()
Return the FQCN of the container that this action changes. Only used by the request interface.

Specified by:
getContainerName in interface Action

getParameters

public java.util.Map getParameters()
Return the parameters of the requested action as an array of strings. The array has an even number of members; even-numbered indices contain parameter names, odd-numbered indices contain parameter values. This method is for enumerating the parameters for the user. This default implementation uses Java reflection to get the parameters using all the available get*() methods.

Specified by:
getParameters in interface Action