ARoad0.gBase
Class ISNodeImpl

java.lang.Object
  extended by ARoad0.gBase.ISNodeImpl
All Implemented Interfaces:
BaseObject, BoundBean, java.beans.PropertyChangeListener, java.util.EventListener

public class ISNodeImpl
extends java.lang.Object
implements java.beans.PropertyChangeListener, BoundBean, BaseObject

This class is responsible for describing the IS nametree nodes and composites for displaying them in the GUI. It is an adaptor to read the properties of a node from the relevant NameISTreeImpl in the BaseManager. This same class is used while the properties are quite different when the node type changes. This works because the GUI reads the properties through the data (e.g. the method names,...) a BeanInfo provides. Selecting the right BeanInfo is the responsability of the method getBeanInfoNameForISnode() in BaseUtilityImpl. Called by ActionOpenGlobalStructure.valueChanged() and openFrame().

See Also:
ActionOpenGlobalStructure.valueChanged(javax.swing.event.TreeSelectionEvent)

Field Summary
private  java.beans.PropertyChangeSupport changeSupport_
          manages all the property change listeners
static ISNodeImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected static int INITIAL_CAPACITY
           
private  ImmutableNameISTree iSTree_
          Remains null only for the IS structure root.
private  Name nodeName_
           
 
Constructor Summary
ISNodeImpl()
          The default constructor.
ISNodeImpl(ImmutableNameISTree _iSTree, ImmutableName _nodeName)
          Registers this instance has a listener of BaseManagerImpl for the events 'OneInformationSystem', 'InformationSystemChange', if the node is not the IS structure root.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
          Add a listener to the bean.
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object _obj)
          Compares the values in the internal maps of this class.
protected  void finalize()
          This method calls finalizeForUser().
protected  void finalizeForUser()
          This method nullifies all the inner properties and unregisters it as property listener.
protected  void firePropertyChange(java.lang.String _propertyName, java.lang.Object _oldValue, java.lang.Object _newValue)
          Fire an event to every registered listener, in any order.
 ImmutableName getComposite()
          Gets the composite if the node is a subcomposite.
 java.lang.String getExtendedVisibleSpace()
          Gets the nodes which are visible for the node.
 ImmutableName getFullName()
          The full name is unique for the Access Road program.
 java.util.List<java.lang.String> getL_AcsAddonDescriptors()
          Gets all the descriptors of the ACS addons that are loaded in the current working directory of Access Road.
 java.util.List<ImmutableName> getL_GroundsOfAlternate()
          Gets the Grounds for which the node is an Alternate.
 java.util.List<ImmutableName> getL_NodesOfComposite()
          Gets the nodes belonging to a composite in the nametree.
 java.util.Map<java.lang.String,java.lang.String[]> getM_Alternates()
          Gets the node property for the Alternate relation.
 ImmutableName getName()
          The name is unique for the Access Road program only for the ACSObjects.
 java.lang.String getNickName()
          This short name is NOT unique for the Access Road program nor the ACS if it is an ACS object.
 java.lang.String getType()
          Gets the type of the node or area, or ISFactoryUtilityImpl.STRUCTURE_ROOT_STRING for the IS structure root.
 int hashCode()
           
 boolean isAuthorizationServer()
          True if the node is an ACS or a composite ACS which is an authorization server.
 boolean isHubNode()
          Tests if a node of the nametree is set as a 'hub' for its children.
 boolean isOpen()
          Gets the state open/closed of a node or area.
 boolean isTiedChild()
          True if the node is a tied node.
 void propertyChange(java.beans.PropertyChangeEvent _evt)
          Receives the events fired by BaseManagerImpl, to send a property change to all the PropertyEditors in the GUI.
 void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iSTree_

private ImmutableNameISTree iSTree_
Remains null only for the IS structure root.


nodeName_

private Name nodeName_

changeSupport_

private transient java.beans.PropertyChangeSupport changeSupport_
manages all the property change listeners


INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
See Also:
Constant Field Values

EMPTY_INSTANCE

public static final ISNodeImpl 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.

Constructor Detail

ISNodeImpl

public ISNodeImpl()
The default constructor.


ISNodeImpl

public ISNodeImpl(ImmutableNameISTree _iSTree,
                  ImmutableName _nodeName)
           throws CreateError
Registers this instance has a listener of BaseManagerImpl for the events 'OneInformationSystem', 'InformationSystemChange', if the node is not the IS structure root. This constructor has to be fast since it is used at each new selection in the IS structure tree, in the GUI. Called by ActionOpenGlobalStructure.openFrame() and valueChanged().

Parameters:
_iSTree - a known NameISTree. Null only for the IS structure root.
_nodeName - is the name of this nameISTree node. Not null.
Throws:
CreateError - if _iSname is unknown, if the node does not belong to the nametree and is not the IS structure root
Method Detail

propertyChange

public final void propertyChange(java.beans.PropertyChangeEvent _evt)
Receives the events fired by BaseManagerImpl, to send a property change to all the PropertyEditors in the GUI. For 'OneInformationSystem', 'InformationSystemChange' events. As the event is about a node which is not this instance node but is indeed a node which is referenced by this node, it is more simple to fire a change event to all the property editors of this instance properties, at every change in the IS.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
_evt - from BaseManagerImpl

addPropertyChangeListener

public final void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Add a listener to the bean.

Specified by:
addPropertyChangeListener in interface BoundBean
Parameters:
_l - the listener

addPropertyChangeListener

public final void addPropertyChangeListener(java.lang.String _propertyName,
                                            java.beans.PropertyChangeListener _l)
Adds a listener to the bean. For the bound properties 'OpenNode', 'NodeType', 'HubNode', 'VisibleSpace', 'AuthorizationServer', 'NodesOfComposite', 'Composite', 'TiedChild', 'Alternates', 'GroundsOfAlternate', and 'FinalizedNode' when the node or its IS is deleted.

Specified by:
addPropertyChangeListener in interface BoundBean
Parameters:
_propertyName - the property to listen
_l - the listener

removePropertyChangeListener

public final void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
Removes a listener to the bean.

Specified by:
removePropertyChangeListener in interface BoundBean
Parameters:
_l - the listener

removePropertyChangeListener

public final void removePropertyChangeListener(java.lang.String _propertyName,
                                               java.beans.PropertyChangeListener _l)
Removes a listener to the bean. For the bound properties 'OpenNode', 'NodeType', 'HubNode', 'VisibleSpace', 'AuthorizationServer', 'NodesOfComposite', 'Composite', 'TiedChild', 'Alternates', 'GroundsOfAlternate', and 'FinalizedNode' when the node or its IS is deleted.

Specified by:
removePropertyChangeListener in interface BoundBean
Parameters:
_propertyName - the property to listen
_l - the listener

getName

public final ImmutableName getName()
Description copied from interface: BaseObject
The name is unique for the Access Road program only for the ACSObjects.

Specified by:
getName in interface BaseObject
Returns:
name of the base object. May be empty, but not null.

getFullName

public final ImmutableName getFullName()
Description copied from interface: BaseObject
The full name is unique for the Access Road program.

Specified by:
getFullName in interface BaseObject
Returns:
like getName()

getNickName

public final java.lang.String getNickName()
This short name is NOT unique for the Access Road program nor the ACS if it is an ACS object. It is often the last component name.

Specified by:
getNickName in interface BaseObject
Returns:
the nick name. May be null.

isOpen

public final boolean isOpen()
Gets the state open/closed of a node or area. The IS structure root is always open.

Returns:
true if the node is open; always false if it is null or unknown.

getType

public final java.lang.String getType()
Gets the type of the node or area, or ISFactoryUtilityImpl.STRUCTURE_ROOT_STRING for the IS structure root.

Returns:
the node type. May be null.

isHubNode

public final boolean isHubNode()
Tests if a node of the nametree is set as a 'hub' for its children. A node may be a hub, which means that for this node, any direct child may have exchanges with any other direct child. For a non-hub node, exchanges between its children are not allowed. The visible space (see NameISTree) of a node having a hub parent always includes all the children of its parent. An area is always a hub node.

Returns:
true if the node is a hub.

getExtendedVisibleSpace

public final java.lang.String getExtendedVisibleSpace()
Gets the nodes which are visible for the node. This extends the native ImmutableNameTree visible space, which is the parent children (if ImmutableNameTree.isHubNode is true) and the ImmutableNameTree areas of the node, if any. The value is one of the constants returned by getExtendedVisibleSpaceConstants(). An area has always ALL_THE_IS_SPACE as visible space.

Returns:
the extended visible space from the node. May be null.

isAuthorizationServer

public final boolean isAuthorizationServer()
True if the node is an ACS or a composite ACS which is an authorization server.


getL_NodesOfComposite

public final java.util.List<ImmutableName> getL_NodesOfComposite()
Gets the nodes belonging to a composite in the nametree.

Returns:
list of the subcomposite names. May be empty. Never null.

isTiedChild

public final boolean isTiedChild()
True if the node is a tied node.


getM_Alternates

public final java.util.Map<java.lang.String,java.lang.String[]> getM_Alternates()
Gets the node property for the Alternate relation. The key is the alternate name. The value for a key is a String array with the ISImpl constants: ALTERNATE_TYPE at the index 0 (mandatory), then, without any specific order in the array, one or several RightsTypes (mandatory), then OPTIONAL_ALTERNATE (option) and OPTIONAL_GROUND (option).

Returns:
the array of alternates for the node. May be empty but not null.

getComposite

public final ImmutableName getComposite()
Gets the composite if the node is a subcomposite.

Returns:
the composite name or null

getL_GroundsOfAlternate

public final java.util.List<ImmutableName> getL_GroundsOfAlternate()
Gets the Grounds for which the node is an Alternate.

Returns:
the list of grounds for the node. May be empty but not null.

getL_AcsAddonDescriptors

public final java.util.List<java.lang.String> getL_AcsAddonDescriptors()
Gets all the descriptors of the ACS addons that are loaded in the current working directory of Access Road. This method is reserved to the IS structure root. It may be called on an empty instance.

Returns:
the list of the ACS addons. May be empty but not null.

clone

public final java.lang.Object clone()
Overrides:
clone in class java.lang.Object
Returns:
a cloned and no-backed instance, with clone of all names.

equals

public final boolean equals(java.lang.Object _obj)
Compares the values in the internal maps of this class.

Specified by:
equals in interface BaseObject
Overrides:
equals in class java.lang.Object
Parameters:
_obj - is the object to compare
Returns:
true if the lists of values are equal

hashCode

public final int hashCode()
Specified by:
hashCode in interface BaseObject
Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode from the node name.

finalizeForUser

protected final void finalizeForUser()
This method nullifies all the inner properties and unregisters it as property listener.


finalize

protected final void finalize()
                       throws java.lang.Throwable
This method calls finalizeForUser().

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

firePropertyChange

protected final void firePropertyChange(java.lang.String _propertyName,
                                        java.lang.Object _oldValue,
                                        java.lang.Object _newValue)
Fire an event to every registered listener, in any order. For the bound properties 'OpenNode', 'NodeType', 'HubNode', 'VisibleSpace', 'AuthorizationServer', 'NodesOfComposite', 'Composite', 'TiedChild', 'Alternates', 'GroundsOfAlternate', and 'FinalizedNode' when the node or its IS is deleted. Called by propertyChange() for all the listeners of all the inner properties.

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