ARoad0.gDMak
Class ActionNewACSyst

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

public class ActionNewACSyst
extends javax.swing.AbstractAction
implements Singleton, CreationDialogListener

An action that creates a new access control system and the related new components in an information system. This class manages all the dialog boxes required for the user input, controls the inputs, creates through gBase.ACSFactoryImpl the ACS in the base, invokes ACSTree.createACSExplorer(), then displays the new ACS resources in a tree with InternalFrame.showTreeFrame(), and updates the explorer through InternalFrame.

See Also:
Serialized Form

Field Summary
private  javax.swing.JTextField acsField_
           
private  javax.swing.JTextField componentField_
           
private  javax.swing.JList componentList_
           
private  ImmutableName currentAncestor_
           
private static javax.swing.JDialog dialog__
           
private  java.awt.Dimension dimension_
           
private  ACSFactoryImpl factory_
          Current factory when the class instance is working for building up an ACS from the user choices
private  javax.swing.ButtonGroup group_
           
private static ActionNewACSyst instance__
          the only instance of the class, following singleton pattern
private  javax.swing.JTextField isField_
           
private  Name iSname_
           
(package private)  java.util.List<java.lang.String> l_addonDescriptors_
          The list from getL_AcsAddonDescriptors in the class BaseManagerImpl.
private static java.lang.String lineSepar__
           
private  java.util.Map m_currentPropertyEditors_
          Current CommonPropertyEditors in the user dialog.
private  Name name_
           
private  java.lang.String nickName_
           
private  Name parent_
           
private  boolean toFinalize_
          In createUserDefinedACS() and createFirstACSproperties(), used to detect the frame closing from the okButton
 
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 ActionNewACSyst()
          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.
private  void addPreACSinGUI(ACSRun _acs)
          Invoked by createFirstACSproperties() to allow the displaying of the ACS rights in the explorer.
private  void createACS()
          Called by prepareACS(), setCurrentAncestor() and handleSelectionDialog() to create the ACS.
private  void createFirstACSproperties(ACSImpl _refAcs)
          Called by createACS() to create the specific ACS rights, or to display an AcsAddon frame for some specific properties to edit.
private  ACSImpl createRBAC(Name _name)
          Invoked by createACS() to create a Role-Based Access Control application on a Linux, and to display the new ACS in the explorer.
 void createUserDefinedACS(javax.swing.JPanel _panel, javax.swing.JTabbedPane _tPane)
          Called by createFirstACSproperties() to create a specific ACS and, before, to display its properties in a generic frame for allowing the user to enter the main values.
private  void endACScreation(ACSImpl _acs)
          Invoked by setCurrentAncestor(), handleCreationDialog() and createUserDefinedACS() with a null argument, or by createACS() to display the ACS.
private  void fillAcsRightsForDerivedACS(ACS _refAcs)
          Called by createACS() to fill the new acs factory with all the ACS rights from the ACS to be copied.
private  void fillDerivedACSproperties(ACSImpl _refAcs)
          This important method fills the ACSFactory with all the ACS properties to be copied from the ACS reference.
private  void fillWithAcsObjects(ACSImpl _acs)
          Adds the immutable objects under the subACS nodes or the groups tree roots.
private  void finalizePropertyEditors()
          Finalizes the current property editors.
static ActionNewACSyst getInstance()
          single public method to get the unique instance
 StringRight[] getRestrictedUpperRightsForRight(java.lang.Integer _newRightKey, StringRight _meta)
          Called by BaseObjectHandler for defining the allowed upper rights to which the new acsright may be connected.
 void handleCreationDialog(boolean _data)
          Called by DialogBox.showBackedJLists() for setNewComponent() which may be recalled.
private  void prepareACS()
          Invoked by actionPerformed() to check and to select the parent ACS.
static void removePreACSinGUI(ImmutableName _objectName)
          Remove the node associated to an ACSRun in the explorer.
private  java.lang.String selectNoNX_ACSType()
          Invoked by createUserDefinedACS() to select a generic type from ACSImpl.getL_AcsTypes(), or to create a new one.
 void setCurrentAncestor()
          Called by prepareACS() to select the current ancestor in the IS.
 void setNewComponent(ImmutableName _currentAncestor)
          Called by setCurrentAncestor() to create a new logical or physical component as an ancestor of the new ACS.
private  void setNewGroup(ACS _acs, java.lang.String _typeStarting)
          Handles the definition by the user of the type and name of a new group, and creates it.
private  void setNewResource(ACS _acs, Directory _parent, java.lang.String _typeStarting)
          Handles the definition by the user of the type, name and account of a new resource, and creates it.
 
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 ActionNewACSyst instance__
the only instance of the class, following singleton pattern


dialog__

private static javax.swing.JDialog dialog__

m_currentPropertyEditors_

private java.util.Map m_currentPropertyEditors_
Current CommonPropertyEditors in the user dialog. The key is the display name.


isField_

private javax.swing.JTextField isField_

acsField_

private javax.swing.JTextField acsField_

parent_

private Name parent_

dimension_

private java.awt.Dimension dimension_

group_

private javax.swing.ButtonGroup group_

name_

private Name name_

iSname_

private Name iSname_

nickName_

private java.lang.String nickName_

factory_

private ACSFactoryImpl factory_
Current factory when the class instance is working for building up an ACS from the user choices


l_addonDescriptors_

java.util.List<java.lang.String> l_addonDescriptors_
The list from getL_AcsAddonDescriptors in the class BaseManagerImpl.


toFinalize_

private boolean toFinalize_
In createUserDefinedACS() and createFirstACSproperties(), used to detect the frame closing from the okButton


lineSepar__

private static java.lang.String lineSepar__

componentList_

private javax.swing.JList componentList_

componentField_

private javax.swing.JTextField componentField_

currentAncestor_

private ImmutableName currentAncestor_
Constructor Detail

ActionNewACSyst

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

Method Detail

getInstance

public static ActionNewACSyst getInstance()
single public method to get the unique instance

Returns:
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. Controls the user imputs (ACS name and type).

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

prepareACS

private void prepareACS()
Invoked by actionPerformed() to check and to select the parent ACS. If the ACS-name field is empty, an error message is displayed. Its IS name is set to "DefaultIS" if it is empty. 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. Calls DialogBox.showExplorerSelectionDialog() which calls handleSelectionDialog().


setCurrentAncestor

public void setCurrentAncestor()
Called by prepareACS() to select the current ancestor in the IS. Calls setNewComponent() to create new logical or physical components as ancestors of the new ACS, at the request of the user. Calls createACS().


setNewComponent

public void setNewComponent(ImmutableName _currentAncestor)
Called by setCurrentAncestor() to create a new logical or physical component as an ancestor of the new ACS. Calls the reentrant method DialogBox.showBackedJLists() which calls handleCreationDialog(), and this method may calls back setNewComponent() to create another component as a child of the previous one. Sets currentAncestor_.

Parameters:
_currentAncestor - current node in the IS nametree

handleCreationDialog

public void handleCreationDialog(boolean _data)
Called by DialogBox.showBackedJLists() for setNewComponent() which may be recalled. Then it is a partially reentrant method which handles componentField_ and componentList_ at each invocation. It sets name_ and parent_ before the call to createACS(). Calls ISFactoryUtilityImpl.getChildTypesForISnode() and BaseManagerImpl.addComponentNodeToIS(). At the end of the loop, calls createACS().

Specified by:
handleCreationDialog in interface CreationDialogListener
Parameters:
_data - true if the user clicks on OK, and false if the user clicks on Cancel

createACS

private void createACS()
Called by prepareACS(), setCurrentAncestor() and handleSelectionDialog() to create the ACS. For an AcsAddon, calls the correct implementation of AcsFactoryForAcsAddon. The ACS type is the beginning of the Addon name, up to a '(' character. iSname_ and parent_ may be null. Calls createUserDefinedACS(), createFirstACSproperties(), endACScreation(), selectNoNX_ACSType() and fillAcsRightsForDerivedACS(), AcsFactory.createRBAC(), createTestForVFandPRI() and createTestOfAll(), AcsFactoryForAcsAddon.create().


createFirstACSproperties

private void createFirstACSproperties(ACSImpl _refAcs)
Called by createACS() to create the specific ACS rights, or to display an AcsAddon frame for some specific properties to edit. The ACS rights, if any, have been already created in the argument. Calls addPreACSinGUI(), removePreACSinGUI(), createUserDefinedACS(). Based on gBase.ACSFactoryImpl and its subclasses in the AcsAddons.

Parameters:
_refAcs - is the reference ACS from which the new acs is derived. Null else.

createUserDefinedACS

public void createUserDefinedACS(javax.swing.JPanel _panel,
                                 javax.swing.JTabbedPane _tPane)
Called by createFirstACSproperties() to create a specific ACS and, before, to display its properties in a generic frame for allowing the user to enter the main values. Calls endACScreation(), removePreACSinGUI(), ActionUtilities.getInstance().setACSFactory(), UtilityImpl.selectBeanInfo(). Based on ACSFactoryImpl.

Parameters:
_panel - created in createFirstACSproperties()
_tPane - created in createFirstACSproperties(). It contains empty properties or the derived ones from a reference ACS

endACScreation

private void endACScreation(ACSImpl _acs)
Invoked by setCurrentAncestor(), handleCreationDialog() and createUserDefinedACS() with a null argument, or by createACS() to display the ACS. Reinitializes the instance properties. For an AcsAddon, calls AcsFactoryForAcsAddon.configure() on the right class from ACS.getM_AcsVocabulary(). Saves the ACS. Calls ActionOpenACSyst.displayOneACS().

Parameters:
_acs - after its creation. Null for a LAMP server or when the process is aborted.

createRBAC

private ACSImpl createRBAC(Name _name)
Invoked by createACS() to create a Role-Based Access Control application on a Linux, and to display the new ACS in the explorer. An RBAC application uses some functional roles to organize the user rights through ACLs. Uses gWork.AcsFactory to create the ACS in the base.

Parameters:
_name - is the name of the new application
Returns:
new ACS or null

selectNoNX_ACSType

private java.lang.String selectNoNX_ACSType()
Invoked by createUserDefinedACS() to select a generic type from ACSImpl.getL_AcsTypes(), or to create a new one.

Returns:
String which is never null, and "no choice" if there is no user selection.

addPreACSinGUI

private void addPreACSinGUI(ACSRun _acs)
                     throws BaseError
Invoked by createFirstACSproperties() to allow the displaying of the ACS rights in the explorer.

Parameters:
_acs - is an uncomplet ACSFactoryImpl
Throws:
BaseError

removePreACSinGUI

public static final void removePreACSinGUI(ImmutableName _objectName)
Remove the node associated to an ACSRun in the explorer. Called by createFirstACSproperties() and createUserDefinedACS().

Parameters:
_objectName - of the ACS

getRestrictedUpperRightsForRight

public StringRight[] getRestrictedUpperRightsForRight(java.lang.Integer _newRightKey,
                                                      StringRight _meta)
Called by BaseObjectHandler for defining the allowed upper rights to which the new acsright may be connected. If the metaright is classed, the selected superior rights are classed, but not only with the same class. If the metaright is negative, the selected superior rights are negative.

Parameters:
_newRightKey - the internal key of the acsright to create
_meta - the selected metaright for the new acsright. May be null.
Returns:
array of all the rights which have an internal key greater than the argument. May be null.

finalizePropertyEditors

private void finalizePropertyEditors()
Finalizes the current property editors. Called by createUserDefinedACS().


fillAcsRightsForDerivedACS

private void fillAcsRightsForDerivedACS(ACS _refAcs)
Called by createACS() to fill the new acs factory with all the ACS rights from the ACS to be copied. Updates factory_.

Parameters:
_refAcs - reference ACS from which the new ACS is build up when it is a derived ACS

fillDerivedACSproperties

private void fillDerivedACSproperties(ACSImpl _refAcs)
This important method fills the ACSFactory with all the ACS properties to be copied from the ACS reference. The alternates, the new components and the composite links are not added there, but the user may do it manually. The current ACSObjects in the ACS reference are not copied from the ACS reference, although the AcsFactoryForAcsAddon.configure() method is called to provide the standard set of ACSObjects. This method adds the comment 'derived by hand by the ACS creator' to the resulting ACS. Based on ACSFactoryImpl. Called by createFirstACSproperties(). Caution: the roots actions adaptation does not work when the key is not the direct parent.

Parameters:
_refAcs - is the reference acs from which the new acs is build up when it is a derived acs

fillWithAcsObjects

private void fillWithAcsObjects(ACSImpl _acs)
Adds the immutable objects under the subACS nodes or the groups tree roots. This is the unique opportunity for the user to add these objects, since the beamer does not allow to do it. There is no adding under a node if the acs has already at most one occurence which is a node child, when the child has been created by coding.

On the contrary of a creation through coding, it is not possible for the user to add a tree of Resources, since the resources which may be created there, are all under a Resources subACS node. Called by endACScreation() before the opening of the new ACS in the explorer.

Parameters:
_acs - is a new ACS having some subACSs or groups tree roots

setNewResource

private void setNewResource(ACS _acs,
                            Directory _parent,
                            java.lang.String _typeStarting)
Handles the definition by the user of the type, name and account of a new resource, and creates it. The new resource creation updates the GUI. Called by fillUserDefinedSubAcsAndGroupTreesObjects(). For creating a full tree of directories and resources as a subACS, it is mandatory to code a specific method, like for Linux.

Parameters:
_acs - the new ACS
_parent - the parent of the new directory to create
_typeStarting - the starting of the type for the new directory

setNewGroup

private void setNewGroup(ACS _acs,
                         java.lang.String _typeStarting)
Handles the definition by the user of the type and name of a new group, and creates it. The new group creation updates the GUI. Called by fillUserDefinedSubAcsAndGroupTreesObjects(). Calls ActionNewEligibleParty.handleNewGroup() to listen the group members for the ACS trees in the GUI.

Parameters:
_acs - the new ACS
_typeStarting - the starting of the type for the new group