Package org.opends.server.extensions
Class UserDefinedVirtualAttributeProvider
- java.lang.Object
-
- org.opends.server.api.VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
-
- org.opends.server.extensions.UserDefinedVirtualAttributeProvider
-
- All Implemented Interfaces:
ConfigurationChangeListener<UserDefinedVirtualAttributeCfg>
public class UserDefinedVirtualAttributeProvider extends VirtualAttributeProvider<UserDefinedVirtualAttributeCfg> implements ConfigurationChangeListener<UserDefinedVirtualAttributeCfg>
This class implements a virtual attribute provider that allows administrators to define their own values that will be inserted into any entry that matches the criteria defined in the virtual attribute rule. This can be used to provide functionality like Class of Service (CoS) in the Sun Java System Directory Server.
-
-
Constructor Summary
Constructors Constructor Description UserDefinedVirtualAttributeProvider()Creates a new instance of this member virtual attribute provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(UserDefinedVirtualAttributeCfg configuration)Applies the configuration changes to this change listener.voidfinalizeVirtualAttributeProvider()Performs any finalization that may be necessary whenever this virtual attribute provider is taken out of service.AttributegetValues(Entry entry, VirtualAttributeRule rule)Generates an unmodifiable attribute with the values for the provided entry.voidinitializeVirtualAttributeProvider(UserDefinedVirtualAttributeCfg configuration)Initializes this virtual attribute based on the information in the provided configuration entry.booleanisConfigurationChangeAcceptable(UserDefinedVirtualAttributeCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.booleanisMultiValued()Indicates whether this virtual attribute provider may generate multiple values.booleanisSearchable(VirtualAttributeRule rule, SearchOperation searchOperation, boolean isPreIndexed)Indicates whether this attribute may be included in search filters as part of the criteria for locating entries.voidprocessSearch(VirtualAttributeRule rule, SearchOperation searchOperation)Processes the provided search operation in which the search criteria includes an operation targeted at this virtual attribute.-
Methods inherited from class org.opends.server.api.VirtualAttributeProvider
approximatelyEqualTo, greaterThanOrEqualTo, hasAllValues, hasValue, hasValue, isConfigurationAcceptable, lessThanOrEqualTo, matchesEqualityAssertion, matchesSubstring
-
-
-
-
Method Detail
-
initializeVirtualAttributeProvider
public void initializeVirtualAttributeProvider(UserDefinedVirtualAttributeCfg configuration) throws ConfigException, InitializationException
Description copied from class:VirtualAttributeProviderInitializes this virtual attribute based on the information in the provided configuration entry.- Overrides:
initializeVirtualAttributeProviderin classVirtualAttributeProvider<UserDefinedVirtualAttributeCfg>- Parameters:
configuration- The configuration to use to initialize this virtual attribute provider.- Throws:
ConfigException- If an unrecoverable problem arises in the process of performing the initialization.InitializationException- If a problem occurs during initialization that is not related to the server configuration.
-
finalizeVirtualAttributeProvider
public void finalizeVirtualAttributeProvider()
Description copied from class:VirtualAttributeProviderPerforms any finalization that may be necessary whenever this virtual attribute provider is taken out of service.- Overrides:
finalizeVirtualAttributeProviderin classVirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
-
isMultiValued
public boolean isMultiValued()
Description copied from class:VirtualAttributeProviderIndicates whether this virtual attribute provider may generate multiple values.- Specified by:
isMultiValuedin classVirtualAttributeProvider<UserDefinedVirtualAttributeCfg>- Returns:
trueif this virtual attribute provider may generate multiple values, orfalseif not.
-
getValues
public Attribute getValues(Entry entry, VirtualAttributeRule rule)
Description copied from class:VirtualAttributeProviderGenerates an unmodifiable attribute with the values for the provided entry.- Specified by:
getValuesin classVirtualAttributeProvider<UserDefinedVirtualAttributeCfg>- Parameters:
entry- The entry for which the values are to be generated.rule- The virtual attribute rule which defines the constraints for the virtual attribute.- Returns:
- The unmodifiable attribute with the values generated for the
provided entry. It may be empty, but it must not be
null.
-
isSearchable
public boolean isSearchable(VirtualAttributeRule rule, SearchOperation searchOperation, boolean isPreIndexed)
Description copied from class:VirtualAttributeProviderIndicates whether this attribute may be included in search filters as part of the criteria for locating entries.- Specified by:
isSearchablein classVirtualAttributeProvider<UserDefinedVirtualAttributeCfg>- Parameters:
rule- The virtual attribute rule which defines the constraints for the virtual attribute.searchOperation- The search operation for which to make the determination.isPreIndexed- Indicates if we expect the search on the virtual attribute to be faster than an index search.- Returns:
trueif this attribute may be included in search filters, orfalseif not.
-
processSearch
public void processSearch(VirtualAttributeRule rule, SearchOperation searchOperation)
Description copied from class:VirtualAttributeProviderProcesses the provided search operation in which the search criteria includes an operation targeted at this virtual attribute. This method should only be called ifisSearchablereturns true and it is not possible to construct a manageable candidate list by processing other elements of the search criteria.- Specified by:
processSearchin classVirtualAttributeProvider<UserDefinedVirtualAttributeCfg>- Parameters:
rule- The virtual attribute rule which defines the constraints for the virtual attribute.searchOperation- The search operation to be processed.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(UserDefinedVirtualAttributeCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein interfaceConfigurationChangeListener<UserDefinedVirtualAttributeCfg>- Parameters:
configuration- The new configuration containing the changes.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(UserDefinedVirtualAttributeCfg configuration)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<UserDefinedVirtualAttributeCfg>- Parameters:
configuration- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
-