|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.gBase.StringRightImpl
public final class StringRightImpl
This class is responsible for managing a right. A right is defined without connection to the user right and the access target. This connection is the role of the right categories as AGO rights or ACL rights for instance. There are two types of rights, the canonical metarights, outside any ACS, and the ACS rights:
- this class manages the ACS rights, registered in their ACSRun,
- this class manages also the embedded right including in a generic or metaright.
Each ACS right has a metaright as equivallent which is a StringMetaRightImpl, subclass of StringRightImpl. The generic right is used to compare rights from different ACS, and to explain precisely the ACS right semantic.
The two types of right may be classed, that is associated to a target class, or ACS right only may be typed, that is associated to a type in a target class. If an ACS right is classed, it is also the generic right class. If it is typed, it is always classed. For a generic right, the class isnot added at the end of the kernel right. For an ACS right, the class and the type are added at the end of the kernel right.
For instance, in LCA Lotus Notes, 'read_javascript' is a typed right for the target class Actor, where 'javascript' is a type of Actor. When a right is classed or typed, the class and the type may be superior to the right container (AGO, ACL, PRI, BDG) specification, or may be inferior, and this is specified by the ACS policy. For instance, if an ACL has an actor as target, and if it uses a classed right where the target class is Directory, then the ACL will be effective only if its ACS sets that the ACL specification is superior to the right class (Directory, there). The ACS may also set that both specifications are applicable if they are compatible, and if not, they are forgotten.
There are several levels of right handling in the program:
- the generic or ACS right contains the semantic of a granting or a denying,
- the ACS defines the set of authorized generic/acs rights for each right category, plus some subsets managed in the specialized rights,
- the ACS right category like AGO rights, ACL rights,... handle a form of connection between a right user, a generic/acs right, and an access target,
- the right realization is the expression of a right category through the filter of ACS rules and inter-ACS applicable adaptors,
- the AccessControlLink is the set of all the right realizations between two nodes of an access path in an information system,
- the access path is a collection of AccessControlLinks from an user right to an access target, and it is handles by a DisplayableLinkImpl,
- the effective rights of an access path are the expression of the right categories through the filter of ACS rules and inter-ACS applicable adaptors.
The right handles the links to the upper and lower rights in a rights network, allowing to compare them. Each ACS has a rights network, somtimes a very simple one. There is also one metarights network. The next upper and lower rights are managed, including the synchronization from the lower rights when the link is updated. So, the upper rights are updated when they are unregistered in the lower rights. There are at most 5 upper rights.
A two-levels right (in Windows for instance) is managed as one parent right which has a detailled description in a set of lower rights. The parent is the unique upper right of these slave rights. Multi-level rights is a generalization where a right is both a parent and a slave. Some rights set may have these tree structure (it is not a network) without be marked as multi-level rights.
A right may be desactivated, and then it is not used by the program in the search of access paths.
It is possible to use a quite empty right when only the getRight() method is needed: use then the constructor with a null ACS, the right and an empty metaright, and use finalizeForUser() at the end. A right may be conditional, and it is then used in an AclEntry to activate it when the condition criterion is fulfilled. The criterion is to be membership to one or several groups. These groups are defined in the kernel right with the separator <IF> before each last component of the group name, for instance in the kernel right 'read<IF>admin' where 'admin' is the name of a group. Caution: the meta_ property is transient and should be restored after each deserialization of an instance. It is a javabean with the following bound properties: 'Comment', 'Parent', 'Slave', 'Desactivated', 'UpperRights', 'LowerRights'. 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.
Field Summary | |
---|---|
private ImmutableName |
acsName_
The name of the ACSRun which manages this right. |
private ACSRun |
acsRun_
The ACSFactory which creates this right when it is an acsright. |
protected java.beans.PropertyChangeSupport |
changeSupport_
manages all the property change listeners of this classes and its subclasses |
private java.lang.String |
comment_
The user comment about this right. |
static StringRightImpl |
EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. |
protected static int |
INITIAL_CAPACITY
|
protected int |
internalKey_
The right key, to compare it in the network rights. |
private boolean |
isDesactivated_
True when the right is desactivated. |
private boolean |
isParent_
True when the right is set as a parent. |
private boolean |
isSlave_
True when the right is set as a slave, with only one upper right (the parent). |
private java.util.Set |
l_CommentChangeSupport_
list of PropertyChangeListeners for the property 'Comment'. |
private java.util.Set |
l_DesactivatedChangeSupport_
list of PropertyChangeListeners for the property 'Desactivated'. |
protected StringRight[] |
l_lowerRights_
This is the list of the ACS rights or metarights (if embedded) which are directly less powerfull, than this instance in the rights network. |
private java.util.Set |
l_LowerRightsChangeSupport_
list of PropertyChangeListeners for the property 'LowerRights'. |
private java.util.Set |
l_ParentChangeSupport_
list of PropertyChangeListeners for the property 'Parent'. |
private java.util.Set |
l_SlaveChangeSupport_
list of PropertyChangeListeners for the property 'Slave'. |
protected StringRight[] |
l_upperRights_
This is the list of the ACS rights or metarights (if embedded) which are directly more powerfull, than this instance in the rights network. |
private java.util.Set |
l_UpperRightsChangeSupport_
list of PropertyChangeListeners for the property 'UpperRights'. |
(package private) StringMetaRight |
meta_
For ACS rights, this is the equivalent to this instance in the metarights space. |
(package private) java.lang.String |
metaRight_
For ACS rights, this is the value returned by meta_.getRight(). |
private java.lang.String |
right_
The effective right, for typed and untyped rights. |
static java.io.ObjectStreamField[] |
serialPersistentFields
standardized variable for the JDK 2 serialization |
private static long |
serialVersionUID
|
private java.lang.Class |
targetClass_
If it is a classed right, this is the target class for the target of the right. |
private java.lang.String |
targetClassType_
If it is a typed right, this is the target type for which this right is applied, only for the target class defined by targetClass_. |
Constructor Summary | |
---|---|
|
StringRightImpl()
Constructor used by EMPTY_INSTANCE. |
protected |
StringRightImpl(java.lang.String _kernelRight,
java.lang.Integer _internalKey,
java.lang.String _targetClass)
Constructor used for the creation of an embedded right in a StringMetaRightImpl instance. |
|
StringRightImpl(java.lang.String _kernelRight,
StringMetaRight _meta,
java.lang.Integer _internalKey,
StringRightImpl[] _l_upperRights,
java.lang.String _targetClassType,
ACSRun _acsRun)
Constructor used for the creation of an ACS right. |
Method Summary | |
---|---|
protected void |
addLowerRight(StringRight _right)
Adds a lower right which are strictly lesser than this right without any intermediate right, following the network of rights in the ACS. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Adds a listener to the bean, for all the bound properties. |
void |
addPropertyChangeListener(java.lang.String _propertyName,
java.beans.PropertyChangeListener _l)
Adds a listener to the bean. |
protected void |
addUpperMetaRight(StringMetaRightImpl _right)
Adds, for an embedded right only, an upper metaright which are strictly greater than this embedded right owner, without any intermediate metaright. |
int |
compareTo(java.lang.Object _o)
Compares two StringRight instances through the internal key, the sens and the right, in that order, and, if not null, through an acs names comparison, whatever the powers and the fields. |
boolean |
equals(java.lang.Object _obj)
Compares the two StringRights, without comparison of the properties l_upperRights_ and l_lowerRights_. |
protected void |
finalize()
This method removes the right from the ACS list, but there is no guarantee that the JVM calls this method before the end of the application. |
protected void |
finalizeClosedRight()
This method is to use only for closed rights in the relevant ACS list, to set an empty instance. |
void |
finalizeForBase()
This method removes the StringRight from the ACS list, from the metaright, from the lower and upper rights. |
void |
finalizeForUser()
This method removes the StringRight from the ACS list, from the metaright, from the lower and upper rights. |
protected void |
firePropertyChange(java.lang.String _propertyName,
java.lang.Object _oldValue,
java.lang.Object _newValue)
Fires an event to every registered listener, in any order. |
ImmutableName |
getAcsName()
Called from the constructor through StringMetaRightImpl.addACSRight() It is both the name of the ACS and then name of its ACSFactory. |
java.lang.String |
getComment()
|
ACSRun |
getEorACS()
After the ACS creation, this method calls BaseManager to get the open ACS. |
StringMetaRight |
getEorMetaRight()
Gets the canonical metaright which is a generic description of this ACS right. |
ImmutableName |
getFullName()
Gets the full name of the right, which is unique for the program. |
int |
getInternalKey()
|
StringRight[] |
getLowerRights()
Gets the set of lower rights which are strictly lesser than this right without any intermediate right, following the network of rights in the ACS. |
ImmutableName |
getName()
Gets the BaseObject name of the right, as a current name with less information than the full name. |
java.lang.String |
getNickName()
Gets a short name limited to 5 characters if positive, 14 first characters if it starts with '|' and positive, and 7 if negative, for displaying this right in the views. |
java.lang.String |
getRight()
If the right is not typed, the result contains the kernel right only. |
long |
getSerialVersionUID()
|
java.lang.String |
getTargetClass()
|
java.lang.String |
getTargetClassType()
|
StringRight[] |
getUpperRights()
Gets the set of upper rights which are strictly greater than this right without any intermediate right, following the network of rights in the ACS. |
int |
hashCode()
|
boolean |
isAcsRightUnderOpenACS()
|
boolean |
isDesactivated()
Get if the right is desactivated. |
boolean |
isEmpty()
|
boolean |
isGrantingRight()
Called from the constructor for ACS rights, by getNickName() and compareTo(). |
boolean |
isParent()
For two-levels rights, this right manages tasks, and its slaves manage operations. |
boolean |
isSlave()
A slave right has a strong link with a parent right. |
boolean |
isTargetClassed()
|
boolean |
isTargetClassTyped()
|
protected void |
removeLowerRight(StringRight _right)
Removes a lower rights which are strictly lesser than this right (or the metaright, if this instance is embedded) without any intermediate right, following the network of rights in the ACS. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener _l)
Removes a listener to the bean, for all the bound properties. |
void |
removePropertyChangeListener(java.lang.String _propertyName,
java.beans.PropertyChangeListener _l)
Removes a listener to the bean. |
protected void |
removeUpperRight(StringRight _right,
java.lang.Object _caller)
Removes a upper right which are strictly greater than this right without any intermediate right, following the network of metarights. |
void |
setComment(java.lang.String _s)
Sets any comment related to this right. |
void |
setDesactivated(boolean _b)
Sets that the right is desactivated. |
void |
setParent(boolean _b)
Sets the right as parent of lower rights - the slaves - in a multi-level right. |
void |
setSlave(boolean _b)
Sets that the right has an unique upper right - the parent, already registered - in a multi-level right. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
protected static final int INITIAL_CAPACITY
private ImmutableName acsName_
private transient ACSRun acsRun_
private java.lang.String right_
protected int internalKey_
private java.lang.Class targetClass_
private java.lang.String targetClassType_
private java.lang.String comment_
protected StringRight[] l_upperRights_
protected StringRight[] l_lowerRights_
transient StringMetaRight meta_
java.lang.String metaRight_
private boolean isParent_
private boolean isSlave_
private boolean isDesactivated_
protected transient java.beans.PropertyChangeSupport changeSupport_
private transient java.util.Set l_CommentChangeSupport_
private transient java.util.Set l_ParentChangeSupport_
private transient java.util.Set l_SlaveChangeSupport_
private transient java.util.Set l_DesactivatedChangeSupport_
private transient java.util.Set l_UpperRightsChangeSupport_
private transient java.util.Set l_LowerRightsChangeSupport_
public static final StringRightImpl EMPTY_INSTANCE
public static final java.io.ObjectStreamField[] serialPersistentFields
Constructor Detail |
---|
public StringRightImpl()
protected StringRightImpl(java.lang.String _kernelRight, java.lang.Integer _internalKey, java.lang.String _targetClass) throws CreateError
There is no links between the most upper metarights dedicated to the rights administration, like '|is_superadmin|', and the lower positive metarights headed by 'full_control' and which have opposite negative rights (like 'deny_all' for 'full_control'). So a subtraction of any lower right to one administration right does not change the administration right. These administration metarights have a strenght superior to 90000, which is the 'full_control' strenght.
Used by BaseUtilityImpl.initializeBasicMetaRights().
_kernelRight
- is the right if the StringRight. Never null._internalKey
- is the internal key which allows ACS right comparisons.
From 1000 to 99999. '1000' is the lesser value. Never null._targetClass
- is the target interface (in gBaseInterface)
for the ACS or embedded right; if not null, this StringRight is classed.
Do not use the 'Immutable' version of the interface as _targetClass.
CreateError
- if the target class is not a gBase interface or if
the kernel right or the internal key is not correct,
the instance has then to be deleted!public StringRightImpl(java.lang.String _kernelRight, StringMetaRight _meta, java.lang.Integer _internalKey, StringRightImpl[] _l_upperRights, java.lang.String _targetClassType, ACSRun _acsRun) throws CreateError
Registers this instance in its ACS and its metaright. An upper right cannot be an administrative right (that is, its metaright has a strenght superior to 90000) if this instance is not an administrative right. The argument _targetClassType is not null only when the metaright is classed, and the type should be ampong the class of the metaright. But this is not controlled by the constructor, and if it is not true, the right will simply not be used in the right analysis. The _acsRun argument delivers both the name of the ACSFactoryImpl which creates the new ACS, and the name of the created ACS. Used by the GUI to create the ACS rights for an ACSFactoryImpl instance.
_kernelRight
- is the right if the StringRight if not typed,
or otherwise it is the start of the right. Never null and do not contain
the character '-'. Contain one or several '<IF>' to have
a conditional right._meta
- is the StringMetaRight which is equivallent to this StringRight.
Never null, empty or desactivated._internalKey
- is the internal key which allows ACS right comparisons.
From 1 to 999. '1' is the lesser value. Never null._l_upperRights
- is the set of upper rights which are strictly greater than this right
without any intermediate rights, following the network of rights in the same ACS.
The number of upper rights is from 0 to 5 (including). May be null._targetClassType
- is the type which is the end of the right.
To use only when the _meta target class is not null. May be null.
Is added after '_' at the end of the kernel right, for having the displayed right._acsRun
- is the ACSFactory owning this right.
Never null.
CreateError
- if ACSFactoryImpl.addRight() throws it, or if
the kernel right, the metaright or the internal key is not correct,
an upper right is not superior to this instance;
an upper right has a metaright which is inferior to _meta;
an upper right is an administration right while the new right is not;
the instance has then to be deleted!Method Detail |
---|
public final ImmutableName getAcsName()
getAcsName
in interface StringRight
public final ACSRun getEorACS()
public final ImmutableName getFullName()
here, ':: ' is added by gBase.NameImpl.toString(). This name is used only outside gBase, following BaseObject interface.
getFullName
in interface BaseObject
getFullName
in interface StringRight
public final ImmutableName getName()
This name is used only outside gBase, following BaseObject interface.
getName
in interface BaseObject
getFullName()
,
BaseUtilityImpl.getRightFromNameAsString(java.lang.String, ARoad0.gBaseInterface.ACSRun)
public final java.lang.String getNickName()
The exception is for the administrative rights where the 17 last characters are used from the nick name.
If right_ is '|modify_security_descriptor|', the nick name is '|modify_security|'.
If right_ is 'read', the nick name is the same. If right_ is 'read&execute', the nick name is 'read&'. If right_ contains '_', the nick name 2 last characters are '_%' where '%' is here the character at the right of the last '_' in right_. For example, 'write_for_directory' gives 'wri_d'. The nick name for a negative right starts with 'd_', if the right starts by 'deny_'. The other parts of the nick name are like for a positive right. If right is 'deny_read', the nick name is 'd_read'. If the right is 'deny_write_for_directory', the nick name is 'd_wri_d'. If the negative right does not start with 'deny_', it is processed like a positive right and the nick name size is limited to 5. This short name is NOT unique for the Access Road program, nor for the ACS if it is an ACS object.
getNickName
in interface BaseObject
getNickName
in interface StringRight
public final int getInternalKey()
getInternalKey
in interface StringRight
public final boolean isTargetClassed()
isTargetClassed
in interface StringRight
public final boolean isTargetClassTyped()
isTargetClassTyped
in interface StringRight
public final java.lang.String getRight()
getRight
in interface StringRight
public final java.lang.String getTargetClass()
getTargetClass
in interface StringRight
public final java.lang.String getTargetClassType()
getTargetClassType
in interface StringRight
public void setComment(java.lang.String _s)
setComment
in interface StringRight
_s
- is an user comment which is associated to the right.public final java.lang.String getComment()
getComment
in interface StringRight
public boolean isGrantingRight()
isGrantingRight
in interface StringRight
public final boolean isEmpty()
isEmpty
in interface StringRight
public final boolean isParent()
isParent
in interface StringRight
public final boolean isSlave()
isSlave
in interface StringRight
public boolean isAcsRightUnderOpenACS()
public final void setParent(boolean _b) throws BaseError
setParent
in interface StringRight
_b
- is true to set the right as parent
BaseError
- when _b true if there are some lower rights or if it is after the
ACS creation process.public final void setSlave(boolean _b) throws BaseError
setSlave
in interface StringRight
_b
- is true to set the right as slave
BaseError
- when _b true if there is not exactly one upper right,
or if the upper right is not a parent, or if it is after the
ACS creation process.public final void setDesactivated(boolean _b)
setDesactivated
in interface StringRight
_b
- is true to desactivate the rightpublic final boolean isDesactivated()
isDesactivated
in interface StringRight
public final StringMetaRight getEorMetaRight()
getEorMetaRight
in interface StringRight
public final StringRight[] getLowerRights()
getLowerRights
in interface StringRight
public final StringRight[] getUpperRights()
getUpperRights
in interface StringRight
public final boolean equals(java.lang.Object _obj)
equals
in interface BaseObject
equals
in interface StringRight
equals
in class java.lang.Object
_obj
- to compare
public final int hashCode()
hashCode
in interface BaseObject
hashCode
in interface StringRight
hashCode
in class java.lang.Object
public final int compareTo(java.lang.Object _o) throws java.lang.ClassCastException
compareTo
in interface StringRight
compareTo
in interface java.lang.Comparable
_o
- to compare
java.lang.ClassCastException
- - if the specified object's type
prevents it from being compared to this current Objectpublic long getSerialVersionUID()
public final java.lang.String toString()
toString
in interface StringRight
toString
in class java.lang.Object
public void finalizeForUser() throws UpDateError
finalizeForUser
in interface FinalizedObjectForUser
finalizeForUser
in interface StringRight
UpDateError
- if the ACS does not known the right (if
it is a clone, typically), if the metaright is wrong,
or if a lower or upper right is not correct.public void finalizeForBase() throws UpDateError
finalizeForBase
in interface FinalizedObject
UpDateError
- if the ACS does not known the right (if
it is a clone, typically), if the metaright is wrong,
or if a lower or upper right is not correct.public void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
addPropertyChangeListener
in interface BoundBean
_l
- PropertyChangeListener to add. Caution: the listener must NOT
have specific hashCode() and equals() methods, to work with HashSet
in the removing operations.public void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
addPropertyChangeListener
in interface BoundBean
_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.public void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
removePropertyChangeListener
in interface BoundBean
_l
- is the PropertyChangeListener to removepublic void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
removePropertyChangeListener
in interface BoundBean
_propertyName
- String is the name of the property_l
- is the PropertyChangeListener to removeprotected void addUpperMetaRight(StringMetaRightImpl _right) throws BaseError
_right
- which directly includes this right. Never null.
BaseError
- if the right is a slave, or the parameter is null,
or the number of upper rights is already 5,
or an upper right is an administration right while the new right is not,
or it is not an embedded right.protected void removeUpperRight(StringRight _right, java.lang.Object _caller)
_right
- directly includes this right. Never null._caller
- is the object which calls this method; used to
identify the upper right finalizing operation with _caller == _right
for an ACS right only.protected void addLowerRight(StringRight _right)
_right
- is directly included in this right. Never null.protected void removeLowerRight(StringRight _right)
_right
- is directly included in this right. Never null.protected void firePropertyChange(java.lang.String _propertyName, java.lang.Object _oldValue, java.lang.Object _newValue)
_propertyName
- name of the changing property_oldValue
- of the property_newValue
- of the property. No operation if equal to _oldValue
and not null.protected void finalizeClosedRight()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |