ARoad0.AcsAddon.Accbee.MySQL.gBase
Class VirtualFolderMySQLImpl

java.lang.Object
  extended by ARoad0.gBase.FolderAbst
      extended by ARoad0.gBase.VirtualFolderImpl
          extended by ARoad0.AcsAddon.Accbee.MySQL.gBase.VirtualFolderMySQLImpl
All Implemented Interfaces:
VirtualFolderMySQL, ACSObject, ACSObjectAddon, BaseBeanManager, BaseObject, BoundBean, FinalizedObject, FinalizedObjectForUser, Folder, ImmutableFolder, ImmutableLeaf, ImmutableNode, ImmutablePrivilegeTarget, ImmutableSource, ImmutableTarget, ImmutableVirtualFolder, Leaf, Node, PrivilegeTarget, PrivilegeUser, VirtualFolder, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Comparable, java.util.EventListener

public class VirtualFolderMySQLImpl
extends VirtualFolderImpl
implements VirtualFolderMySQL

This class is responsible to simulate a MySQL view, adding a view delegate under the database node in the resources tree. This class controls that the VirtuelFolder elements are only from the right database. The DEFINER mode is the default one for the MySQL views. It creates a VirtualFolder with a couple UserID/GroupID as parameter of the constructor. This UserID becomes the Account of the AG context for the view delegate. The GroupID is the host of the account. This feature implies the creation of a VirtualFolderMySQLImpl class in the AcsAddon gBase package, as subclass of VirtualFolderImpl in the generic gBase package.

The view definition is 'frozen' at creation time in MySQL, but it is not useful to extend this constraint to the view simulation in Access Road. As actor, the view delegate in the resources tree runs under the couple UserID/GroupID passed on to the VirtualFolder constructor of the view, if any. This is also the responsibility of the VirtualFolderMySQLImpl constructor.

It is a javabean with the bound properties of the superclass.

This class has no subclass in this package,and no variables. Note: no equals() nor clone() methods. See the Copyright.

See Also:
Serialized Form

Field Summary
static VirtualFolderMySQLImpl EMPTY_INSTANCE
           
 
Fields inherited from class ARoad0.gBase.VirtualFolderImpl
aCS_, aliasHandler_, EP_VFOLDER, folderMember_, memberOneTimeInTree_, nodeHandler_, parent_, privHandler_, RES_VFOLDER, serialPersistentFields, VFType_
 
Fields inherited from class ARoad0.gBase.FolderAbst
baseError_, changeSupport_, comment_, connectedToSeveralACS_, INITIAL_CAPACITY, INITIAL_CAPACITY_5, l_connectedACSNames_, m_BaseObjects_, m_ObjectsNames_, name_, PRIME, type_
 
Constructor Summary
VirtualFolderMySQLImpl()
          Default constructor
VirtualFolderMySQLImpl(ImmutableName _name, ACS _acs, VirtualFolderMySQL _parent, java.lang.String _type, UserID _definer, GroupIDMySQL _host)
          This is the main constructor.
 
Method Summary
 void addEorBaseObject(BaseObject _obj)
          Adds a member to this virtual folder.
 java.lang.Object copy(ImmutableName _name, ACS _acs, Node _parent, java.lang.Boolean _toRegisterInManager)
          This method provides a copy of the instance with another name, without children copying because the copy order will not be always correct.
protected  VirtualFolderImpl copyOwnVariables(VirtualFolderMySQLImpl _result)
          UNUSED - This method provides a copy of the instance variables.
 void finalizeForBase()
          Finalizes the view delegate if not null.
 java.util.Map<java.lang.String,java.lang.String> getAddonInnerPropertiesToListen()
          Gets the specific events to listen from an ACSObject, because these events should change the rights of an ACSObject in an ACS Addon.
 ImmutableUserID getEorDefinerForDelegate()
          In the MySQL DEFINER mode, the view delegate runs under an account.
 GroupIDMySQL getEorDefinerHostForDelegate()
          In the MySQL DEFINER mode, the view delegate runs under an account and a current host.
static VirtualFolderMySQL valueOf(ImmutableName _name, ACS _acs, VirtualFolderMySQL _parent, java.lang.String _type, UserID _definer, GroupIDMySQL _host)
          No use, since CollectionPropertyEditor calls BaseObjectHandler.
 
Methods inherited from class ARoad0.gBase.VirtualFolderImpl
addAcsOfSoftReferences, addEorChild, addEorPrivilegeForLinksToTarget, addEorPrivilegeForTypeToTarget, addEorSoftAlias, addInViewList, addPropertyChangeListener, addPropertyChangeListener, compareTo, copyOwnVariables, detectMemberInFolderTree, equals, fastHashCode, finalizeForUser, finalizeFromDeserialization, getAcsName, getEorACS, getEorAliasAsInternalHardReference, getEorImmutableL_TargetInheritedLinkedPrivileges, getEorL_Children, getEorL_TargetInheritedLinkedPrivileges, getEorL_TargetPrivilegeForLinks, getEorL_TargetPrivilegeForTypes, getEorL_TargetPrivileges, getEorParent, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getImpliedViews, getL_AcsOfSoftReferences, getL_SoftAlias, getM_TargetInheritedLinkedPRIRights, getMainVFType, getMemberOneTimeInTree, getPropertyChangeListeners, removeAcsOfSoftReferences, removeEorBaseObject, removeEorChild, removeEorPrivilegeToTarget, removeEorSoftAlias, removeInViewList, removePropertyChangeListener, removePropertyChangeListener, resetInheritedPrivilegeRights, resetInheritedPrivilegeRightsOfChildren, selectInheritedPrivilege, setEorAliasAsInternalHardReference, setEorL_TargetInheritedLinkedPrivileges, setEorReferenceAsInternalHardAlias, setType, valueOf
 
Methods inherited from class ARoad0.gBase.FolderAbst
addOwnListening, containsBaseObject, finalize, finalizeForCopy, firePropertyChange, getComment, getConnectedToSeveralACS, getEorBaseError, getEorL_ConnectedACSNames, getEorM_BaseObjects, getFullName, getName, getNickName, getSerialVersionUID, getType, hashCode, isEmpty, prepareAfterRestoring, prepareBeforeSaving, prepareDataAfterRestoring, propertyChange, removeOwnListening, setComment, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ARoad0.gBaseInterface.VirtualFolder
resetInheritedPrivilegeRights, resetInheritedPrivilegeRightsOfChildren, selectInheritedPrivilege
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableVirtualFolder
equals, getEorL_Children, getMainVFType, getMemberOneTimeInTree, getPropertyChangeListeners
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableSource
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias, getType
 
Methods inherited from interface ARoad0.gBaseInterface.Folder
addPropertyChangeListener, addPropertyChangeListener, propertyChange, removeEorBaseObject, removePropertyChangeListener, removePropertyChangeListener, setComment
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableFolder
containsBaseObject, getComment, getConnectedToSeveralACS, getEorL_ConnectedACSNames, getEorM_BaseObjects, getType, isEmpty
 
Methods inherited from interface ARoad0.gBaseInterface.PrivilegeTarget
addEorPrivilegeForTypeToTarget, removeEorPrivilegeToTarget
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutablePrivilegeTarget
getEorImmutableL_TargetInheritedLinkedPrivileges, getEorL_TargetPrivilegeForLinks, getEorL_TargetPrivilegeForTypes, getEorL_TargetPrivileges, getM_TargetInheritedLinkedPRIRights, getType
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableTarget
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableLeaf
compareTo, getEorParent
 
Methods inherited from interface ARoad0.gBaseInterface.ACSObject
getAcsName, getEorACS
 
Methods inherited from interface ARoad0.gBaseInterface.BaseObject
getFullName, getName, getNickName, hashCode
 
Methods inherited from interface ARoad0.gBaseInterface.FinalizedObjectForUser
finalizeForUser
 

Field Detail

EMPTY_INSTANCE

public static final VirtualFolderMySQLImpl EMPTY_INSTANCE
Constructor Detail

VirtualFolderMySQLImpl

public VirtualFolderMySQLImpl()
Default constructor


VirtualFolderMySQLImpl

public VirtualFolderMySQLImpl(ImmutableName _name,
                              ACS _acs,
                              VirtualFolderMySQL _parent,
                              java.lang.String _type,
                              UserID _definer,
                              GroupIDMySQL _host)
                       throws CreateError
This is the main constructor. The arguments _definer and _host are not properties of this class, but they are used to create the view delegate, as alias of this virtual folder. A view must have 'view' at the end of its name. The property aliasHandler_ is intialized in this constructor. Calls the superclass constructor and setEorAliasAsInternalHardReference().

With a definer and a host, the user message errors are:

- The definer ACS is not the ACS of this virtual folder.

- The host cannot be null when the definer is not null.

- The host ACS is not the ACS of this virtual folder.

- The host is not a simple host.

- The Host is not the simple host of the definer.

Parameters:
_name - name of the folder name. Its last component is added to the _acs name to get the folder name. It is not added to the parent name, since this is the job of valueOf(). Never null.
_acs - is the main ACS of the folder to create. Never null.
_parent - is the folder which contains this folder, and with the same type. May be null or immutable. The last component has the form 'database_name views' if the new VirtualFolder is a view.
_type - is the folder type. Used like the Resource type. If null, the internal value is "". Not the main type, get through getMainVFType.
_definer - not null to set the view delegate as running under this account. May be null.
_host - the host of _definer, from the same ACS. May be null. Never null if _definer is not null.
Throws:
CreateError - if _m_BaseObjects contains a null, no ACSObject, empty-name or not _acs object, or with double link in the folders tree for a ACS, if _parent has not the same folder type, if the name is the name of a known VirtualFolder, Resource or EligibleParty, or if the object type is not managed by the ACS.
Method Detail

valueOf

public static VirtualFolderMySQL valueOf(ImmutableName _name,
                                         ACS _acs,
                                         VirtualFolderMySQL _parent,
                                         java.lang.String _type,
                                         UserID _definer,
                                         GroupIDMySQL _host)
                                  throws CreateError
No use, since CollectionPropertyEditor calls BaseObjectHandler. Calls the main constructor. Caution: it has to not be used as a Resource name in the same ACS, because linked privileges have resources and folders as targets.

Parameters:
_name - of the view. It is copied.
_acs - is the main ACS of the folder to create. Never null.
_parent - is the folder which contains this folder, and with the same type; may be null.
_type - is the folder type. If null, the internal value is "". Used for some typed privileges. The main type is get through getMainVFType.
_definer - not null to set the view delegate as running under this account. May be null.
_host - the host of _definer. May be null. Never null if _definer is not null.
Throws:
CreateError - if _acs is null, or from the constructor.

getEorDefinerForDelegate

public ImmutableUserID getEorDefinerForDelegate()
In the MySQL DEFINER mode, the view delegate runs under an account.

Specified by:
getEorDefinerForDelegate in interface VirtualFolderMySQL
Returns:
the account under which the view delegate runs. Null when there is no delegate.

getEorDefinerHostForDelegate

public GroupIDMySQL getEorDefinerHostForDelegate()
In the MySQL DEFINER mode, the view delegate runs under an account and a current host.

Specified by:
getEorDefinerHostForDelegate in interface VirtualFolderMySQL
Returns:
the host under which the view delegate runs. Null when there is no delegate.

addEorBaseObject

public void addEorBaseObject(BaseObject _obj)
                      throws CreateError
Adds a member to this virtual folder. Overrides the super method to control that the VirtualFolder elements are only from the right database, then calls the super method.

Specified by:
addEorBaseObject in interface Folder
Overrides:
addEorBaseObject in class VirtualFolderImpl
Parameters:
_obj - non-null ACSObject to add in the folder
Throws:
CreateError - if the object is already known by the view, if it is known in the tree when it is restricted to one instance, or it is not a resource or an actor (following the main type), or if its ACS is not the folder ACS, or the object type is not authorized, or if it is not an object from the view database.

getAddonInnerPropertiesToListen

public java.util.Map<java.lang.String,java.lang.String> getAddonInnerPropertiesToListen()
Gets the specific events to listen from an ACSObject, because these events should change the rights of an ACSObject in an ACS Addon. These events are listened to update the views containing these ACSObjects. This method does not cover the parent properties of a Resource or a VirtualFolder (see ARoad0.gBase.AcsAddon.getAddonParentPropertiesToListen()). To define the events, the map key may have the following values:

- 'THIS' to say that the single object to listen is the ACSObject,

- 'ACS.method_name' to say that the list of objects to listen is returned by the method 'method_name' in the Addon ACS class.

For each map key, the values have the following format:

'AAA.method_name IF BBB'

where:

- AAA: THIS (mandatory),

- method_name: 'get' method name of the ACSObject that is associated, in the relevant BeanInfo class, to the event to listen (mandatory)

- IF BBB: where BBB is TRUE, or FALSE, or NULL, or NOT-NULL, to say that the event must be listened if and only if the returned value of the method_name is respectively a boolean TRUE, or FALSE, or an object NULL, or NOT-NULL (option).

When the map value starts with 'ACS', the ACS method to call has the ACSObject has one argument. Otherwise, the ACS or the ACSObject method has no argument. Called by ARoad0.UtilityImpl.removeAddonParentPropertyChangeListener(). Overridden by the subclass DirectoryMySQLImpl.

Specified by:
getAddonInnerPropertiesToListen in interface ACSObjectAddon
Returns:
map to define the specific ACS Addon events to listen. Is always null.
See Also:
AcsAddon.getAddonParentPropertiesToListen()

finalizeForBase

public void finalizeForBase()
                     throws UpDateError
Finalizes the view delegate if not null. Called by finalizeForUser() and by the associations manager when the instance is the root of the database views. Calls superclass finalizeForBase().

Specified by:
finalizeForBase in interface FinalizedObject
Overrides:
finalizeForBase in class VirtualFolderImpl
Throws:
UpDateError - from Basic.removeInVFolderList()

copy

public java.lang.Object copy(ImmutableName _name,
                             ACS _acs,
                             Node _parent,
                             java.lang.Boolean _toRegisterInManager)
                      throws CreateError
This method provides a copy of the instance with another name, without children copying because the copy order will not be always correct.

Overrides:
copy in class VirtualFolderImpl
Parameters:
_name - is the copy name. Caution: it has to not be used as a Resource name in the same ACS, because linked privileges have resources and folders as targets.
_acs - is the main ACS of the copy to create. May not be the ACS of this instance.
_parent - is the VirtualFolderMySQL (not Node!) which belongs to _acs and will have the copy. May be null.
_toRegisterInManager - false if this method must not register the instance in the ACS.
Returns:
Object is a copy as VirtualFolderMySQLImpl instance
Throws:
CreateError - of the constructor with the same parameters, or if _parent is not a virtual folder, or _parent ACS is not _acs.

copyOwnVariables

protected VirtualFolderImpl copyOwnVariables(VirtualFolderMySQLImpl _result)
                                      throws CreateError
UNUSED - This method provides a copy of the instance variables. Each internal variable that is an external object reference has a shallow copy (no deep copy). Copy the privileges only if it is possible. Called by copy() and by the copyOwnVariables() methods of the subclasses.

Parameters:
_result - to update with this instance variables copies
Returns:
the updated _result
Throws:
CreateError - from