ARoad0.gDMak
Class ActionImportACS

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by ARoad0.gDMak.ActionImportACS
All Implemented Interfaces:
Singleton, java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class ActionImportACS
extends javax.swing.AbstractAction
implements Singleton

An action that imports in the base an unknown access control system from a file. After the import operation, a saving updates the initial file of the imported ACS. The imported ACS must have the same ACSImpl version than the current ones. This class manages all the dialog boxes required for the user, controls the inputs, imports the ACS in the base from its file, helps the user to create the external links to the current open ACS, then displays the imported ACS in the explorer and the beamer.

An ACS has to belong to an information system (IS), named below 'IS-name'. This name has only one String component. The imported ACS name has the String form ' IS-name:: aaaa:: bbbb:: cc:: ddddddddddd:: eeee:: ', where xxx is both a component of the name and a component in the IS nametree. The ACS file name depends on all the components of the ACS name. This may forbids the importation of an ACS if there is a current ACS having the same file name, or if there is an IS node or area in the same case. It is not possible to change the name of the imported ACS or the name of a current ACS.

To import an ACS, it has to be closed before, into its source Access Road instance. It is not necessary to remove it from this source instance, and the ACS has not to be prepared for the export. The imported ACS file is simply copied from its source Access Road working directory to the working directory of the targeted Access Road instance. For importing in its Access Road instance, the user has to enter the full name of the ACS. An error is displayed if the associated file, derived from the ACS name, is not find into the working directory. To import two ACS, one being the child of the second one, the user has to import the parent first.

If the information system is unknown, is is added into the IS list as a hub node. The ACS parent name is compared to the current nodes of the ACS IS. If the parent name does exist in the IS, the ACS is registered 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 import. The other properties of the ACS node in the source IS nametree are copied into the target IS nametree.

In the imported ACS, all the inner properties are restored, including its structure, its behavior and its set of ACSobjects. This includes the ACS roots in the parent ACS, if the parent is an ACS. Otherwise, the roots are deleted during the import. If the parent is an ACS, it has to comply with 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 is why the set of roots may be partially restored, or not at all.

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 chooses, in the class ActionImportACS, to create some of these closed objects. The returned map described each Bridge, AclEntry or Privilege, including the names of 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.

As the inter-ACS links are detected through the objects names, some 'ghosts' are possible in specific configurations. For instance, if the ACS 'rrr' has been closed and removed while it had a bridge with the open ACS 'aaa', then 'aaa' keeps the memory of this inter-ACS link, through the name of a 'rrr' Actor. If the imported ACS is also named 'rrr' with a same-named Actor, the ACS 'aaa' will try to restore a 'ghost' bridge with the new ACS. This may also occur on AclEntries or Privileges external links. This feature is applicable in the two sens, both for bridges, AclEntries and Privileges. For the bridges, it is suffisant to have the bridge description in one of the relevant ACS to recreate the bridge. For the AclEntries and the Privileges, the full restoration data is only into the owner of the AclEntry or Privilege. The user should review the external links of the imported ACS, to delete these ghost links after their creation by the import procedure, or to keep them after their creation, or to recreate them if they have not been created by the import procedure. For detecting them just after the import, it is possible to open all the current ACS in the base, before the import operation. If there are too many ACS in the base, the work may be done on the per-ACS basis. The ghost links are then useful to replace an ACS to remove by an imported ACS, without changing some of its inter-ACS links of the previous ACS. This is of course a choice to explain in the documentation of the import operation.

See Also:
Serialized Form

Field Summary
private static ActionImportACS instance__
          the only instance of the class, following singleton pattern
private static java.lang.String lineSepar__
           
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
private ActionImportACS()
          with this private constructor, the compiler won't generate a default public constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
          Manages the actions fired from the main menu, and displays a dialog box to enter the imported ACS name.
static ActionImportACS getInstance()
          only public method to get the unique instance
private  void prepareACS(Name _name)
          Invoked by actionPerformed() to import the ACS from its name.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance__

private static ActionImportACS instance__
the only instance of the class, following singleton pattern


lineSepar__

private static java.lang.String lineSepar__
Constructor Detail

ActionImportACS

private ActionImportACS()
with this private constructor, the compiler won't generate a default public constructor

Method Detail

getInstance

public static ActionImportACS getInstance()
only public method to get the unique instance

Returns:
ActionImportACS, the unique instance

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Manages the actions fired from the main menu, and displays a dialog box to enter the imported ACS name.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
ev - ActionEvent

prepareACS

private void prepareACS(Name _name)
Invoked by actionPerformed() to import the ACS from its name. If the ACS-name field is empty, an error message is displayed. If the complete ACS name is already known by the base, an error message is displayed. There is no control of space character at the end of any name entered by the user, nor control of the name size. Call ACS_Facade.getImportedACS() and display the error message if any.

Parameters:
_name - of the imported ACS