ARoad0.AcsAddon.Accbee.Ubuntu.gBase
Class CAgoUserUbuntuImpl

java.lang.Object
  extended by ARoad0.AcsAddon.Accbee.Ubuntu.gBase.CAgoUserUbuntuImpl
All Implemented Interfaces:
java.io.Serializable

public class CAgoUserUbuntuImpl
extends java.lang.Object
implements java.io.Serializable

This class is an embedded one, responsible for modeling the AGO 'other' rights and the sticky bit on Ubuntu directories. It does not handle all the AGO rights. It is used as a private attribute of a composite class instance (called the master) which delegates the processing of some methods to this class. This class responsability covers both the AGO 'other' rights and the inherited group rights, since they depends on the sticky bit. The master class is a ResourceUbuntu, and the master transfers directly all the relevant actions to this class.

It is a javabean with the following bound properties: 'OtherRights', 'FromTheParentOther', 'InheritedOtherRights'. The listeners are proper to the master instance. Excepting for ViewInBaseEPRImpl, they are outside the gBase packages, transient (not serialized in this instance backup). They are called in any order. They receive only a copy of the new value, to protect the property. All the exceptions from the listeners are catched, and a dialog box is displayed to inform the user. This class is public to be overriden in the AcsAddons. This class has no subclass in this package. See the Copyright.

See Also:
Serialized Form

Field Summary
protected  java.beans.PropertyChangeSupport changeSupport_
          manages all the property change listeners and also for its subclasses
(package private) static CAgoUserUbuntuImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected static int INCREMENT_CAPACITY
           
protected static int INITIAL_CAPACITY
           
protected static int INITIAL_CAPACITY_2
           
private  StringRight[] l_otherRights_
          The other rights of the Linux/Unix resource
private  ResourceUbuntu master_
          The master is the instance for which this class operates as an embedded one.
private  boolean parentTreeORightsAllowToGoAcross
          True if the master parent allows to go to the master for AGO other rigths.
protected static int PRIME
           
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization
private static long serialVersionUID
           
 
Constructor Summary
CAgoUserUbuntuImpl()
          Default constructor.
CAgoUserUbuntuImpl(ResourceUbuntu _master)
          Used by the master constructor before the registration in the ACS.
 
Method Summary
protected  void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
          Adds a listener to the bean, for all the bound properties.
protected  void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
protected  CAgoUserUbuntuImpl cloneC(ResourceUbuntu _master)
          Clone for embedded class, without registering the new object in the ACSs.
(package private)  CAgoUserUbuntuImpl copy(ResourceUbuntu _masterCopy)
          This method provides a copy of the instance with another master.
 boolean equals(java.lang.Object _obj)
          Works even if the instance is finalized.
protected  void finalize()
          This method calls finalizeForBase().
protected  void finalizeForBase()
          This method is called by finalize(), but finalize() may be not called.
protected  void finalizeFromDeserialization()
          The instance is NOT removed as a listener, since there is no listener.
protected  void fireL_inheritedOtherRights(StringRight[] _l_old, StringRight[] _l_new)
          Fires the event 'InheritedOtherRights', from the parent of the resource 'other' category.
protected  void firePropertyChange(java.lang.String _propertyName, java.lang.Object _oldValue, java.lang.Object _newValue)
          Fires an event to every registered listener, in any order.
protected  boolean getAGOAccessFromTheParentOther()
           
protected  StringRight[] getL_inheritedGroupRights()
          Gets the inherited rights from the parent of the resource group, including the control by the parent sticky bit.
protected  StringRight[] getL_inheritedOtherRights()
          Gets the inherited rights from the parent of the resource for 'other' AGO rights.
protected  StringRight[] getL_otherRights()
          Gets the access rights for the EligibleParties which are not the UserID or the GroupID owners of this resource, nor the root UserID.
 long getSerialVersionUID()
           
 int hashCode()
           
protected  void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
          Removes a listener to the bean, for all the bound properties.
protected  void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
protected  void setAGOAccessFromTheParentOther(boolean _b)
           
protected  void setL_otherRights(StringRight[] _s)
          Sets the rights for the EligibleParties which are not 'root' nor this resource userID, and which are not members of this resource groupID.
 java.lang.String toString()
          Gets the name last component of each privilege.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
See Also:
Constant Field Values

INITIAL_CAPACITY_2

protected static final int INITIAL_CAPACITY_2
See Also:
Constant Field Values

INCREMENT_CAPACITY

protected static final int INCREMENT_CAPACITY
See Also:
Constant Field Values

PRIME

protected static final int PRIME
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

master_

private ResourceUbuntu master_
The master is the instance for which this class operates as an embedded one.


l_otherRights_

private StringRight[] l_otherRights_
The other rights of the Linux/Unix resource


parentTreeORightsAllowToGoAcross

private boolean parentTreeORightsAllowToGoAcross
True if the master parent allows to go to the master for AGO other rigths. This property complements the 2 booleans in ResourceImpl.l_parentTreeAGRightsAllowToGoAcross_.


changeSupport_

protected transient java.beans.PropertyChangeSupport changeSupport_
manages all the property change listeners and also for its subclasses


EMPTY_INSTANCE

static final CAgoUserUbuntuImpl EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. Caution: never change the state of the returned instance.


serialPersistentFields

public static final java.io.ObjectStreamField[] serialPersistentFields
variable for the JDK 2 serialization

Constructor Detail

CAgoUserUbuntuImpl

CAgoUserUbuntuImpl()
Default constructor. No registration in the master.


CAgoUserUbuntuImpl

CAgoUserUbuntuImpl(ResourceUbuntu _master)
             throws CreateError
Used by the master constructor before the registration in the ACS.

Parameters:
_master - which owns this instance
Throws:
CreateError - if _master is null. Does not control the ACS management.
Method Detail

copy

CAgoUserUbuntuImpl copy(ResourceUbuntu _masterCopy)
                  throws CreateError
This method provides a copy of the instance with another master. Each internal variable that is an external object reference have a shallow copy (no deep copy).

Parameters:
_masterCopy - is the master of the new copy
Returns:
a new instance of CAgoUserUbuntuImpl
Throws:
CreateError - of the constructor with the same parameters.

getL_otherRights

protected StringRight[] getL_otherRights()
Gets the access rights for the EligibleParties which are not the UserID or the GroupID owners of this resource, nor the root UserID. Does not take in account if the parent tree allows or not any access.

Returns:
the AGO 'other' rights, following the Unix/Linux scheme. No null value. May be empty, or null only if the instance is finalized.

setL_otherRights

protected void setL_otherRights(StringRight[] _s)
                         throws UpDateError
Sets the rights for the EligibleParties which are not 'root' nor this resource userID, and which are not members of this resource groupID. The rights may have the two sens to implement Umask, and may be acsrights or metarights. The ACS constraints on 'OtherRights' are applied only if they are not null, otherwise all the arguments are validated. The negative rights are subtracted from the positive rights. No action if the instance has been finalized. If a new right is not allowed by the ACS, it is removed and the other rights are kept. Noop if the resource type contains 'byAcsCreator' or 'immutable'. No adding of null or negative elements. Calls userID.getUMask() to add the denyings rights of the account. Calls BaseUtilityImpl.subtractNegativeFromPositiveInOneACS() and UtilityImpl.selectHeaders(). Called by the master. If the master is an ActorUbuntuImpl, calls ACS.addActorFromOtherInCurrentContext(). If the master is a DirectoryUbuntuImpl, calls on its children for the methods setAGOAccessFromTheParentOther() and fireL_inheritedOtherRights(). Fires a PropertyChange for 'OtherRights'.

Parameters:
_s - array of acsrights and/or metarights. May be null.
Throws:
UpDateError - if the other rights are immutable, or if there are more than 20 increasing chains to analyze from one lesser right, or if the new rights contain a 'delete' or 'rename' right, while its parent does not allow it through its deleting-renaming flag.

getL_inheritedGroupRights

protected StringRight[] getL_inheritedGroupRights()
Gets the inherited rights from the parent of the resource group, including the control by the parent sticky bit. Calls BaseUtilityImpl.getChildRightsSetFromParentAGRights(), BaseUtilityImpl.subtractNegativeNotRemovingInOneACS() and BaseUtilityImpl.getDenyDeleteRenameRights().

Returns:
an array of access rights for the GroupID which contains this resource, in the main ACS. May be empty, or null only if the instance is finalized.

getL_inheritedOtherRights

protected StringRight[] getL_inheritedOtherRights()
Gets the inherited rights from the parent of the resource for 'other' AGO rights. Calls BaseUtilityUbuntuImpl.getChildRightsSetFromParentAGORights(), BaseUtilityImpl.subtractNegativeNotRemovingInOneACS() and BaseUtilityImpl.getDenyDeleteRenameRights().

Returns:
an array of access rights for the 'other' AGO category, in the main ACS. May be empty, or null only if the instance is finalized.

getAGOAccessFromTheParentOther

protected boolean getAGOAccessFromTheParentOther()
Returns:
true if the parent authorizes its 'other' AGO category to have access to this instance.

addPropertyChangeListener

protected void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Adds a listener to the bean, for all the bound properties. Used by the master only.

Parameters:
_l - PropertyChangeListener to add. Caution: the listener must NOT have specific hashCode() and equals() methods, to work with HashSet in the removing operations.

addPropertyChangeListener

protected void addPropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Used by the master for the properties: 'OtherRights', 'FromTheParentOther', 'InheritedOtherRights'.

Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to add. Caution: the listener must NOT have specific hashCode() and equals() methods, to work with HashSet in the removing operations.

removePropertyChangeListener

protected void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
Removes a listener to the bean, for all the bound properties. Used by the master.

Parameters:
_l - PropertyChangeListener to remove

removePropertyChangeListener

protected void removePropertyChangeListener(java.lang.String _propertyName,
                                            java.beans.PropertyChangeListener _l)
Removes a listener to the bean. Used by the master for the properties: 'OtherRights', 'FromTheParentOther', 'InheritedOtherRights'.

Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to remove

cloneC

protected CAgoUserUbuntuImpl cloneC(ResourceUbuntu _master)
Clone for embedded class, without registering the new object in the ACSs. The external object references are not cloned (see "Eor" in get method). Used by the master clone() method.

Parameters:
_master - must be a clone of this instance master
Returns:
instance with _master as master.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode value for this object

equals

public boolean equals(java.lang.Object _obj)
Works even if the instance is finalized.

Overrides:
equals in class java.lang.Object
Parameters:
_obj - to compare
Returns:
true if _obj is an instance of CAgoUserUbuntuImpl (or a derived class) equals to this instance (with the same class)

getSerialVersionUID

public long getSerialVersionUID()
Returns:
long

toString

public java.lang.String toString()
Gets the name last component of each privilege. Never null.

Overrides:
toString in class java.lang.Object
Returns:
String

setAGOAccessFromTheParentOther

protected void setAGOAccessFromTheParentOther(boolean _b)
Parameters:
_b - true if the parent authorizes its 'other' AGO category to have access to this instance.

fireL_inheritedOtherRights

protected final void fireL_inheritedOtherRights(StringRight[] _l_old,
                                                StringRight[] _l_new)
Fires the event 'InheritedOtherRights', from the parent of the resource 'other' category. Called by the parent DirectoryUbuntuImpl.setL_otherRights() method.

Parameters:
_l_old - an array of the old access rights for the 'other' AGO category, in the main ACS. May be empty.
_l_new - an array of the new access rights for the 'other' AGO category, in the main ACS. May be empty.

finalizeForBase

protected void finalizeForBase()
                        throws UpDateError
This method is called by finalize(), but finalize() may be not called. An unused object has to be deleted to inform the others objects, and this method HAS TO BE CALLED before deleting the instance. This method does not raise PropertyChangeEvents since the BeanInfo for this class specifies that its ACS informs the listeners when this instance is finalized. To test if an instance has been finalized, uses (master_ == null).

Throws:
UpDateError - is never thrown.

finalizeFromDeserialization

protected void finalizeFromDeserialization()
The instance is NOT removed as a listener, since there is no listener. The internal maps are set to null, but not the private bound properties sets. Does not call finalizeForBase(). Called for EPRViewInBaseImpl only.


firePropertyChange

protected void firePropertyChange(java.lang.String _propertyName,
                                  java.lang.Object _oldValue,
                                  java.lang.Object _newValue)
Fires an event to every registered listener, in any order. For the bound properties 'OtherRights', 'FromTheParentOther', 'InheritedOtherRights'. Called by all the updating methods.

Parameters:
_propertyName - name of the changing property
_oldValue - of the property
_newValue - of the property. No operation if equal to _oldValue and not null.

finalize

protected void finalize()
                 throws java.lang.Throwable
This method calls finalizeForBase(). There is no guaranee that the JVM calls this method before the end of the application.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable