net.javamud.data
Class ACL

java.lang.Object
  |
  +--net.javamud.data.ACL
All Implemented Interfaces:
Cloneable, SISCapable

public class ACL
extends Object
implements Cloneable, SISCapable

Access Control List. Provides a permissions structure for the JavaMud.
Be careful because ACLs Inherit separately from the MudObject hierarchy. This allows permissions to remain consistent even as MudObjects are moved and deleted during the running of the MUD.

I thought it would be a bad thing to change permissions on an item just because it was picked up from it's room and so now is contained by a player...

Author:
Timothy Hinchcliffe
Created On:
15 June 2002

Field Summary
protected  Set Add
          Set of Permissions set on this ACL.
protected  boolean COWAdd
          Copy On Write on Add.
protected  boolean COWExc
          Copy On Write on Exclude.
protected  Set Exclude
          Set of Permissions excluded (not inherited) on this ACL.
protected  ACL Inherited
          Parent ACL from which permissions are inherited.
 
Constructor Summary
ACL()
           
 
Method Summary
 Object clone()
          Sets Copy On Write flags then super.clone()s.
 boolean equals(Object object)
          (this == object).
 Collection getSISObjects()
          Gets the Objects that can be reviewed for SIS.
 boolean implies(Permission perm)
          Returns true if this ACL implies Permission perm .
 boolean isInherited(Permission perm)
          Get whether or not the Permission perm is inherited or not.
 void setParent(MudObject mo)
          Change where this ACL Inherits permissions from.
 void updateSISObject(Object original, Object replacement)
          Called by a SIS Groveller to replace an object with a different object that equals() it.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Add

protected Set Add
Set of Permissions set on this ACL.


COWAdd

protected boolean COWAdd
Copy On Write on Add.


COWExc

protected boolean COWExc
Copy On Write on Exclude.


Exclude

protected Set Exclude
Set of Permissions excluded (not inherited) on this ACL.


Inherited

protected ACL Inherited
Parent ACL from which permissions are inherited.

Constructor Detail

ACL

public ACL()
Method Detail

setParent

public void setParent(MudObject mo)
Change where this ACL Inherits permissions from.

Parameters:
mo - The new ACL parent MudObject.

getSISObjects

public Collection getSISObjects()
Gets the Objects that can be reviewed for SIS.
The objects in question MUST support the Object.equals() method.
Additionally and of the Objects that are SISCapable will be queued for groveling.

Specified by:
getSISObjects in interface SISCapable
Returns:
A Collection of Objects.

isInherited

public boolean isInherited(Permission perm)
Get whether or not the Permission perm is inherited or not.

Parameters:
perm - Permission to test.
Returns:
Inherited?

clone

public Object clone()
Sets Copy On Write flags then super.clone()s.
This is a good way to copy a set of permissions.

Overrides:
clone in class Object
Returns:
Cloned ACL

equals

public boolean equals(Object object)
(this == object). Even if 2 ACLs mean the same thing, they cannot safely be considered "equal" to each other as it is very likely that they will need to be changed independently. As they implement the SISCapable interface, they can reduce space usage by SISing their fields.

This method is defined to ensure that ACLs can be SISGrovelled safely.

Overrides:
equals in class Object
Parameters:
object - Object to test for equality
Returns:
(this == object)
See Also:
SISCapable, SISGroveller

implies

public boolean implies(Permission perm)
Returns true if this ACL implies Permission perm .

Parameters:
perm - Permision to test
Returns:
Boolean

updateSISObject

public void updateSISObject(Object original,
                            Object replacement)
Called by a SIS Groveller to replace an object with a different object that equals() it.
Objects should be checked with .equals, and that they are valid against the original object to reduce problems from erroneous or hostile SISGrovellers.
If the replacement cannot be made, the method should still return cleanly. There is nothing to be gained by throwing an Exception.

Specified by:
updateSISObject in interface SISCapable
Parameters:
original - Object to replace.
replacement - Object to replace original with.