Package org.ametys.core.right
Class RightsExtensionPoint
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.core.right.RightsExtensionPoint
- All Implemented Interfaces:
ExtensionPoint<Right>
,Initializable
,Component
,LogEnabled
,ThreadSafe
public class RightsExtensionPoint
extends AbstractLogEnabled
implements ExtensionPoint<Right>, Initializable, ThreadSafe, Component
This extension point handle a list of rights handled by the plugins or the application.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addExtension
(String id, String pluginName, String pluginId, Configuration configuration) Add an extension to this point.void
addRight
(String id, I18nizableText labelKey, I18nizableText descriptionKey, I18nizableText categoryKey) Declare a new right as used.protected void
addRight
(String pluginName, Configuration configuration) Declare a new right (not as used)getExtension
(String id) Returns the named extensionReturns a Set containing the ids of all known extensionsboolean
hasExtension
(String id) Returns true if the named extension existsvoid
void
Finalize the initialization of the extensions.
This method is called after alladdExtension()
calls.
This is the last step before the actual startup of the application.void
removeRight
(String id) Remove a right from the list of used rightsvoid
toSAX
(ContentHandler handler) SAX all managed rightsMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The avalon role -
_rights
The map of rightId, Right of declared rights
-
-
Constructor Details
-
RightsExtensionPoint
public RightsExtensionPoint()
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
hasExtension
Description copied from interface:ExtensionPoint
Returns true if the named extension exists- Specified by:
hasExtension
in interfaceExtensionPoint<Right>
- Parameters:
id
- the unique id of the extension- Returns:
- true if the named extension exists
-
addExtension
public void addExtension(String id, String pluginName, String pluginId, Configuration configuration) throws ConfigurationException Description copied from interface:ExtensionPoint
Add an extension to this point. Each implementation knows the meaning of the given configuration.- Specified by:
addExtension
in interfaceExtensionPoint<Right>
- Parameters:
id
- the unique identifier of the extension.pluginName
- Unique identifier for the plugin hosting the extensionpluginId
- Unique feature identifier (unique for a given pluginName)configuration
- the information about the extension to be added- Throws:
ConfigurationException
- when a configuration problem occurs
-
addRight
protected void addRight(String pluginName, Configuration configuration) throws ConfigurationException Declare a new right (not as used)- Parameters:
pluginName
- The name of the plugin declaring the extensionconfiguration
- The configuration of the extension- Throws:
ConfigurationException
- if configuration if not complete
-
addRight
public void addRight(String id, I18nizableText labelKey, I18nizableText descriptionKey, I18nizableText categoryKey) throws IllegalArgumentException Declare a new right as used. Use this method to add a right programmatically.- Parameters:
id
- The id of the right (not null or empty)labelKey
- The label of the right (i18n key) (not null or empty)descriptionKey
- The description of the right (i18n key) (not null or empty)categoryKey
- The category of the right (i18n key) (not null or empty)- Throws:
IllegalArgumentException
- if the id is already declared
-
removeRight
Remove a right from the list of used rights- Parameters:
id
- id of the right to remove
-
getExtension
Description copied from interface:ExtensionPoint
Returns the named extension- Specified by:
getExtension
in interfaceExtensionPoint<Right>
- Parameters:
id
- the unique id of the extension- Returns:
- the named extension
-
getExtensionsIds
Description copied from interface:ExtensionPoint
Returns a Set containing the ids of all known extensions- Specified by:
getExtensionsIds
in interfaceExtensionPoint<Right>
- Returns:
- a Set containing the ids of all known extensions
-
initializeExtensions
Description copied from interface:ExtensionPoint
Finalize the initialization of the extensions.
This method is called after alladdExtension()
calls.
This is the last step before the actual startup of the application.- Specified by:
initializeExtensions
in interfaceExtensionPoint<Right>
- Throws:
Exception
- if something wrong occurs
-
toSAX
SAX all managed rights- Parameters:
handler
- the handler receiving SAX events- Throws:
SAXException
- if something wrong occurs
-