ARoad0.gBase
Class BaseManagerImpl

java.lang.Object
  extended by ARoad0.gBase.BaseManagerImpl
All Implemented Interfaces:
ACSManager, BaseBeanManager, BoundBean, ViewManager, Singleton

public class BaseManagerImpl
extends java.lang.Object
implements ACSManager, ViewManager, Singleton

This large class is the single manager for the Access Road object-oriented database. It allows to register, save, close, open and remove the ACS and the views. It allows to create, update, save and remove the information systems, their nodes and components. It allows to register and unregister an AcsAddon. After ACSFactoryImpl and ACSImpl, this is the most complex class of the gBase package.

This class manages a map of nametrees which describes the tree structures of IS, components and ACS. The key is the IS name, and the value is a NameISTree which describes the structure. An information system may contain some ACS, subACS, composite ACS, composite subACS, physical components and logical components. A physical component is a hardware in the information system. A logical component is simply a software which have no ACS functions. An information system cannot contain another one.

The IS structure is a tree of named nodes, each having a type and some associated properties. The ACS nodes are opened and closed in the program, and all the other nodes are created/opened/closed at the ACS creation/opening/closing. This is true for the subACS of the ACS, but also for any composite ACS which is opened only when all the ACS of its elements are opened, and for any physical or logicial component, since it is opened in the IS at the opening of one ACS which is its child.

This structure has a specific format which is defined in the class ISNodeImpl. There is a default IS for all the ACS without an explicit IS, and all these ACS are in a flat list under the default IS root. Deleting is done into the Access Road base, not the files into the Access Road operating system work directory.

A view is a user selection of several ACS objects.

This class offers lists of the current open or closed ACS and views. It does not create the ACS and the views directly, but registers and saves them when there are created through ACSFactory or their view constructors. On the other hand, the information system nametrees are created directly by this class.

Caution: a new ACS may have the name of an ACSObject in a closed ACS, and this is not checked. The ACSObjects in the open ACS are all checked. When the relevant closed ACS is opened, there is no more checking of the name doublons. During the search of objects from their names, the ACS is selected first.

There is only one instance of this class. It is a javabean with the following bound properties:

'OpenACS', 'OpenViews', 'OneInformationSystem', 'OneInformationSystemNode', 'OneInformationSystemNodeOpening'. Since the AcsAddons are (un)registered at the starting of the program, there is no bound property for them.

Other changes in nametree nodes are managed by ACSFactory. The listeners are proper to this instance, outside gBase, transient. They are called in any order.

Nevertheless, an order exists between these events and the events fired by the ACS and the views, when there are some operations on them:

- any change on 'OpenACS' and 'OpenViews' is fired - after - the creation or opening, but, it is fired - before - the closing or removing, and the events from the ACS or the view.

The listeners receive only a copy of the new value, to protect the property. All the exceptions from the listeners are catched, and a dialog box is displayed to inform the user.

All the Access Road data is saved as serialized Java objects under the Access Road working directory, with the file extension 'acr'. This includes the AcsAddon files. There are 3 main types of objects to serialize independently:

- ACS: for each one, the file name starts with 'ACS0_'; its serialization maintains references among the objects of almost all classes in gBase, excepted for ViewInBase classes for which there are no references,

- ViewInBase: for each one, the file name starts with 'VIEW0_'; its serialization does not maintain references among the objects in all the relevant ACS, since only names are saved. There are no references to other ViewInBases into it.

- Information System NameTree: the single file name is 'm_nametrees_v0.acr'; it is serialized without external references into it.

The other small objects to save are the general descriptors of the Access Road context. That includes:

- 'l_acs_v0.acr' for the ACS names,

- 'l_views_v0.acr' for the view names,

- 'l_metarights_v0.acr' for the metarights,

- 'l_acsaddon_v0.acr' for the ACS addon names,

- 'GUI_config.acr' for the locations of the objects in the GUI.


Field Summary
private  java.beans.PropertyChangeSupport changeSupport_
          manage all the property change listeners
private static int INITIAL_CAPACITY
           
protected static BaseManagerImpl INSTANCE
           
private static java.util.List<ImmutableName> l_Acs__
          ACS names
private static java.util.List<java.lang.String> l_AcsAddonDescriptors__
          The form of a value is 'Editor: full_editor_name - AcsAddon: addon_name', like in ACSImpl.getEditorAndAddonNames().
protected static java.util.List<StringMetaRight> l_MetaRights__
          List of metarights.
private static java.util.List<ImmutableName> l_Views__
          View names
protected static java.util.Map<java.lang.Integer,StringMetaRight[]> m_MetaRightsArrayFromPower__
          Map of metarights where the getPower() value is the key; the value in the map is an array of all the metarights having the same power.
protected static java.util.Map<java.lang.String,StringMetaRight> m_MetaRightsFromRight__
          Map of metarights where the getRight() value is the key; the value in the map is the metaright.
private static java.util.Map<ImmutableName,ImmutableNameISTree> m_NameTrees__
          m_NameTrees__ is a map of NameISTrees which describes the structure of each IS.
protected static java.util.Map<ImmutableName,ImmutableACS> m_OpenAcs__
          ACS map; ACS name is the key
protected static java.util.Map<ImmutableName,ViewInBase> m_OpenViews__
          View map; view name is the key
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization.
private static long serialVersionUID
           
 
Constructor Summary
private BaseManagerImpl()
          Reads the files "l_metarights_v0.acr", "l_is_v0.acr", "m_nametrees_v0.acr", l_acs_v0.acr" and "l_views_v0.acr" to initialize the rights, IS, components, ACS and view maps.
 
Method Summary
protected  void addAcsOrSubAcsNodeToIS(ImmutableName _ISname, Name _parent, ImmutableName _name, java.lang.String _node_type, boolean _is_hub, java.lang.String _visible_space, boolean _server, boolean _fireChange)
          Called by ACSFactory to add an ACS or subACS to the IS nametrees, after the call to newEorACS(), and by importACS().
 void addComponentNodeToIS(ImmutableName _ISname, ImmutableName _name, java.lang.String _node_type)
          Called by ACSFactoryImpl and importACS() to add a physical or logical component to the IS nametrees, and by ActionNewACSyst.handleSelectionDialog().
protected  void addCompositeNodeToIS(ImmutableName _ISname, java.lang.String _name, java.lang.String _node_type, boolean _is_authorization_server)
          Called by ACSFactory to add a Composite ACS or a Composite subACS to the IS nametrees.
 void addIS(ImmutableName _name, boolean _is_hub)
          Called by newEorACS() and ActionNewACSsyst to add an information system, to save it in the NameTrees map through a new NameISTree with a passive root which is the IS name.
 void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
          Add a listener to the bean.
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Add a listener to the bean.
protected  void addSecondaryPropertiesToAcsOrSubNode(ImmutableName _ISname, ImmutableName _name, boolean _is_tied_child, ImmutableName _composite, ImmutableName[] _l_alternates, java.util.Map<ImmutableName,java.lang.String[]> _m_alternateProperties, boolean _fireChange)
          Called by ACSFactory to add some Tied-Child, Composite, Alternate relations to an ACS or subACS in the IS nametree, after the call to addAcsOrSubAcsNodeToIS().
private  void closeACS(ACSImpl _acs, boolean _withSaving)
          Closes an open ACS with or without saving it.
 void closeDefaultBase()
          Closes the base without savings, with all the open ACS and all the open views first.
 void closeOpenACS(ACSImpl _acs, boolean _withSaving)
          Closes an open ACS with saving or not, and closes all its children ACS.
 void closeOpenView(ViewInBase _view)
          Closes an open view without saving it.
 void closeSketchView(EPRViewInBaseImpl _view)
          Close the sketch view without saving it.
private static void createMetaRightMaps()
          Create the generic metaright maps which are internal to this instance.
private  void cutACSExternalLinks(ACSImpl _acs)
          Cuts all the external links to another open ACS and to the metarights.
private  void cutACSInternalLinks(ACSImpl _acs)
          Cuts all the internal links.
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.
 java.util.Set<ImmutableName> getElementsOfOneView(ImmutableName _name, boolean _acsNames)
          Gets the elements of a closed or opened ViewInBase.
 java.util.Map<ImmutableName,ImmutableACS> getEorM_OpenACS()
          Called in the generic access paths searching, then may be called from a view worker thread.
 java.util.Map<ImmutableName,ViewInBase> getEorM_OpenViews()
           
 java.util.Map getGUI()
          Gets the GUI configuration from the 'GUI_config.acr' file.
static BaseManagerImpl getInstance()
          Only method to obtain the unique instance of BaseManagerImpl.
 ImmutableName getISofName(ImmutableName _name)
          Gets the IS name if the name is known as a node name or an area name.
 ImmutableNameISTree getISTree(ImmutableName _name)
          Returns an IS nametree.
 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_ACSNames()
          Return the names of the registered ACS, open ones and closed ones.
 java.util.Set<ImmutableName> getL_CompositeNodesOfIS(ImmutableName _ISname)
          Get the Composite ACS and a Composite subACS of an IS nametrees.
 java.util.Set<ImmutableName> getL_IS()
          Returns the names of the registered IS, which are also the IS nametree names.
 java.util.List<StringMetaRight> getL_MetaRights()
          Gets all the metarights in an sorted set.
 StringMetaRight[] getL_MetaRightsFromPower(int _power)
          Gets all the metarights with the same power.
 java.util.List<StringMetaRight> getL_NonAdministrativeMetaRights()
          Gets all the non-administrative metarights in an ordered list, which is a subset of the metarights for GUI displaying and user selecting.
 java.util.List<ImmutableName> getL_ViewNames()
          Gets the names of the open or closed views.
 java.util.Map<ImmutableName,ImmutableNameISTree> getM_ISTrees()
          Returns the map of all the registered IS nametrees.
 StringMetaRight getMetaRight(java.lang.String _right)
          Gets the metaright with the correct right, following the creations in BaseUtilityImpl.initializeBasicMetaRights().
 StringMetaRight getMetaRightFromName(ImmutableName _name)
          Gets the metaright with the correct name through getName().
 long getSerialVersionUID()
           
 boolean getSupportsXML()
           
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> importACS(ImmutableName _name)
          Imports an unknown ACS from a file in the current directory, creates it as a node in the right IS, opens and saves it.
 boolean isOpenACS(ImmutableName _name)
           
 boolean isOpenView(ImmutableName _name)
           
 boolean knowsACS(ImmutableName _name)
           
 boolean knowsIS(ImmutableName _name)
           
 boolean knowsView(ImmutableName _name)
           
protected  void newEorACS(ACS _acs, boolean _ISroot_is_hub)
          Called by the ACSFactoryImpl.createACS().
protected  void newEorCopiedViewToSave(ViewInBase _view)
          Called by the ViewInBaseImpl copyAndFinalize() method for registering the instance and to save it, while it is not open.
protected  void newEorView(ViewInBase _view)
          Called by the ViewInBaseImpl constructor for registering the instance.
static void newMetaRight(StringMetaRight _right, boolean _toSave)
          Register a new metaright.
 ACSImpl openACS(ImmutableName _name)
          Opens a registered and closed ACS from a file in the current directory.
 void openAllViews()
          Open all known views, when there are all closed.
 ViewInBase openView(ImmutableName _name)
          Opens a registered and closed view from a file in the current data directory.
 void removeACS(ImmutableName _name)
          The ACS name is removed from the ACS list and from the IS nametree, like all its children in the IS nametree if they exist.
private  void removeAcsNodeToIS(ImmutableName _ISname, ImmutableName _name)
          Called to remove an ACS to the IS nametrees and save it, and to remove also all its direct and indirect children, including its subACS and all the ACS and subACS which are its children.
 void removeComponentNodeToIS(ImmutableName _ISname, ImmutableName _name)
          Called to remove a physical or logical component to the IS nametrees, and all its direct and indirect children, including its subACS and all the ACS and subACS which are its children.
 void removeCompositeNodeToIS(ImmutableName _ISname, ImmutableName _name)
          Called to remove a Composite ACS or a Composite subACS to the IS nametrees.
 void removeIS(ImmutableName _name)
          Called by removeACS() to remove an information system, and to save the new NameTrees map.
protected  void removeMetaRight(StringMetaRight _right)
          UNUSED METHOD.
private  void removeOneACS(ImmutableName _name)
          The ACS name is removed from the ACS list and from the IS nametree, like all its children in the IS nametree if they exist.
 void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
          remove a listener to the bean.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          remove a listener to the bean.
 void removeView(ImmutableName _name)
          The view name is removed from the view list in ViewManager.
private  void restoreACSExternalLinks(ACSImpl _acs)
          Restores all the external links to another open ACS and in the metarights.
 void restoreACSInternalLinks(ACSImpl _acs)
          Restores all the internal properties of an ACS.
private  void saveACS(ACSImpl _acs)
          Saves an open ACS without closing for it.
 void saveAllViews()
          Save all the open views in some files (one per view) in the default data directory.
 void saveAndCloseDefaultBase()
          Save and close the base with the ACS and the view lists, even if it is empty.
 void saveAndCloseOpenView(ViewInBase _view)
          Close an open view and save it before.
 void saveDefaultBase()
          Saves the base with the ACS and view lists, even if there are empty.
 void saveGUI(java.util.Map _config)
          Saves the GUI configuration in the file 'GUI_config.acr'.
private static void saveMetaRights()
          Save the metarights list.
private  void saveNameTrees()
          Save the NameTrees map in the file 'l_metarights_v0.acr'.
 void saveOpenACS(ACSImpl _acs)
          Saves an open ACS without closing it, with a synchronization on it.
 void saveOpenView(ViewInBase _view)
          Saves an open view without closing it.
private  void saveView(ViewInBase _view)
          Saves a view without closing it.
private  void updateAndSaveAcsAddonDescriptors()
          Fills up the list l_AcsAddonDescriptors__ with the ACS addon editors and names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

l_Acs__

private static java.util.List<ImmutableName> l_Acs__
ACS names


m_NameTrees__

private static java.util.Map<ImmutableName,ImmutableNameISTree> m_NameTrees__
m_NameTrees__ is a map of NameISTrees which describes the structure of each IS. The key is the IS name, and the value is a NameISTree where the root is the IS name. The NameISTree has immutable names as nodes, which are the names of the ACS, physical component, logical components, subACS and composite ACS of the information system. The NameISTree defines the properties of each node and its links with its environment in the information system. The only node property which is often updated is the boolean to tell the node is opened or closed. The other node properties in the NameISTree are updated only when a node is created or removed from the base, at the creation/removing of an ACS.


l_AcsAddonDescriptors__

private static java.util.List<java.lang.String> l_AcsAddonDescriptors__
The form of a value is 'Editor: full_editor_name - AcsAddon: addon_name', like in ACSImpl.getEditorAndAddonNames().


l_Views__

private static java.util.List<ImmutableName> l_Views__
View names


m_OpenAcs__

protected static java.util.Map<ImmutableName,ImmutableACS> m_OpenAcs__
ACS map; ACS name is the key


m_OpenViews__

protected static java.util.Map<ImmutableName,ViewInBase> m_OpenViews__
View map; view name is the key


l_MetaRights__

protected static java.util.List<StringMetaRight> l_MetaRights__
List of metarights.


m_MetaRightsFromRight__

protected static java.util.Map<java.lang.String,StringMetaRight> m_MetaRightsFromRight__
Map of metarights where the getRight() value is the key; the value in the map is the metaright. No saving.


m_MetaRightsArrayFromPower__

protected static java.util.Map<java.lang.Integer,StringMetaRight[]> m_MetaRightsArrayFromPower__
Map of metarights where the getPower() value is the key; the value in the map is an array of all the metarights having the same power. No saving.


serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

changeSupport_

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


INSTANCE

protected static final BaseManagerImpl INSTANCE

serialPersistentFields

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

Constructor Detail

BaseManagerImpl

private BaseManagerImpl()
Reads the files "l_metarights_v0.acr", "l_is_v0.acr", "m_nametrees_v0.acr", l_acs_v0.acr" and "l_views_v0.acr" to initialize the rights, IS, components, ACS and view maps. Writes the file 'l_acsaddon_v0.acr'. Uses Desktop.AR_URI which has to be intialized. GetGUI() is the first method called by Gui1.Desktop after the construction.

Method Detail

getInstance

public static final BaseManagerImpl getInstance()
Only method to obtain the unique instance of BaseManagerImpl. Test the file l_acs_v0.acr in the default directory and read it if it exists. Reads also l_is_v0.acr, l_components_v0.acr, l_views_v0.acr

Returns:
BaseManagerImpl

createMetaRightMaps

private static final void createMetaRightMaps()
Create the generic metaright maps which are internal to this instance. Called by the constructor.


knowsIS

public boolean knowsIS(ImmutableName _name)
Parameters:
_name - ImmutableName of an IS
Returns:
boolean true if _name is known as an IS name.

getISofName

public ImmutableName getISofName(ImmutableName _name)
Gets the IS name if the name is known as a node name or an area name. The beginning of the argument should be the IS name, and this method checks if the name is really known by the IS. The name may be an IS, an ACS, a subACS, a composite, a physical component or a logical component. To use for testing the presence of a node or an area. Note: it is not allowed to have two components with the same name in two different IS.

Parameters:
_name - of the node or area. Never null.
Returns:
IS name, or null.

getL_IS

public java.util.Set<ImmutableName> getL_IS()
Returns the names of the registered IS, which are also the IS nametree names. The order of the IS is the order of their creations. This order is used to display both the IS trees and the ACS in the explorer.

Returns:
set of IS names. Never null.

getM_ISTrees

public java.util.Map<ImmutableName,ImmutableNameISTree> getM_ISTrees()
Returns the map of all the registered IS nametrees.

Returns:
map of immutable and no-cloned NameISTrees. Never null.

getISTree

public ImmutableNameISTree getISTree(ImmutableName _name)
Returns an IS nametree.

Parameters:
_name - name of the IS; not null
Returns:
the nameTree. May be null or an empty nameTree.

addIS

public final void addIS(ImmutableName _name,
                        boolean _is_hub)
                 throws BaseError
Called by newEorACS() and ActionNewACSsyst to add an information system, to save it in the NameTrees map through a new NameISTree with a passive root which is the IS name. Fires the property change 'OneInformationSystem'.

Parameters:
_name - name of a new IS. Not null.
_is_hub - is true if the IS is a node hub, which means that for this node, any direct child may have exchanges with any other direct child, if the rights allow them.
Throws:
BaseError - if the IS name is already known as ACS, IS or component, or FileNotFoundException and IOException.

removeIS

public final void removeIS(ImmutableName _name)
                    throws BaseError
Called by removeACS() to remove an information system, and to save the new NameTrees map. Removes all the ACS of the IS. This is a public method only for testing. Fires the property changes 'OneInformationSystem', and 'OpenACS' for each closed ACS.

Parameters:
_name - of an IS. Never null.
Throws:
BaseError - if the IS name is not known, or FileNotFoundException and IOException.

addAcsOrSubAcsNodeToIS

protected final void addAcsOrSubAcsNodeToIS(ImmutableName _ISname,
                                            Name _parent,
                                            ImmutableName _name,
                                            java.lang.String _node_type,
                                            boolean _is_hub,
                                            java.lang.String _visible_space,
                                            boolean _server,
                                            boolean _fireChange)
                                     throws BaseError
Called by ACSFactory to add an ACS or subACS to the IS nametrees, after the call to newEorACS(), and by importACS(). Do not handle the Tied-Child, Composite, Alternate relations of the new ACS or subACS (see addSecondaryPropertiesToAcsOrSubNode()). Conditional firing of a property change 'OneInformationSystemNode' with the old and the new nameISTree.

Parameters:
_ISname - the IS name
_parent - is a node in the nametree. May be null.
_name - is the new ACS or subACS name, which is put at the end of the children array of _parent
_node_type - is the _name type; it is an allowed type for the _parent children, following the NameTreeImpl policy.
_is_hub - is true if the child is a node hub, which means that for this node, any direct child may have exchanges with any another direct child.
_visible_space - is the visible space for the ACS. Never null.
_server - true if the new ACS is an authorization server. Not used for a subACS, for which this method sets it to false.
_fireChange - true to fire a property change 'OneInformationSystemNode'. To set to false if Tied-Child, Composite or Alternate relations have still to be set.
Throws:
BaseError - if _parent is not a node of this nametree, if _child is null, is already a nametree node, if the parent does not allow this type for its children, wrong node type, wrong visible space, or if its length is greater than 12, or FileNotFoundException and IOException.

addSecondaryPropertiesToAcsOrSubNode

protected final void addSecondaryPropertiesToAcsOrSubNode(ImmutableName _ISname,
                                                          ImmutableName _name,
                                                          boolean _is_tied_child,
                                                          ImmutableName _composite,
                                                          ImmutableName[] _l_alternates,
                                                          java.util.Map<ImmutableName,java.lang.String[]> _m_alternateProperties,
                                                          boolean _fireChange)
                                                   throws BaseError
Called by ACSFactory to add some Tied-Child, Composite, Alternate relations to an ACS or subACS in the IS nametree, after the call to addAcsOrSubAcsNodeToIS(). This method is independant to newEorACS() which is called by the ACS constructor to register the ACS in the ACS list. It may be called several times, with varied arguments.

The Composite relation is defined in the mandatory paths of _name, and _name is added as subcomposite to the ImmutableNameISTree.Area which defines the Composite.

The Alternate relation is defined through the two last method arguments, which must be coherent. The items in _l_alternates are ACS/SubACS/Composite ACS/Composite SubACS nodes in the IS nametree. Almost all the couples are allowed in the Alternate relation, excepted when a ground ACS has an alternate SubACS or Composite SubACS.

The _m_alternateProperties keys must be strictly the _l_alternates items. The _m_alternateProperties value for a key is a String array with the ISFactoryUtilityImpl constants: ALTERNATE_TYPE at the index 0 (mandatory), then, without any specific order in the array, some right types (mandatory), OPTIONAL_ALTERNATE (optional), OPTIONAL_GROUND (optional). The argument _m_alternateProperties is stored in specific links in the IS nametree. A double name derived from _name and the alternate name is used as key for the link. These specific keys are not handled by NameISTreeImpl, so they are managed by this method and the class ISNodeImpl.

It is possible to change, through this method, some of the 3 relations for a given ACS or subACS. There are some dependencies among the relations, and there are checked by this method which throws an exception if a constraint is not fulfilled. The dependencies between relations are listed hereafter:

- a subcomposite cannot be a ground for alternates.

- a subcomposite ACS may be a Tied-Child of its parent, but it is not workable until all the subcomposites of the Composite are opened.

The ACS node is always opened by this method.

May fire a property change 'OneInformationSystemNode' with the new node name.

Parameters:
_ISname - the IS name
_name - is the ACS or subACS node name in the current IS nametree
_is_tied_child - true if the new ACS is a tied child to its parent. Not used for a subACS, for which this method sets it to false.
_composite - name of the Composite ACS or Composite SubACS for which this ACS or subACS is a subcomposite. This subcomposite is added to the Composite list. May be null.
_l_alternates - are the alternate names in the same IS for this ACS or subACS as a ground. No more than 4 items. May be null or empty. Each argument is updated.
_m_alternateProperties - where each name in _l_alternates is a map key, and the map value is an array of the properties for the alternate. Must be not null if _l_alternates is not null nor empty, with the good format.
_fireChange - true to fire a property change 'OneInformationSystemNode'. To set to false if it is not the last call to this method in the same sequence.
Throws:
BaseError - if a constraint is not fulfilled, or FileNotFoundException and IOException.

addCompositeNodeToIS

protected final void addCompositeNodeToIS(ImmutableName _ISname,
                                          java.lang.String _name,
                                          java.lang.String _node_type,
                                          boolean _is_authorization_server)
                                   throws BaseError
Called by ACSFactory to add a Composite ACS or a Composite subACS to the IS nametrees. This method has to be called before the creation of the subcomposites in the IS nametree.

It implements a Composite through the ImmutableNameISTree.Area property. The property is_hub_for_children is always true for a composite. The extended visible space of a composite is always NameISTreeImpl.ALL_THE_IS_SPACE. A composite is never a tied child of its parent. Its working depends on the opening of all its subcomposites, and this is managed by this class at each opening and closing of an ACS. The standard information systems IPV4/6_ADDRESSES_SPACE do not allow a composite node. The Composite node is not opened by this method.

Firing of a property change 'OneInformationSystemNode' with the new node name.

Parameters:
_ISname - the IS name
_name - the last component of the new Composite ACS or subACS name
_node_type - is the _name type; it is an allowed type for the _parent children, following the ISImpl policy.
_is_authorization_server - true if the new Composite ACS is an authorization server. Not used for a Composite subACS, for which this method sets it to false.
Throws:
BaseError - if _parent is not a node of this nametree, if _child is null, is already a nametree node, if the parent does not allow this type for its children, wrong node type, or FileNotFoundException and IOException.

addComponentNodeToIS

public final void addComponentNodeToIS(ImmutableName _ISname,
                                       ImmutableName _name,
                                       java.lang.String _node_type)
                                throws BaseError
Called by ACSFactoryImpl and importACS() to add a physical or logical component to the IS nametrees, and by ActionNewACSyst.handleSelectionDialog(). This type of node has no extended visible space. Iit is always a hub. The component parent name is the context of _name. The two standard information systems IPv4/6 allow only a logical node for the two first levels. The two first levels of an IPv4 address has to be a number lesser than 256. Firing of a property change 'OneInformationSystemNode' with the new node name.

Parameters:
_ISname - the IS name
_name - is the new component name, which is put at the end of the children array of its parent
_node_type - is the _name type; it is an allowed type for the _parent children, following the ISImpl policy.
Throws:
BaseError - if the parent is not a node of this nametree, if _child is null, is already a nametree node, if the parent does not allow this type for its children, wrong node type, or FileNotFoundException and IOException.

removeAcsNodeToIS

private final void removeAcsNodeToIS(ImmutableName _ISname,
                                     ImmutableName _name)
                              throws BaseError
Called to remove an ACS to the IS nametrees and save it, and to remove also all its direct and indirect children, including its subACS and all the ACS and subACS which are its children.

This method is called only by removeACS(). Handles the Tied-Child, Composite, Alternate relations of the ACS and its subACS.

Some of the Alternate properties are stored in specific links in the IS nametree. A double name derived from _name and the alternate name is used as key for the link. These specific keys are not handled by NameISTreeImpl, so they are managed by this method.

Firing of a property change 'OneInformationSystemNode' with the old node name.

Parameters:
_ISname - the IS name
_name - is the ACS name
Throws:
BaseError - if a name is null or unknown, if it is not an ACS node, or FileNotFoundException and IOException.

removeCompositeNodeToIS

public final void removeCompositeNodeToIS(ImmutableName _ISname,
                                          ImmutableName _name)
                                   throws BaseError
Called to remove a Composite ACS or a Composite subACS to the IS nametrees. This method handles the ImmutableNameISTree.Area property, and it removes the subcomposite property of the subcomposites. For a Composite ACS, the subcomposites are also removed from the IS nametree. For a Composite subACS, the subcomposites remain in the IS nametree since their ACS stay there, but the subcomposites will be unworkable. Firing of a property change 'OneInformationSystemNode' with the old node name.

Parameters:
_ISname - the IS name
_name - is the Composite ACS or Composite subACS name
Throws:
BaseError - if _parent is not a node of this nametree, if _name is null, or FileNotFoundException and IOException.

removeComponentNodeToIS

public final void removeComponentNodeToIS(ImmutableName _ISname,
                                          ImmutableName _name)
                                   throws BaseError
Called to remove a physical or logical component to the IS nametrees, and all its direct and indirect children, including its subACS and all the ACS and subACS which are its children.

Firing of a property change 'OneInformationSystemNode' with the old node name.

Parameters:
_ISname - the IS name
_name - is the new ACS or subACS name
Throws:
BaseError - if a name is null or unknown, if it is not an ACS node, or FileNotFoundException and IOException.

getL_CompositeNodesOfIS

public final java.util.Set<ImmutableName> getL_CompositeNodesOfIS(ImmutableName _ISname)
Get the Composite ACS and a Composite subACS of an IS nametrees.

Parameters:
_ISname - the IS name
Returns:
the composite node names. Never null. Empty if _ISname is unknown.

saveNameTrees

private final void saveNameTrees()
                          throws BaseError
Save the NameTrees map in the file 'l_metarights_v0.acr'. Called by all the update methods for the nametrees.

Throws:
BaseError - if FileNotFoundException and IOException.

updateAndSaveAcsAddonDescriptors

private final void updateAndSaveAcsAddonDescriptors()
                                             throws BaseError
Fills up the list l_AcsAddonDescriptors__ with the ACS addon editors and names. The form of a value is 'Editor: editor_name - AcsAddon: addon_name'. Saves the ACS addon editors and names in the file 'l_acsaddon_v0.acr', that is never read by the program. Scans the packages under the directory 'ARoad0.AcsAddon' to update and to save the list of ACS addons. The 4 standard directories (gBase, gBaseBeanInfo, gBaseInterface, gWork) of an AcsAddon have to be there, even if one may be empty. The standard file AcsFactoryXXX has to be in the directory 'gWork', where 'XXX' is the AcsAddon package name. Caution: two ACS from the same AcsAddon may have different ACS policy checksums if one has been derived from another one, with changes in the ACS policy. Uses Desktop.AR_URI which has to be intialized. Called by the constructor.

Throws:
BaseError - if FileNotFoundException and IOException, or if an AcsAddon have not the 4 standard directories (gBase, gBaseBeanInfo, gBaseInterface, gWork).

openACS

public ACSImpl openACS(ImmutableName _name)
                throws BaseError
Opens a registered and closed ACS from a file in the current directory. Opens all the child nodes in the NameISTree which are not ACS. Analyzes the need to open the closed Bridges, AclEntries and Privileges in every open ACS and in this ACS, and the need to create the closed bridge links. Calls setOpenNode() on the IS nametree, to open the direct and indirect children if they are not ACS, or a child of a child ACS. Creates the roots in the parent ACS which have been deleted at the ACS closing. Fires the events 'OpenACS' and several 'OneInformationSystemNodeOpening' events.

Specified by:
openACS in interface ACSManager
Parameters:
_name - ImmutableName of the ACS to open. Its file name is built with the two last components of the name, or with the single component
Returns:
the opened ACS after a setting of all the external references to open ACS, and deleting all the references to closed ACS.
Throws:
BaseError - if the ACS is not known, the ACS is open, the open ACS has not the same name, or ClassNotFoundException, IOException with invalidClassException if ACSImpl has changed.

importACS

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> importACS(ImmutableName _name)
                                                                           throws BaseError,
                                                                                  DialogError
Imports an unknown ACS from a file in the current directory, creates it as a node in the right IS, opens and saves it. The saving updates the initial file of the imported ACS. If the IS is unknown, adds it to the list as a hub node. Compares the ACS parent name to the current nodes of the ACS IS. If the parent name does exist in the IS, registers the ACS under this node if there is no child having the same name. If there is no chain of nodes in the IS to match to the ACS parent name, a chain of nodes derived from the ACS name, is created with logical nodes. During the importation, two following IS nametree properties are missed. They are the Composite and Alternate relations to an ACS or subACS in the IS nametree. An imported ACS has no composite and no alternate, and it is not possible to edit them after the importation. The other properties of the ACS node in the source IS nametree are copied into the target IS nametree.

This method restores all the inner properties of the imported ACS, including its structure, behavior and ACSobjects. This includes the ACS roots, but they are applied only if the parent is an ACS. Otherwise, the roots are deleted during the import. If the parent is an ACS, it has to comply to the structure and behavior of the parent ACS source, so that the roots action may be applied without error. However, errors in the creation of roots do not stop the import operation.

This method never opens the external ACSObjects of the imported ACS, and its closed Bridges, AclEntries and linked Privileges. It rather returns a map containing the description of these closed objects. The user may choose, in the class ActionImportACS, to create some of these closed objects. The returned map described each Bridge, AclEntry or Privilege, including the rights. Even if they are ACS rights from the imported ACS, they are always fully defined. The import operation resets the links between the ACS rights and the current metarights of the running Access Road instance. Called by ACS_Facade.getImportedACS(). Fires an event 'OpenACS' after the ACS opening.

Parameters:
_name - ImmutableName of the ACS to import. Its file name is built with the two last components of the name, or with the single component
Returns:
the map of the closed external ACSObjects which have a Bridge, AclEntries or linked Privileges in this imported ACS. May be empty but not null.
Throws:
BaseError - if the ACS name is known or null argument, or SecurityException, or the IS name of the imported acs or its parent in the IS ImmutableNameTree are unknown, or wrong saving
DialogError - if the open ACS has not the same name, or ClassNotFoundException, IOException with invalidClassException if ACSImpl has changed.
See Also:
ActionImportACS

saveDefaultBase

public void saveDefaultBase()
                     throws BaseError
Saves the base with the ACS and view lists, even if there are empty. Updates the file 'l_acs_v0.acr'. First, all the open views are saved in some files (one per open view) in the working directory. With saveOpenACS(), each open ACS is saved in some files (one per open ACS) in the working directory. The metarights are not saved since it is done on line, but their links to the acsrights are updated. Fires no event.

Specified by:
saveDefaultBase in interface ACSManager
Throws:
BaseError - if an acs or a view is not open, ACSname.lastComponent() is null, FileNotFoundException or IOException.

closeDefaultBase

public void closeDefaultBase()
                      throws BaseError
Closes the base without savings, with all the open ACS and all the open views first. Called by ACS_Facade.closeDefaultBase() for ActionExit.

Specified by:
closeDefaultBase in interface ACSManager
Throws:
BaseError - if an acs is not open.

saveAndCloseDefaultBase

public void saveAndCloseDefaultBase()
                             throws BaseError
Save and close the base with the ACS and the view lists, even if it is empty. All open ACS and views, but not the closed ones, are saved in some files (one per open ACS and view) in the working directory. Call closeOpenACS().

Specified by:
saveAndCloseDefaultBase in interface ACSManager
Throws:
BaseError - if an acs or a view is not open, ACSname.lastComponent() is null, FileNotFoundException or IOException.

saveOpenACS

public void saveOpenACS(ACSImpl _acs)
                 throws BaseError
Saves an open ACS without closing it, with a synchronization on it. The ACS instance is not modified.

- If one of its Resources or one of its EligibleParty is controlled by the AclEntry or the linked Privilege of an another ACS, it is NOT unrecorded in this another ACS.

- If _acs is a controller, its external AclEntries and linked Privileges are unrecorded in the controlled Resources and relevant EligibleParties, and in their main ACS, then _acs is saved and its external AclEntries and linked Privileges are recorded again with _acs.checkClosedAclEntries(), but they are new instances THAT MUST BE TAKEN IN ACCOUNT BY THE APPLICATION.

- If _acs has bridge links, they are also cuts then restored.

Called by saveDefaultBase(). Calls saveACS(), and the code is synchronized on the argument.

Specified by:
saveOpenACS in interface ACSManager
Parameters:
_acs - to be saved
Throws:
BaseError - if _acs is not open, ACSname.lastComponent() is null, or FileNotFoundException and IOException.

closeOpenACS

public void closeOpenACS(ACSImpl _acs,
                         boolean _withSaving)
                  throws BaseError
Closes an open ACS with saving or not, and closes all its children ACS. Uses this method after a saving, or when an ACS instance is corrupted, before the opening of the old saving. Updates the IS nametree node states, including all the children. The ACS is still known in ACSManager. Calls closeACS() for each ACS under _acs in the IS nametree, and for _acs. After the call of this method, each processed ACS should be set to null. closeACS() fires 'OpenACS' and 'OneInformationSystemNodeOpening' events.

Specified by:
closeOpenACS in interface ACSManager
Parameters:
_acs - ACS to be closed and finalized.
_withSaving - true to save the ACS
Throws:
BaseError - if _acs is not open.

removeACS

public void removeACS(ImmutableName _name)
               throws BaseError
The ACS name is removed from the ACS list and from the IS nametree, like all its children in the IS nametree if they exist. Its roots in the parent ACS are deleted if there are roots only for this ACS. If it is opened, the ACS is closed and saved before. So, it will be possible to restore the ACS in the futur. To handle a corrupted ACS instance and to recover a correct ACS from file, it is recommended to use closeOpenACS(). Call removeOneACS() for the ACS and its children. No direct firing of event changes.

Specified by:
removeACS in interface ACSManager
Parameters:
_name - ACS to remove from the base.
Throws:
BaseError - if the ACS is unknown, or it is not a leaf in the IS nametree, or if ACSname.lastComponent() is null, FileNotFoundException and IOException.

getL_ACSNames

public java.util.List<ImmutableName> getL_ACSNames()
Return the names of the registered ACS, open ones and closed ones.

Specified by:
getL_ACSNames in interface ACSManager
Returns:
cloned list of ACS names

getEorM_OpenACS

public java.util.Map<ImmutableName,ImmutableACS> getEorM_OpenACS()
Called in the generic access paths searching, then may be called from a view worker thread.

Specified by:
getEorM_OpenACS in interface ACSManager
Returns:
unmodifiable map of non-null instances of the open ACS, where the ACS name is the key. Never null.

knowsACS

public boolean knowsACS(ImmutableName _name)
Specified by:
knowsACS in interface ACSManager
Parameters:
_name - ImmutableName of an ACS
Returns:
boolean true if _name is known as an ACS name. The ACS may be open or closed.

isOpenACS

public boolean isOpenACS(ImmutableName _name)
Specified by:
isOpenACS in interface ACSManager
Parameters:
_name - ImmutableName of an ACS
Returns:
boolean true if _name is known as an ACS name and the ACS is open.

restoreACSInternalLinks

public final void restoreACSInternalLinks(ACSImpl _acs)
Restores all the internal properties of an ACS. Fills in the ACS the l_NoRightProxyActors_ list and the m_RightsOfInternalKey_ map, and restores the internal properties of VirtualFolders. It is not necessary to call this method after cutACSInternalLinks() during the simple saving of the ACS, since the workable properties of the VirtualFolders remains usable after ACSImpl.closeVirtualFolders(), and the other ACS properties this method updates are not changed by cutACSInternalLinks(). The code is synchronized on the argument. Called by openACS(), importACS(), AcsFactory.configure() and the same class and method in the ACS addons. Caution: has to be called by any AcsFactoryForAcsAddon.configure() method which creates some Actors. Calls ACSImpl.fillNoRightProxyActors(), fillVirtualFolders(), fillRightsOfInternalKey().

Parameters:
_acs - to be restored.

getSerialVersionUID

public long getSerialVersionUID()
Specified by:
getSerialVersionUID in interface ACSManager
Specified by:
getSerialVersionUID in interface ViewManager
Returns:
long

getSupportsXML

public boolean getSupportsXML()
Returns:
boolean true if the base supports XML exports for their Meta rights, ACS and IS.

addPropertyChangeListener

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

Specified by:
addPropertyChangeListener in interface BaseBeanManager
Specified by:
addPropertyChangeListener in interface BoundBean
Parameters:
_l - PropertyChangeListener to add. Caution: the listener must NOT have specific hashCode() and equals() methods, to work with HashSet in the removing operations.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String _propertyName,
                                      java.beans.PropertyChangeListener _l)
Add a listener to the bean. For the properties 'OpenViews', 'OneInformationSystem', 'OneInformationSystemNode', 'OneInformationSystemNodeOpening', 'OpenACS'. Not used for the opening and the closing, which is managed directly by the gDMak package.

Specified by:
addPropertyChangeListener in interface BaseBeanManager
Specified by:
addPropertyChangeListener in interface BoundBean
Parameters:
_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.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
remove a listener to the bean. No use.

Specified by:
removePropertyChangeListener in interface BaseBeanManager
Specified by:
removePropertyChangeListener in interface BoundBean
Parameters:
_l - PropertyChangeListener to remove

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
remove a listener to the bean. For the properties 'OpenViews', 'OneInformationSystem', 'OneInformationSystemNode', 'OneInformationSystemNodeOpening', 'OpenACS'. Used by gDMak.XXXTreeBaseListenerImpl.

Specified by:
removePropertyChangeListener in interface BaseBeanManager
Specified by:
removePropertyChangeListener in interface BoundBean
Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to remove

newEorACS

protected final void newEorACS(ACS _acs,
                               boolean _ISroot_is_hub)
                        throws BaseError
Called by the ACSFactoryImpl.createACS(). Calls addIS() for a new IS, then fires 'OpenACS' in all cases. Does not save the new ACS and does not register it in the IS nametree. Registers the ACS in the ACS list and the ACS IS in the IS nametree. The user error messages are the followings:

- The ACS name is already known as an ACS name.

- The ACS name is already known as the name of an object into another open ACS.

The caller may invoke later the methods addAcsOrSubAcsNodeToIS() and addSecondaryPropertiesToAcsOrSubNode().

Caution: the new ACS may have the name of an ACSObject in a closed ACS, and this is not checked. When the closed ACS is opened, there is no more checking of the name doublons. In the search of objects from their names, the ACS is selected first.

Parameters:
_acs - is the new ACS to be recorded in the base manager. _acs must not be null (throws an InternalError)
_ISroot_is_hub - is true for a new IS for which the root in the nametree is a hub. There is a new IS if _acs.getISName() returns an unknown IS name, and otherwise this argument is not used.
Throws:
BaseError - if the ACS name is already known as ACS, IS or component, if the IS name is not known, if _parentName is not a node of the IS nametree
See Also:
addAcsOrSubAcsNodeToIS(ARoad0.gBaseInterface.ImmutableName, ARoad0.gBaseInterface.Name, ARoad0.gBaseInterface.ImmutableName, java.lang.String, boolean, java.lang.String, boolean, boolean)

saveACS

private final void saveACS(ACSImpl _acs)
                    throws BaseError
Saves an open ACS without closing for it. If its objects are still referenced by other open ACS, a crash may corrupt the base integrity. Called by closeACS(), saveOpenACS(), and the calling code has to be synchronized on the argument.

Parameters:
_acs - ACS to be saved.
Throws:
BaseError - if ACSname.lastComponent() is null, or FileNotFoundException and IOException.

removeOneACS

private void removeOneACS(ImmutableName _name)
                   throws BaseError
The ACS name is removed from the ACS list and from the IS nametree, like all its children in the IS nametree if they exist. Its roots in the parent ACS are deleted if there are roots only for this ACS. If it is opened, the ACS is closed and saved before. So, it will be possible to restore the ACS in the futur. To handle a corrupted ACS instance and to recover a correct ACS from file, it is recommended to use closeOpenACS(). The ACS saving file is not deleted in the files system. Of course, it should be manually removed by the user. ACSManager.openACS(_name) wont work. Calls removeIS() if this ACS is the last ACS of its IS, and this is the single way to remove an IS. Call closeOpenACS() if the acs is open. Call removeAcsNodeToIS(). No direct firing of event changes. Called by removeACS().

Parameters:
_name - of the ACS to remove from the base.
Throws:
BaseError - if the ACS is unknown, or it is not a leaf in the IS nametree, or if ACSname.lastComponent() is null, FileNotFoundException and IOException.

cutACSExternalLinks

private final void cutACSExternalLinks(ACSImpl _acs)
Cuts all the external links to another open ACS and to the metarights.

If one of the ACS resource or eligible party is controlled by the AclEntry of an another ACS, to avoid failed external references, it is unregistered in this another ACS with ACS.ExternalAclEntries(_acs).

If _acs is a controller, its external AclEntries are unregistered in the controlled resources and relevant eligible parties, and in their main ACS, with _acs.ExternalAclEntries(all ACS).

If one of the ACS resource or eligible party is controlled through the linked privilege of another ACS, or controls through a linked privilege of another ACS, its external privileges are unregistered with ACS.closeExternalLinkedPrivileges(). If _acs has bridge links, their are closed with closeBridges() in the two sens.

The code is synchronized on the argument and also on each other open ACS to process. Called by saveOpenACS(), closeACS().

Parameters:
_acs - to isolate from the other open ACS

cutACSInternalLinks

private final void cutACSInternalLinks(ACSImpl _acs)
Cuts all the internal links. Fills the VirtualFolder internal properties. The code is synchronized on the argument. Called by saveOpenACS(), closeACS().

Parameters:
_acs - to be saved.

restoreACSExternalLinks

private final void restoreACSExternalLinks(ACSImpl _acs)
Restores all the external links to another open ACS and in the metarights. Process the metarights, the AclEntries and the bridges which has to be opened. Called by openACS(), saveDefaultBase(), saveOpenACS(), importACS(). The code is synchronized on the argument and also on each other open ACS to process.

Parameters:
_acs - to restore

closeACS

private void closeACS(ACSImpl _acs,
                      boolean _withSaving)
               throws BaseError
Closes an open ACS with or without saving it. Uses this method after a saving, or when an ACS instance is corrupted, before the opening of the old saving. The ACS is still known in ACSManager. In this method, THE OBJECT _ACS IS SET TO NULL.

- If one of its resources or one of its eligible party is controlled by the aclEntry of an another ACS, to avoid failed external references, it is unrecorded in this another ACS with ACS.closeAclEntriesTo(_acs).

- If _acs is a controller, its aclEntries are unrecorded in the controlled resources and relevant eligible parties, and in their main ACS, with closeAclEntriesTo(_acs).

- If there are bridge links, closes them.

- cuts the links with metarights.

- then finalizes the ACS.

After the call of this method, set the _acs to null, or restore it with _acs = openACS(cloned _acs name). Fires an 'OpenACS' event to the ACSTreeBaseListenerImpls and ViewInBases before the the finalization of the ACS and its true removing in m_OpenAcs__. Then, the open views that contains some objects from this ACS are closed without user message. Fires an 'OneInformationSystemNodeOpening' event to the BaseListeners after the finalization of the ACS and its removing. Called by closeOpenACS(). Calls saveACS(), and the code is synchronized on the argument.

Parameters:
_acs - to be closed and finalized
_withSaving - true to save the ACS
Throws:
BaseError - if _acs is not open.

openAllViews

public void openAllViews()
                  throws BaseError,
                         DialogError
Open all known views, when there are all closed. Fire an event 'OpenViews' for each open view.

Specified by:
openAllViews in interface ViewManager
Throws:
BaseError - if a view is not known or ClassNotFoundException, a view object belongs to a closed ACS (with the relevant closed ACS names that may be get through BaseError.getL_Exception()), or IOException, or if a view is open at the start of the method (if so, close it before a new call to this method).
DialogError - if a view contains closed-ACS objects.

saveAllViews

public void saveAllViews()
                  throws BaseError
Save all the open views in some files (one per view) in the default data directory.

Specified by:
saveAllViews in interface ViewManager
Throws:
BaseError - if viewName.lastComponent() is null, FileNotFoundException or IOException.

saveAndCloseOpenView

public void saveAndCloseOpenView(ViewInBase _view)
                          throws BaseError
Close an open view and save it before. Fire an event 'OpenViews'. Work if an implied acs is closed. The view is still known in ViewManager. In this method, THE OBJECT _VIEW IS SET TO NULL. After the call of this method, SET the object _view TO NULL.

Specified by:
saveAndCloseOpenView in interface ViewManager
Parameters:
_view - ViewInBase to be saved, closed and finalized.
Throws:
BaseError - if ViewName.lastComponent() is null, or FileNotFoundException and IOException.

saveOpenView

public void saveOpenView(ViewInBase _view)
                  throws BaseError
Saves an open view without closing it. The view instance is not modified.

Specified by:
saveOpenView in interface ViewManager
Parameters:
_view - ViewInBase to be saved.
Throws:
BaseError - if _view is not open, ViewName.lastComponent() is null, or FileNotFoundException and IOException.

getL_ViewNames

public java.util.List<ImmutableName> getL_ViewNames()
Gets the names of the open or closed views.

Specified by:
getL_ViewNames in interface ViewManager
Returns:
unmodifiable list of view names

getEorM_OpenViews

public java.util.Map<ImmutableName,ViewInBase> getEorM_OpenViews()
Specified by:
getEorM_OpenViews in interface ViewManager
Returns:
unmodifiable map of non-null instances of the open views, where the view name is the key Never null.

knowsView

public boolean knowsView(ImmutableName _name)
Specified by:
knowsView in interface ViewManager
Parameters:
_name - ImmutableName of a view
Returns:
boolean true if _name is known as a view name. The view may be open or closed.

isOpenView

public boolean isOpenView(ImmutableName _name)
Specified by:
isOpenView in interface ViewManager
Parameters:
_name - ImmutableName of a view
Returns:
boolean true if _name is known as a view name and the view is open.

openView

public ViewInBase openView(ImmutableName _name)
                    throws BaseError,
                           DialogError
Opens a registered and closed view from a file in the current data directory. Calls ViewInBase.prepareAfterRestoring() and ARoad0.Gui1.DialogBox.showAlarmMessage() to inform about the deleted objects which has been removed from the view. If ViewInBase.prepareAfterRestoring() throws an exception, the view is not opened and the DialogError is thrown by this method to inform the user. Else, if prepareAfterRestoring() returns a non-null message, it is displayed to the user, typically to inform that a deleted object cannot be kept in the opening view. Fires an event 'OpenViews'. remove '<>' at the start and the end of a 'NMNM' indicator, for a NoMoreNoLess view (new in 0.7.2). 0.7.0 and 0.7.1 backward compatibility: opens a NoMore-NoLess view having a file name with '<NMNL>'.

Specified by:
openView in interface ViewManager
Parameters:
_name - ImmutableName of an EPRViewInBaseImpl to open. Its file name is built with the three last components of the name, at most.
Returns:
the open view.
Throws:
BaseError - if the view is not known, the view is open, the open view has not the same name, or ClassNotFoundException, IOException.
DialogError - if the view contains an object from a closed ACS, and the exception message should be shown to the user

getElementsOfOneView

public java.util.Set<ImmutableName> getElementsOfOneView(ImmutableName _name,
                                                         boolean _acsNames)
                                                  throws BaseError
Gets the elements of a closed or opened ViewInBase. For the closed views, calls FolderAbst.prepareDataAfterRestoring(). Fires no event. A closed view is not opened by this method.

Parameters:
_name - of an opened or closed ViewInBase.
_acsNames - false to get the view elements names, true to get the names of the ACS which own the view elements
Returns:
the element names or the ACS names; if for ACS, it may contains a null item. Never null.
Throws:
BaseError - if the view is not known, the open view has not the same name, or ClassNotFoundException, IOException.

closeOpenView

public void closeOpenView(ViewInBase _view)
Closes an open view without saving it. Fires an event 'OpenViews' to the Gui2.ViewTreeBaseListenerImpl before the closing, to done it before the view proper events. Finalizes the view. The file is not deleted.

Specified by:
closeOpenView in interface ViewManager
Parameters:
_view - to be closed and finalized. Is null when a view is closed after the closing of one of its ACS, because gDMak.ActionClose cannot get the view then.

closeSketchView

public void closeSketchView(EPRViewInBaseImpl _view)
Close the sketch view without saving it. No 'OpenViews' firing. Finalize the view. No associated file.

Parameters:
_view - to be closed and finalized.

removeView

public void removeView(ImmutableName _name)
                throws BaseError
The view name is removed from the view list in ViewManager. If it is open, the view is closed and saved before. The view saving file is not deleted, but it could be (or removed) by the user. Then, ViewManager.openView(this view) can't work. The view objects in the JVM memory are not finalized.

Specified by:
removeView in interface ViewManager
Parameters:
_name - ImmutableName of the view to remove.
Throws:
BaseError - if the view is unknown, viewName.lastComponent() is null, or FileNotFoundException and IOException.

saveGUI

public final void saveGUI(java.util.Map _config)
                   throws BaseError
Saves the GUI configuration in the file 'GUI_config.acr'. Called by ActionSaveAll, ActionSave.

Parameters:
_config - is the map of the configuration objects, where the object name is the key
Throws:
BaseError - if FileNotFoundException and IOException.

getGUI

public final java.util.Map getGUI()
                           throws BaseError
Gets the GUI configuration from the 'GUI_config.acr' file. Called by ActionSave, ActionSaveAll, ActionExit, Desktop.

Returns:
the map of the configuration objects in the GUI, where the object name is the key. Null if there is no 'GUI_config.acr' file.
Throws:
BaseError - if ClassNotFoundException and IOException.

getL_MetaRights

public java.util.List<StringMetaRight> getL_MetaRights()
Gets all the metarights in an sorted set.

Returns:
the metarights. Never null nor empty.

getL_AcsAddonDescriptors

public 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. The form of a value is 'Editor: editor_name - AcsAddon: addon_name'. The public descriptor of the ACS Addon is the String property PUBLIC_ACS_ADDON_NAME in the class gWork.AcsFactoryXXX, where XXX is the name of the Addon package as it is get from ACS.getM_AcsVocabulary(), for the key ACSFactoryUtilityImpl.ACSADDON_PACKAGE_EDITOR. Called by ISNodeImpl.getL_AcsAddonDescriptors(), gDMak.ActionAcsAddonGuides and ActionNewACSyst.

Returns:
the descriptors. Never null and may be empty.

getL_NonAdministrativeMetaRights

public java.util.List<StringMetaRight> getL_NonAdministrativeMetaRights()
Gets all the non-administrative metarights in an ordered list, which is a subset of the metarights for GUI displaying and user selecting. A non-administrative metaright has its right which does not ended by '|'.

Returns:
the metarights list. Never null nor empty.

getMetaRight

public StringMetaRight getMetaRight(java.lang.String _right)
Gets the metaright with the correct right, following the creations in BaseUtilityImpl.initializeBasicMetaRights(). It may be desactivated. Called in the generic access paths searching, then may be called from a view worker thread.

Parameters:
_right - is from StringRight.getRight()
Returns:
the metaright. May be null.

getMetaRightFromName

public StringMetaRight getMetaRightFromName(ImmutableName _name)
Gets the metaright with the correct name through getName().

Parameters:
_name -
Returns:
the metaright. May be null.

getL_MetaRightsFromPower

public StringMetaRight[] getL_MetaRightsFromPower(int _power)
Gets all the metarights with the same power.

Parameters:
_power - is the power of the searched metarights
Returns:
the metaright array. May be null.

newMetaRight

public static void newMetaRight(StringMetaRight _right,
                                boolean _toSave)
                         throws CreateError
Register a new metaright. Used only by the StringMetaRightImpl constructor for testing.

Parameters:
_right - the new metaright
_toSave - true if the saving must be provided
Throws:
CreateError - if the metaright is already known

removeMetaRight

protected void removeMetaRight(StringMetaRight _right)
                        throws CreateError
UNUSED METHOD. Unregisters a metaright. Called by the metaright finalizeForUser() method.

Throws:
CreateError - if the metaright is not known

saveMetaRights

private static final void saveMetaRights()
                                  throws BaseError
Save the metarights list.

Throws:
BaseError - if FileNotFoundException or IOException

firePropertyChange

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. For the properties 'OpenViews', 'OneInformationSystem', 'OneInformationSystemNode', 'OpenACS'.

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

newEorView

protected final void newEorView(ViewInBase _view)
                         throws CreateError
Called by the ViewInBaseImpl constructor for registering the instance.

Parameters:
_view - is the new view to be recorded. _view must not be null (throws InternalError).
Throws:
CreateError - if the view name is already known

newEorCopiedViewToSave

protected final void newEorCopiedViewToSave(ViewInBase _view)
                                     throws BaseError
Called by the ViewInBaseImpl copyAndFinalize() method for registering the instance and to save it, while it is not open.

Parameters:
_view - is the new view to be recorded. _view must not be null (throws InternalError).
Throws:
BaseError - if the view name is already known

saveView

private final void saveView(ViewInBase _view)
                     throws BaseError
Saves a view without closing it. Prepares it if it is a ViewInBaseImpl. Does not update the view names file. For a NoMoreNoLess view, remove '<>' at the start and the end of 'NMNL' (new in 0.7.2). 0.7.0 and 0.7.1 backward compatibility: deletes the old file with '<NMNL>', if any. Called by saveAndCloseEorOpenView(), saveOpenView(), newEorViewCopy(), saveAllViews().

Parameters:
_view - to be saved.
Throws:
BaseError - if ViewName.lastComponent() is null, or FileNotFoundException and IOException.