ARoad0.gBase
Class CAliasImpl

java.lang.Object
  extended by ARoad0.gBase.CAliasImpl
All Implemented Interfaces:
java.io.Serializable

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

This class is an embedded class responsible for modeling an ACSObject as reference to an alias, and/or as alias of a reference. The alias is the source of an ARoad0.CNot.AccessControlLink.IS_ALIAS relation to its reference as target. The hard alias setting is done through a call to the master of the CAliasImpl instance. The hard reference of an alias is get through the methods of this class. The soft reference of an alias is get through a call to getReferenceOfSoftAlias() on the reference ACS. This is the correct way gWork.compoundRightsFactoryImpl uses in the methods selectDirectHiddenReferenceForAlias() and selectDirectReferencesInViewForAlias(), both for the hard and the soft aliasing. The CAliasImpl master may be an alias or a reference. It may be a BasicImpl or a VirtualFolderImpl. There is no constraints on the reference class for a given alias class. Both for hard and soft relations, the alias relation is not multi-level: a reference cannot be the alias of another object. There are two types of alias relation this class may handle:

(1) the internal hard alias produces a direct reference-to-alias relation in the same ACS, and the two objects know this one-to-one relation,

(2) the soft alias produces an indirect reference-to-alias relation where the alias is internal or external, where the reference knows all its soft aliases, and the alias simply knows the ACS of its unique soft reference.

The soft alias results in a specific processing in each AcsAddon ACS, since the reference is returned by the method ACS.getReferenceOfSoftAlias() for a given external ACSObject as argument. This ACS method registers the soft alias relation in the CAliasImpl instances of the reference and the alias.

It is the responsibility of the ACS associations or the AcsAddon code to set an internal alias for one new ACSObject, as an alias or as an alias reference. On the other hand, the soft Alias relation may be only set by an AcsAddon.

Generally speaking, in the standard way of use, the alias transfers directly its rights as target to its reference, including, for an internal alias, its Account/Groups context. If the elements of the AG context are not yet in the path, this may define new links, from the reference to each account or group of the context. This is the propagation of the indirect AG context. The hard alias relation is alone to handle this tranfert in Access Road. There is no such a propagation in an AclEntry or a Privilege relation, even if an AclEntry transfers the direct AG context. This case may occur when:

(1) a GroupIDMember is a hard alias in a view, and the hard reference receives the AG rights of its alias.

(2) an Actor is a hard alias running as actor under a given AG context, and the hard reference receives the AG rights of its alias.

These cases are simple when the hard alias is in the view, since this implies the reference is also in the view, and the paths from the alias are displayed so that the user may see them directly. Otherwise, the cases occur into an access path when the hard alias is an intermediate node, and if the node before the hard alias do not transmit its proper AG context.

An exemple of indirect AG context propagation is for a 3-nodes path having the form 'ep/privilege/actor started from xid/alias/virtual folder', where the actor runs under the account U and the group G. The generic rule is that the rights of 'ep' on the virtual folder depend on the actor AG context, if any, since the privileges do not propagate the Account/Groups context of 'ep'. While U and G are not intermediate nodes in this path, if the actor is an intermediate node, the path is extended by the links 'run under/U' and 'run under/G'. If the actor does not run under U, there is no AG context to propagate through the alias link. It is important to note that, while there is an alias relation, the 'ep' rights on the virtual folder are always, defined by the privileges. Simply, the AG context of the actor provides the rights to the virtual folder.

This exemple shows how it is possible to extend the properties of a given class of the generic model, since VirtualFolder becomes there able to run under a GroupIDMember. Such an extension of the model may be provided to any ACSObject class, each time the instance is the reference of an alias. This feature is independant to the VirtualFolder ACS property for managing the rights propagation to the members.

A second exemple of indirect AG context propagation is in the MySQL AcsAddon. A MySQL view is a VirtualFolder having an Actor alias. The view provides access to its members through the account or the group of the VirtualFolder AG context. This may be the AG context of the VirtualFolder alias - if this alias is such a self-AG-context Actor (MySQL DEFINER mode) - or it may be the direct AG context from the nodes before the haard alias in the path (MySQL INVOKER mode).

One non-standard way of use for this embedded class, in an AcsAddon, is to set some of its properties without complying with the previous recommandations. For exemple, the MySQL AcsAddon needs to model the PROXY relation between several ProxyMySQL and one UserIDMySQL. The hard aliasing is not adapted, but this AcsAddon uses the methods of the soft aliasing to set the PROXY link. However, the MySQL ACS does not manage the soft aliasing, so there is no overload in the access paths searches. Detecting a PROXY target through the method ACS.getReferenceOfSoftAlias() would be more heavy when there are several open ACS. This is why the MySQL AcsAddon chooses to complete the access paths searching, in NodeRightsMySQLImpl, by a direct reading of a ProxyMySQL property returning the current PROXY target. Such a non-standard way allows to display the soft aliasing properties in the beamer, because the MySQL ACS manages the hard aliasing for another need (that is the view delegate).

All variables are private to secure the white box inheritances from this class. It is a javabean with the following bound properties:

- 'HardAliasReference', 'HardAlias', 'hasSoftAlias', 'SoftAlias', 'AcsOfSoftReferences'.

The listeners are proper to this instance. Excepting for EPRViewInBaseImpl, they are 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. This class is public to be overriden in the AcsAddons, and in this case, the subclass is only called by some classes in the same package. See the Copyright.

See Also:
ImmutableBasic.getEorReferenceAsInternalHardAlias(), ImmutableACS.getReferenceOfSoftAlias(ARoad0.gBaseInterface.ACSObject), CompoundRightsFactoryImpl.selectDirectHiddenReferenceForAlias(ARoad0.Gui2.GraphicView, ARoad0.gBaseInterface.EPRViewInBase, ARoad0.gBaseInterface.ACSObject), Serialized Form

Field Summary
protected  java.beans.PropertyChangeSupport changeSupport_
          manages all the property change listeners of this class and its subclasses
(package private) static CAliasImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected  ACSObject hardReferenceOrAlias_
           
protected  ImmutableName hardReferenceOrAliasName_
           
protected static int INCREMENT_CAPACITY
           
protected static int INITIAL_CAPACITY
          Protected variables
protected static int INITIAL_CAPACITY_2
           
protected  boolean isHardReference_
           
protected  ImmutableName[] l_AcsOfSoftReferences_
           
protected  ImmutableName[] l_SoftAlias_
           
protected  ACSObject master_
           
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization
private static long serialVersionUID
           
 
Constructor Summary
protected CAliasImpl()
          The basic constructor.
protected CAliasImpl(ACSObject _master)
          Used by the master constructor.
 
Method Summary
protected  void addAcsOfSoftReferences(ImmutableName _acs)
          Adds the ACS name of an external or internal soft reference to the master as soft alias.
protected  void addEorSoftAlias(ImmutableName _alias)
          Adds an external or internal soft alias to the master as soft reference.
protected  void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
          Adds a listener to the bean, for all the bound properties.
protected  void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
protected  CAliasImpl cloneC(ACSObject _master)
          Clone for embeddd class without registering the new object in the ACSs.
protected  CAliasImpl copy(ACSObject _masterCopy)
          This method provides a copy of the instance with another name, without children copying because the copy order will not be always correct.
 boolean equals(java.lang.Object _obj)
           
protected  void finalize()
          This method removes the CAlias from the ACS lists, but there is no guarantee that the JVM calls this method before the end of the application.
protected  void finalizeForBase()
          Finalizes the CAlias and the hard alias, for a master hard reference.
protected  void finalizeFromDeserialization()
          This method finalizes the instance, since it is used after a deserialization.
protected  void firePropertyChange(java.lang.String _propertyName, java.lang.Object _oldValue, java.lang.Object _newValue)
          Fires an event to every registered listener, in any order.
protected  ACSObject getEorAliasAsInternalHardReference()
          Get the unique ACSObject, if any, of this ACS for which this object is an internal hard reference.
protected  ACSObject getEorReferenceAsInternalHardAlias()
          Get the unique ACSObject, if any, of this ACS for which this object is an internal hard alias.
protected  boolean getHasSoftAlias()
           
protected  ImmutableName[] getL_AcsOfSoftReferences()
          As a soft alias, sets a sorted array of names of the ACS of the soft references.
protected  ImmutableName[] getL_SoftAlias()
          As a soft reference, gets a sorted array of names of the soft alias.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
          Returns the change listeners for a property.
 long getSerialVersionUID()
           
 int hashCode()
           
protected  void removeAcsOfSoftReferences(ImmutableName _acs)
          Removes an external or internal alias from the master as soft reference.
protected  void removeEorSoftAlias(ImmutableName _alias)
          Removes an external or internal alias from the master as soft reference.
protected  void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
          Removes a listener to the bean, for all the bound properties.
protected  void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
protected  void setEorAliasAsInternalHardReference(ACSObject _ali)
          Sets the unique ACSObject, if any, of this ACS for which this object is an internal hard reference.
protected  void setEorReferenceAsInternalHardAlias(ACSObject _ref)
          Sets the unique ACSObject, if any, of this ACS for which this object is an internal hard alias.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
Protected variables

See Also:
Constant Field Values

INITIAL_CAPACITY_2

protected static final int INITIAL_CAPACITY_2
See Also:
Constant Field Values

INCREMENT_CAPACITY

protected static final int INCREMENT_CAPACITY
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

master_

protected ACSObject master_

l_SoftAlias_

protected ImmutableName[] l_SoftAlias_

l_AcsOfSoftReferences_

protected ImmutableName[] l_AcsOfSoftReferences_

hardReferenceOrAlias_

protected transient ACSObject hardReferenceOrAlias_

hardReferenceOrAliasName_

protected ImmutableName hardReferenceOrAliasName_

isHardReference_

protected boolean isHardReference_

EMPTY_INSTANCE

static final CAliasImpl 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.


changeSupport_

protected transient java.beans.PropertyChangeSupport changeSupport_
manages all the property change listeners of this class and its subclasses


serialPersistentFields

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

Constructor Detail

CAliasImpl

protected CAliasImpl()
The basic constructor.


CAliasImpl

protected CAliasImpl(ACSObject _master)
              throws CreateError
Used by the master constructor. No checking of the management of hard and soft alias by the master ACS.

Parameters:
_master - is the master of this embedded class
Throws:
CreateError - the master is null
Method Detail

copy

protected CAliasImpl copy(ACSObject _masterCopy)
                   throws CreateError
This method provides a copy of the instance with another name, without children copying because the copy order will not be always correct.

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
a value derived from the parent nick name hashcode

getL_SoftAlias

protected final ImmutableName[] getL_SoftAlias()
As a soft reference, gets a sorted array of names of the soft alias.

Returns:
ImmutableName[] of the alias. May be null but not empty.

getL_AcsOfSoftReferences

protected final ImmutableName[] getL_AcsOfSoftReferences()
As a soft alias, sets a sorted array of names of the ACS of the soft references.

Returns:
ImmutableName[] of the acs. May be null but not empty.

getHasSoftAlias

protected final boolean getHasSoftAlias()
Returns:
true if, as a soft reference, there is at least one soft alias.

getEorReferenceAsInternalHardAlias

protected ACSObject getEorReferenceAsInternalHardAlias()
Get the unique ACSObject, if any, of this ACS for which this object is an internal hard alias. Calls UtilityImpl.getBaseObject().

Returns:
the hard reference. May be null.

getEorAliasAsInternalHardReference

protected ACSObject getEorAliasAsInternalHardReference()
Get the unique ACSObject, if any, of this ACS for which this object is an internal hard reference. Calls UtilityImpl.getBaseObject().

Returns:
the hard alias. May be null.

setEorReferenceAsInternalHardAlias

protected void setEorReferenceAsInternalHardAlias(ACSObject _ref)
                                           throws UpDateError
Sets the unique ACSObject, if any, of this ACS for which this object is an internal hard alias. The generic gBase package does not call this method, nor the user from the GUI. It is the responsibility of the ACS associations or the AcsAddon code to set an internal alias for one new ACSObject, as an alias or as an alias reference. If the master is already a reference, it cannot become an alias. Fires the property change 'HardAliasReference'.

Parameters:
_ref - the reference. May be null.
Throws:
UpDateError - _basic does not belong to the same ACS or the master is already an alias reference

setEorAliasAsInternalHardReference

protected void setEorAliasAsInternalHardReference(ACSObject _ali)
                                           throws UpDateError
Sets the unique ACSObject, if any, of this ACS for which this object is an internal hard reference. Calls setEorReferenceAsInternalHardAlias() on the alias. The generic gBase package does not call this method, nor the user from the GUI. It is the responsibility of the ACS associations or the AcsAddon code to set an internal alias for one new ACSObject, as an alias or as an alias reference. If the master is already an alias, it cannot become a reference. Calls getEorReferenceAsInternalHardAlias(). Called by finalizeForBase() from the alias. Fires the property change 'HardAlias'.

Parameters:
_ali - the alias. May be null.
Throws:
UpDateError - _basic does not belong to the same ACS or the master is already an alias

addEorSoftAlias

protected void addEorSoftAlias(ImmutableName _alias)
                        throws UpDateError
Adds an external or internal soft alias to the master as soft reference. The alias is normally updated by the ACS calling method. In the standard way of use, called only by the ACS through the master, which may add controls on the parameter class. Has to be used by the AcsAddon. Fires the events 'SoftAlias' and 'hasSoftAlias'.

Parameters:
_alias - ACSObject. No action if null, or already known.
Throws:
UpDateError - _alias belongs to the same ACS or the type is immutable

removeEorSoftAlias

protected void removeEorSoftAlias(ImmutableName _alias)
                           throws UpDateError
Removes an external or internal alias from the master as soft reference. The alias is normally updated by the ACS calling method. In the standard way of use, called only by the ACS through the master, which may add controls on the parameter class. Detects the alias through a name comparison. Fires the 'SoftAlias' and the 'hasSoftAlias' property change events. If firePropertyChange() throws an exception, displays an user message. No action if the list is null.

Parameters:
_alias - alias of the master. No action if null.
Throws:
UpDateError - if _alias is not known.

addAcsOfSoftReferences

protected void addAcsOfSoftReferences(ImmutableName _acs)
                               throws UpDateError
Adds the ACS name of an external or internal soft reference to the master as soft alias. The reference is updated by the ACS calling method. Used only by the ACS through the master, which may add controls on the parameter class. Has to be used by the AcsAddon. Fires the event 'AcsOfSoftReferences'.

Parameters:
_acs - ACS name. No action if null, or already known.
Throws:
UpDateError

removeAcsOfSoftReferences

protected void removeAcsOfSoftReferences(ImmutableName _acs)
                                  throws UpDateError
Removes an external or internal alias from the master as soft reference. The alias is updated by the ACS calling method. Used only by the ACS through the master, which may add controls on the parameter class. Detects the alias through a name comparison. Fires 'AcsOfSoftReferences' property change events. If firePropertyChange() throws an exception, displays an user message. No action if the list is null.

Parameters:
_acs - ACS name. No action if null.
Throws:
UpDateError - if _alias is not known.

addPropertyChangeListener

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

Parameters:
_l - PropertyChangeListener to add

addPropertyChangeListener

protected void addPropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Used by Gui1.CommonPropertyEditor for all the bound properties: 'SoftAlias', 'hasSoftAlias', 'AcsOfSoftReferences', 'HardAliasReference', 'HardAlias'.

Parameters:
_propertyName - name of the property
_l - PropertyChangeListener to add

removePropertyChangeListener

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

Parameters:
_l - PropertyChangeListener to remove

removePropertyChangeListener

protected void removePropertyChangeListener(java.lang.String _propertyName,
                                            java.beans.PropertyChangeListener _l)
Removes a listener to the bean. Used by Gui1.CommonPropertyEditor for all the bound properties: 'SoftAlias', 'hasSoftAlias', 'AcsOfSoftReferences', 'HardAliasReference', 'HardAlias'.

Parameters:
_propertyName - 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.

Parameters:
_propertyName - name of the listened property.
Returns:
the change listeners. May be null.

finalizeForBase

protected void finalizeForBase()
                        throws UpDateError
Finalizes the CAlias and the hard alias, for a master hard reference. Does not finalize the hard reference of a master alias, but unregister the master in the reference. Calls getEorReferenceAsInternalHardAlias() and getEorAliasAsInternalHardReference(). Calls setEorAliasAsInternalHardReference() on the reference. HAVE TO BE USED before the deleting of the CAlias.

Throws:
UpDateError - if the CAlias is unknown of the main ACS (if it is a clone, typically)

finalizeFromDeserialization

protected void finalizeFromDeserialization()
This method finalizes the instance, 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 for EPRViewInBaseImpl only.


cloneC

protected CAliasImpl cloneC(ACSObject _master)
Clone for embeddd class without registering the new object in the ACSs. Caution: don't use any modifying method that may altere the integrity of the base. The soft alias name list is cloned, and not the hard alias reference. The external object references are not cloned (see "Eor" in get method).

Parameters:
_master - the clone master
Returns:
cloned object with _master as the master
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object _obj)
Overrides:
equals in class java.lang.Object
Parameters:
_obj - Object
Returns:
true if _obj is a CAliasImpl instance (or an instance of an extended class) equals to the current one

getSerialVersionUID

public long getSerialVersionUID()
Returns:
long: serial version UID for serialization of the instance

firePropertyChange

protected void firePropertyChange(java.lang.String _propertyName,
                                  java.lang.Object _oldValue,
                                  java.lang.Object _newValue)
Fires an event to every registered listener, in any order. For the properties 'SoftAlias', 'hasSoftAlias', 'AcsOfSoftReferences', 'HardAliasReference', 'HardAlias'.

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

finalize

protected void finalize()
                 throws java.lang.Throwable
This method removes the CAlias from the ACS lists, 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