ARoad0.AcsAddon.Accbee.MySQL.gBase
Class ProxyMySQLImpl

java.lang.Object
  extended by ARoad0.gBase.BasicImpl
      extended by ARoad0.gBase.EligiblePartyImpl
          extended by ARoad0.gBase.GroupIDMemberImpl
              extended by ARoad0.gBase.UserIDImpl
                  extended by ARoad0.AcsAddon.Accbee.MySQL.gBase.ProxyMySQLImpl
All Implemented Interfaces:
ProxyMySQL, UserIDMySQL, ACSObject, ACSObjectAddon, BaseBeanManager, BaseObject, Basic, BoundBean, Copyable, EligibleParty, FinalizedObject, FinalizedObjectForUser, GroupIDMember, ImmutableBasic, ImmutableEligibleParty, ImmutableGroupIDMember, ImmutablePrivilegeSource, ImmutableSource, ImmutableTarget, ImmutableUserID, PrivilegeSource, PrivilegeUser, UserID, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class ProxyMySQLImpl
extends UserIDImpl
implements ProxyMySQL

This class is responsible for modeling a MySQL proxy user having a proxied account as a non-generic alias reference. The generic soft aliasing feature is very partially used. This class copies most of the UserIDMySQLImpl features, but there are important differences:

- a proxy user is never member of an account-for-hosts group.

- for a new proxy user 'xxxx', there is no empty non-conditional ACL on 'MySQL Server' for the accounts-for-hosts group 'xxxx§@%'.

- the ACS policy allows no ACL to a proxy account, since it is simply the alias of another account.

The proxied account is never a proxy account. The host of the proxied account is independant to the host of its proxy account. This class works with UserIDMySQLImpl that implements the proxy account. This AcsAddon does not use the ACS management of the soft aliasing between ProxyMySQLImpl and UserIDMySQLImpl. This is why CompoundRightsFactoryImpl does not use its method selectDirectReferencesInViewForAlias() for this proxy link. The ALIAS link is implemented directly by the AcsAddon, but however, the class UserIDMySQLImpl uses the Basic property 'SoftAlias' to keep the names of the proxy accounts, for a given proxied account. This class implements the following rules, and informs the Access Road user with the same sentence as error message when they are not fulfilled with:

- The host of an account cannot be null.

- The name of an account cannot contain the characters '%', '_', '§' or '@'.

- User names can be up to 16 characters long, but no more.

- The host of an account has to be a simple host.

- The proxied account cannot be a proxy account.

- The host name is not the name of an open ACS.

- The name xxx is not the name of an account in the open ACS.

This class has no subclass in this package. It is a javabean with the following bound properties: 'CurrentGroupID'. The listeners are proper to this instance, outside gBase, transient (not serialized in this instance backup). They are called in any order. They receive the new value, without copy. All the exceptions from the listeners are catched, and a dialog box is displayed to inform the user.

See Also:
Serialized Form

Field Summary
static ProxyMySQLImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected  GroupIDMySQLImpl host_
           
protected  UserIDMySQLImpl proxiedAccount_
           
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization
private static long serialVersionUID__
           
 
Fields inherited from class ARoad0.gBase.UserIDImpl
l_currentActors_, l_ownResources_, order_, primGroup_
 
Fields inherited from class ARoad0.gBase.GroupIDMemberImpl
isAdmin_, l_Groups_
 
Fields inherited from class ARoad0.gBase.EligiblePartyImpl
m_AclEntriesResources_
 
Fields inherited from class ARoad0.gBase.BasicImpl
aCS_, aCS_Name_, aliasHandler_, changeSupport_, comment_, folderMember_, INCREMENT_CAPACITY, INITIAL_CAPACITY, INITIAL_CAPACITY_2, iS_Name_, m_ConstrainedChildACS_, name_, PRIME, privHandler_, type_
 
Constructor Summary
ProxyMySQLImpl()
          The basic constructor
ProxyMySQLImpl(ImmutableName _name, ACS _acs, java.lang.String _epType, java.lang.Boolean _isAdmin, GroupIDMySQLImpl _host, UserIDMySQLImpl _proxiedAccount)
          Constructor used in the beamer, from the 'New' button, to create a proxy account.
ProxyMySQLImpl(ImmutableName _name, ACS _acs, java.lang.String _epType, boolean _isAdmin, GroupIDMySQLImpl _host, UserIDMySQLImpl _proxiedAccount, boolean _toRegisterInManager)
          Unused for the creation of a ProxyMySQL.
 
Method Summary
 void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
 java.lang.Object copy(ImmutableName _name, ACS _acs, Directory _parent, java.lang.Boolean _toRegisterInManager)
          This method provides a copy of the instance with another name.
protected  ProxyMySQLImpl copyOwnVariables(ProxyMySQLImpl _result, boolean _withoutInternalAcl)
          This method provides a copy of the instance variables.
 java.lang.Object copyWithoutInternalAcl(ImmutableName _name, ACS _acs, Directory _parent, java.lang.Boolean _toRegisterInManager)
          This method provides a copy of the instance as copy() but without copying the internal AclEntries.
 void finalizeForBase()
          This method removes this instance in its groups directly.
 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.Returns always null, because these events are listened only to update the views containing these ACSObjects.
 GroupIDMySQLImpl getEorFirstHost()
           
 UserIDMySQL getProxiedAccount()
          Gets the proxied account under which this proxy account gets MySQL rights.
 long getSerialVersionUID()
          For the java serialization.
 void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener to the bean.
protected static void setValueOf(ProxyMySQLImpl _user, GroupIDMySQLImpl _host, UserIDMySQLImpl _proxiedAccount)
          Sets, for the constructors, a new account as member of the matched pattern-name groups and member of its mandatory host.
 
Methods inherited from class ARoad0.gBase.UserIDImpl
addCurrentActor, addGroupToGM, addOwnResource, clone, copyOwnVariables, equals, finalize, finalizeFromDeserialization, getEorL_UserIDCurrentActors, getEorL_UserIDOwnResources, getEorPrimGroup, getOrder, getPropertyChangeListeners, hashCode, ownsResource, removeCurrentActor, removeGroupToGM, removeOwnResource, removePrimGroup, setEorPrimGroup, setOrder, toString
 
Methods inherited from class ARoad0.gBase.GroupIDMemberImpl
copy, copyOwnVariables, copyWithoutAcl, getEorL_GroupID, isAdmin
 
Methods inherited from class ARoad0.gBase.EligiblePartyImpl
addAclEntryToEP, addEorPrivilegeForLinksToSource, addEorPrivilegeForTypeToSource, copyOwnVariables, deleteAclEntries, getEorL_AclConnectedResources, getEorL_SourcePrivilegeForLinks, getEorL_SourcePrivilegeForTypes, getEorL_SourcePrivileges, getEPType, removeAclEntryToEP, removeEorPrivilegeToSource, setEPType
 
Methods inherited from class ARoad0.gBase.BasicImpl
addAcsOfSoftReferences, addConstrainedChildACS, addEorSoftAlias, addInVFolderList, addInViewList, addPropertyChangeListener, compareTo, copyOwnVariables, finalizeForUser, firePropertyChange, getAcsName, getComment, getEorACS, getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getFullName, getHasSoftAlias, getImpliedViews, getIS_Name, getL_AcsOfSoftReferences, getL_SoftAlias, getM_ConstrainedChildACS, getName, getNickName, getType, getVirtualFolders, removeAcsOfSoftReferences, removeConstrainedChildACS, removeEorSoftAlias, removeInVFolderList, removeInViewList, removePropertyChangeListener, setComment, setEorAliasAsInternalHardReference, setEorReferenceAsInternalHardAlias, setType
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ARoad0.gBaseInterface.UserID
finalizeForUser, setEorPrimGroup, setOrder
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableUserID
getEorL_UserIDCurrentActors, getEorL_UserIDOwnResources, getEorPrimGroup, getOrder, ownsResource
 
Methods inherited from interface ARoad0.gBaseInterface.GroupIDMember
addGroupToGM, removeGroupToGM
 
Methods inherited from interface ARoad0.gBaseInterface.EligibleParty
setEPType
 
Methods inherited from interface ARoad0.gBaseInterface.Basic
setComment
 
Methods inherited from interface ARoad0.gBaseInterface.PrivilegeSource
addEorPrivilegeForTypeToSource, removeEorPrivilegeToSource
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableGroupIDMember
getEorL_GroupID, isAdmin
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableEligibleParty
getEorL_AclConnectedResources, getEPType, getM_ConstrainedChildACS
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableBasic
getComment, getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getImpliedViews, getIS_Name, getL_AcsOfSoftReferences, getL_SoftAlias, getPropertyChangeListeners, getVirtualFolders
 
Methods inherited from interface ARoad0.gBaseInterface.BoundBean
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutablePrivilegeSource
getEorL_SourcePrivilegeForLinks, getEorL_SourcePrivilegeForTypes, getEorL_SourcePrivileges
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableSource
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias, getType
 
Methods inherited from interface ARoad0.gBaseInterface.ACSObject
getAcsName, getEorACS
 
Methods inherited from interface ARoad0.gBaseInterface.BaseObject
equals, getFullName, getName, getNickName, hashCode
 
Methods inherited from interface ARoad0.gBaseInterface.BaseBeanManager
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableTarget
getEorAliasAsInternalHardReference, getEorReferenceAsInternalHardAlias, getHasSoftAlias, getL_AcsOfSoftReferences, getL_SoftAlias, getType
 

Field Detail

serialVersionUID__

private static final long serialVersionUID__
See Also:
Constant Field Values

host_

protected GroupIDMySQLImpl host_

proxiedAccount_

protected UserIDMySQLImpl proxiedAccount_

EMPTY_INSTANCE

public static final ProxyMySQLImpl EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. Caution: never change the state of the returned instance.


serialPersistentFields

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

Constructor Detail

ProxyMySQLImpl

public ProxyMySQLImpl()
The basic constructor


ProxyMySQLImpl

public ProxyMySQLImpl(ImmutableName _name,
                      ACS _acs,
                      java.lang.String _epType,
                      java.lang.Boolean _isAdmin,
                      GroupIDMySQLImpl _host,
                      UserIDMySQLImpl _proxiedAccount)
               throws CreateError
Constructor used in the beamer, from the 'New' button, to create a proxy account.

A host in MySQL is simulated by a GroupID having a 'host' type, with the special case of the group 'localhost' that has the type 'host byAcsCreator' to forbid its deleting by the Access Road user. The host to use, if it is not 'localhost', has to be an open ACS having an account with the new userID name as name, and the user 'anonymous' is the single exception to this rule.

This constructor ensures that the new account is member of the pattern-name accounts-for-hosts groups that match to it, if it is not the user 'anonymous'. For a new account 'user', an empty non-conditional ACL on 'MySQL Server' is set without rights for the accounts-for-hosts group 'user§@%', if it does not exist. Calls setValueOf(). Calls the super constructor.

Parameters:
_name - ImmutableName of the userID as a kind of eligible party
_acs - ACS owning the userID
_epType - is the eligible party type, and may be null if the ACS allows it.
_isAdmin - true only if the instance has an administrative role in the ACS, for the technical administration or the users
_host - mandatory host for an account. Never null.
_proxiedAccount - proxied account of this instance. Never null.
Throws:
CreateError - if ACS.newEorEligibleParty() throws it - the instance must then be deleted !

ProxyMySQLImpl

public ProxyMySQLImpl(ImmutableName _name,
                      ACS _acs,
                      java.lang.String _epType,
                      boolean _isAdmin,
                      GroupIDMySQLImpl _host,
                      UserIDMySQLImpl _proxiedAccount,
                      boolean _toRegisterInManager)
               throws CreateError
Unused for the creation of a ProxyMySQL. Calls the super constructor and setValueOf().

Parameters:
_name - ImmutableName of the eligible party to create
_acs - Main ACS of the eligible party to create
_epType - is the eligible party type, and may be null if the ACS allows it.
_isAdmin - true only if the instance has an administrative role in the ACS, for the technical administration or the users
_host - mandatory host for an account. Never null.
_proxiedAccount - proxied account of this instance. Never null.
_toRegisterInManager - false if this method must not register the instance in its ACS.
Throws:
CreateError - if ACS.newEorEligibleParty() throws it - the instance must then be deleted !
Method Detail

getProxiedAccount

public UserIDMySQL getProxiedAccount()
Gets the proxied account under which this proxy account gets MySQL rights.

Specified by:
getProxiedAccount in interface ProxyMySQL
Returns:
the proxied account. Never null.

getSerialVersionUID

public long getSerialVersionUID()
Description copied from class: BasicImpl
For the java serialization.

Specified by:
getSerialVersionUID in interface ImmutableBasic
Overrides:
getSerialVersionUID in class UserIDImpl
Returns:
the static serialVersionUID__ of this class

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.Returns always null, because these events are listened only 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().

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
This method removes this instance in its groups directly. The superclass cannot be used, since it is done through a call to GroupIDMySQLImpl.removeEorMember(), which may fire an exception. Calls GroupIDMySQLImpl.removeEorMemberWithoutControl() and UserIdMySQLImpl.removeEorSoftAlias(). Overrides the super method and calls it at the end. This method HAS TO BE USED before deleting the UserID. Note: when this method is called by the EligiblePartyImpl constructor, the proper variables of this class are not still initialized.

Specified by:
finalizeForBase in interface FinalizedObject
Overrides:
finalizeForBase in class UserIDImpl
Throws:
UpDateError - if the instance cannot be removed from its first host group

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String _propertyName,
                                      java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Used by Gui1.CommonPropertyEditor for the properties: 'CurrentGroupID'. Overrides the super method and calls it.

Specified by:
addPropertyChangeListener in interface BaseBeanManager
Specified by:
addPropertyChangeListener in interface BoundBean
Overrides:
addPropertyChangeListener in class UserIDImpl
Parameters:
_propertyName - 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.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Removes a listener to the bean. Used by Gui1.CommonPropertyEditor for the properties: 'CurrentGroupID'. Note: using this method does not remove a listener which has been registered through addPropertyChangeListener(PropertyChangeListener _l). Overrides the super method and calls it.

Specified by:
removePropertyChangeListener in interface BaseBeanManager
Specified by:
removePropertyChangeListener in interface BoundBean
Overrides:
removePropertyChangeListener in class UserIDImpl
Parameters:
_propertyName - name of the property
_l - PropertyChangeListener to remove

getEorFirstHost

public GroupIDMySQLImpl getEorFirstHost()
Specified by:
getEorFirstHost in interface UserIDMySQL
Returns:
the immutable first host of this MySQL user. May be null only at the creation or if finalized.

copy

public java.lang.Object copy(ImmutableName _name,
                             ACS _acs,
                             Directory _parent,
                             java.lang.Boolean _toRegisterInManager)
                      throws CreateError
This method provides a copy of the instance with another name. Do not copy the own resources or the current actors. The copy order is 3 times the source order. Caution: do not copy the user and the group if _result does not belong to aCS_ and if there are no user or group in the _result ACS which have similar names - that is that are ended by the same Strings in this instance user or group names. Call copyOwnVariables(). This method is overridden by the subclasses.

Specified by:
copy in interface Copyable
Overrides:
copy in class UserIDImpl
Parameters:
_name - copy name. Usually creates as an extension of _parent name.
_acs - main ACS of the copy to create. May not be the ACS of this instance.
_parent - is not used, wathever the value.
_toRegisterInManager - false if this method must not register the instance in the ACS.
Returns:
a new instance of UserIDImpl
Throws:
CreateError - of the constructor with the same parameters, or if _parent ACS is not _acs, or addAclEntry() exceptions.

copyWithoutInternalAcl

public java.lang.Object copyWithoutInternalAcl(ImmutableName _name,
                                               ACS _acs,
                                               Directory _parent,
                                               java.lang.Boolean _toRegisterInManager)
                                        throws CreateError
This method provides a copy of the instance as copy() but without copying the internal AclEntries. Calls copyOwnVariables().

Specified by:
copyWithoutInternalAcl in interface EligibleParty
Overrides:
copyWithoutInternalAcl in class UserIDImpl
Parameters:
_name - copy name. Usually creates as an extension of _parent name.
_acs - main ACS of the copy to create. May not be the ACS of this instance.
_parent - is not used, wathever the value.
_toRegisterInManager - false if this method must not register the instance in the ACS.
Returns:
a new instance of UserIDImpl
Throws:
CreateError - of the constructor with the same parameters, or if _parent ACS is not _acs, or addAclEntry() exceptions.

copyOwnVariables

protected ProxyMySQLImpl copyOwnVariables(ProxyMySQLImpl _result,
                                          boolean _withoutInternalAcl)
                                   throws CreateError
This method provides a copy of the instance variables. Called by copy() and by the copyOwnVariables() methods of the subclasses.

Parameters:
_result - to update with this instance variables copies
_withoutInternalAcl - true if the internal AclEntries - that is with a resource having the same ACS - must not be copied
Returns:
updated _result
Throws:
CreateError

setValueOf

protected static void setValueOf(ProxyMySQLImpl _user,
                                 GroupIDMySQLImpl _host,
                                 UserIDMySQLImpl _proxiedAccount)
                          throws CreateError
Sets, for the constructors, a new account as member of the matched pattern-name groups and member of its mandatory host. A host in MySQL is simulated by a GroupID having a 'host' type, with the special case of the group 'localhost' that has the type 'host byAcsCreator' to forbid its deleting by the Access Road user. The host to use, if it is not 'localhost', has to be an open ACS having an account with the new userID name as name, and the user 'anonymous' is the single exception to this rule.

This constructor ensures that the new account is member of the pattern-name accounts-for-hosts groups that match to it, if it is not the user 'anonymous'. For a new account 'user', an empty non-conditional ACL on 'MySQL Server' is set without rights for the accounts-for-hosts group 'user§@%', if it does not exist. Called by the constructor. Calls GroupIDMySQLImpl.isMemberOfMySQLPatternNameGroup() and addEorMemberToPatternNameGroup().

Parameters:
_user - new instance of this class
_host - host group is mandatory. Never null.
_proxiedAccount - proxied account of the proxy _user. Never null.
Throws:
CreateError - if the constraints are not fulfilled with