ARoad0.AcsAddon.Accbee.Ubuntu.gBase
Class UserIDUbuntuImpl

java.lang.Object
  extended by ARoad0.gBase.BasicImpl
      extended by ARoad0.gBase.EligiblePartyImpl
          extended by ARoad0.gBase.GroupIDMemberImpl
              extended by ARoad0.gBase.UserIDImpl
                  extended by ARoad0.AcsAddon.Accbee.Ubuntu.gBase.UserIDUbuntuImpl
All Implemented Interfaces:
UserIDUbuntu, ACSObject, BaseBeanManager, BaseObject, Basic, BoundBean, Copyable, EligibleParty, FinalizedObject, FinalizedObjectForUser, GroupIDMember, ImmutableBasic, ImmutableEligibleParty, ImmutableGroupIDMember, ImmutablePrivilegeSource, ImmutableSource, ImmutableTarget, ImmutableUserID, PrivilegeSource, PrivilegeUser, UserID, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class UserIDUbuntuImpl
extends UserIDImpl
implements UserIDUbuntu

This class is responsible for modeling an account in an ACS Ubuntu, as a kind of eligible party. As a Linux/Unix account, it has an umask value. The order is a 16-bit user identifier (UID). It is a javabean with the following bound properties:, 'UMask'. 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, and a dialog box is displayed to inform the user.

All variables are private to secure the white box inheritances from this class. Most of the variables are protected. This class has no subclass in this package.

See Also:
Serialized Form

Field Summary
static UserIDUbuntuImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for default values.
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization
private static long serialVersionUID__
           
protected  java.lang.String uMask_
           
 
Fields inherited from class ARoad0.gBase.UserIDImpl
l_currentActors_, l_ownResources_, order_, primGroup_
 
Fields inherited from class ARoad0.gBase.GroupIDMemberImpl
isAdmin_, l_Groups_
 
Fields inherited from class ARoad0.gBase.EligiblePartyImpl
m_AclEntriesResources_
 
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
UserIDUbuntuImpl()
          simple constructor.
UserIDUbuntuImpl(ImmutableName _name, ACS _acs, java.lang.String _epType, java.lang.Boolean _isAdmin)
          Constructor used in the beamer by the editor for the ACS EP list, from the 'New' button.
UserIDUbuntuImpl(ImmutableName _name, ACS _acs, java.lang.String _epType, boolean _isAdmin, boolean _toRegisterInManager)
          Used for the creation of an userID.
 
Method Summary
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
 java.lang.Object clone()
          Clone without register the new object in the ACSs.
 java.lang.Object copy(ImmutableName _name, ACS _acs, Directory _parent, java.lang.Boolean _toRegisterInManager)
          This method provides a copy of the instance with another name.
protected  UserIDUbuntuImpl copyOwnVariables(UserIDUbuntuImpl _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)
          This method provides a copy of the instance as copy() but without copying the internal aclEntries.
 boolean equals(java.lang.Object _obj)
          Does not compare the comment.
protected  void finalize()
          This method sets the properties to null and unregisters the instance, but there is no guaranee that the JVM calls this method before the end of the application.
 void finalizeForBase()
          This method HAS TO BE USED before deleting the userID.
protected  void finalizeFromDeserialization()
          Does not call finalizeForBase().
 long getSerialVersionUID()
          For the java serialization.
 java.lang.String getUMask()
          This umask defines some rights to subtract to the 'full control' right, at the creation of a Resource that belongs to this UserID.
protected  boolean isMaskWithWXR(java.lang.String _mask)
          Called by processUMask().
protected  boolean isNxUMask(java.lang.String _umask)
          Check if _umask is '--- --- --- ' to 'rwx rwx rwx ', following Linux/Unix format (from 0 to 777).
protected  java.util.Set<StringRight> processNoWXRuMask(java.lang.String _mask, java.util.Set<StringRight> _l_result)
          NO USE.
 java.util.Set<StringRight> processUMask(java.lang.String _mask, boolean _isDirectory, boolean _isNxDirectory)
          Gets the denying rights for a resource and its owner/group/other AGO rights.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
 void setUMask(java.lang.String _umask)
          The allowed format is 3 blocks for respectively Account, Group and Other rights.
 java.lang.String toString()
          Gets the name last component of the instance.
 
Methods inherited from class ARoad0.gBase.UserIDImpl
addCurrentActor, addGroupToGM, addOwnResource, copyOwnVariables, getEorL_UserIDCurrentActors, getEorL_UserIDOwnResources, getEorPrimGroup, getOrder, getPropertyChangeListeners, hashCode, ownsResource, removeCurrentActor, removeGroupToGM, removeOwnResource, removePrimGroup, setEorPrimGroup, setOrder
 
Methods inherited from class ARoad0.gBase.GroupIDMemberImpl
copy, copyOwnVariables, copyWithoutAcl, getEorL_GroupID, isAdmin
 
Methods inherited from class ARoad0.gBase.EligiblePartyImpl
addAclEntryToEP, addEorPrivilegeForLinksToSource, addEorPrivilegeForTypeToSource, copyOwnVariables, deleteAclEntries, getEorL_AclConnectedResources, getEorL_SourcePrivilegeForLinks, getEorL_SourcePrivilegeForTypes, getEorL_SourcePrivileges, getEPType, removeAclEntryToEP, removeEorPrivilegeToSource, setEPType
 
Methods inherited from class ARoad0.gBase.BasicImpl
addAcsOfSoftReferences, addConstrainedChildACS, addEorSoftAlias, addInVFolderList, addInViewList, addPropertyChangeListener, compareTo, copyOwnVariables, 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.UserID
finalizeForUser, setEorPrimGroup, setOrder
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableUserID
getEorL_UserIDCurrentActors, getEorL_UserIDOwnResources, getEorPrimGroup, getOrder, ownsResource
 
Methods inherited from interface ARoad0.gBaseInterface.GroupIDMember
addGroupToGM, removeGroupToGM
 
Methods inherited from interface ARoad0.gBaseInterface.EligibleParty
setEPType
 
Methods inherited from interface ARoad0.gBaseInterface.Basic
setComment
 
Methods inherited from interface ARoad0.gBaseInterface.PrivilegeSource
addEorPrivilegeForTypeToSource, removeEorPrivilegeToSource
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableGroupIDMember
getEorL_GroupID, isAdmin
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableEligibleParty
getEorL_AclConnectedResources, getEPType, getM_ConstrainedChildACS
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableBasic
getComment, getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getImpliedViews, getIS_Name, getL_AcsOfSoftReferences, getL_SoftAlias, getPropertyChangeListeners, getVirtualFolders
 
Methods inherited from interface ARoad0.gBaseInterface.BoundBean
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutablePrivilegeSource
getEorL_SourcePrivilegeForLinks, getEorL_SourcePrivilegeForTypes, getEorL_SourcePrivileges
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableSource
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias, getType
 
Methods inherited from interface ARoad0.gBaseInterface.ACSObject
getAcsName, getEorACS
 
Methods inherited from interface ARoad0.gBaseInterface.BaseObject
getFullName, getName, getNickName, hashCode
 
Methods inherited from interface ARoad0.gBaseInterface.BaseBeanManager
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableTarget
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias, getType
 

Field Detail

serialVersionUID__

private static final long serialVersionUID__
See Also:
Constant Field Values

uMask_

protected java.lang.String uMask_

EMPTY_INSTANCE

public static final UserIDUbuntuImpl EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for default 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

UserIDUbuntuImpl

public UserIDUbuntuImpl()
simple constructor.


UserIDUbuntuImpl

public UserIDUbuntuImpl(ImmutableName _name,
                        ACS _acs,
                        java.lang.String _epType,
                        java.lang.Boolean _isAdmin)
                 throws CreateError
Constructor used in the beamer by the editor for the ACS EP list, from the 'New' button.

Parameters:
_name - ImmutableName of the userID as a kind of eligible party
_acs - ACSUbuntuImpl owning this userID
_epType - is the EligibleParty type, and may be null if the ACS allows it.
_isAdmin - true only if the instance has an administrative role in the ACS, for the technical administration or the users administration.
Throws:
CreateError - if ACSUbuntuImpl.newEorEligibleParty() throws it - the instance must then be deleted !

UserIDUbuntuImpl

public UserIDUbuntuImpl(ImmutableName _name,
                        ACS _acs,
                        java.lang.String _epType,
                        boolean _isAdmin,
                        boolean _toRegisterInManager)
                 throws CreateError
Used for the creation of an userID.

Parameters:
_name - ImmutableName of the userID to create
_acs - ACSUbuntuImpl owning this userID
_epType - is the EligibleParty type, and may be null if the ACS allows it.
_isAdmin - true only if the instance has an administrative role in the ACS, for the technical administration or the users administration.
_toRegisterInManager - false if this method must not register the instance in its ACS.
Throws:
CreateError - if ACSUbuntuImpl.newEorEligibleParty() throws it - the instance must then be deleted !
Method Detail

copy

public java.lang.Object copy(ImmutableName _name,
                             ACS _acs,
                             Directory _parent,
                             java.lang.Boolean _toRegisterInManager)
                      throws CreateError
This method provides a copy of the instance with another name. Do not copy the own resources or the current actors. The copy order is 3 times the source order. _aliasRef may belong to another ACS than this instance ACS. Caution: do 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 Strings in this instance user or group names. Call copyOwnVariables(). This method is overridden by the subclasses.

Specified by:
copy in interface Copyable
Overrides:
copy in class UserIDImpl
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 UserIDUbuntuImpl
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
This method provides a copy of the instance as copy() but without copying the internal aclEntries. Does not copy the own resources or the current actors. The copy order is 3 times the source order. 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 Strings in this instance user or group names. Calls copyOwnVariables().

Specified by:
copyWithoutInternalAcl in interface EligibleParty
Overrides:
copyWithoutInternalAcl in class UserIDImpl
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 UserIDUbuntuImpl
Throws:
CreateError - of the constructor with the same parameters, or if _parent ACS is not _acs, or addAclEntry() exceptions.

setUMask

public void setUMask(java.lang.String _umask)
              throws UpDateError
The allowed format is 3 blocks for respectively Account, Group and Other rights. _umask is the target value extended by SimplePropertyEditor with " ". No control of the management by the ACS of accounts, groups and other. Noop and error mesage to the user if the ep type starts with 'byAcsCreator' or 'immutable' after the creation.

Specified by:
setUMask in interface UserIDUbuntu
Parameters:
_umask - from '--- --- --- ' to 'rwx rwx rwx ', following Linux/Unix concept (from 0 to 777), or 3 used acsrights/metarights separated by one space, or 3 blocks separated by one space and inferior to 4, containing at most one of the characters 'wxr'.
Throws:
UpDateError - for all the wrong formats or if the umask is immutable

getUMask

public java.lang.String getUMask()
This umask defines some rights to subtract to the 'full control' right, at the creation of a Resource that belongs to this UserID. The default value is '--- --- ---' for respectively Account, Group and Other rights.

Specified by:
getUMask in interface UserIDUbuntu
Returns:
the allowed format of 3 blocks of 3 letters among the values '-', 'r', 'w', 'x'.

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: 'UMask'. Overrides the super method and calls it.

Specified by:
addPropertyChangeListener in interface BaseBeanManager
Specified by:
addPropertyChangeListener in interface BoundBean
Overrides:
addPropertyChangeListener in class UserIDImpl
Parameters:
_propertyName - 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: 'UMask'. 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 UserIDImpl
Parameters:
_propertyName - name of the property
_l - PropertyChangeListener to remove

getSerialVersionUID

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

Specified by:
getSerialVersionUID in interface ImmutableBasic
Overrides:
getSerialVersionUID in class UserIDImpl
Returns:
the static serialVersionUID__ of this UserIDUbuntu class

processUMask

public java.util.Set<StringRight> processUMask(java.lang.String _mask,
                                               boolean _isDirectory,
                                               boolean _isNxDirectory)
Gets the denying rights for a resource and its owner/group/other AGO rights. Searching first in the acsrights, and if no matched right is found, uses the correct metaright ('deny_read' for 'r', for instance). Calls processNoWXRuMask() if the _mask lenght is superior to 3, or if it does not contain the characters 'w', 'x' and 'r'. Returns an empty set if _mask is '-', '--' or '---'.

Specified by:
processUMask in interface UserIDUbuntu
Parameters:
_mask - part of this userID umask which describes the requirement for owner or for group or other
_isDirectory - true if the calling resource is a directory, not a Linux/Unix one. Unused in this method, but it is kept for future uses.
_isNxDirectory - true if the calling resource is a Linux/Unix directory. _isDirectory has to be false.
Returns:
the denying rights set by the umask for A, G and O rights. May be empty but not null.

finalize

protected void finalize()
                 throws java.lang.Throwable
This method sets the properties to null and unregisters the instance, but there is no guaranee that the JVM calls this method before the end of the application.

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

finalizeForBase

public void finalizeForBase()
                     throws UpDateError
This method HAS TO BE USED before deleting the userID. Note: when this method is called by the EligiblePartyImpl constructor, the proper variables of this class are not still initialized.

Specified by:
finalizeForBase in interface FinalizedObject
Overrides:
finalizeForBase in class UserIDImpl
Throws:
UpDateError - if the userID is unknown of the main ACS (if it is a clone, typically), or if a linked immutable object fires an exception

finalizeFromDeserialization

protected void finalizeFromDeserialization()
Does not call finalizeForBase(). Called only by EPRViewInBaseImpl.

Overrides:
finalizeFromDeserialization in class UserIDImpl

clone

public java.lang.Object clone()
Clone without register the new object in the ACSs. Caution: don't use any modifying method that may altere the integrity of the base.

Overrides:
clone in class UserIDImpl
Returns:
Object is not registred in the ACSs. The umask is cloned.

equals

public boolean equals(java.lang.Object _obj)
Description copied from class: EligiblePartyImpl
Does not compare the comment.

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

toString

public java.lang.String toString()
Description copied from class: BasicImpl
Gets the name last component of the instance. Used in the explorer to display the element. Never null.

Overrides:
toString in class UserIDImpl
Returns:
String: the variables of the instance : name (last component). May be null.

copyOwnVariables

protected UserIDUbuntuImpl copyOwnVariables(UserIDUbuntuImpl _result,
                                            boolean _withoutInternalAcl)
                                     throws CreateError
This method provides a copy of the instance variables. Called by copy() and by the copyOwnVariables() methods of the subclasses.

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:
updated _result
Throws:
CreateError

processNoWXRuMask

protected java.util.Set<StringRight> processNoWXRuMask(java.lang.String _mask,
                                                       java.util.Set<StringRight> _l_result)
NO USE. Gets one denying right for a resource and its owner/group/other AGO rights, when the Linux/Unix 'wxr' format is not used. The kernel right of the denying right has to be 'deny_' extended by _mask. Called by processUMask() and setUMask() when isMaskWithWXR() return false.

Parameters:
_mask - part of this userID umask which describes the requirement for owner, or for group, or for other
_l_result - set to fill with the denying rights
Returns:
the denying right set by the umask for A or G or O AGO rights. May be empty but not null.

isNxUMask

protected boolean isNxUMask(java.lang.String _umask)
Check if _umask is '--- --- --- ' to 'rwx rwx rwx ', following Linux/Unix format (from 0 to 777). Called by setUMask() when the ACS type is LINUX. For another ACS type, 'wxr-' may be used in any order in umask, with the same use, and the umask is not tested there.

Parameters:
_umask -
Returns:
true if the umask complies to the Linux/Unix format

isMaskWithWXR

protected boolean isMaskWithWXR(java.lang.String _mask)
Called by processUMask().

Parameters:
_mask - is a block in an umask, used for defined the denying requirement for an owner, or group, or other rights in AGO rights
Returns:
true if the mask contains only the characters '-', 'w', 'x' or 'r' in a size inferior to 4, in any order; several instances of a character is possible