JAFS API v2

org.openafs.jafs
Class ACL

java.lang.Object
  |
  +--org.openafs.jafs.ACL
All Implemented Interfaces:
Comparable, Serializable

public class ACL
extends Object
implements Serializable, Comparable

An abstract representation of AFS file and directory pathnames. This class is an extension of the standard Java File class with file-based manipulation methods overridden by integrated AFS native methods.

Version:
2.2, 03/24/2003 - Added new Delta ACL functionality and changes from Stonehenge., 2.0, 04/18/2001 - Completely revised class for efficiency.
See Also:
Serialized Form

Nested Class Summary
static class ACL.Entry
          AFS ACL Entry Class.
 
Constructor Summary
ACL(String path)
           
ACL(String path, boolean init)
           
 
Method Summary
 void addNegativeEntries(ACL.Entry[] entries)
          Adds the provided list of negative ACL entries to this ACL instance.
 void addNegativeEntry(ACL.Entry entry)
          Adds a single negative ACL entry to this ACL instance.
 void addNegativeExpungeEntry(ACL.Entry entry)
          Add a negative ACL entry to the list of negative ACL entries to be expunged; used in Delta ACLs.
 void addPositiveEntries(ACL.Entry[] entries)
          Adds the provided list of positive ACL entries to this ACL instance.
 void addPositiveEntry(ACL.Entry entry)
          Adds a single positive ACL entry to this ACL instance.
 void addPositiveExpungeEntry(ACL.Entry entry)
          Add a positive ACL entry to the list of positive ACL entries to be expunged; used in Delta ACLs.
 int compareTo(ACL acl)
          Compares two ACL objects respective to their paths and does not factor any other attribute.
 int compareTo(Object obj)
          Comparable interface method.
 boolean containsNegative(ACL.Entry entry)
          Returns true if this ACL contains the specified ACL entry.
 boolean containsPositiveEntry(ACL.Entry entry)
          Returns true if this ACL contains the specified ACL entry.
 boolean equals(ACL acl)
          Tests whether two ACL objects are equal, based on their paths and permission bits.
 void flush()
          Writes the ACL to AFS, making all changes immediately effective.
 ACL getDeltaACL(ACL acl)
          Returns a "Delta ACL", which is an ACL that represents only the difference (delta) of two ACLs, relative to the current ACL instance by the provided ACL specified by acl.
 int getEntryCount()
          Returns the total number of ACL entries, this is the sum of positive and negative entries.
 ACL.Entry[] getNegativeEntries()
          Returns all negative ACL entries for this ACL instance.
 ACL.Entry getNegativeEntry(String name)
          Returns the negative ACL entry associated with the specified user/group name.
 int getNegativeEntryCount()
          Returns the number of negative ACL entries for this ACL instance.
 ACL.Entry[] getNegativeExpungeEntries()
          Returns all negative ACL entries to be expunged; used in Delta ACLs.
 String getPath()
          Returns the path this ACL instance is bound to.
 ACL.Entry[] getPositiveEntries()
          Returns all positive ACL entries for this ACL instance.
 ACL.Entry getPositiveEntry(String name)
          Returns the positive ACL entry associated with the specified user/group name.
 int getPositiveEntryCount()
          Returns the number of positive ACL entries for this ACL instance.
 ACL.Entry[] getPositiveExpungeEntries()
          Returns all positive ACL entries to be expunged; used in Delta ACLs.
 void removeAllNegativeEntries()
          Removes all negative ACL entries from this ACL instance.
 void removeAllPositiveEntries()
          Removes all positive ACL entries from this ACL instance.
 void removeNegativeEntry(ACL.Entry entry)
          Removes a single negative ACL entry from this ACL instance.
 void removePositiveEntry(ACL.Entry entry)
          Removes a single positive ACL entry from this ACL instance.
 void setNegativeEntries(ACL.Entry[] entries)
          Sets the complete array of negative ACL entries to the provided ACL entry list (entries) for this ACL instance.
 void setPositiveEntries(ACL.Entry[] entries)
          Sets the complete array of positive ACL entries to the provided ACL entry list (entries) for this ACL instance.
 String toString()
          Returns a String representation of this ACL
 void update(ACL delta)
          Updates the current ACL instance by replacing, adding, or deleting ACL entries designated by the specified Delta ACL (delta).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ACL

public ACL(String path)
    throws AFSException

ACL

public ACL(String path,
           boolean init)
    throws AFSException
Method Detail

getEntryCount

public int getEntryCount()
Returns the total number of ACL entries, this is the sum of positive and negative entries.

Returns:
Total number of ACL entries

getPath

public String getPath()
Returns the path this ACL instance is bound to.

Returns:
Path for this ACL

flush

public void flush()
           throws AFSException
Writes the ACL to AFS, making all changes immediately effective. This method requires an active connection to AFS.

AFSException

getPositiveEntryCount

public int getPositiveEntryCount()
Returns the number of positive ACL entries for this ACL instance.

Returns:
Positive ACL entry count

getPositiveEntries

public ACL.Entry[] getPositiveEntries()
Returns all positive ACL entries for this ACL instance.

Returns:
All positive ACL entries

getPositiveEntry

public ACL.Entry getPositiveEntry(String name)
Returns the positive ACL entry associated with the specified user/group name.

Parameters:
name - Name of user/group for desired ACL entry.
Returns:
Positive ACL entry
See Also:
ACL.Entry.getUser()

getPositiveExpungeEntries

public ACL.Entry[] getPositiveExpungeEntries()
Returns all positive ACL entries to be expunged; used in Delta ACLs.

Returns:
All positive ACL entries

containsPositiveEntry

public boolean containsPositiveEntry(ACL.Entry entry)
Returns true if this ACL contains the specified ACL entry.

Parameters:
entry - Positive ACL entry
Returns:
true if the specified ACL entry is present; false otherwise.

addPositiveEntry

public void addPositiveEntry(ACL.Entry entry)
                      throws AFSException
Adds a single positive ACL entry to this ACL instance.

Parameters:
entry - ACL.Entry object to add
AFSException

addPositiveEntries

public void addPositiveEntries(ACL.Entry[] entries)
                        throws AFSException
Adds the provided list of positive ACL entries to this ACL instance.

Parameters:
entries - Array of ACL.Entry objects to add
AFSException

setPositiveEntries

public void setPositiveEntries(ACL.Entry[] entries)
                        throws AFSException
Sets the complete array of positive ACL entries to the provided ACL entry list (entries) for this ACL instance.

Parameters:
entries - Array of ACL.Entry objects that represent this ACL's positive entry list.
AFSException

addPositiveExpungeEntry

public void addPositiveExpungeEntry(ACL.Entry entry)
                             throws AFSException
Add a positive ACL entry to the list of positive ACL entries to be expunged; used in Delta ACLs.

Parameters:
entry - Positive ACL entries to be expunged.
AFSException

removePositiveEntry

public void removePositiveEntry(ACL.Entry entry)
                         throws AFSException
Removes a single positive ACL entry from this ACL instance.

Parameters:
entry - ACL.Entry object to removed
AFSException

removeAllPositiveEntries

public void removeAllPositiveEntries()
                              throws AFSException
Removes all positive ACL entries from this ACL instance.

AFSException

getNegativeEntryCount

public int getNegativeEntryCount()
Returns the number of negative ACL entries for this ACL instance.

Returns:
Negative ACL entry count

getNegativeEntries

public ACL.Entry[] getNegativeEntries()
Returns all negative ACL entries for this ACL instance.

Returns:
All negative ACL entries

getNegativeEntry

public ACL.Entry getNegativeEntry(String name)
Returns the negative ACL entry associated with the specified user/group name.

Parameters:
name - Name of user/group for desired ACL entry.
Returns:
Negative ACL entry
See Also:
ACL.Entry.getUser()

getNegativeExpungeEntries

public ACL.Entry[] getNegativeExpungeEntries()
Returns all negative ACL entries to be expunged; used in Delta ACLs.

Returns:
All negative ACL entries to be expunged.

containsNegative

public boolean containsNegative(ACL.Entry entry)
Returns true if this ACL contains the specified ACL entry.

Parameters:
entry - Negative ACL entry
Returns:
true if the specified ACL entry is present; false otherwise.

addNegativeEntry

public void addNegativeEntry(ACL.Entry entry)
                      throws AFSException
Adds a single negative ACL entry to this ACL instance.

Parameters:
entry - ACL.Entry object to add
AFSException

addNegativeEntries

public void addNegativeEntries(ACL.Entry[] entries)
                        throws AFSException
Adds the provided list of negative ACL entries to this ACL instance.

Parameters:
entries - Array of ACL.Entry objects to add
AFSException

addNegativeExpungeEntry

public void addNegativeExpungeEntry(ACL.Entry entry)
                             throws AFSException
Add a negative ACL entry to the list of negative ACL entries to be expunged; used in Delta ACLs.

Parameters:
entry - Negative ACL entries to be expunged.
AFSException

setNegativeEntries

public void setNegativeEntries(ACL.Entry[] entries)
                        throws AFSException
Sets the complete array of negative ACL entries to the provided ACL entry list (entries) for this ACL instance.

Parameters:
entries - Array of ACL.Entry objects that represent this ACL's negative entry list.
AFSException

removeNegativeEntry

public void removeNegativeEntry(ACL.Entry entry)
                         throws AFSException
Removes a single negative ACL entry from this ACL instance.

Parameters:
entry - ACL.Entry object to removed
AFSException

removeAllNegativeEntries

public void removeAllNegativeEntries()
                              throws AFSException
Removes all negative ACL entries from this ACL instance.

AFSException

getDeltaACL

public ACL getDeltaACL(ACL acl)
                throws AFSException
Returns a "Delta ACL", which is an ACL that represents only the difference (delta) of two ACLs, relative to the current ACL instance by the provided ACL specified by acl.

This ACL instance represents the base or reference object while the provided ACL (acl) represents the object in question. Therefore, if the provided ACL has an entry that differs from the base ACL, then the resulting Delta ACL will contain that entry found in the provided ACL; base ACL entries are never entered into the Delta ACL, but rather are used solely for comparison.

Parameters:
acl - the ACL to compare this ACL instance to
Returns:
Delta ACL by comparing this ACL instance with acl
AFSException

update

public void update(ACL delta)
            throws AFSException
Updates the current ACL instance by replacing, adding, or deleting ACL entries designated by the specified Delta ACL (delta).

If the provided Delta ACL has an entry that differs from this ACL instance, then the ACL entry of the Delta ACL will be set.

Parameters:
delta - the Delta ACL to be applied to this ACL instance
AFSException

compareTo

public int compareTo(ACL acl)
Compares two ACL objects respective to their paths and does not factor any other attribute. Alphabetic case is significant in comparing names.

Parameters:
acl - The ACL object to be compared to this ACL instance
Returns:
Zero if the argument is equal to this ACL's path, a value less than zero if this ACL's path is lexicographically less than the argument, or a value greater than zero if this ACL's path is lexicographically greater than the argument

compareTo

public int compareTo(Object obj)
Comparable interface method.

Specified by:
compareTo in interface Comparable
See Also:
compareTo(ACL)

equals

public boolean equals(ACL acl)
Tests whether two ACL objects are equal, based on their paths and permission bits.

Parameters:
acl - the ACL to test
Returns:
whether the specifed ACL is the same as this ACL

toString

public String toString()
Returns a String representation of this ACL

Overrides:
toString in class Object
Returns:
a String representation of this ACL

JAFS API v2