ARoad0.AcsAddon.Accbee.MySQL.gWork
Class AcsFactoryMySQL

java.lang.Object
  extended by ARoad0.AcsAddon.Accbee.MySQL.gWork.AcsFactoryMySQL
All Implemented Interfaces:
AcsFactoryForAcsAddon, Singleton

public class AcsFactoryMySQL
extends java.lang.Object
implements AcsFactoryForAcsAddon

This class is an utility class for the creation of the MySQL 5 ACS on any parent ACS. It uses the packages ARoad0.AcsAddon.Accbee.MySQL.xxx to create the ACS in the base. The requirements for the MySQL access controls are described in http://dev.mysql.com/doc/refman/5.5/en/request-access.html and the near pages.

To simulate the MySQL server, the features are provided first by a configuration of the Access Road core functions in the generic gBase package. This is the responsibility of this class:

- to model the MySQL server, using UserID, GroupID, Resource, Directory, Actor, VirtualFolder, AclEntry, conditional AclEntry and inherited AclEntry, Bridge, hard alias,

- 31 MySQL rights, and no direct use of the metarights,

- 12 main types of Resources, 14 main types of EligibleParties, 3 main types of VirtualFolders,

- 42 ACS type policies for GroupID, Directory, Resource, VirtualFolder, Actor,

- 27 specialized rights for AclEntry on all the types of targets and sources,

- 4 automatic associations for new MySQL database.

The MySQL server is mainly simulated by the way of a MySQL AcsAddon, with the following specific features:

- inherited AclEntries and AclEntry sorting, in MySQL.gBase,

- enforcing exactly one host per account, in MySQL.gBase,

- UserID as parameter of the VirtualFolder constructor, in MySQL.gBase,

- VirtualFolder to simulate a MySQL view, enforcing to have elements only from the database, in MySQL.gBase,

- VirtualFolder alias as Actor running under the VirtualFolder UserID, in MySQL.gBase,

- '%' and '_' wildcard characters in the names of groups and directories, in MySQL.gBase,

- BasesSetMySQL to model a set of databases, in MySQL.gBase,

- ProxyMySQL to model a proxy account, in MySQL.gBase,

- conditional overlaying of the received AG context on the VirtualFolder alias, in MySQL.gWork,

- detection of the effective rights of an user, in MySQL.Work,

- access path deleting if there is another path having priority,

in MySQL.gWork.

No roots are created on the parent ACS. The limitations on the MySQL server simulation are described in the package documentation. To comply with the AcsAddon architectural pattern, this class offers the method create() called by ActionNewACSyst.create(), and the method configure() called by ActionNewACSyst.fillWithAcsObjects().


Field Summary
private static AcsFactoryMySQL instance__
          the only instance of the class, following singleton pattern
static java.lang.String PUBLIC_ACS_ADDON_NAME
          The descriptor of the AcsAddon to set in the menu for creating a new ACS.
 
Constructor Summary
AcsFactoryMySQL()
          with this public constructor for the subclasses.
 
Method Summary
 ACSImpl configure(ACSImpl _result)
          Configure MySQL server as an ACS.
static void configureMySQLonLinux(ImmutableName _name, ACS _core, ACSFactoryImpl _factory)
          Currently unused.
 ACSImpl create(ImmutableName _iSname, ImmutableName _name, java.lang.String _type, ImmutableName _parent)
          Creates a specific MySQL ACS.
static AcsFactoryForAcsAddon getInstance()
          Only method to obtain the unique instance.
 java.lang.String getPublicAcsAddonName()
          Gets the descriptor of the AcsAddon, to set in the menu for creating a new ACS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance__

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


PUBLIC_ACS_ADDON_NAME

public static final java.lang.String PUBLIC_ACS_ADDON_NAME
The descriptor of the AcsAddon to set in the menu for creating a new ACS. It has to contain a '(' character. ActionNewACSyst uses it to define the ACS type, as the beginning of the text up to the first '(' character.

See Also:
Constant Field Values
Constructor Detail

AcsFactoryMySQL

public AcsFactoryMySQL()
with this public constructor for the subclasses.

Method Detail

getInstance

public static AcsFactoryForAcsAddon getInstance()
Only method to obtain the unique instance. Called by reflection from ActionNewACSyst.createACS().

Returns:
an AcsFactoryMySQL instance

getPublicAcsAddonName

public java.lang.String getPublicAcsAddonName()
Gets the descriptor of the AcsAddon, to set in the menu for creating a new ACS. This method has to return a static variable, because it is called after a call to the empty constructor. Called by ActionNewACSyst.actionPerformed().

Specified by:
getPublicAcsAddonName in interface AcsFactoryForAcsAddon

create

public ACSImpl create(ImmutableName _iSname,
                      ImmutableName _name,
                      java.lang.String _type,
                      ImmutableName _parent)
               throws BaseError
Creates a specific MySQL ACS. The method configure() is called after this method by ActionNewACSyst.fillWithAcsObjects(). The limitations on the MySQL server simulation are described in the package documentation.

Creates a specific MySQL ACS. The NX ACS is detected when its type contains 'Linux'. configure() is called after this method by ActionNewACSyst.fillWithAcsObjects(). This method makes most of the work, but the ACS vocabulary is set by ACSFactoryMySQLImpl directly. Called by ActionNewACSyst.create(). Calls configureMySQLonLinux().

Specified by:
create in interface AcsFactoryForAcsAddon
Parameters:
_iSname - the IS of the new ACS. May be null.
_name - of the ACS to create or open. No test of null value nor empty.
_type - must be the beginning of PUBLIC_ACS_ADDON_NAME
_parent - is the parent node of the new ACS in the IS. Never null. Have to be an ACS.
Returns:
the new ACS
Throws:
BaseError - if the ACS is known, the ACS is open, the core ACS is null when it is mandatory, or ClassNotFoundException, IOException with invalidClassException if ACSImpl HAS CHANGED, or if the type or the specified structure are not correct.

configure

public ACSImpl configure(ACSImpl _result)
Configure MySQL server as an ACS. The Resources first directory is 'MySQL server', with one database 'BASE One' and a '|pattern-name_bases sets|' node for which 'BASES O%' is the single child. The second directory without parent is the connection subACS, as parent of the user connections. Under the database 'BASE One', two tables 'Customers table' and 'Products table' are created with columns, indexes, triggers, stored functions and stored procedures. The VirtualFolders root is 'Views root', and the associations create the passive node 'database One views' as parent of all the 'database One' views. The 3 standard GroupIDs to create under the 'standard_tree' are '|pattern-name_accounts-for-hosts|', '|pattern-name_hosts|' and '|standard for simple hosts|'. The only mandatory GroupID to create is 'localhost'. Creates also local%, '%', and jerry§@llocal%. Caution: only the type 'account' is correct for an UserID, even if the ACS policy allows more. The created UserIDs are those found in the localhost, that is the parent ACS if it is not a Linux ACS. Otherwise, only the accounts 'root', 'tom', 'jerry' and 'anonymous' are created, with the proxy 'lp'. 2 views 'Amounts view' and 'Prod view' are created. Removes the default conditional AclEntry from 'root@localhost' to 'MySQL server', and adds a new non-conditional AclEntry with the rights 'GRANT OPTION' and 'ALL'. Compatibility note for an ACS derived from the version 0.7.0: no '' directory. Called by ActionNewACSyst.fillWithAcsObjects().

Specified by:
configure in interface AcsFactoryForAcsAddon
Parameters:
_result - to create
Returns:
MySQL ACS with the initial and standard trees of resources and its eligible parties.

configureMySQLonLinux

public static final void configureMySQLonLinux(ImmutableName _name,
                                               ACS _core,
                                               ACSFactoryImpl _factory)
Currently unused. Creates the roots of the MySQL server in the parent ACS. They are only opening and closing roots. Called by create().

Parameters:
_name - ImmutableName for the ACS to create. No test of null value nor empty.
_core - is the ACS parent on which the MySQL server is building up, and it is updated by the initial and standard trees of resources and eligible parties of the MySQL server
_factory - a ACSFactoryMySQLImpl instance