ARoad0.gBase
Class UtilityImpl

java.lang.Object
  extended by ARoad0.gBase.UtilityImpl
All Implemented Interfaces:
CoreAlgorithm

public final class UtilityImpl
extends java.lang.Object
implements CoreAlgorithm

This class is an utility class for BaseObjects, StringRights, the BeanInfo and the AcsAddon management. It cannot be subclassed in an AcsAddon. As a CoreAlgorithm, each worker thread of a GraphicView uses a dedicated instance of this class. It applies the ACS rules:

- 'AGO right: no denying rights'

- 'bridge right: no denying rights'

- 'sens metarule: ACS denyings are superior to ACS grantings (there are + and - operations), for each right type'

- 'right type order: default order: root, A in AGO, all other right types'

It is used by gBase and the AcsAddon gBase packages. It also implements some core algorithms that gWork uses in the access paths search.

ARoad0.gWork.RightsMediatorImpl uses this class to create view instances in the view worker thread, while the first instance is used by the gBase consumers in the main thread.

The direct calls to ACS in the core algorithms are for the methods getL_Rights(), getFirstRightFromMeta(), getEorM_EligibleParties(), getEorL_VirtualFolders(), getEorL_Resources(). The direct calls to BaseManagerImpl in the core algorithms are for the method getMetaRight() and in getBaseObject(), isOpenACS(), isOpenView(), getMetaRightFromName() getEorM_OpenACS().

The methods have to be fast in the access paths search. Some private sets are created at the instance construction to avoid the creation of sets at each method call. Nonetheless, this class is stateless, since each method clears all its sets at its starting.

For the event management of the ACS Addons, the 4 ACSObjectAddon methods add/removeAddonInnerPropertyChangeListener() and add/removeAddonParentPropertyChangeListener() allow the views to listen the specific events from their nodes, when they belong to an AcsAddon.


Field Summary
private static int INITIAL_CAPACITY
           
private static UtilityImpl instance__
          the first instance of the class, used by gBase and the GUI, not by the GraphicView worker threads
private  java.util.Set<StringRight> l_headers_
          used to speed up selectHeaders()
private  java.util.LinkedList l_methodResult_
          used to speed up getFirstIncreasingRightsChain()
private  java.util.Set l_PathsUpFromLesser_
           
private  java.util.Set<StringRight> l_removed_
          used to speed up selectHeaders() and subtractNotRemovingCommonLowerNodes()
private  java.util.Set l_rightsUpFromCurrent_
           
private  java.util.Set<StringRight> l_test_
          used to speed up subtractNotRemovingCommonLowerNodes() and subtractInOneSetInOneACS()
private  java.util.Set<StringRight> l_to_next_test_
          used to speed up subtractNotRemovingCommonLowerNodes()
private  java.util.Set<StringRight> l_to_retain_
          used to speed up subtractNegativeHeadersNotRemovingInOneACS()
private  java.util.Set l_toAddTol_PathsUpFromLesser_
           
 
Constructor Summary
UtilityImpl()
          Called by gWork.RightsMediatorImpl to be used in the GraphicView worker thread.
 
Method Summary
 void addAddonInnerPropertyChangeListener(java.beans.PropertyChangeListener _listener, ACSObjectAddon _obj)
          Registers for the specific events to listen, because these events should change the rights of an ACSObject in an ACS Addon.
 void addAddonParentPropertyChangeListener(java.beans.PropertyChangeListener _listener, ACSObject _obj)
          Registers the specific events to listen on a Resource or a VirtualFolder, and its direct and indirect parents, because these events should change the rights of the Resource or VirtualFolder in an ACS Addon.
private  void changeAddonInnerPropertyChangeListener(java.beans.PropertyChangeListener _listener, ACSObjectAddon _obj, boolean _toAdd)
          Registers or unregisters for the specific events to listen, because these events should change the rights of an ACSObject in an ACS Addon.
private  void changeAddonParentPropertyChangeListener(java.beans.PropertyChangeListener _listener, ACSObject _obj, boolean _toAdd)
          Registers or unregisters the specific events to listen on a Resource or a VirtualFolder, and its direct and indirect parents, because these events should change the rights of the Resource or VirtualFolder in an ACS Addon.
 void finalizeForProcess()
          Finalizes the instance.
 java.util.Map<java.lang.String,java.lang.String[]> getACSVocabularyFromArrayOrInterface(java.lang.String _text)
          Gets the map of the ACS vocabulary from the right ACSFactory, following the pattern of packages and class names in Access Road.
 BaseObject getBaseObject(ImmutableName _name)
          Gets the BaseObject from the names of an open entity.
 java.lang.String getBeanInfoNameFromClass(java.lang.String _text)
          Get the name of the BeanInfo class from the operational class.
 java.lang.String getClassNameFromArrayOrInterface(java.util.Map<java.lang.String,java.lang.String[]> _m_vocabulary, java.lang.String _text)
          Gets the name of the operational class from the interface name, with 'Immutable' or not, as an array or not, following the pattern of packages and class names in Access Road.
 java.lang.String getEffectiveClassName(java.util.Map _m_vocabulary, java.lang.String _className)
          Returns the name of the effective class to use.
private  java.util.LinkedList getFirstIncreasingRightsChain(StringRight _rightOne, StringRight _rightTwo, StringRight _upperToAvoid)
          Gets a StringRights increasing chain where the two arguments are at the two ends, if the chain exists.
static UtilityImpl getFirstInstance()
          Method to obtain the first instance of UtilityImpl, for the gBase consumers and generally the main thread and the event dispatch thread.
 java.lang.String getObjectTypeWithoutImmutable(java.lang.String _type)
          Returns the argument without the key word 'immutable ' at the start or the end of the string.
 java.lang.String getParentOrder(ImmutableLeaf _leaf, ImmutableNode _node)
          Gets the order of a node from a leaf.
 void removeAddonInnerPropertyChangeListener(java.beans.PropertyChangeListener _listener, ACSObjectAddon _obj)
          Unregisters for the specific events to listen, because these events should change the rights of an ACSObject in an ACS Addon.
 void removeAddonParentPropertyChangeListener(java.beans.PropertyChangeListener _listener, ACSObject _obj)
          Unregisters the specific events to listen on a Resource or a VirtualFolder, and its direct and indirect parents, because these events should change the rights of the Resource or VirtualFolder in an ACS Addon.
 BeanInfoPattern selectBeanInfo(BaseObject _objectInBeamer)
          Analyzes the BaseObject to select the right BeanInfo in gBase.
 void selectHeaders(java.util.Set<StringRight> _l_updatedRights)
          Selects the stronguest rights, in removing all the rights in the argument which have a direct or indirect upper rights in the argument.
 java.util.Set<StringRight>[] separateRightsFromSens(StringRight[] _l_right)
          UNUSED.
 java.util.Set<StringRight> substractNegativeFromPositiveRights(java.util.Set<StringRight> _l_upd_rights)
          Wrapper and caller of subtractNegativeNotRemovingInOneACS().
 java.util.Set<StringRight> subtractDeleteRightsInOneACS(java.util.Set<StringRight> _l_posRights, ImmutableACS _acs, boolean _forNode)
          UNUSED.
 java.util.Set<StringRight> subtractInOneSetInOneACS(StringRight[] _l_right, ImmutableACS _acs, boolean _forNode)
          Operates the reduction of each positive right by all the negative rights.
 java.util.Set<StringRight> subtractNegativeHeadersNotRemovingInOneACS(java.util.Set _l_headPosRights, java.util.Set _l_headNegRights, ImmutableACS _acs, boolean _forNode)
          Operates the reduction of each positive right by all the negative rights.
 java.util.Set<StringRight> subtractNegativeNotRemovingInOneACS(java.util.Set<StringRight> _l_posRights, java.util.Set<StringRight> _l_negRights, ImmutableACS _acs, boolean _forNode)
          Operates the reduction of each positive right by all the negative rights, afer a filtering of the headers for each sens.
 java.util.Set<StringRight> subtractNotRemovingCommonLowerNodes(StringRight _rightOne, StringRight _rightTwo, ImmutableACS _acs, boolean _forNode)
          Substracts the second right to the first right.
 boolean withAssociatedDirectoryRight(StringRight _right)
          Tests if the metaright of the argument is 'goto', 'read', 'write' or 'execute'.
 boolean withDenyExecuteRight(StringRight[] _l_rights)
          Detects the rights which are directly or indirectly linked to the metaright 'deny_execute'.
 boolean withDirectExecuteRight(StringRight[] _l_rights)
          Detects the rights which are directly linked to the metaright 'execute', as 'read & execute' for instance.
 boolean withExecuteRight(StringRight[] _l_rights, boolean _forNode)
          Detects the rights which are directly or indirectly linked to the metaright 'execute', as 'read & execute' for instance.
 StringRight withInverseRight(StringRight _right)
          Detect the inverse right, if any, that it is defined, if _right is positive, as the negative right which as the same semantic and strenght.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance__

private static final UtilityImpl instance__
the first instance of the class, used by gBase and the GUI, not by the GraphicView worker threads


INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

l_test_

private final java.util.Set<StringRight> l_test_
used to speed up subtractNotRemovingCommonLowerNodes() and subtractInOneSetInOneACS()


l_to_next_test_

private final java.util.Set<StringRight> l_to_next_test_
used to speed up subtractNotRemovingCommonLowerNodes()


l_to_retain_

private final java.util.Set<StringRight> l_to_retain_
used to speed up subtractNegativeHeadersNotRemovingInOneACS()


l_removed_

private final java.util.Set<StringRight> l_removed_
used to speed up selectHeaders() and subtractNotRemovingCommonLowerNodes()


l_headers_

private final java.util.Set<StringRight> l_headers_
used to speed up selectHeaders()


l_methodResult_

private final java.util.LinkedList l_methodResult_
used to speed up getFirstIncreasingRightsChain()


l_rightsUpFromCurrent_

private final java.util.Set l_rightsUpFromCurrent_

l_PathsUpFromLesser_

private final java.util.Set l_PathsUpFromLesser_

l_toAddTol_PathsUpFromLesser_

private final java.util.Set l_toAddTol_PathsUpFromLesser_
Constructor Detail

UtilityImpl

public UtilityImpl()
Called by gWork.RightsMediatorImpl to be used in the GraphicView worker thread.

Method Detail

getFirstInstance

public static UtilityImpl getFirstInstance()
Method to obtain the first instance of UtilityImpl, for the gBase consumers and generally the main thread and the event dispatch thread. The GraphicView worker threads use dedicated instances set by gWork.RighsMediatorImpl.

Returns:
ACSFactoryUtilityImpl

getFirstIncreasingRightsChain

private final java.util.LinkedList getFirstIncreasingRightsChain(StringRight _rightOne,
                                                                 StringRight _rightTwo,
                                                                 StringRight _upperToAvoid)
                                                          throws BaseError
Gets a StringRights increasing chain where the two arguments are at the two ends, if the chain exists. This method has to be fast because it is used in subtractNotRemovingCommonLowerNodes(), withExecuteRight(), selectHeaders(), withDenyExecuteRight() and withDirectExecuteRight(). If there is a positive right and a negative one, or if compareTo() returns 0, the result is null. The lesser right is the first item in the returned LinkedList. It is an increasing chain, so rights are more powerfull when the index increments. Return the first increasing chain which is found, but it may exist several chains in the rights network between the two right arguments. Return null if the comparison (compareTo method) returns 0, if the arguments have not the same sens, or if there is no result. This method does not use a double up-down search, because rights have more lower rights than upper rights, and so, a single down-up search is generally faster. Acs rights have generally a right network much more simple than metarights, so the result is faster for acs rights. Metarights and acsrights have never any chain linking them, and the result null is quite fast to found since acsrights are inferior and the search begins from them without exploring the metarights network. It the two arguments are ACS rights from more than one ACS, the method returns null. A non-null _upperToAvoid is used by subtractNotRemovingCommonLowerNodes(). Note: to ensure performance, if there are more than 20 increasing chains to analyze from the lesser right, an exception is thrown. This should never be, and it indicates that the design of rights is very poor.

Parameters:
_rightOne - is one end of the chain of rights to get. Not null.
_rightTwo - is the second end of the chain of rights to get. Not null.
_upperToAvoid - a direct upper right of the lesser right among the two arguments. No action if it is not a direct upper right of the lesser right, or if it is the greater right among the two arguments. The result will never include this right. May be null.
Returns:
a chain of linked increasing rights, from the index 0. May be null, or its minimal lenght is 2.
Throws:
BaseError - if an argument is null, if there are more than 20 increasing chains to analyze from the lesser right

substractNegativeFromPositiveRights

public final java.util.Set<StringRight> substractNegativeFromPositiveRights(java.util.Set<StringRight> _l_upd_rights)
Wrapper and caller of subtractNegativeNotRemovingInOneACS(). Caution: this method updates its argument by the removing of negative rights, so the recommanded use is 'set = substractNegativeFromPositiveRights(set)' to avoid any error on the 'set' variable. Called by RightsFactory_Facade.getEffectiveRightsForPair() and getFirstShapeEffectiveRights(), DisplayablelinkUtilities.getDLinksFromNegativeACLPaths(), AclRightsFactoryImpl.getL_aclEntryRights().

Parameters:
_l_upd_rights - to analyze. Not null. Updated by the method.
Returns:
an all-positive or all-negative rights set. May be empty but not null.

subtractNotRemovingCommonLowerNodes

public final java.util.Set<StringRight> subtractNotRemovingCommonLowerNodes(StringRight _rightOne,
                                                                            StringRight _rightTwo,
                                                                            ImmutableACS _acs,
                                                                            boolean _forNode)
                                                                     throws BaseError
Substracts the second right to the first right. This operation returns the lower rights which remain applicable when _rightOne is reduced by the opposite of _rightTwo in the same rights set.

_rightTwo and all the upper rights of _rightTwo are removed in _rightOne. For the lower rights, if a _rightOne (direct or indirect) lower right, say R, is also a _rightTwo (direct or indirect) lower right, the common node R is put in the result.

Returns, if any, all the lower rights of _rightOne if it is equal to _rightTwo. If _rightOne is not equal to _rightTwo, return _rightOne if getFirstIncreasingRightsChain(_rightOne, _rightTwo) is null or starts with _rightOne. If _rightOne and _rightTwo are acs rights from different ACS, returns _rightOne. Called by subtractNegativeHeadersNotRemovingInOneACS(), so this method has to be fast. Calls getFirstIncreasingRightsChain(). Calls withAssociatedDirectoryRight() to detect the 'directory' rights, that have 'read', 'write' or 'execute' as metaright. Does not call selectHeaders(), so l_removed_ may be used by the two methods independantly. Uses the instance properties l_test_, l_to_next_test_ and l_removed_.

Parameters:
_rightOne - first right. Not null.
_rightTwo - second right to subtract. Must have the same class and the same sens that _rightOne. Not null.
_acs - uses all the rights in the two first arguments. May be null.
_forNode - true if these rights are for a Node (Directory or VirtualFolder); the 'directory' rights are not removed, and their equivallent like 'read' is removed
Returns:
a subset of the _rightOne direct and indirect lower rights, or _rightOne if _rightTwo is totally independant. May be empty but never null. All the items in the result are acsrights of _acs or metarights used by _acs.
Throws:
BaseError - if an argument is null, if there is a positive right and a negative one, or an acsright and a metaright, or if there are more than 20 increasing chains to analyze from the lesser right
See Also:
subtractNegativeHeadersNotRemovingInOneACS(java.util.Set, java.util.Set, ARoad0.gBaseInterface.ImmutableACS, boolean)

selectHeaders

public final void selectHeaders(java.util.Set<StringRight> _l_updatedRights)
                         throws BaseError
Selects the stronguest rights, in removing all the rights in the argument which have a direct or indirect upper rights in the argument. Acsrights and metarights, granting and denying rights, acsrights from different acs may be mixed, but each of these four categories will generate at most one header in the result. Called by ResourceImpl, PrivilegeAbst, AclEntryImpl, RightsFactory_Facade.getEffectiveRightsForPair(), DisplayableLinkUtilities.getEffectiveRightsAndCommentOnRights(), subtractNegativeNotRemovingInOneACS(), subtractInOneSetInOneACS(), subtractNegativeHeadersNotRemovingInOneACS(). Calls getFirstIncreasingRightsChain().

Parameters:
_l_updatedRights - metarights and acsrights to filter, which may be granting or denying ones. Not null and no null item. Is updated by this method.
Throws:
BaseError - if an item is null in the argument, if there are more than 20 increasing chains to analyze from the lesser right

withAssociatedDirectoryRight

public final boolean withAssociatedDirectoryRight(StringRight _right)
Tests if the metaright of the argument is 'goto', 'read', 'write' or 'execute'. Called by subtractNotRemovingCommonLowerNodes().

Parameters:
_right - acsright or metaright to analyze
Returns:
true only if _right metaright is 'read', 'write' or 'execute'.

withExecuteRight

public final boolean withExecuteRight(StringRight[] _l_rights,
                                      boolean _forNode)
Detects the rights which are directly or indirectly linked to the metaright 'execute', as 'read & execute' for instance. If the argument contains some negative rights, this method subtracts them to the positive rights. Called by ACSImpl, ActorImpl, AclRightsFactoryImpl and CompoundRightsFactoryImpl. Calls subtractInOneSetInOneACS() and getFirstIncreasingRightsChain().

Parameters:
_l_rights - to analyze. May be null or empty.
_forNode - true if these rights are for a node, and so the 'directory' rights are not removed
Returns:
true only if the rights contain an 'execute' right

withDenyExecuteRight

public final boolean withDenyExecuteRight(StringRight[] _l_rights)
Detects the rights which are directly or indirectly linked to the metaright 'deny_execute'. Calls getFirstIncreasingRightsChain() and BaseManagerImpl.getInstance().getMetaRight().

Parameters:
_l_rights - to analyze
Returns:
true only if the rights contain one 'deny_execute' right, or contain a right to modify the current rights for having a deny_execution right.

withDirectExecuteRight

public final boolean withDirectExecuteRight(StringRight[] _l_rights)
Detects the rights which are directly linked to the metaright 'execute', as 'read & execute' for instance. False if it contains '|modify_security_descriptor|', since it is an indirect access to the 'execute' right. Calls getFirstIncreasingRightsChain() and BaseManagerImpl.getInstance().getMetaRight().

Parameters:
_l_rights - to analyze
Returns:
true only if the argument contains an 'execute' right.

withInverseRight

public final StringRight withInverseRight(StringRight _right)
Detect the inverse right, if any, that it is defined, if _right is positive, as the negative right which as the same semantic and strenght. Use the pattern of name 'xxx' and 'deny_xxx'. 'goto' and 'deny_all' are not in this pattern, but they are handled too. But do not process 'full_controlchild' and 'full_controlnxchild', which are desactivated. For an acsright, the return value is the first right to be associated to the correct metaright. Called by subtractNegativeFromPositiveInOneACS().

Parameters:
_right - acsright or metaright to analyze
Returns:
the inverse right, or null.

subtractNegativeNotRemovingInOneACS

public final java.util.Set<StringRight> subtractNegativeNotRemovingInOneACS(java.util.Set<StringRight> _l_posRights,
                                                                            java.util.Set<StringRight> _l_negRights,
                                                                            ImmutableACS _acs,
                                                                            boolean _forNode)
Operates the reduction of each positive right by all the negative rights, afer a filtering of the headers for each sens. Each negative right is subtracted to each positive right, and the positive results, if any for each positive right, are put in the returned set. Each negative right and all its upper rights are removed in each positive right. For the lower rights, if a positive right (direct or indirect) lower right, say R, is also a negative right (direct or indirect) lower right, this common node R is put in the result. If a negative right is stronger than all positive rights, the returned set is empty, and the calling method could use _l_headNegRights as the resulting right set if necessary. If _acs is null, the result is not limited by the _acs rights set. Called by ResourceImpl/DirectoryImpl.setL_xxxRights(), their constructors to process the umasks, AclRightsFactoryImpl.getL_aclEntryRights(), DisplayableLinkUtilities.getDLinksFromNegativeACLPaths() and getEffectiveRightsAndComment(), substractNegativeFromPositiveRights(). Wrapper and caller of subtractNegativeHeadersNotRemovingInOneACS().

Parameters:
_l_posRights - positive rights in an HashSet. Not null and no null item. No update.
_l_negRights - negative rights in an HashSet. Not null and no null item. No update.
_acs - uses all the rights in the two right sets. May be null.
_forNode - true if these rights are for a Node (Directory or VirtualFolder): the 'directory' rights are not removed if applicable
Returns:
the set of positive rights are all headers, and are used by _acs if not null. May be empty, not null.
See Also:
selectHeaders(java.util.Set)

subtractInOneSetInOneACS

public final java.util.Set<StringRight> subtractInOneSetInOneACS(StringRight[] _l_right,
                                                                 ImmutableACS _acs,
                                                                 boolean _forNode)
Operates the reduction of each positive right by all the negative rights. Each negative right negRight is subtracted to each positive right, and the positive results, if any for each positive right posRight, are put in the returned set. All the upper rights of negRight are removed in each posRight. For the lower rights, this method processes in a different way than subtractNegativeFromPositiveInOneACS(): If a posRight (direct or indirect) lower right, say R, is also a negRight (direct or indirect) lower right, the common node R IS applicable, and then posRight too. If a negative right is stronger than all positive rights, the returned set is empty, and the calling method could use _l_headNegRights as the resulting right set if necessary. If _acs is null, the result is not limited by the _acs rights set. Called by withExecuteRight(). Calls subtractNegativeHeadersNotRemovingInOneACS().

Parameters:
_l_right - rights array not null nor empty.
_acs - uses all the rights in the two right sets. May be null.
_forNode - true if these rights are for a node, and so the 'directory' rights are not removed
Returns:
the set of positive rights are all headers, and are used by _acs if not null. May be empty, not null.
See Also:
selectHeaders(java.util.Set)

subtractNegativeHeadersNotRemovingInOneACS

public final java.util.Set<StringRight> subtractNegativeHeadersNotRemovingInOneACS(java.util.Set _l_headPosRights,
                                                                                   java.util.Set _l_headNegRights,
                                                                                   ImmutableACS _acs,
                                                                                   boolean _forNode)
Operates the reduction of each positive right by all the negative rights. Each negative right is subtracted to each positive right, and the positive results, if any for each positive right, are put in the returned set. Each negative right and all the upper rights are removed in each positive right. If a negative right is stronger than all positive rights, the returned set is empty, and the calling method could use _l_headNegRights as the resulting right set if necessary. For the lower rights, if a positive right (direct or indirect) lower right, say R, is also a negative right (direct or indirect) lower right, this common node R is put in the result. If _acs is null, the result is not limited by the _acs rights set.

Applies the ACS rules:

- 'AGO right: no denying rights'

- 'bridge right: no denying rights'

- 'sens metarule: ACS denyings are superior to ACS grantings (there are + and - operations), for each right type'

- 'right type order: default order: root, A in AGO, all other right types'

Uses the instance property l_to_retain_. Called by subtractNegativeNotRemovingInOneACS() and subtractInOneSetInOneACS(). Calls StringRightImpl.selectHeaders() and subtractNotRemovingCommonLowerNodes(), withInverseRight().

Parameters:
_l_headPosRights - positive rights with only headers. Not null and no null item. No update in this method, but the method may return it.
_l_headNegRights - negative rights with only headers. Not null and no null item. No update.
_acs - uses all the rights in the two right sets. May be null.
_forNode - true if these rights are for a node, and so the 'directory' rights are not removed
Returns:
the set of all-positive rights are all headers, and are used by _acs if not null. May be empty, not null.
See Also:
selectHeaders(java.util.Set)

separateRightsFromSens

public final java.util.Set<StringRight>[] separateRightsFromSens(StringRight[] _l_right)
UNUSED. Detect the positive and negative rights, and put them in two separate sets.

Parameters:
_l_right - array of acsrights or metarights to analyze
Returns:
two Set of StringRights: the positive ones at 0 and the negative ones at the index 1 of the returned array. Each set may be empty.

subtractDeleteRightsInOneACS

public final java.util.Set<StringRight> subtractDeleteRightsInOneACS(java.util.Set<StringRight> _l_posRights,
                                                                     ImmutableACS _acs,
                                                                     boolean _forNode)
UNUSED. Subtract the 4 'delete' lower rights from a set. Call subtractNegativeFromPositiveInOneACS(). Do not handle acs rights.

Parameters:
_l_posRights - positive metarights. Not null and no null item.
_acs - uses all the rights in the two right sets. May be null.
_forNode - true if these rights are for a node, and so the 'directory' rights are not removed
Returns:
the set of positive rights are all headers, and are used by _acs if not null. May be empty, not null.

getObjectTypeWithoutImmutable

public java.lang.String getObjectTypeWithoutImmutable(java.lang.String _type)
Returns the argument without the key word 'immutable ' at the start or the end of the string. Called by gWork.FactoryUtilities.isTargetForPrivilegeForType(), BasicImpl.setType(), ACSImpl.getEorL_PrivilegeForTypesForSource/Target(), ACSFactoryImpl.getL_MapKeysForTypePolicies(), most of the ACSObject classes and CPrivilegeUserImpl.

Parameters:
_type - of a BaseObject
Returns:
the type without 'immutable '; may be _type.

selectBeanInfo

public BeanInfoPattern selectBeanInfo(BaseObject _objectInBeamer)
Analyzes the BaseObject to select the right BeanInfo in gBase. Works for the generic gBase and the AcsAddon gBase packages. Called by the static initializer of the delete button in Gui1.BeamerManager, Gui1.BeamerManager.updateBeamerPane(), SimplePropertyEditor, CollectionPropertyEditor, ActionNewACSyst, ACSTree.createACSExplorer(), gWork.RightsMediatorImpl. Does not process the IS nodes in the nameISTree for their displaying in the GUI, since they are not BaseObjects. If the BaseObject is an interface, select the BeanInfo of the relevant implementation class if it exists. If the BaseObject is an array, selects the BeanInfo of the implementation class. Follows the names pattern in gBase to select the right BeanInfo. Throws an InternalError if the BeanInfo can't be found. Called in the generic access paths search by UtilityImpl.add/removeAddonInner/ParentPropertyChangeListener(), then may be called from a view worker thread. The other calls are from the main thread or the event dispatch thread.

Parameters:
_objectInBeamer - is the object to display in the beamer
Returns:
the BeanInfo of the object

getBeanInfoNameFromClass

public java.lang.String getBeanInfoNameFromClass(java.lang.String _text)
Get the name of the BeanInfo class from the operational class. Simply add 'BeanInfo' at the end of the 'gBase' package and at the end of the argument. For instance, with the 'ARoad0.gBase.ResourceImpl' argument, it returns the value 'ARoad0.gBaseBeanInfo.ResourceImplBeanInfo'. Works for the generic gBase and the ACS Addon gBase packages.

Parameters:
_text - a gBase class name
Returns:
the BeanInfo class name

getClassNameFromArrayOrInterface

public final java.lang.String getClassNameFromArrayOrInterface(java.util.Map<java.lang.String,java.lang.String[]> _m_vocabulary,
                                                               java.lang.String _text)
Gets the name of the operational class from the interface name, with 'Immutable' or not, as an array or not, following the pattern of packages and class names in Access Road.

Works for the generic gBase and for the AcsAddon gBase packages. For instance, with the '[LARoad0.gBaseInterface.ImmutableResource' argument, this method returns the value 'ARoad0.gBase.Resource'. Returns the argument if it is the name of a class. Follows the gBase pattern for classes and interface names, and the AcsAddon pattern. Searches in gBase from interfaces in gBaseInterface. Called by BeamerManager.getElementaryPropertyType(), BaseObjectHandler, DialogBox and most of the PropertyEditors. Calls ACSFactoryUtilityImpl.getEffectiveClassName().

Parameters:
_m_vocabulary - from getACSVocabularyFromArrayOrInterface(). Never null. For a class or an interface which is not managed in the AcsAddon framework, like for StringRight, this property has to be empty.
_text - an interface or a class name in a gBase or a gBaseInterface package. Never null.
Returns:
the class name, or null if _text is a generic interface like BaseObject or Node, if the _text cental word is not found in ACSFactoryUtilityImpl.L_ACS_GENERIC_CLASSES, or if the relevant AcsAddon class name does not start with 'ARoad0.AcsAddon.'

getACSVocabularyFromArrayOrInterface

public final java.util.Map<java.lang.String,java.lang.String[]> getACSVocabularyFromArrayOrInterface(java.lang.String _text)
Gets the map of the ACS vocabulary from the right ACSFactory, following the pattern of packages and class names in Access Road.

Works for the generic gBase and for the AcsAddon gBase packages. For instance, with the '[LARoad0.gBaseInterface.ImmutableResource' argument, this method returns the vocabulary from the constructor of ARoad0.gBase.ACSFactoryImpl. With 'ARoad0.AcsAddon.Accbee.Ubuntu.gBaseInterface.ResourceUbuntu' as parameter, this method returns the vocabulary from the constructor of ARoad0.AcsAddon.Accbee.Ubuntu.gBase.ACSFactoryUbuntuImpl. Follows the gBase pattern for class and interface names, and the AcsAddon pattern. Called by selectBeanInfo(), BaseUtilityImpl.getL_AcsRestrictedRights(), BaseObjectHandler, DialogBox and most of the PropertyEditors, often to be used with getClassNameFromArrayOrInterface().

Gets the ACSFactoryImpl empty constructor or one of its subclass constructor, to call getM_AcsVocabulary(). For a generic gBaseInterface that is not managed in the AcsAddon framework, returns always an empty map. These generic gBaseInterface interfaces are ACSObject, BaseObject, Leaf, Node, NameTree, NameISTree, Source, Target, DetailledName, StringRight, StringMetaRight. Only the two last interfaces have an implementation in the generic gBase package, and StringMetaRightImpl is not a subclass of StringRightImpl.

Parameters:
_text - an interface or a class name in a gBase or a gBaseInterface package, from the generic packages or from an AcsAddon package. Never null.
Returns:
the ACS vocabulary, or an empty map if it is not managed in the AcsAddon framework, or null if _text does not contain the word 'gBase', if the _text cental word is not found in ACSFactoryUtilityImpl.L_ACS_GENERIC_CLASSES, or if the relevant AcsAddon class name does not start with 'ARoad0.AcsAddon.'

getEffectiveClassName

public final java.lang.String getEffectiveClassName(java.util.Map _m_vocabulary,
                                                    java.lang.String _className)
Returns the name of the effective class to use. It may be a generic class from ARoad0.gBase, and the returned value is 'ARoad0.gBase._classNameImpl'. Or it may be a class from an AcsAddon, and the returned value is 'ARoad0.AcsAddon.xxxx.yyyy.gBase._classNameyyyyImpl' where 'xxxx' is the editor name and 'yyyy' is the AcsAddon package name.

In this second case, it may be an AcsAddon classic class that subclass and replace a generic gBase class, or it may be an extension class which is defined at the key ACSADDON_EXTENSION_CLASSES in the vocabulary map.

It is possible to replace a generic class, in a package named 'yyyy', by a classic class from a package 'zzzz'. On the other hand, this is not authorized for the extension classes, since they must be in the same AcsAddon gBase package. Furthermore, an extension class must be the subclass of a generic gBase class or of an AcsAddon classic class.

Called by getClassNameFromArrayOrInterface(), AssociateUtilityImpl, ACSFactoryImpl, ActionNewResource, ActionNewEligibleParty.

Parameters:
_m_vocabulary - from ACSRun.getM_AcsVocabulary() or getACSVocabularyFromArrayOrInterface(). For a class or an interface which is not managed in the AcsAddon framework, like for StringRight, this property has to be empty.
_className - one of the constants in L_CLASSIC_CLASS_KEYS, or an AcsAddon extension class which is described with the key ACSADDON_EXTENSION_CLASSES in _m_vocabulary, with the format _className/is/one_classic_class_name
Returns:
the effective class name. Null if it is a generic interface like BaseObject or Node, or if the AcsAddon class name does not start with 'ARoad0.AcsAddon.'

addAddonInnerPropertyChangeListener

public void addAddonInnerPropertyChangeListener(java.beans.PropertyChangeListener _listener,
                                                ACSObjectAddon _obj)
Registers for the specific events to listen, because these events should change the rights of an ACSObject in an ACS Addon. Then, 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 addAddonParentPropertyChangeListener()). Called by ARoad0.gBase.EPRViewInBaseImpl, NoThanViewInBaseImpl, gWork.RightsMediatorImpl. Calls changeAddonInnerPropertyChangeListener().

Parameters:
_listener - to register
_obj - the basic object for which some ACS events or ACSObject events have to be listened, to catch the changings in its rights. Noop if _obj is null, or if _obj is not from an AcsAddon ACS.

addAddonParentPropertyChangeListener

public void addAddonParentPropertyChangeListener(java.beans.PropertyChangeListener _listener,
                                                 ACSObject _obj)
Registers the specific events to listen on a Resource or a VirtualFolder, and its direct and indirect parents, because these events should change the rights of the Resource or VirtualFolder in an ACS Addon. Then, these events are listened to update the views which contain these ACSObjects. This method does not cover the inner properties of an ACSObject (see addAddonInnerPropertyChangeListener()). Called by ARoad0.gBase.EPRViewInBaseImpl, NoThanViewInBaseImpl, gWork.RightsMediatorImpl. Calls changeAddonParentPropertyChangeListener().

Parameters:
_listener - to register
_obj - the basic object of an AcsAddon ACS, for which some ACS events or ACSObject events have to be listened, to catch the changings in its rights. Noop if _obj is null, not a Resource or a VirtualFolder, or if _obj is not from an AcsAddon ACS.

removeAddonInnerPropertyChangeListener

public void removeAddonInnerPropertyChangeListener(java.beans.PropertyChangeListener _listener,
                                                   ACSObjectAddon _obj)
Unregisters for the specific events to listen, because these events should change the rights of an ACSObject in an ACS Addon. Then, these events are listened to update the views which contain these ACSObjects. This method does not cover the parent properties of a Resource or a VirtualFolder (see removeAddonParentPropertyChangeListener()). Called by ARoad0.gBase.EPRViewInBaseImpl, NoThanViewInBaseImpl, gWork.RightsMediatorImpl. Calls changeAddonInnerPropertyChangeListener().

Parameters:
_listener - to register
_obj - the basic object for which some ACS events or ACSObject events have to be listened, to catch the changings in its rights. Noop if _obj is null, or if _obj is not from an AcsAddon ACS.

removeAddonParentPropertyChangeListener

public void removeAddonParentPropertyChangeListener(java.beans.PropertyChangeListener _listener,
                                                    ACSObject _obj)
Unregisters the specific events to listen on a Resource or a VirtualFolder, and its direct and indirect parents, because these events should change the rights of the Resource or VirtualFolder in an ACS Addon. Then, these events are listened to update the views which contain these ACSObjects. This method does not cover the inner properties of an ACSObject (see removeAddonInnerPropertyChangeListener()). Called by ARoad0.gBase.EPRViewInBaseImpl, NoThanViewInBaseImpl, gWork.RightsMediatorImpl. Calls changeAddonParentPropertyChangeListener().

Parameters:
_listener - to register
_obj - the basic object for which some ACS events or ACSObject events have to be listened, to catch the changings in its rights. Noop if _obj is null, is not a Resource or a VirtualFolder, or if _obj is not from an AcsAddon ACS.

changeAddonInnerPropertyChangeListener

private final void changeAddonInnerPropertyChangeListener(java.beans.PropertyChangeListener _listener,
                                                          ACSObjectAddon _obj,
                                                          boolean _toAdd)
Registers or unregisters for the specific events to listen, because these events should change the rights of an ACSObject in an ACS Addon. Then, these events are listened to update the views which contain these ACSObjects. This method does not cover the parent properties of a Resource or a VirtualFolder (see addAddonParentPropertyChangeListener()). Called by add/removeAddonParentPropertyChangeListener(). Calls ACSObjectAddon.getAddonInnerPropertiesToListen() and selectBeanInfo().

Parameters:
_listener - to register
_obj - the basic object for which some ACS events or ACSObject events have to be listened, to catch the changings in its rights. Noop if _obj is null, or if _obj is not from an AcsAddon ACS.
_toAdd - true for adding the listeners, false to remove them
See Also:
ACSObjectAddon.getAddonInnerPropertiesToListen()

changeAddonParentPropertyChangeListener

private final void changeAddonParentPropertyChangeListener(java.beans.PropertyChangeListener _listener,
                                                           ACSObject _obj,
                                                           boolean _toAdd)
Registers or unregisters the specific events to listen on a Resource or a VirtualFolder, and its direct and indirect parents, because these events should change the rights of the Resource or VirtualFolder in an ACS Addon. Then, these events are listened to update the views which contain these ACSObjects. This method does not cover the inner properties of an ACSObject (see addAddonInnerPropertyChangeListener()). Called by add/removeAddonParentPropertyChangeListener(). Calls AcsAddon.getAddonParentPropertiesToListen().

Parameters:
_listener - to register
_obj - the basic object of an AcsAddon ACS, for which some ACS events or ACSObject events have to be listened, to catch the changings in its rights. Noop if _obj is null, not a Resource or a VirtualFolder, or if _obj is not from an AcsAddon ACS.
_toAdd - true for adding the listeners, false to remove them
See Also:
AcsAddon.getAddonParentPropertiesToListen()

getParentOrder

public final java.lang.String getParentOrder(ImmutableLeaf _leaf,
                                             ImmutableNode _node)
Gets the order of a node from a leaf. For instance, the direct parent of a leaf has the order '1', and its direct parent has the order '2', and so on. Called by CPrivilegeUserImpl.setM_TargetInheritedLinkedPRIRights(), resetInheritedPrivilegeRights() and ResourceImpl.resetInheritedAclEntryRights().

Parameters:
_leaf - is never null
_node - is never null. Cannot be _leaf.
Returns:
the parent order as String of a number. Returns '0' if _leaf has no parent, and '-1' if _node is not a direct or indirect parent of _leaf.

getBaseObject

public final BaseObject getBaseObject(ImmutableName _name)
Gets the BaseObject from the names of an open entity. It must be a metaright, an ACS right (which is not an ACSObject), an ACSObject or a ViewInBase. Open ACS and open views are looked for first, since an ACSObject should have the name of an ACS or a view. Thus, an ACSObject having the name of an ACS or view is undetectable. If a view or an ACS has the same name than an ACSObject, the view or the acs is returned without warning message. After the open ACS and the open view names, the method searches for among the metarights, then among the ACSObjects of each open ACS. Looking for the ACSObject over all the open ACS, but not in the closed ACS. Caution: a new ACS may have the name of an ACSObject in a closed ACS, and this is not checked. The ACSObjects in the open ACS are all checked. When the relevant closed ACS is opened, there is no more checking of the name doublons. During the search of objects from their names, the ACS is selected first.

Parameters:
_name - object name
Returns:
the object or null

finalizeForProcess

public void finalizeForProcess()
Finalizes the instance. Called by RightsMediatorImpl.finalizeForProcess(), but not for the first instance.