ARoad0.gBase
Class PrivilegeForTypeImpl

java.lang.Object
  extended by ARoad0.gBase.PrivilegeAbst
      extended by ARoad0.gBase.PrivilegeForTypeImpl
All Implemented Interfaces:
ACSObject, BaseObject, BoundBean, DetailledName, FinalizedObject, FinalizedObjectForUser, ImmutablePrivilege, Privilege, PrivilegeForType, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class PrivilegeForTypeImpl
extends PrivilegeAbst
implements PrivilegeForType

This class is responsible for modeling a set of rights from a source with a given type, to an access target with another given type. A source has rights upon a target through a typed privilege if the privilege source type is the type of the given source, and if the privilege target type is the type of the given target. One typed privilege is designed to produce rights for numerous sources and numerous targets, and without ability to change them except through a straight deletion of the typed privilege. The rights of a privilege are immutable after its creation, while the AclEntry has immutable source and target, but with editable rights after the creation.

A typed privilege is managed by an ACS, and it is registered by the program in the relevant sources and targets. They may be external ones (that is, their ACS is not the Privilege ACS) only for TYPED_FOR_SEED privileges, and then the privilege is not registered in its sources and targets. Access sources are usually EligibleParties, but not only. This allows to give a PrivilegeForType to a Directory for example.

The ACSObject type is the main criteria to apply the privilege to sources and targets. However, the prefix '<immutable>' in a type does not change the PrivilegeforTypes of the ACSObject. There are the four privilege subtypes: TYPED, TYPED_CLASSED, TYPED_CLASSED_SPECIFIC, and TYPED_FOR_SEED. TYPED_CLASSED privilege is a TYPED privilege with contraints on source and target classes. TYPED_CLASSED_SPECIFIC is a TYPED_CLASSED privilege for named source and target. TYPED_FOR_SEED is a TYPED privilege reserved for the authorization servers and for external sources and targets. CAUTION: the gWork package manages only the TYPED PrivilegeForType, in this version.

Following the ACS policy, sources and targets may have static or dynamic types. 'dynamic' means that the user may change the type after the object creation. If the source type (or the target type) is set '<undefined>' in the privilege, then there is no restriction for the relevant type. It may have some limitations about the allowed source and target types, and this is controlled by the ACS.

The relevant sources and targets register/unregister the typed privilege when the source, the target, the type or the privilege is created/deleted. Then, sources and targets know their typed privileges, but typed privileges do not know the sources and targets which use them. To detect the applicable typed privileges between a source and a target, the two privilege lists are compared through '==', not equals(). But the relevant sources and targets do NOT register/unregister TYPED_FOR_SEED privileges, which have external sources and targets having no link to these privileges.

When a target is created or deleted, it calls the method fireOneTypedPrivilegeTargetEvent() in its typed privileges, which fires an event 'OneTypedPrivilegeTarget' to its listeners. This is used by gWork.RightsMediatorImpl to detect when a view may have to change its rights.

This is a javabean with the following bound properties:

- 'PrivilegeSourceClass'

- 'PrivilegeTargetClass'

- 'OneTypedPrivilegeTarget'

The privilege key is used by the ACS to find a privilege. The key is the couple (main type, nick name). The main privilege value is an immutable list of rights. The privilege gets positive or negative rights: it grants or denies accesses. The rights and the key CANNOT be updated after the privilege creation, nor the rights sens (grant or deny). There is a 'See Why' description to complement the comment.

Sources and target may be any ACSObject, to allow to give a privilege to a Directory, and to allow certificate seeds in Authorization Servers. A Privilege instance is always dedicated to one ACS. The privileges may be applicable to external (from other ACS) objects only for TYPED_FOR_SEED privileges. In the other cases, privileges are limited to their own ACS.

With a TYPED, a TYPED_CLASSED or a TYPED_CLASSED_SPECIFIC privilege, the standard rights are never classed nor typed (not possible if they are metarights). With a TYPED_CLASSED privilege, the source and target classes are constrained, in addition to their type restrictions. For instance, the access source may have to be an ImmutableEligibleParty, like many other right types, and the target may have to be a Resource. A TYPED_CLASSED_SPECIFIC privilege is reserved to a named source and a named target. Their two names are put in the privilege source or target type, while the source an the target do not register the privilege. At the construction of a classed privilege, it is mandatory for the user to call setSourceClassOneTime() and setTargetClassOneTime() to define the source class and the target class. Otherwise, PrivilegeAbst.getL_Rights() returns an empty array.

An access control seed is the ACS data which allows an ACS, as an Authorization Server, to provide a certificat at the request of external actors. The true access control right is a certificate or an equivalent. It is then built up by the gWork package from the seed given by the Authorization Server. A TYPED_FOR_SEED privilege is then used by the Authorization Server, where the criterion to deliver the certificate is put in the privilege type. This criteria is applicable to the source and to the target. It has generally the following structure: Basic_FullName.toString(). The Authorization Server has to not use any constraint on the target types in privileges. The right is translated and stored by gWork for any access source which requests to the Authorization Server and is authorized to receive it. A TYPED_FOR_SEED privilege is always external.

This class has subclasses in the AcsAddon packages. Most of the variables are protected. See the Copyright.

See Also:
PrivilegeAbst, PrivilegeForLinksImpl, Serialized Form

Field Summary
protected  boolean classed_
          if true, the instance has the TYPED_CLASSED or a TYPED_CLASSED_SPECIFIC type
static PrivilegeForTypeImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected  boolean seed_
          if true, the instance has the TYPED_FOR_SEED type
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization
protected  java.lang.Class sourceClass_
          Class of the privilege users, if TYPED_CLASSED or TYPED_CLASSED_SPECIFIC.
protected  java.lang.String sourceType_
          The source type.
protected  boolean specific_
          if true, the instance has the TYPED_CLASSED_SPECIFIC type
protected  java.lang.Class targetClass_
          Class on which the privilege is applied, if TYPED_CLASSED or TYPED_CLASSED_SPECIFIC.
protected  java.lang.String targetType_
          The target type.
 
Fields inherited from class ARoad0.gBase.PrivilegeAbst
aCS_, acsName_, changeSupport_, comment_, detailledName_, INCREMENT_CAPACITY, INITIAL_CAPACITY, l_rights_, L_TYPES, LINKED, LINKED_FOR_ONE_TO_ONE, LINKED_IF_ALL_SOURCES, mainType_, nickName_, positiveRight_, PRIME, secondType_, seeWhy_, TYPED, TYPED_CLASSED, TYPED_CLASSED_SPECIFIC, TYPED_FOR_SEED
 
Constructor Summary
PrivilegeForTypeImpl()
          Constructor to use only as a transient value for initialization, or used from ARoad0.gBase.PrivilegeImplBeanInfo.getPropertyDescriptors() in ARoad0.Gui1.CollectionPropertyEditor.getValue().
PrivilegeForTypeImpl(ACS _aCS, java.lang.String _nickName, java.lang.String _sourceType, java.lang.String _targetType, java.lang.String _mainType, StringRight[] _l_rights, java.lang.String _secondType)
          This is the only way to request the creation of a typed privilege instance from the GUI.
PrivilegeForTypeImpl(ACS _aCS, java.lang.String _sourceType, java.lang.String _targetType, java.lang.String _nickName, java.lang.String _mainType, StringRight[] _l_rights, java.lang.String _secondType, boolean _toRegisterInManager)
          This is the only way to create a typed privilege, with one of the four possible types.
 
Method Summary
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean for the events 'PrivilegeSourceClass', 'PrivilegeTargetClass', 'OneTypedPrivilegeTarget'.
protected static java.lang.String buildUpDetailledName(java.lang.String _mainType, java.lang.String _nickName, java.lang.String _firstRight, java.lang.String _sourceType, java.lang.String _targetType)
          This method allows to create the detailled name, unique in the ACS.
 java.lang.Object clone()
          Used to clone an ACS.
 java.lang.Object copy(ImmutableName _name, ACS _acs, Node _parent, java.lang.Boolean _toRegisterInManager)
          This method provides a copy of the instance with another name, only for another ACS.
 boolean equals(java.lang.Object _obj)
          Do NOT use this method to compare the typed privileges of a source and a target.
protected  void finalize()
          This method calls finalizeForBase(), but there is no guarantee that the JVM calls this method before the end of the application.
 void finalizeForBase()
          It sets to null almost all variables, so the instance is equals to a new PrivilegeForTypeImpl().
protected  void finalizeFromDeserialization()
          This method does not finalize the sources and the targets, even for a TYPED_CLASSED_SPECIFIC.
 void fireOneTypedPrivilegeTargetEvent(ImmutablePrivilegeTarget _oldValue, ImmutablePrivilegeTarget _newValue)
          Activates the firing of a 'OneTypedPrivilegeTarget' event to all its listeners.
 boolean getClassed()
           
protected static java.lang.String getDetailledNameFromNameForType(ImmutableName _name, int _typeIndex)
          Gets the detailled name from the privilege name.
 Privilege getEmptyInstance()
           
 boolean getForSeed()
           
 ImmutableName getFullName()
          The full name is unique for the Access Road program.
 java.lang.Object[] getKeyReferencesFromName(ImmutableName _privName)
          Gets the main components from the typed privilege name as a string, returned by getName().
 ImmutableName getName()
          Gets the BaseObject name of the privilege.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
          Returns the change listeners for a property.
 java.lang.String getSourceClass()
          Gets the interface which may be assignable from the effective source class.
 java.lang.String getSourceType()
           
 boolean getSpecific()
           
 java.lang.String getTargetClass()
          Gets the interface which may be assignable from the effective target class.
 java.lang.String getTargetType()
           
 boolean isEmpty()
           
 boolean isExternalPrivilege()
          Only LINKED_FOR_SEED privileges are external ones, among the typed privileges, and this is true for them in all cases.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean for the events 'PrivilegeSourceClass', 'PrivilegeTargetClass', 'OneTypedPrivilegeTarget'.
 void setSourceClassOneTime(java.lang.String _class)
          Sets the interface which may be assignable from the effective source class.
 void setTargetClassOneTime(java.lang.String _class)
          Sets the interface which may be assignable from the effective targets class.
 java.lang.String toString()
          The format is ' Detailled name: KKKK; source type: FFFF; target type: NNNNNNNN'.
 
Methods inherited from class ARoad0.gBase.PrivilegeAbst
addPropertyChangeListener, compareTo, finalizeForUser, firePropertyChange, getAcsFromName, getAcsName, getComment, getDetailledName, getDetailledNameFromName, getEorACS, getKeyPropertiesFromDetailledName, getL_PrivilegeTypes, getL_Rights, getMainType, getNameFromDetailledName, getNickName, getPositiveRight, getPreviousDetailledName, getSecondType, getSeeWhy, getSerialVersionUID, hashCode, removePropertyChangeListener, setComment, setRights, setSecondType, setSeeWhy
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ARoad0.gBaseInterface.Privilege
setComment, setSecondType, setSeeWhy
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutablePrivilege
getAcsFromName, getComment, getEorACS, getL_Rights, getMainType, getPositiveRight, getSecondType, getSeeWhy
 
Methods inherited from interface ARoad0.gBaseInterface.ACSObject
getAcsName
 
Methods inherited from interface ARoad0.gBaseInterface.BaseObject
getNickName, hashCode
 
Methods inherited from interface ARoad0.gBaseInterface.BoundBean
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface ARoad0.gBaseInterface.DetailledName
getDetailledName, getDetailledNameFromName, getKeyPropertiesFromDetailledName, getNameFromDetailledName
 
Methods inherited from interface ARoad0.gBaseInterface.FinalizedObjectForUser
finalizeForUser
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

classed_

protected boolean classed_
if true, the instance has the TYPED_CLASSED or a TYPED_CLASSED_SPECIFIC type


specific_

protected boolean specific_
if true, the instance has the TYPED_CLASSED_SPECIFIC type


seed_

protected boolean seed_
if true, the instance has the TYPED_FOR_SEED type


sourceType_

protected java.lang.String sourceType_
The source type. May be null.


targetType_

protected java.lang.String targetType_
The target type. May be null.


sourceClass_

protected java.lang.Class sourceClass_
Class of the privilege users, if TYPED_CLASSED or TYPED_CLASSED_SPECIFIC. May be null, even if classed. This class may not be an EligibleParty.


targetClass_

protected java.lang.Class targetClass_
Class on which the privilege is applied, if TYPED_CLASSED or TYPED_CLASSED_SPECIFIC. May be null, even if classed. This class may not be a Resource.


EMPTY_INSTANCE

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


serialPersistentFields

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

Constructor Detail

PrivilegeForTypeImpl

public PrivilegeForTypeImpl()
Constructor to use only as a transient value for initialization, or used from ARoad0.gBase.PrivilegeImplBeanInfo.getPropertyDescriptors() in ARoad0.Gui1.CollectionPropertyEditor.getValue().


PrivilegeForTypeImpl

public PrivilegeForTypeImpl(ACS _aCS,
                            java.lang.String _nickName,
                            java.lang.String _sourceType,
                            java.lang.String _targetType,
                            java.lang.String _mainType,
                            StringRight[] _l_rights,
                            java.lang.String _secondType)
                     throws CreateError
This is the only way to request the creation of a typed privilege instance from the GUI. Calls the second constructor.

Parameters:
_aCS - owns this Privilege. Non-null External Object Reference.
_nickName - short privilege name. Cannot be null.
_sourceType - type of the object which have the access rights. Cannot be null, but '<undefined>' is a neutral value. For a TYPED_FOR_SEED privilege or a TYPED_CLASSED_SPECIFIC privilege, it has to follow the format Name.toString().
_targetType - type of the object on which access rights are applied. Cannot be null, but '<undefined>' is a neutral value. For a TYPED_FOR_SEED privilege or a TYPED_CLASSED_SPECIFIC privilege, it has to follow the format Name.toString().
_mainType - must be one of the PrivilegeAbst constant
_l_rights - StringRight array of privilege rights. May be null, but a null value is not allowed at the first position. Creates an empty array with a length of 0 if the argument is null. All rights have to be all positive or all negative. If the type is PrivilegeAbs.TYPED, rights have to be non-classed, non-typed rights.
_secondType - the second type which drives the rights and the immutability, just like a Basic type. If null, the internal value is set to "<undefined>".
Throws:
CreateError - if this privilege already exists (_aCS.newEorPrivilege() throws it), if the rights or the privilege type is not correct, or if _nickName contains '::' or '>>', or if a parameter is null, or if a relevant source or a target does not register this privilege, or if typed privilege with classed or typed rights.

PrivilegeForTypeImpl

public PrivilegeForTypeImpl(ACS _aCS,
                            java.lang.String _sourceType,
                            java.lang.String _targetType,
                            java.lang.String _nickName,
                            java.lang.String _mainType,
                            StringRight[] _l_rights,
                            java.lang.String _secondType,
                            boolean _toRegisterInManager)
                     throws CreateError
This is the only way to create a typed privilege, with one of the four possible types. A TYPED privilege is the most simple one. A TYPED_CLASSED privilege is a TYPED privilege with contraints on source and target classes. A TYPED_FOR_SEED privilege is used as a certificate seed, where the criteria to deliver the certificate is put in the two types. This criteria is applicable to the source and to the target. It has the following structure: Basic_FullName.toString().

A TYPED_CLASSED_SPECIFIC privilege is reserved to a named source and a named target. Their two names are put in the privilege source or target type, while the source an the target do not register the privilege. This criteria is applicable to the source and to the target. It has the following structure: Basic_FullName.toString().

The relevant sources and targets register/unregister the typed privilege when the source, the target or the privilege is created/deleted, so sources and targets know their typed privileges, but typed privileges do not know the sources and targets which use them. This is also true for TYPED_FOR_SEED privileges, which have external sources and targets. If the instance is classed, displays a message to the user to recall him that the source class and the target class have to be set. For this purpose, calls ARoad0.Gui1.DialogBox.showOkMessage().

Parameters:
_aCS - owns this Privilege. Non-null External Object Reference.
_sourceType - type of the object which have the access rights. Cannot be null, but '<undefined>' is a neutral value. If it is a TYPED_FOR_SEED or a TYPED_CLASSED_SPECIFIC privilege, the argument has to use the format Name.toString(). Otherwise, if the argument contains 'immutable ', this word is removed in the type.
_targetType - type of the object on which access rights are applied. Cannot be null, but '<undefined>' is a neutral value. If it is a TYPED_FOR_SEED or a TYPED_CLASSED_SPECIFIC privilege, the argument has to use the format Name.toString(). Otherwise, if the argument contains '<undefined>', this word is removed in the type.
_nickName - short privilege name. Cannot be null.
_mainType - must be one of the PrivilegeAbst constant
_l_rights - StringRight array of privilege rights. May be null, but a null value is not allowed at the first position. Creates an empty array with a length of 0 if the argument is null. All rights have to be all positive or all negative. If the type is PrivilegeAbs.TYPED, rights have to be non-classed, non-typed rights.
_secondType - the second type drives the rights and the immutability, just like a Basic type. If null, the internal value is set to '<undefined>'.
_toRegisterInManager - false if this method must not register the instance in its ACS.
Throws:
CreateError - if this privilege already exists, if the rights or the privilege type is not correct, or if the nick name contains '::' or '>>', contains a character that is not a letter, if a null right or a right which is not authorized. if a relevant source or a target does not register this privilege, or if it is a typed privilege with classed or typed rights.
Method Detail

buildUpDetailledName

protected static java.lang.String buildUpDetailledName(java.lang.String _mainType,
                                                       java.lang.String _nickName,
                                                       java.lang.String _firstRight,
                                                       java.lang.String _sourceType,
                                                       java.lang.String _targetType)
                                                throws CreateError
This method allows to create the detailled name, unique in the ACS. Used in the Privilege implementation constructor. The format of the returned value is:

privilegeType || nickName || first right || source type >> target type

Parameters:
_mainType - one of the allowed privilege types. Never null.
_nickName - privilege nick name. Never null.
_firstRight - first right of the privilege. Never null.
_sourceType - source type of the privilege. Never null.
_targetType - target type of the privilege. Never null.
Returns:
the privilege detailled name, even if all the parameters are null.
Throws:
CreateError - if '||', '>>' or '::' is in _nickName

getDetailledNameFromNameForType

protected static java.lang.String getDetailledNameFromNameForType(ImmutableName _name,
                                                                  int _typeIndex)
                                                           throws BaseError
Gets the detailled name from the privilege name. The format of the returned value is:

privilegeType || nickName || first right || source type >> target type Calls buildUpDetailledName(). Called only by PrivilegeAbst.getDetailledNameFromName().

Parameters:
_name - typed privilege name
_typeIndex - index of the component '|| PRIV_TYPE' in _name
Returns:
the detailled name of the privilege
Throws:
BaseError - if there is a wrong format for _name
See Also:
PrivilegeAbst.buildUpDetailledName(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

setSourceClassOneTime

public void setSourceClassOneTime(java.lang.String _class)
                           throws CreateError
Sets the interface which may be assignable from the effective source class. It is a criteria which complements the type to select the privilege source. The source class is reserved to the 2 main types TYPED_CLASSED and TYPED_CLASSED_SPECIFIC of privileges. This method may be called only one time, and it is mandatory to do it just after the creation of the privilege. Fires the event 'PrivilegeSourceClass'.

Specified by:
setSourceClassOneTime in interface PrivilegeForType
Parameters:
_class - end of a gBaseInterface class name, like 'Resource' for the class ARoad0.gBaseInterface.Resource
Throws:
CreateError - if the privilege has not the main type TYPED_CLASSED or TYPED_CLASSED_SPECIFIC, if _class does not define a gBaseInterface class or if it is not the first call to this method

setTargetClassOneTime

public void setTargetClassOneTime(java.lang.String _class)
                           throws CreateError
Sets the interface which may be assignable from the effective targets class. It is a criteria which complements the type to select the privilege targets. The target class is reserved to the 2 main types TYPED_CLASSED and TYPED_CLASSED_SPECIFIC of privileges. This method may be called only one time, and it is mandatory to do it just after the creation of the privilege. Fires the event 'PrivilegeTargetClass'.

Specified by:
setTargetClassOneTime in interface PrivilegeForType
Parameters:
_class - end of a gBaseInterface class name, like 'Resource' for the class ARoad0.gBaseInterface.Resource
Throws:
CreateError - if the privilege has not the type TYPED_CLASSED or TYPED_CLASSED_SPECIFIC, if _class does not define a gBaseInterface class or if it is not the first call to this method

getFullName

public ImmutableName getFullName()
The full name is unique for the Access Road program. Its is equal to the privilege name.

Specified by:
getFullName in interface BaseObject
Returns:
a copy of the name. Null for an empty privilege.

getName

public ImmutableName getName()
Gets the BaseObject name of the privilege. The typed Privilege name is composed of: ACS:: aCS name :: || PRIV_TYPE:: main type :: || NICK_NAME:: privilege name :: || FIRST_RIGHT:: first right :: || SOUR_TYPE:: sourceType :: >> TARG_TYPE:: targetType here, ':: ' is added by gBase.NameImpl.toString(). The reverse functions of getName() are getKeyReferencesFromName() and getDetailledNameFromName(). This name is used only outside gBase, following BaseObject interface.

Specified by:
getName in interface BaseObject
Specified by:
getName in interface ImmutablePrivilege
Returns:
ImmutableName of the privilege, or null if it is an empty privilege

getSourceType

public final java.lang.String getSourceType()
Specified by:
getSourceType in interface PrivilegeForType
Returns:
the source type. May be null.

getTargetType

public final java.lang.String getTargetType()
Specified by:
getTargetType in interface PrivilegeForType
Returns:
the target type. May be null.

getClassed

public final boolean getClassed()
Specified by:
getClassed in interface PrivilegeForType
Returns:
boolean true if the Privilege type is PrivilegeAbst.TYPED_CLASSED or TYPED_CLASSED_SPECIFIC.

getSpecific

public final boolean getSpecific()
Returns:
boolean true if the Privilege type is PrivilegeAbst.TYPED_CLASSED_SPECIFIC.

getForSeed

public final boolean getForSeed()
Returns:
boolean true if the Privilege type is PrivilegeAbst.TYPED_FOR_SEED.

getSourceClass

public final java.lang.String getSourceClass()
Gets the interface which may be assignable from the effective source class. It is a criteria which complements the type to select the privilege source. This property is never null when it is a TYPED_CLASSED or a TYPED_CLASSED_SPECIFIC privilege, and always null otherwise. 'EligibleParty' is an example of value.

Specified by:
getSourceClass in interface PrivilegeForType
Returns:
the class name in gBaseInterface. May be null.

getTargetClass

public final java.lang.String getTargetClass()
Gets the interface which may be assignable from the effective target class. It is a criteria which complements the type to select the privilege targets. This property is never null when it is a TYPED_CLASSED or a TYPED_CLASSED_SPECIFIC privilege, and always null otherwise. 'Resource' is an example of value.

Specified by:
getTargetClass in interface PrivilegeForType
Returns:
the class name in gBaseInterface. May be null.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String _propertyName,
                                      java.beans.PropertyChangeListener _l)
Adds a listener to the bean for the events 'PrivilegeSourceClass', 'PrivilegeTargetClass', 'OneTypedPrivilegeTarget'. Used by Gui1.CommonPropertyEditor for the 'Comment' and 'SeeWhy' properties. Overiddes the super method.

Specified by:
addPropertyChangeListener in interface BoundBean
Overrides:
addPropertyChangeListener in class PrivilegeAbst
Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to add

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Removes a listener to the bean for the events 'PrivilegeSourceClass', 'PrivilegeTargetClass', 'OneTypedPrivilegeTarget'. Overiddes the super method.

Specified by:
removePropertyChangeListener in interface BoundBean
Overrides:
removePropertyChangeListener in class PrivilegeAbst
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 ImmutablePrivilege
Overrides:
getPropertyChangeListeners in class PrivilegeAbst
Parameters:
_propertyName - name of the listened property.
Returns:
the change listeners. May be null or empty.

clone

public java.lang.Object clone()
Used to clone an ACS. Caution: the clone is not registered in its ACS, nor in its source and targets.

Overrides:
clone in class PrivilegeAbst
Returns:
Object without change in the external references but copy of these references.

equals

public boolean equals(java.lang.Object _obj)
Do NOT use this method to compare the typed privileges of a source and a target. Rather use the '==' fonction.

Specified by:
equals in interface BaseObject
Overrides:
equals in class PrivilegeAbst
Parameters:
_obj - to compare.
Returns:
boolean true if _obj is equal with the same class, as implementation of PrivilegeForTypeImpl.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface ImmutablePrivilege
Returns:
boolean true if equal to new PrivilegeForTypeImpl()

getEmptyInstance

public Privilege getEmptyInstance()
Specified by:
getEmptyInstance in interface ImmutablePrivilege

isExternalPrivilege

public boolean isExternalPrivilege()
Only LINKED_FOR_SEED privileges are external ones, among the typed privileges, and this is true for them in all cases.

Specified by:
isExternalPrivilege in interface ImmutablePrivilege
Returns:
true if the source or the target is from another ACS

toString

public java.lang.String toString()
The format is ' Detailled name: KKKK; source type: FFFF; target type: NNNNNNNN'.

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

finalizeForBase

public void finalizeForBase()
                     throws UpDateError
It sets to null almost all variables, so the instance is equals to a new PrivilegeForTypeImpl(). The relevant sources and targets register/unregister the typed privilege when the source, the target or the privilege is created/deleted, so sources and targets know their typed privileges, but typed privileges do not know the sources and targets which use them. This is NOT true for TYPED_FOR_SEED privileges, which have external sources and targets. An unused object has to be deleted to inform the others objects, and this method HAS TO BE CALLED before deleting this object. This method is called by finalize() and finalizeForUser().

Specified by:
finalizeForBase in interface FinalizedObject
Overrides:
finalizeForBase in class PrivilegeAbst
Throws:
UpDateError - if the privilege is unknwon from the ACS, the sources or the targets.

copy

public java.lang.Object copy(ImmutableName _name,
                             ACS _acs,
                             Node _parent,
                             java.lang.Boolean _toRegisterInManager)
                      throws CreateError
This method provides a copy of the instance with another name, only for another ACS. On the contrary of PrivilegeForLinksImpl.copy(), the PrivilegeForType copy in the same ACS has no interest without changing the rights or the types. Each internal variable that is an external object reference have a shallow copy or a deep copy. Comment is not copied.

Parameters:
_name - is NOT the copy name; must be a one-component name, and the component is the nick name of the copy.
_acs - is the main ACS of the copy to create. Have to be different to the ACS of this instance.
_parent - must be null here.
_toRegisterInManager - false if this method must not register the instance in its ACS.
Returns:
Object is a copy of the object, in the same class.
Throws:
CreateError - if _name or _acs is null, or _parent is not null, or _acs is this privilege ACS, or _name is not a one-component name.

getKeyReferencesFromName

public java.lang.Object[] getKeyReferencesFromName(ImmutableName _privName)
                                            throws CreateError
Gets the main components from the typed privilege name as a string, returned by getName(). These key components define fully the privilege instance. This method is used by Gui1.PropertyEditor to remove a privilege from a list displaying the privilege name in the beamer. Called by ACS_Facade.getPrivilege().

Specified by:
getKeyReferencesFromName in interface ImmutablePrivilege
Parameters:
_privName - is the privilege name, returned by getName()
Returns:
null if the name format is wrong (for PrivilegeForType or PrivilegeForLinks), or an array of the 6 Privilege components:

- index 0: name of the ACS which manages this privilege (ImmutableName) - index 1: privilege type (String) - index 2: nick name (String) - index 3: grant or deny (String) - index 4: source type (String) - index 5: target type (String)

Throws:
CreateError - if the argument or a component is null or not correct, not a privilege name string, or if a main component string is not provided by NameImpl.toString()
See Also:
PrivilegeAbst.getAcsFromName(ARoad0.gBaseInterface.ImmutableName)

fireOneTypedPrivilegeTargetEvent

public void fireOneTypedPrivilegeTargetEvent(ImmutablePrivilegeTarget _oldValue,
                                             ImmutablePrivilegeTarget _newValue)
Activates the firing of a 'OneTypedPrivilegeTarget' event to all its listeners. Called by each new and finalized PrivilegeTarget that uses this PrivilegeForType. Noop if the two arguments are null, if the two ones are not null, if the two arguments are identical.

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

finalize

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

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

finalizeFromDeserialization

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