|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.cams.access.AbstractPermission
Provides an abstract implementation of the Permission interface.
| Field Summary | |
protected AccessControlRule |
acr
The AccessControlRule associated with this Permission. |
protected String[] |
actions
An array of Permission actions. |
protected long |
actionsMask
A bit mask used to hold the actions associated with this Permission. |
protected Config |
config
The Config object through which configuration parameters, services, and a Logger are available. |
protected String |
desc
A textual description of this Permission. |
protected Logger |
logger
The Logger to which DEBUG, INFO, WARNING, ERROR, and FATAL messages are sent. |
protected ResourcePattern |
rp
The ResourcePattern associated with this Permission. |
protected String |
securityDomainName
The Security Domain name associated with this Permission. |
protected ResourceType |
type
The ResourceType of the Permission. |
| Constructor Summary | |
AbstractPermission(ResourceType type)
Create a new AbstractPermission. |
|
AbstractPermission(ResourceType type,
ResourcePattern rp,
String[] actions)
Create a new AbstractPermission. |
|
| Method Summary | |
int |
compareTo(Object o)
Compares this object with the specified object for order. |
AccessControlRule |
getAccessControlRule()
Get the AccessControlRule. |
String[] |
getActions()
Get the actions specified for this Permission. |
long |
getActionsMask()
Get an integer mask representing the actions being requested on the Resource. |
String |
getDescription()
Get a textual description. |
ResourcePattern |
getResourcePattern()
Get the ResourcePattern. |
ResourceType |
getResourceType()
Get the ResourceType. |
String |
getSecurityDomain()
Get the name of the SecurityDomain associated with this Permission. |
void |
initialize(Config config)
Initialize the AccessControlRule. |
abstract boolean |
match(ResourceRequest resourceReq)
Determine if a ResourceRequest matches the ResourcePattern and one of the actions associated with this Permission. |
abstract PermissionCollection |
newPermissionCollection()
Create a new PermissionCollection suitable for storing
homogeneous Permission instances. |
abstract boolean |
overlaps(Permission permission)
Check for an overlapping Permission. |
void |
setAccessControlRule(AccessControlRule acr)
Set the AccessControlRule. |
void |
setActions(String[] actions)
Set the actions associated with this Permission. |
void |
setDescription(String desc)
Set a textual description. |
void |
setResourcePattern(ResourcePattern rp)
Set the ResourcePattern. |
void |
setSecurityDomain(String securityDomainName)
Set the name of the SecurityDomain associated with this Permission. |
String |
toString()
Create a String representation of this Permission. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected ResourceType type
protected String desc
protected ResourcePattern rp
protected AccessControlRule acr
protected String securityDomainName
protected String[] actions
protected long actionsMask
protected Config config
protected Logger logger
| Constructor Detail |
public AbstractPermission(ResourceType type)
throws InvalidPermissionException
type - the ResourceType of the permission.
InvalidPermissionException - if actions contains an invalid
action, or if any other error occurs creating the Permission.
public AbstractPermission(ResourceType type,
ResourcePattern rp,
String[] actions)
throws InvalidPermissionException
type - the ResourceType of the permission.rp - the ResourcePattern of the permission.actions - an array of permission actions.
InvalidPermissionException - if actions contains an invalid
action, or if any other error occurs creating the Permission.| Method Detail |
public void initialize(Config config)
throws ConfigException
initialize in interface Permissionconfig - a Config object that provides access to configuration
parameters and a runtime Context.
ConfigExceptionpublic ResourceType getResourceType()
getResourceType in interface Permissionpublic String getDescription()
getDescription in interface Permissionpublic void setDescription(String desc)
setDescription in interface Permissiondesc - a textual description of the Permission.public ResourcePattern getResourcePattern()
ResourcePattern.
getResourcePattern in interface PermissionResourcePattern associated with this
Permission.public void setResourcePattern(ResourcePattern rp)
setResourcePattern in interface Permissionrp - the ResourcePattern associated
with this Permission.public AccessControlRule getAccessControlRule()
AccessControlRule.
getAccessControlRule in interface PermissionAccessControlRule that protects
Resources matching the
ResourcePattern.
If null, then another SecurityDomain (not the one
containing an instance of this Permission), must be associated
with the ResourcePattern.public void setAccessControlRule(AccessControlRule acr)
The
AccessControlRule protects Resources
matching the ResourcePattern. If null, then another
SecurityDomain (not the one containing an instance of
this Permission), must be associated with the
ResourcePattern so access control checks can be
delegated to that SecurityDomain.
setAccessControlRule in interface Permission
acr - the AccessControlRule or null if another
SecurityDomain protects the Resources
associated with this Permission.
public String getSecurityDomain()
getSecurityDomain in interface Permissionpublic void setSecurityDomain(String securityDomainName)
setSecurityDomain in interface PermissionsecurityDomainName - the name of the SecurityDomain that owns
* resources matching this Permission.public String[] getActions()
getActions in interface Permission
public void setActions(String[] actions)
throws UnknownActionException
setActions in interface Permissionactions - a String representation of the actions
UnknownActionException - if one or more of the actions is
unknown for the type of resource associated with the permission.public long getActionsMask()
getActionsMask in interface Permissionpublic abstract boolean match(ResourceRequest resourceReq)
match in interface PermissionresourceReq - the ResourceRequest to be checked against this
Permission.
public abstract PermissionCollection newPermissionCollection()
PermissionCollection suitable for storing
homogeneous Permission instances.
newPermissionCollection in interface PermissionPermissionCollection suitable for storing a
collection of Permission instances of this class.public abstract boolean overlaps(Permission permission)
Two Permission instances: A and B are considered to overlap if:
overlaps in interface Permissionpermission - the Permission to be checked for an overlap.
public String toString()
toString in class Objectpublic int compareTo(Object o)
In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive. The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)
The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
Note: this class has a natural ordering that is inconsistent with equals.
compareTo in interface Comparableo - the Object to be compared.
ClassCastException - if the specified object's type prevents it
from being compared to this Object.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||