ARoad0.gBase
Class ResourceImpl

java.lang.Object
  extended by ARoad0.gBase.BasicImpl
      extended by ARoad0.gBase.ResourceImpl
All Implemented Interfaces:
ACSObject, BaseBeanManager, BaseObject, Basic, BoundBean, Copyable, FinalizedObject, FinalizedObjectForUser, ImmutableBasic, ImmutableLeaf, ImmutablePrivilegeTarget, ImmutableResource, ImmutableTarget, Leaf, PrivilegeTarget, PrivilegeUser, Resource, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
ActorImpl, DirectoryImpl, ResourceMySQLImpl, ResourceUbuntuImpl

public class ResourceImpl
extends BasicImpl
implements Resource

This class is responsible for modeling a resource, that is an access target, in an access control system on which it is registered. The resource may have a parent in the resource tree of this ACS. The resource is accessed from EligibleParties (userID, groupID, actor) through AclEntries belonging to this ACS or to another one. The resource has an userID (account) and a groupID (group) in this ACS. It has AG rights for them and for the super-administrator of the ACS. The resource is a PrivilegeTarget for PrivilegeForTypes and PrivilegeForLinks.

Directory may manage container-for-target cascading rights to its Resource children, both for the Account/Group rights, the AclEntry rights and the Privilege rights. But only one of these three inheritances is possible in a given ACS. The generic packages handle fully only the AG inherited rights. For the AcsAddons handling of the AclEntry or the Privilege inherited rights, the generic gBase package provides the basic methods on Resource to set and get the inherited rights. The generic gBase package provides also the handling of the listeners for the two property changes 'InheritedTargetPrivileges' and 'InheritedTargetAclEntries', but without any firing of these changes. The generic gWork package handles these three inherited rights in the access path search. An AcsAddon package, to fully process these two inherited rights, has then only to code how the Directory subclass updates the inherited rights in its children, and to code the LinkRightsImpl subclass for overriding some of the 'ThroughNodesTree' methods which implemente the algorithms for the rights inheritance.

All the rights and the type are constrained by the ACS. If 'immutable' is in the Resource type, the class rejects any updating on the userID, groupID, parent and all the rights. Nonetheless, an AclEntry may be added wihtout any removing. If 'byAcsCreator' is in the type, the same behavior is set, and in addition, the user cannot finalize this instance.

It is a javabean with the following bound properties: 'AclRights', 'UserID', 'GroupID', 'RootRights', 'GroupRights', 'OwnerRights', 'EPsThroughAclEntry', 'AcsControllers', 'FromTheParentAccount', 'FromTheParentGroup', 'InheritedOwnerRights', 'InheritedGroupRights', 'OneTargetTypedPrivilege', 'OneTargetLinkedPrivilege', and from the subclasses in the AcsAddon, 'InheritedTargetPrivileges', 'InheritedTargetAclEntries'. The listeners are proper to this instance, outside gBase, 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 in the 'set' method, and a dialog box is displayed to inform the user.

This class has several subclasses in this package and in the AcsAddon packages. Most of the variables are protected.

See Also:
Serialized Form

Field Summary
protected  boolean actorActivated_
          Protected variables
static ResourceImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected  GroupID groupID_
           
protected  AclEntry[] l_aclEntry_
           
protected  StringRight[] l_groupRights_
           
protected  java.util.ArrayList<AclEntry> l_inheritedT_AclEntries_
          List of the current inherited AclEntry.
protected  ImmutableName[] l_OpenAcsControllerNames_
          Array of ACS that control this resource through external AclEntries or external LINKED_FOR_ONE_TO_ONE privileges.
protected  StringRight[] l_ownerRights_
           
protected  boolean[] l_parentTreeAGRightsAllowToGoAcross_
          2 booleans for Account/Group inheritance rights, in this order.
protected  StringRight[] l_rootRights_
           
protected  java.util.Map<java.lang.String,StringRight[]> m_inheritedT_ACLRights_
          TreeMap of inherited AclEntry rights. by default, it is not displayed to the user in the generic BeanInfo class.
protected  Directory parent_
           
static java.io.ObjectStreamField[] serialPersistentFields
          Properties for the serialization
private static long serialVersionUID__
          Private variables
protected  UserID userID_
           
 
Fields inherited from class ARoad0.gBase.BasicImpl
aCS_, aCS_Name_, aliasHandler_, changeSupport_, comment_, folderMember_, INCREMENT_CAPACITY, INITIAL_CAPACITY, INITIAL_CAPACITY_2, iS_Name_, m_ConstrainedChildACS_, name_, PRIME, privHandler_, type_
 
Constructor Summary
ResourceImpl()
          Default constructor.
ResourceImpl(ImmutableName _name, ACS _acs, Directory _parent, UserID _owner, java.lang.String _resourceType)
          Used by the beamer editor for the ACS resources list, from the 'New' button, and by the gWork.AcsFactory.
ResourceImpl(ImmutableName _name, ACS _acs, Directory _parent, UserID _owner, java.lang.String _resourceType, boolean _toRegisterInManager)
          Used for the creation of a resource with its type.
 
Method Summary
 AclEntry addAclEntry(ImmutableACS _aclAcs, ImmutableEligibleParty _ep, StringRight[] _l_right, java.lang.Boolean _positiveRight, ImmutableGroupID _conditionGroup)
          Creates a new AclEntry which delivers rights to an eligible party to access or to deny access to this resource.
protected  void addAcsController(Name _ACSname)
          Called by addAclEntry() and addEorPrivilegeForLinksToTarget().
protected  void addEorPrivilegeForLinksToTarget(PrivilegeForLinks _priv)
          Sets a privilege as applicable to this access target, without right inheritance.
 void addEorPrivilegeForTypeToTarget(PrivilegeForType _priv)
          Sets a privilege as applicable to this access target.
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
 java.lang.Object clone()
          Clones without registering of the new object in the ACSs.
 int compareTo(java.lang.Object o)
          The comparison is based on the name compareTo() method of each resource when they are not equals, except when there is a node.
 boolean containsAclEntryToEP(EligibleParty _ep)
          Tests if an EligibleParty is associated to the resource through an AclEntry.
 java.lang.Object copy(ImmutableName _name, ACS _acs, Directory _parent, java.lang.Boolean _toRegisterInManager)
          Provides a copy of the instance with another name.
protected  ResourceImpl copyOwnAcl(ResourceImpl _result, boolean _withoutInternalAcl, boolean _withoutExternalAcl)
          This method provides a copy of the AclEntries, all the AclEntries (see restrictions) or only the external ones.
protected  ResourceImpl copyOwnVariables(ResourceImpl _result, boolean _withoutInternalAcl)
          This method provides a copy of the instance variables.
 java.lang.Object copyWithoutInternalAcl(ImmutableName _name, ACS _acs, Directory _parent, java.lang.Boolean _toRegisterInManager)
          Provides a copy of the instance as Copyable.copy(), but without copying the internal aclEntries.
 boolean equals(java.lang.Object _obj)
          Does not compare the comment.
 void finalizeForBase()
          This method removes the resource from the ACS lists (main and controllers), from its parent, its userID and its groupID.
protected  void finalizeFromDeserialization()
          NO USE.
protected  void fireL_inheritedGroupRights(StringRight[] _l_old, StringRight[] _l_new)
          Fires the event 'InheritedGroupRights', from the parent of the resource group.
protected  void fireL_inheritedOwnerRights(StringRight[] _l_old, StringRight[] _l_new)
          Fires the event 'InheritedOwnerRights', from the parent of the resource owner.
 boolean getActorActivated()
          Used by ACS.getEorM_OwnActors(), and by ACSTreeBaseListenerImpl for detecting the case of a wrong actor creation.
 boolean getAGOAccessFromTheParentAccount()
          Note: the access from the parent userID depends only to the userID rights.
 boolean getAGOAccessFromTheParentGroup()
           
 ImmutableGroupID getEorGroupID()
           
 java.util.List<AclEntry> getEorImmutableL_TargetInheritedAclEntries()
          Gets the immutable list of all the inherited AclEntries of the target.
 java.util.List<PrivilegeForLinks> getEorImmutableL_TargetInheritedLinkedPrivileges()
          Gets all the immutable list of the inherited linked privileges of the target.
 java.util.Set<ImmutableEligibleParty> getEorL_EPthroughAclEntry()
          Gets all the EligibleParties associated to the Resource through at least one AclEntry.
 java.util.ArrayList<AclEntry> getEorL_TargetInheritedAclEntries()
          Gets a reference on all the inherited AclEntries of this target.
 java.util.List<PrivilegeForLinks> getEorL_TargetInheritedLinkedPrivileges()
          Gets all the inherited linked privileges of this target.
 java.util.List<PrivilegeForLinks> getEorL_TargetPrivilegeForLinks()
          Gets all the privilegeForLinks linked to this target, not the privilegeForTypes.
 java.util.List<PrivilegeForType> getEorL_TargetPrivilegeForTypes()
          Gets all the PrivilegeForTypes of this target.
 java.util.List<Privilege> getEorL_TargetPrivileges()
          Gets all the direct privileges linked to this target, not the inherited ones.
 ImmutableNode getEorParent()
          Gets the current parent node of the resource
 ImmutableUserID getEorUserID()
          Get the userID, following the AGO rights.
 AclEntry[] getL_aclEntry()
          Gets the AclEntries of this resource.
 ImmutableName[] getL_AcsControllers()
          Gets the open ACS that manages an external AclEntry or Linked Privilege for this resource.
 StringRight[] getL_groupRights()
          caution: does not take these rights in account if the parent tree does not allow any access while AG rights inheritance is managed.
 StringRight[] getL_inheritedGroupRights()
          Gets the inherited rights from the parent of the resource group.
 StringRight[] getL_inheritedOwnerRights()
          Gets the inherited rights from the parent of the resource owner.
 StringRight[] getL_ownerRights()
          Gets the rights of the resource owner.
 StringRight[] getL_rootRights()
          Get the rights of the root, following AGO rights concept.
 java.util.Map<java.lang.String,StringRight[]> getM_TargetInheritedACLRights()
          Gets the internal map of the inherited AclEntry rights, where the default key is the name of the EligibleParty having the rights on the target, extended with, as last component, the parent order of the target parent which has given the rights.
 java.util.Map<java.lang.String,StringRight[]> getM_TargetInheritedLinkedPRIRights()
          Gets the internal map of the inherited linked privilege rights, where the default key is the name of the EligibleParty having the rights, extended with, as last component, the parent order of the direct or indirect parent which has given the rights.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
          Returns the change listeners for a property.
 java.lang.String getResourceType()
          The resource types are generally defined at the ACS level.
 long getSerialVersionUID()
          For the java serialization.
 int hashCode()
           
 boolean hasTheAccountAndGroupOfParent()
          If there is no parent, return true to avoid useless processing.
protected  void removeACL(ImmutableACS _aclAcs, ImmutableEligibleParty _ep, boolean _positiveRight, ImmutableGroupID _conditionGroup)
          Deletes an inner AclEntry which delivers rights to an EligibleParty to access or to deny access to this Resource.
 void removeAclEntry(ImmutableACS _aclAcs, ImmutableEligibleParty _ep, boolean _positiveRight, ImmutableGroupID _conditionGroup)
          Deletes an aclEntry which delivers rights to an eligible party to access or to deny access to this resource.
protected  void removeAcsController(ImmutableName _ACSname)
          Called by removeAclEntry() and removeEorPrivilegeToTarget().
protected  void removeEorGroupID()
          Removes the groupID of the resource.
 void removeEorPrivilegeToTarget(Privilege _priv)
          Unregisters the privilege when it is no more used by this privilege target.
protected  void removeEorUserID()
          Removes the userID of the resource.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
 void resetInheritedAclEntryRights(AclEntry _acl)
          Resets the inherited AclEntry rights after an user edition.
 void resetInheritedPrivilegeRights(PrivilegeForLinks _lpri)
          Resets the inherited Privilege rights after an user edition.
 AclEntry selectInheritedAclEntry(AclEntry _acl, java.lang.String _type)
          Returns the AclEntry to use as inherited AclEntry in a child.
 PrivilegeForLinks selectInheritedPrivilege(PrivilegeForLinks _lpri, java.lang.String _type)
          Returns the Privilege to use as inherited Privilege in a child.
protected  void setAGOAccessFromTheParentAccount(boolean _b)
          Called by DirectoryImpl.setL_ownerRights().
protected  void setAGOAccessFromTheParentGroup(boolean _b)
          Called by DirectoryImpl.setL_groupRights().
 void setEorGroupID(ImmutableGroupID _g)
          Defines the main group owning this resource as an access target.
 void setEorParent(Node _par, java.lang.Object _caller)
          Deprecated. finalizeForBase() uses parent_.removeEorChild()
 void setEorUserID(ImmutableUserID _u)
          Sets the userID of the resource, and set the current userID in the own actors if it was the previous userID.
 void setL_groupRights(StringRight[] _s)
          Sets the rights for the members of the groupID which owns this resource.
 void setL_ownerRights(StringRight[] _s)
          Sets the rights for the account which owns this resource.
 void setL_rootRights(StringRight[] _s)
          Sets the rights for the userID 'root'.
 void setResourceType(java.lang.String _st)
          Sets the type which drives the immutablility and the allowed rights of the object.
 java.lang.String toString()
          Gets the name last component of the instance.
 
Methods inherited from class ARoad0.gBase.BasicImpl
addAcsOfSoftReferences, addConstrainedChildACS, addEorSoftAlias, addInVFolderList, addInViewList, addPropertyChangeListener, copyOwnVariables, finalize, finalizeForUser, firePropertyChange, getAcsName, getComment, getEorACS, getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getFullName, getHasSoftAlias, getImpliedViews, getIS_Name, getL_AcsOfSoftReferences, getL_SoftAlias, getM_ConstrainedChildACS, getName, getNickName, getType, getVirtualFolders, removeAcsOfSoftReferences, removeConstrainedChildACS, removeEorSoftAlias, removeInVFolderList, removeInViewList, removePropertyChangeListener, setComment, setEorAliasAsInternalHardReference, setEorReferenceAsInternalHardAlias, setType
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableResource
getM_ConstrainedChildACS
 
Methods inherited from interface ARoad0.gBaseInterface.Basic
finalizeForUser, setComment
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableBasic
getComment, getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getImpliedViews, getIS_Name, getL_AcsOfSoftReferences, getL_SoftAlias, getVirtualFolders
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutablePrivilegeTarget
getType
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableTarget
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias
 
Methods inherited from interface ARoad0.gBaseInterface.ACSObject
getAcsName, getEorACS
 
Methods inherited from interface ARoad0.gBaseInterface.BaseObject
getFullName, getName, getNickName
 

Field Detail

actorActivated_

protected boolean actorActivated_
Protected variables


l_rootRights_

protected StringRight[] l_rootRights_

l_groupRights_

protected StringRight[] l_groupRights_

l_ownerRights_

protected StringRight[] l_ownerRights_

userID_

protected UserID userID_

groupID_

protected GroupID groupID_

parent_

protected Directory parent_

l_parentTreeAGRightsAllowToGoAcross_

protected boolean[] l_parentTreeAGRightsAllowToGoAcross_
2 booleans for Account/Group inheritance rights, in this order. Updated by the direct and indirect parents in DirectoryImpl.setAllowToGoAccross(). The first boolean is true if, for its userID, this resource may be accessed through the parent tree. Used in get/setL_xxxRights(). The default value is true for all the booleans. In the AcsAddon Ubuntu, this property is completed by a third boolean to handle the 'other' property.


serialVersionUID__

private static final long serialVersionUID__
Private variables

See Also:
Constant Field Values

l_aclEntry_

protected AclEntry[] l_aclEntry_

m_inheritedT_ACLRights_

protected java.util.Map<java.lang.String,StringRight[]> m_inheritedT_ACLRights_
TreeMap of inherited AclEntry rights. by default, it is not displayed to the user in the generic BeanInfo class. The default key is the name of the EligibleParty having the rights, extended with, as last component, the String order of the parent which has given the rights. For instance, the direct parent has the string '1' and its direct parent has the string '2' as last name component. A subclass may change the key form, and it may choose to not use this property. A subclass may use the constructor TreeMap(Comparator comparator) to set an ordering which is different to the natural ordering of the keys. An AcsAddon may choose to not use this property while it handles the inherited ACL.


l_inheritedT_AclEntries_

protected java.util.ArrayList<AclEntry> l_inheritedT_AclEntries_
List of the current inherited AclEntry. The default value is null. This is the data source of m_inheritedT_ACLRights_.


l_OpenAcsControllerNames_

protected ImmutableName[] l_OpenAcsControllerNames_
Array of ACS that control this resource through external AclEntries or external LINKED_FOR_ONE_TO_ONE privileges. May be null.


EMPTY_INSTANCE

public static final ResourceImpl 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
Properties for the serialization

Constructor Detail

ResourceImpl

public ResourceImpl()
Default constructor. No registration in the ACS. Defines "full control" default rights for the owner, and no right for the group.


ResourceImpl

public ResourceImpl(ImmutableName _name,
                    ACS _acs,
                    Directory _parent,
                    UserID _owner,
                    java.lang.String _resourceType)
             throws CreateError
Used by the beamer editor for the ACS resources list, from the 'New' button, and by the gWork.AcsFactory. Calls the other constructor.

Parameters:
_name - ImmutableName of the resource
_acs - main ACS of the resource
_parent - of the resource; may be null.
_owner - owns the resource; may be null.
_resourceType - is the resource type which drives the rights and the immutability of the instance. If null, the value is set to "<undefined>".
Throws:
CreateError - if ACSImpl.newEorResource() throws it; the instance has then to be deleted !

ResourceImpl

public ResourceImpl(ImmutableName _name,
                    ACS _acs,
                    Directory _parent,
                    UserID _owner,
                    java.lang.String _resourceType,
                    boolean _toRegisterInManager)
             throws CreateError
Used for the creation of a resource with its type. If _owner is null, the new resource account is the parent account. If _owner is not null, the resource account is _owner, and its group is the account primary group if it is not null and if the parent group does not enforce 'ChildGID'. Else, the new resource group is the parent group. If _resourceType has the format '<byAcsCreator> fffff', the parent must have '<fffff_subacs>' as a component in its name. If this format is the parent type format, no child adding is allowed. If _resourceType has not the format '<byAcsCreator> fffff' nor '<byAcsCreator>', with the ACS having 'ffffff' as a subACS type, the parent must not have '<fffff_subacs>' as a component in its name. Controls the ACS constraints for 'Directory.TypesOfChildFor.' on the parent type, and 'Resource.NoAccount'. Defines "full_control" default rights for the owner and "|is_superadmin|" for root. Used by copy() and the subclass constructors.

Parameters:
_name - non-null ImmutableName of the resource to create
_acs - main ACS of the resource to create
_parent - has the resource as child; may be null or immutable.
_owner - owns the resource; if null, the parent account is used if any.
_resourceType - is the resource type which drives the rights and the immutability of the instance. If null, the value is set to "<undefined>".
_toRegisterInManager - false if this method must not register the instance in its ACS.
Throws:
CreateError - if ACSImpl.newEorResource() throws it, if _parent is not a DirectoryImpl or does not allow an adding of child, if the parent type is '<byAcsCreator> fffff', if the resource has a strong type but is not under the right parent - the instance has then to be deleted! - or if _bridgeRef does not belong to another ACS - the new instance is then finalized before the exception is thrown.
Method Detail

copy

public java.lang.Object copy(ImmutableName _name,
                             ACS _acs,
                             Directory _parent,
                             java.lang.Boolean _toRegisterInManager)
                      throws CreateError
Provides a copy of the instance with another name. Each internal variable that is an external object reference have a shallow copy (no deep copy). Most of the aclEntries are copied, but not the list of ViewInBase that contains this instance. Caution: does not copy the user and the group if _result does not belong to aCS_ and if there are no user or group in the _result ACS which have similar names - that is that are ended by the same last component in this instance user or group names.

For aclEntries, if _result ACS is not this resource ACS, and if the aclEntry ACS is this resource ACS, sets _result ACS as the aclEntry ACS of the copied acl. Caution: does not copy an aclEntry if:

- _acs is not this resource ACS,

- the acl eligible party ACS is this resource ACS,

- and there is no matched EligibleParty (with the same last components) in _acs

Calls copyOwnVariables(). This method is overridden by the subclasses.

Specified by:
copy in interface Copyable
Overrides:
copy in class BasicImpl
Parameters:
_name - copy name. Usually creates as an extension of _parent name.
_acs - main ACS of the copy to create. May not be the ACS of this instance.
_parent - DirectoryImpl which belongs to _acs and will have the copy. May be null.
_toRegisterInManager - false if this method must not register the instance in the ACS.
Returns:
a new instance of ResourceImpl
Throws:
CreateError - of the constructor with the same parameters, or if _parent ACS is not _acs, or addAclEntry() exceptions.

copyWithoutInternalAcl

public java.lang.Object copyWithoutInternalAcl(ImmutableName _name,
                                               ACS _acs,
                                               Directory _parent,
                                               java.lang.Boolean _toRegisterInManager)
                                        throws CreateError
Provides a copy of the instance as Copyable.copy(), but without copying the internal aclEntries. It is used for ACSImpl.copy(), because all the EP must be copied first before the copy of all the resources with their aclEntries. Each internal variable that is an external object reference has a shallow copy (no deep copy), but without copy for the internal aclEntry nor the list of ViewInBase that contains this instance. Called from BaseUtilitiesImpl.copyDirectoriesAndActors(). Calls copyOwnVariables().

Specified by:
copyWithoutInternalAcl in interface Resource
Parameters:
_name - copy name. Usually creates as an extension of _parent name.
_acs - main ACS of the copy to create. May not be the ACS of this instance.
_parent - is not used, wathever the value.
_toRegisterInManager - false if this method must not register the instance in the ACS.
Returns:
a new instance of this class
Throws:
CreateError - of the constructor with the same parameters, or if _parent ACS is not _acs, or addAclEntry() exceptions.

setEorParent

public final void setEorParent(Node _par,
                               java.lang.Object _caller)
                        throws BaseError
Deprecated. finalizeForBase() uses parent_.removeEorChild()

Defines the parent node and updates it. Noop if the type contains 'byAcsCreator' or 'immutable'. The previous parent is updated, except if it is the caller of this method, or if this instance is a new clone (see clone()).

Parameters:
_par - is the new parent of this leaf, as an external object reference. The new parent is updated. May be null.
_caller - of this method; if it is the parent or this instance, the parent is not updated
Throws:
BaseError - if the parent is not own by the same acs, or InternalError if parent.setEorL_Children() throws a BaseError, or if it is immutable for its parent.

getEorParent

public final ImmutableNode getEorParent()
Gets the current parent node of the resource

Specified by:
getEorParent in interface ImmutableLeaf
Returns:
a reference on the parent node. May be null.

getL_AcsControllers

public ImmutableName[] getL_AcsControllers()
Gets the open ACS that manages an external AclEntry or Linked Privilege for this resource. The resource ACS forbids to have both external ACL and external privilege. For compatibility purpose about the version 0.7.0, this method removes the null values in the array.

Specified by:
getL_AcsControllers in interface ImmutableResource
Returns:
the open ACS controller names. May be null, never empty nor with null items.

setEorUserID

public void setEorUserID(ImmutableUserID _u)
                  throws UpDateError
Sets the userID of the resource, and set the current userID in the own actors if it was the previous userID. It is a bound property. Changes the group, which becomes the primary group of the new account if it is not null. Noop and error mesage to the user if the resource type starts with '<byAcsCreator>' or '<immutable>', or if 'Resource.NoAccount' in the ACS container policy forbids the account for this resource type. Overridden in the AcsAddon Ubuntu.

Specified by:
setEorUserID in interface Resource
Parameters:
_u - owns this resource, in the main ACS. May be null.
Throws:
UpDateError - if _u does not belong to this resource main ACS, or if it is immutable for its userID.

getEorUserID

public ImmutableUserID getEorUserID()
Description copied from interface: ImmutableResource
Get the userID, following the AGO rights.

Specified by:
getEorUserID in interface ImmutableResource
Returns:
ImmutableUserID which owns this resource, in the main ACS. May be null.

setL_ownerRights

public void setL_ownerRights(StringRight[] _s)
                      throws UpDateError
Sets the rights for the account which owns this resource. The rights may be acsrights and metarights, positive and negative rights. The ACS constraints on 'OwnerRights' are applied only if they are not null, otherwise all the arguments are validated. If a new right is not allowed by the ACS, it is removed without comment to the user, and the other rights are kept. The negative rights are subtracted from the positive rights. No action if the instance has been finalized. Noop if the resource type contains 'byAcsCreator' or 'immutable'. No adding of null or negative elements. The 'full_control' equivallent is the default right if there is no umask. Called by the constructor to copy the parent rights. Calls BaseUtilityImpl.subtractNegativeFromPositiveInOneACS() and UtilityImpl.selectHeaders(). Overridden and called by DirectoryImpl to update l_parentTreeAGRightsAllowToGoAcross_. Fires a PropertyChange for 'OwnerRights'.

Specified by:
setL_ownerRights in interface Resource
Parameters:
_s - array of acsrights and/or metarights. May be null.
Throws:
UpDateError - if the owner rights are immutable, if there are more than 20 increasing chains to analyze from one lesser right.

getL_ownerRights

public final StringRight[] getL_ownerRights()
Gets the rights of the resource owner. Caution: do not take these rights in account if the parent tree does not allow any access, while the AG rights inheritance is managed.

Specified by:
getL_ownerRights in interface ImmutableResource
Returns:
an array of positive access rights for the UserID which owns this resource, in the main ACS. No null value. May be empty, or null only if the instance is finalized.

setEorGroupID

public void setEorGroupID(ImmutableGroupID _g)
                   throws UpDateError
Defines the main group owning this resource as an access target. Called by setEorUserID() to set as new group, the primary group of the new account. Sets the group rights to null. Noop and error mesage to the user if the resource type contains '<byAcsCreator>' or '<immutable>'. Reads the ACS 'GroupID.NoMainGroup' values to check if the argument may be a main group. It is a bound property.

Specified by:
setEorGroupID in interface Resource
Parameters:
_g - GroupID which owns this resource, in the main ACS. May be null.
Throws:
UpDateError - if _g does not belong to the main ACS of this resource, or if it is immutable for its groupID.

getEorGroupID

public ImmutableGroupID getEorGroupID()
Specified by:
getEorGroupID in interface ImmutableResource
Returns:
ImmutableGroupID primary group which owns this resource, in the main ACS. May be null.

setL_groupRights

public void setL_groupRights(StringRight[] _s)
                      throws UpDateError
Sets the rights for the members of the groupID which owns this resource. The rights may be acsrights and metarights, positive and negative rights. The ACS constraints on 'GroupRights' 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. No adding of null or negative elements. Noop if the resource type contains '<byAcsCreator>' or '<immutable>'. Calls BaseUtilityImpl.subtractNegativeFromPositiveInOneACS() and UtilityImpl.selectHeaders(). Called by the constructor and setEorGroupID(). Overridden, and also called, by DirectoryImpl to update l_parentTreeAGRightsAllowToGoAcross_. Overridden by the AcsAddon Resource subclasses. Fires a PropertyChange for 'GroupRights'.

Specified by:
setL_groupRights in interface Resource
Parameters:
_s - array of acsrights and/or metarights. May be null.
Throws:
UpDateError - if the group rights are immutable, or if there are more than 20 increasing chains to analyze from one lesser right.

getL_groupRights

public final StringRight[] getL_groupRights()
caution: does not take these rights in account if the parent tree does not allow any access while AG rights inheritance is managed.

Specified by:
getL_groupRights in interface ImmutableResource
Returns:
an array of positive access rights for the GroupID which owns this resource, in the main ACS. No null value. May be empty, or null only if the instance is finalized.

hasTheAccountAndGroupOfParent

public final boolean hasTheAccountAndGroupOfParent()
If there is no parent, return true to avoid useless processing. Return also true if the 4 compared objects are null. Note: unused in gWork since even when the parent has the same A and G, this parent may have different rights than this resource rights.

Specified by:
hasTheAccountAndGroupOfParent in interface ImmutableResource
Returns:
true if this instance has the same userID and main group than its direct parent.

getAGOAccessFromTheParentAccount

public boolean getAGOAccessFromTheParentAccount()
Note: the access from the parent userID depends only to the userID rights.

Specified by:
getAGOAccessFromTheParentAccount in interface ImmutableResource
Returns:
true if the parent authorizes its userID to have access to this instance.

getAGOAccessFromTheParentGroup

public boolean getAGOAccessFromTheParentGroup()
Specified by:
getAGOAccessFromTheParentGroup in interface ImmutableResource
Returns:
true if the parent authorizes its groupID to have access to this instance.

getL_inheritedOwnerRights

public StringRight[] getL_inheritedOwnerRights()
Gets the inherited rights from the parent of the resource owner. Calls BaseUtilityImpl.getChildRightsFromParentAGRights().

Specified by:
getL_inheritedOwnerRights in interface ImmutableResource
Returns:
an array of access rights for the UserID which owns this resource, in the main ACS. May be empty but not null.

getL_inheritedGroupRights

public StringRight[] getL_inheritedGroupRights()
Gets the inherited rights from the parent of the resource group. Calls BaseUtilityImpl.getChildRightsSetFromParentAGRights().

Specified by:
getL_inheritedGroupRights in interface ImmutableResource
Returns:
an array of access rights for the GroupID which contains this resource, in the main ACS. May be empty but not null.

setL_rootRights

public void setL_rootRights(StringRight[] _s)
                     throws UpDateError
Sets the rights for the userID 'root'. 'full_control' equivallent is a mandatory right, even if it is not in the constrained rights list. No action if the instance has been finalized or if a right is not allowed. Noop if the resource type contains '<byAcsCreator>' or '<immutable>'. Fires a PropertyChange for 'RootRights'.

Specified by:
setL_rootRights in interface Resource
Parameters:
_s - array of acsrights and/or metarights. May be null.
Throws:
UpDateError - if the root rights are immutable.

getL_rootRights

public final StringRight[] getL_rootRights()
Description copied from interface: ImmutableResource
Get the rights of the root, following AGO rights concept.

Specified by:
getL_rootRights in interface ImmutableResource
Returns:
an array of access rights for the root UserID, in the main ACS, following the Unix/Linux scheme. No null value. May be empty, or null only if the instance is finalized.

setResourceType

public void setResourceType(java.lang.String _st)
                     throws UpDateError
Sets the type which drives the immutablility and the allowed rights of the object. Called by the constructor and ActorImpl.setEPType() since the EPType is then the ResourceType. This is just a wrapper of super.setType() and it fires the event 'ResourceType'.

Specified by:
setResourceType in interface Resource
Parameters:
_st - type of the resource.
Throws:
UpDateError - if the type is null, starts with , or not known by the ACS, or not associated to the previous type.

getResourceType

public java.lang.String getResourceType()
The resource types are generally defined at the ACS level.

Specified by:
getResourceType in interface ImmutableResource
Returns:
String of resource type, as for exemple "executable" or "file". May be null.

addAclEntry

public AclEntry addAclEntry(ImmutableACS _aclAcs,
                            ImmutableEligibleParty _ep,
                            StringRight[] _l_right,
                            java.lang.Boolean _positiveRight,
                            ImmutableGroupID _conditionGroup)
                     throws CreateError
Creates a new AclEntry which delivers rights to an eligible party to access or to deny access to this resource. The resource name must have a name following the pattern IS_name / ACS_name / resource_name, to allow the identification of the ACS in the EligibleParty _ep. The new AclEntry is added at the end of the current list. This method rejects a new non-conditional ACL having the set (ACS, source, target, sens) of a known non-conditional ACL, while a conditional ACL may have the same set. This method rejects a new right-condition ACL having the set (ACS, source, target, sens) of a known conditional ACL, while a non-conditional ACL may have the same set. This method rejects a new flexible conditional ACL having the first condition group of a known conditional ACL and the same set (ACS, source, target, sens), but it may be the second condition group of this conditional ACL.

The control of the ACS policy is done in the AclEntry constructor and the ACS. For the creation of the ACL by the user, if there is no rights to select, BaseObjectHandler.setRestrictedSelectedArguments() sets an array with a null object as first value, and this method produces an exception. On the other hand, an association may use a null value for the rights array, and this is allowed to create an ACL without rights. There is an error mesage to the user if the resource or the EP is immutable. The creation of the inherited AclEntry in a child is not handled by the generic gBase package, while the rights updating of the inherited AclEntry is handled by the generic classes AclEntryImpl, ResourceImpl and DirectoryImpl. The sequence of calls from this method is the following:

- new AclEntryImpl,

- ACS.newAclEntry(),

- EligibleParty.addEorAclEntryToEP(),

- updating of l_aclEntry_,

- addAcsController(),

- firePropertyChange().

'AclRights' and 'EPsThroughAclEntry' are bound properties. The 'AclRights' event sends some copies of the old and the new array of AclEntry. 'AclRights' must be also the bound property name of the rights in AclEntryImpl, to allow the work of GUI1 classes, and the sended values are then a StringRight array. 'AclRights' is listen by every gWork.RightsMediatorImpl where the view depends on the AclEntries of this resource.

Specified by:
addAclEntry in interface Resource
Parameters:
_aclAcs - ImmutableACS which owns the new AclEntry, and to be recorded as an ACS controller of this resource if it is not its main ACS.
_ep - EligibleParty connected to the resource through a new aclEntry. It has to not be immutable, but may be created by the program.
_l_right - is an array of positive or negative rights of _ep on this resource (that is, if READ is a right, _ep can read on the resource). May be null.
_positiveRight - is true if the rights are set to authorize (grant), and false if they are set to forbid (deny).
_conditionGroup - first condition group. May be null.
Returns:
the new AclEntry.
Throws:
java.lang.InternalError - if this resource has a null name or a null ACS, or if _ep is not an EligiblePartyImpl nor an ActorImpl.
CreateError - if _ep or _aclAcs is null, or if _ep is already recorded in this resource with the same ACS, or thrown by the AclEntry constructor or ACS.newEorAclEntry().

removeAclEntry

public void removeAclEntry(ImmutableACS _aclAcs,
                           ImmutableEligibleParty _ep,
                           boolean _positiveRight,
                           ImmutableGroupID _conditionGroup)
                    throws UpDateError
Deletes an aclEntry which delivers rights to an eligible party to access or to deny access to this resource. 'EPsThroughAclEntry' and 'AclRights' are bound properties, and 'AclRights' is the last firing. This method unregisters the relevant AclEntry in the EligibleParty, in this Resource, and in the relevant ACS. The ACS of the AclEntry may be unregistered in this resource if there are no other AclEntry owned by this ACS in this resource. Noop and error mesage to the user if the resource or the EP is immutable. Calls removeACL().

Specified by:
removeAclEntry in interface Resource
Parameters:
_aclAcs - ImmutableACS which owns the AclEntry, and is recorded as an ACS controller of this resource.
_ep - eligible party connected to the resource through an AclEntry.
_positiveRight - is true if the rights are oriented to authorize, and false if they are oriented to forbid.
_conditionGroup - first condition group. May be null.
Throws:
UpDateError - if _ep is null, unknown, if _aclAcs is closed or unknown, or if the type does not allow this operation.

getL_aclEntry

public final AclEntry[] getL_aclEntry()
Gets the AclEntries of this resource. The AclEntries are not ordering from the AcsControllers names.

Specified by:
getL_aclEntry in interface ImmutableResource
Returns:
a new array with direct references to the AclEntries. May be empty. If the instance is finalized, return null.

containsAclEntryToEP

public boolean containsAclEntryToEP(EligibleParty _ep)
Tests if an EligibleParty is associated to the resource through an AclEntry.

Specified by:
containsAclEntryToEP in interface ImmutableResource
Parameters:
_ep - EligibleParty to test. May be null.
Returns:
true if _ep is referenced in at least one aclEntry in this resource.

getEorL_EPthroughAclEntry

public java.util.Set<ImmutableEligibleParty> getEorL_EPthroughAclEntry()
Gets all the EligibleParties associated to the Resource through at least one AclEntry.

Specified by:
getEorL_EPthroughAclEntry in interface ImmutableResource
Returns:
Set of EligibleParties, through external object references. May be empty, but not null.

getEorL_TargetPrivilegeForLinks

public java.util.List<PrivilegeForLinks> getEorL_TargetPrivilegeForLinks()
Gets all the privilegeForLinks linked to this target, not the privilegeForTypes. Return only the direct privileges, even if the privilege cascading is activated.

Specified by:
getEorL_TargetPrivilegeForLinks in interface ImmutablePrivilegeTarget
Returns:
List of PrivilegeForLinks. May be empty, but never null.

getEorL_TargetPrivilegeForTypes

public java.util.List<PrivilegeForType> getEorL_TargetPrivilegeForTypes()
Gets all the PrivilegeForTypes of this target. Does not include the TYPED_FOR_SEED and TYPED_CLASSED_SPECIFIC privileges.

Specified by:
getEorL_TargetPrivilegeForTypes in interface ImmutablePrivilegeTarget
Returns:
List of PrivilegeForTypes. May be empty, but never null.

getEorL_TargetPrivileges

public java.util.List<Privilege> getEorL_TargetPrivileges()
Gets all the direct privileges linked to this target, not the inherited ones. There is two types of privilege links (allowed or not by the ACS):

- PrivilegeForLinks: linked privilege established for a couple (ACSObject, privilege),

- PrivilegeForType: typed privilege, where the ACSObject and the privilege has a common type, but without the TYPED_FOR_SEED and TYPED_CLASSED_SPECIFIC privileges.

Specified by:
getEorL_TargetPrivileges in interface ImmutablePrivilegeTarget
Returns:
List of Privileges. May be empty, but never null.

addEorPrivilegeForTypeToTarget

public void addEorPrivilegeForTypeToTarget(PrivilegeForType _priv)
                                    throws BaseError
Sets a privilege as applicable to this access target. This method is called only by PrivilegeForTypeImpl at any creation/deletion of a typed privilege or an access target. For the PrivilegeForTypes, only the TYPED and TYPED_CLASSED privilege may be argument. This is false for the TYPED_CLASSED_SPECIFIC and TYPED_FOR_SEED privileges, and this produces the throwning of an InternalError. Called by BasicImpl.setType(), to the indirect request of the instance constructor. Fires 'OneTargetTypedPrivilege' events.

Specified by:
addEorPrivilegeForTypeToTarget in interface PrivilegeTarget
Parameters:
_priv - to register in the target
Throws:
BaseError - if this instance is not a privilege target, if the privilege second type is not authorized for this target.

removeEorPrivilegeToTarget

public void removeEorPrivilegeToTarget(Privilege _priv)
                                throws BaseError
Unregisters the privilege when it is no more used by this privilege target. Called by PrivilegeForLinksImpl and PrivilegeForTypeImpl, NOT by the GUI. PrivilegeForLinksimpl.removeEorPrivilegeTargetLink() checks the type of the target to forbid a change on an immutable target. Calls removeAcsController() for an external one-to-one linked privilege. Fires 'OneTargetTypedPrivilege' or 'OneTargetLinkedPrivilege' event, and, for a typed privilege, calls it fireOneTypedPrivilegeTargetEvent() method.

Specified by:
removeEorPrivilegeToTarget in interface PrivilegeTarget
Parameters:
_priv - to remove
Throws:
BaseError - if the privilege or this source is unknown, or from removeAcsController().

getEorImmutableL_TargetInheritedLinkedPrivileges

public java.util.List<PrivilegeForLinks> getEorImmutableL_TargetInheritedLinkedPrivileges()
Gets all the immutable list of the inherited linked privileges of the target. The LINKED_IF_ALL_SOURCE type is forbidden, and any privilege having more than one target. The generic gWork package denies any access if the returned value is null and if the Privilege inheritance is managed. Null is the default and immutable returned value in this generic gBase class, and this has to be changed in an AcsAddon implementing the inheritance. The privilege is not a clone, and the target is never this instance. In the BeanInfo class of the Resource subclass that extends this class in an AcsAddon package, this property has to be put in the pane ' PRI Inheritance '. Called by gWork.LinkRights.withAccessThroughNodesTreeFromEP() and getL_accessRightsThroughNodesTree().

Specified by:
getEorImmutableL_TargetInheritedLinkedPrivileges in interface ImmutablePrivilegeTarget
Returns:
immutable list of Linked Privileges. May be empty but never null.

getM_TargetInheritedLinkedPRIRights

public java.util.Map<java.lang.String,StringRight[]> getM_TargetInheritedLinkedPRIRights()
Gets the internal map of the inherited linked privilege rights, where the default key is the name of the EligibleParty having the rights, extended with, as last component, the parent order of the direct or indirect parent which has given the rights. For instance, the direct parent has the string '1', and its direct parent has the string '2' as parent order in the last name component, and so on. This property is not displayed to the user. A subclass may change the key form. The map value is always a non-null StringRight array of inherited rights, and it may be empty. Called by gWork.LinkRights.withAccessThroughNodesTreeFromEP() and getL_accessRightsThroughNodesTree(), but only in the AcsAddons implementing the linked privilege inheritance. Such an AcsAddon may also choose to not use this property.

Specified by:
getM_TargetInheritedLinkedPRIRights in interface ImmutablePrivilegeTarget
Returns:
unmodifiable map of inherited rights from the linked privileges. May be empty but never null.

getEorImmutableL_TargetInheritedAclEntries

public java.util.List<AclEntry> getEorImmutableL_TargetInheritedAclEntries()
Gets the immutable list of all the inherited AclEntries of the target. To use by the consumers in the GUI and gWork packages. The generic gWork package denies any access if the returned value is null and if the AclEntry inheritance is managed. Null is the default and immutable returned value in this generic gBase class, and this has to be changed in an AcsAddon implementing the inheritance. The AclEntry is not a clone, and the target is never this instance. In the BeanInfo class of the Resource subclass that extends this class in an AcsAddon package, this property has to be put in the pane ' ACL Inheritance '. Called by gWork.NodeRights.withAccessThroughNodesTreeFromEP() and getL_accessRightsThroughNodesTree().

Specified by:
getEorImmutableL_TargetInheritedAclEntries in interface ImmutableResource
Returns:
immutable list of AclEntries. May be empty or null.
See Also:
getEorL_TargetInheritedAclEntries()

getM_TargetInheritedACLRights

public java.util.Map<java.lang.String,StringRight[]> getM_TargetInheritedACLRights()
Gets the internal map of the inherited AclEntry rights, where the default key is the name of the EligibleParty having the rights on the target, extended with, as last component, the parent order of the target parent which has given the rights. For instance, the direct parent has the string '1', and its direct parent has the string '2' as parent order in the last name component, and so on. This property is not displayed to the user. A subclass may change the key form. A subclass may use the constructor TreeMap(Comparator comparator) to set an ordering which is different to the natural ordering of the keys. The map value is always a non-null StringRight array of inherited rights, and it may be empty. Called for the gWork consumers, but only in the AcsAddons implementing the ACL inheritance. Such an AcsAddon may also choose to not use this property.

Specified by:
getM_TargetInheritedACLRights in interface ImmutableResource
Returns:
unmodifiable map of inherited rights from the AclEntries. May be empty but never null.

getActorActivated

public boolean getActorActivated()
Used by ACS.getEorM_OwnActors(), and by ACSTreeBaseListenerImpl for detecting the case of a wrong actor creation.

Specified by:
getActorActivated in interface ImmutableResource
Returns:
true if this resource is an actor.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String _propertyName,
                                      java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Used by Gui1.CommonPropertyEditor for the properties: 'AclRights', 'UserID', 'GroupID', 'RootRights', 'GroupRights', 'OwnerRights', 'EPsThroughAclEntry', 'AclAcsControllers', 'PriAcsController', 'FromTheParentAccount', 'FromTheParentGroup', 'InheritedOwnerRights', 'InheritedGroupRights', 'OneTargetTypedPrivilege', 'OneTargetLinkedPrivilege', and from the subclasses in the AcsAddon, 'InheritedTargetPrivileges', 'InheritedTargetAclEntries'. Overrides the super method and calls it.

Specified by:
addPropertyChangeListener in interface BaseBeanManager
Specified by:
addPropertyChangeListener in interface BoundBean
Overrides:
addPropertyChangeListener in class BasicImpl
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

public void removePropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Removes a listener to the bean. Used by Gui1.CommonPropertyEditor for the properties: 'AclRights', 'UserID', 'GroupID', 'RootRights', 'GroupRights', 'OwnerRights', 'EPsThroughAclEntry', 'AclAcsControllers', 'PriAcsController', 'FromTheParentAccount', 'FromTheParentGroup', 'InheritedOwnerRights', 'InheritedGroupRights', 'OneTargetTypedPrivilege', 'OneTargetLinkedPrivilege', and from the subclasses in the AcsAddon, 'InheritedTargetPrivileges', 'InheritedTargetAclEntries'. Note: using this method does not remove a listener which has been registered through addPropertyChangeListener(PropertyChangeListener _l). Overrides the super method and calls it.

Specified by:
removePropertyChangeListener in interface BaseBeanManager
Specified by:
removePropertyChangeListener in interface BoundBean
Overrides:
removePropertyChangeListener in class BasicImpl
Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to remove

getPropertyChangeListeners

public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
Returns the change listeners for a property. Used by the AcsAddons.

Specified by:
getPropertyChangeListeners in interface ImmutableBasic
Overrides:
getPropertyChangeListeners in class BasicImpl
Parameters:
_propertyName - name of the listened property.
Returns:
the change listeners. May be null or empty.

clone

public java.lang.Object clone()
Clones without registering of the new object in the ACSs. Caution: don't use any updating method on this clone, because that may destroy the base integrity. A finalized instance returns a clone with getEorACS() which returns null, but getName() and getAcsName() operates.

Overrides:
clone in class BasicImpl
Returns:
Object; is not registred in the ACSs. The names, the aclEntries, the AG rights, the ACS controller names are cloned. The AclEntries are weakly cloned, so they have no direct link to this resource. The external object references are not cloned
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object _obj)
Does not compare the comment. Works even if the instance is user-finalized.

Specified by:
equals in interface BaseObject
Overrides:
equals in class BasicImpl
Parameters:
_obj -
Returns:
true if _obj is an instance of ResourceImpl (or a derived class) equals to this instance (with the same class)

hashCode

public int hashCode()
Specified by:
hashCode in interface BaseObject
Overrides:
hashCode in class BasicImpl
Returns:
the hashcode derived from the userID, the type and folder member hashcodes

getSerialVersionUID

public long getSerialVersionUID()
Description copied from class: BasicImpl
For the java serialization.

Specified by:
getSerialVersionUID in interface ImmutableBasic
Overrides:
getSerialVersionUID in class BasicImpl
Returns:
the static serialVersionUID__ of this Resource class

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
The comparison is based on the name compareTo() method of each resource when they are not equals, except when there is a node. The nodes are always smaller than the leaves.

Specified by:
compareTo in interface ImmutableLeaf
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class BasicImpl
Parameters:
o - Object to compare must be an ImmutableResource
Returns:
0 if the resources are equals, a negative integer if this Resource object is lesser than the argument, and a positive integer if this Resource object is greater than the argument.
Throws:
java.lang.ClassCastException - - if the specified object's type prevents it from being compared to this current Object

finalizeForBase

public void finalizeForBase()
                     throws UpDateError
This method removes the resource from the ACS lists (main and controllers), from its parent, its userID and its groupID. The view list is not updated, and views are informed by the ACS through removeEorResource(). This method is called by finalize(), but finalize() may be not called. An unused object has to be deleted to inform the other objects, and this method HAS TO BE CALLED before deleting the resource. Called by ACSImpl.finalizeForBase() and setAcsRelationsInIS(), parent Directory.finalizeForBase() and by finalizeForUser(). Calls ACSImpl.removeEorResource() only if the object is known by the ACS. Calls parent.setEorL_Children() rather than parent.removeEorChild(). This method does not raise PropertyChangeEvents since the BeanInfo for this class specifies that its ACS informs the listeners when this instance is finalized, but each called method like UserIDImpl.removeOwnResource() throws a ChangeEvent to the Gui1/Gui2/gWork classes. So each call products a new searching of the true rights if this resource belongs to an open view. To test if an instance has been finalized, uses (l_aclEntry_ == null).

Specified by:
finalizeForBase in interface FinalizedObject
Overrides:
finalizeForBase in class BasicImpl
Throws:
UpDateError - if the main ACS do not known the resource (if it is a clone without setName(), typically)

toString

public java.lang.String toString()
Gets the name last component of the instance. Used in the explorer to display the element. Never null.

Overrides:
toString in class BasicImpl
Returns:
String

resetInheritedAclEntryRights

public void resetInheritedAclEntryRights(AclEntry _acl)
Resets the inherited AclEntry rights after an user edition. Called by the parent when there is a change in the effective rights of an inherited AclEntry. Reads l_inheritedT_AclEntries_ and updates m_inheritedT_ACLRights_ only for one relevant key. May be overridden only in the AcsAddons handling the ACL inheritance. Not described in the BeanInfo since the user does not call it. Note: the creation of the inherited AclEntry in a child is not handled by the generic gBase package, while the rights updating of the inherited AclEntry is handled. Called by Directory.resetInheritedAclEntryRightsOfChildren(). Overridden in DirectoryImpl and called from it.

Specified by:
resetInheritedAclEntryRights in interface Resource
Parameters:
_acl - inherited AclEntry with updated rights. Never null.

selectInheritedAclEntry

public AclEntry selectInheritedAclEntry(AclEntry _acl,
                                        java.lang.String _type)
Returns the AclEntry to use as inherited AclEntry in a child. Empty method which returns the argument. Should be never called, and throws an InternalError. Has to be overridden by any AcsAddon handling the ACL inheritance.

Specified by:
selectInheritedAclEntry in interface ImmutableResource
Parameters:
_acl - the initial AclEntry which may be given to the child
_type - type of a child, as Resource
Returns:
the inherited AclEntry if the child inherits this initial AclEntry, or null

resetInheritedPrivilegeRights

public void resetInheritedPrivilegeRights(PrivilegeForLinks _lpri)
Resets the inherited Privilege rights after an user edition. Called by the master parent when there is a change in the effective rights of an inherited Privilege. This is only when it is about a change in the sources. Contrary to AclEntry, the rights are immutable and there is no condition. The subclassing of CPrivilegeUserImpl is possible in an AcsAddon, but it is also possible to overread the same method in a subclass of this class. Not described in the BeanInfo since the user does not call it. Note: the creation of the inherited Privilege in a child is not handled by the generic gBase package, while the rights updating of the inherited Privilege is handled. Called by Directory.resetInheritedPrivilegeRightsOfChildren(). Overridden in DirectoryImpl and called from it.

Specified by:
resetInheritedPrivilegeRights in interface Resource
Parameters:
_lpri - inherited Privilege with updated rights. Never null.

selectInheritedPrivilege

public PrivilegeForLinks selectInheritedPrivilege(PrivilegeForLinks _lpri,
                                                  java.lang.String _type)
Returns the Privilege to use as inherited Privilege in a child. Empty method which returns the argument. Should be never called, and throws an InternalError. Has to be overridden into an AcsAddon handling the privilege inheritance.

Specified by:
selectInheritedPrivilege in interface ImmutablePrivilegeTarget
Specified by:
selectInheritedPrivilege in interface Resource
Parameters:
_lpri - the initial Privilege which may be given to the child
_type - type of a child, as Resource
Returns:
the inherited Privilege if the child inherits this initial Privilege, or null

getEorL_TargetInheritedAclEntries

public java.util.ArrayList<AclEntry> getEorL_TargetInheritedAclEntries()
Gets a reference on all the inherited AclEntries of this target. This method is not in the Resource interface. Called by the parent class in the gBase package, to prepare the updating of the list with a call to setEorL_TargetInheritedAclEntries(). To use by the AcsAddons.

Returns:
the internal list of inherited AclEntries, or an empty list. May be a new empty list or an old empty list, but never null. It is not a copy.
See Also:
getEorImmutableL_TargetInheritedAclEntries()

getEorL_TargetInheritedLinkedPrivileges

public java.util.List<PrivilegeForLinks> getEorL_TargetInheritedLinkedPrivileges()
Gets all the inherited linked privileges of this target. This method is not in the Resource interface. The LINKED_IF_ALL_SOURCE type is forbidden, and any privilege having more than one target. To use by the parent in the gBase package, to prepare the updating of the list with a call to setEorL_TargetInheritedLinkedPrivileges(). The privilege may be a clone, and the target may not be this instance. Caution: a clone is not registered in its ACS, nor in its sources and targets. However, it is possible in the beamer to navigate from a cloned privilege to its targets or sources.

Returns:
reference on the internal list of inherited Linked Privileges. May be a new empty list or an old empty list, but never null.
See Also:
getEorL_TargetInheritedLinkedPrivileges()

setAGOAccessFromTheParentAccount

protected void setAGOAccessFromTheParentAccount(boolean _b)
Called by DirectoryImpl.setL_ownerRights(). Do not control if the ACS manages the AG rights inheritance. Note: the access from the parent userID depends only to the userID rights.

Parameters:
_b - true if the parent authorizes its userID to have access to this instance.

setAGOAccessFromTheParentGroup

protected void setAGOAccessFromTheParentGroup(boolean _b)
Called by DirectoryImpl.setL_groupRights(). Do not control if the ACS manages the AG rights inheritance.

Parameters:
_b - true if the parent authorizes its groupID to have access to this instance.

fireL_inheritedOwnerRights

protected final void fireL_inheritedOwnerRights(StringRight[] _l_old,
                                                StringRight[] _l_new)
Fires the event 'InheritedOwnerRights', from the parent of the resource owner. Called by the parent Directory.setL_ownerRights() method.

Parameters:
_l_old - an array of the old access rights for the UserID which owns this resource, in the main ACS. May be empty.
_l_new - an array of the new access rights for the UserID which owns this resource, in the main ACS. May be empty.

fireL_inheritedGroupRights

protected final void fireL_inheritedGroupRights(StringRight[] _l_old,
                                                StringRight[] _l_new)
Fires the event 'InheritedGroupRights', from the parent of the resource group. Called by the parent Directory.setL_groupRights() method.

Parameters:
_l_old - an array of the old access rights for the UserID which owns this resource, in the main ACS. May be empty.
_l_new - an array of the new access rights for the UserID which owns this resource, in the main ACS. May be empty.

copyOwnVariables

protected ResourceImpl copyOwnVariables(ResourceImpl _result,
                                        boolean _withoutInternalAcl)
                                 throws CreateError
This method provides a copy of the instance variables. Each internal variable that is an external object reference has a shallow copy (no deep copy). Most of the aclEntries are copied, but not the list of ViewInBase that contains this instance, nor comments. In most of the cases, the aclEntry arguments are copied, but see the exceptions. Called by copy() and by the copyOwnVariables() methods of the subclasses. Calls copyOwnAcl(). Caution: does not copy the user and the group if _result does not belong to aCS_ and if there are no user or group in the _result ACS which have similar names - that is that are ended by the same last component in this instance user or group names.

For AclEntries, if _result ACS is not this resource ACS, and if the AclEntry ACS is this resource ACS, sets _result ACS as the AclEntry ACS of the copied ACL. Caution: does not copy an aclEntry if: - _result ACS is not this resource ACS, - the eligible party ACS is this resource ACS, - and there is no matched EligibleParty (with the same last components) in the _result ACS

Parameters:
_result - to update with this instance variables copies
_withoutInternalAcl - true if the internal aclEntries - that is with a resource having the same ACS - must not be copied
Returns:
the updated _result
Throws:
CreateError - of addAclEntry()

copyOwnAcl

protected ResourceImpl copyOwnAcl(ResourceImpl _result,
                                  boolean _withoutInternalAcl,
                                  boolean _withoutExternalAcl)
                           throws CreateError
This method provides a copy of the AclEntries, all the AclEntries (see restrictions) or only the external ones. Most of the aclEntries are copied, but not the list of ViewInBase that contains this instance, nor comments. If _result ACS is not this resource ACS, and if the AclEntry ACS is this resource ACS, sets _result ACS as the AclEntry ACS of the copied acl. Caution: does not copy an internal AclEntry if: - _result ACS is not this resource ACS, - the eligible party ACS is this resource ACS, - and there is no matched EligibleParty (with the same last components) in the _result ACS Called by copyOwnVariables() and by BaseUtilitiesImpl.copyDirectoryChildrenForACS().

Parameters:
_result - to update with this instance AclEntries copies
_withoutInternalAcl - true if the internal aclEntries - that is with a resource having the same ACS - must not be copied
_withoutExternalAcl - true if the internal aclEntries - that is with a resource having the same ACS - must not be copied
Returns:
updated _result
Throws:
CreateError - of addAclEntry()

removeEorUserID

protected void removeEorUserID()
                        throws UpDateError
Removes the userID of the resource. To use ONLY when the UserID is finalizing. In the other cases, use setEorUserID(). It is a bound property. The main difference with setEorUserID() is that _u.removeOwnResource(this) is not invoked in this method.

Throws:
UpDateError

removeEorGroupID

protected void removeEorGroupID()
                         throws UpDateError
Removes the groupID of the resource. To use only when the groupID is finalizing. In the other cases, use setEorGroupID(). It is a bound property. The main difference with setEorGroupID() is that removeOwnResource(this) is not invoked in this method.

Throws:
UpDateError

removeACL

protected final void removeACL(ImmutableACS _aclAcs,
                               ImmutableEligibleParty _ep,
                               boolean _positiveRight,
                               ImmutableGroupID _conditionGroup)
                        throws UpDateError
Deletes an inner AclEntry which delivers rights to an EligibleParty to access or to deny access to this Resource. 'EPsThroughAclEntry' and 'AclRights' are bound properties, and 'AclRights' is the last firing. The resulting array may be a 0-size array. It does not contain null or empty AclEntries. After a removing, the order of the remaining AclEntries is not changed.

Parameters:
_aclAcs - ImmutableACS which owns the AclEntry, and is recorded as an ACS controller of this resource.
_ep - eligible party connected to the resource through an AclEntry. This method unrecords the relevant aclEntry in _ep, in this resource, and in the relevant ACS. The ACS of the aclEntry may be unrecorded in this resource if there are no other aclEntry owned by this ACS in this resource.
_positiveRight - is true if the rights are oriented to authorize, and false if they are oriented to forbid.
_conditionGroup - first condition group. May be null.
Throws:
UpDateError - if _ep is null, unknown, or if _aclAcs is closed or unknown.

finalizeFromDeserialization

protected void finalizeFromDeserialization()
NO USE. This method finalizes the AclEntries and the other attibutes, since it is used after a deserialization. There, the attributes have been deserialized but are not 'true' objects of the base. 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 by EPRViewInBaseImpl only.

Overrides:
finalizeFromDeserialization in class BasicImpl

addAcsController

protected void addAcsController(Name _ACSname)
                         throws CreateError
Called by addAclEntry() and addEorPrivilegeForLinksToTarget(). Fires the PropertyChangeEvent 'AclAcsController' or 'PriAcsController'.

Parameters:
_ACSname - open ACS which controls this resource. No exception if it is already known.
Throws:
CreateError - if the Name is null, the ACS is closed, or if it is the main ACS of this resource.

removeAcsController

protected void removeAcsController(ImmutableName _ACSname)
                            throws UpDateError
Called by removeAclEntry() and removeEorPrivilegeToTarget(). Fires the PropertyChangeEvent 'AclAcsController' or 'PriAcsController'.

Parameters:
_ACSname - open ACS that controls this resource.
Throws:
UpDateError - if _ACSname is null or unknown.

addEorPrivilegeForLinksToTarget

protected void addEorPrivilegeForLinksToTarget(PrivilegeForLinks _priv)
                                        throws BaseError
Sets a privilege as applicable to this access target, without right inheritance. Called by PrivilegeForLinksImpl.addEorPrivilegeTargetLink() which checks the type of the target to forbid a change on an immutable target. This instance is registered in the privilege by this method. Calls addAcsController() for an external one-to-one linked privilege. Fires 'OneTargetLinkedPrivilege' events.

Parameters:
_priv - to register in the target
Throws:
BaseError - if this instance is not a privilege target, if the privilege second type is not authorized for this target, or from addAcsController().