org.opends.server.extensions
Class UserDefinedVirtualAttributeProvider

java.lang.Object
  extended by org.opends.server.api.VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
      extended by 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
UserDefinedVirtualAttributeProvider()
          Creates a new instance of this member virtual attribute provider.
 
Method Summary
 ConfigChangeResult applyConfigurationChange(UserDefinedVirtualAttributeCfg configuration)
          Applies the configuration changes to this change listener.
 void finalizeVirtualAttributeProvider()
          Performs any finalization that may be necessary whenever this virtual attribute provider is taken out of service.
 java.util.LinkedHashSet<AttributeValue> getValues(Entry entry, VirtualAttributeRule rule)
          Generates a set of values for the provided entry.
 void initializeVirtualAttributeProvider(UserDefinedVirtualAttributeCfg configuration)
          Initializes this virtual attribute based on the information in the provided configuration entry.
 boolean isConfigurationChangeAcceptable(UserDefinedVirtualAttributeCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 boolean isMultiValued()
          Indicates whether this virtual attribute provider may generate multiple values.
 boolean isSearchable(VirtualAttributeRule rule, SearchOperation searchOperation)
          Indicates whether this attribute may be included in search filters as part of the criteria for locating entries.
 void processSearch(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, hasAnyValue, hasValue, hasValue, isConfigurationAcceptable, lessThanOrEqualTo, matchesSubstring
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDefinedVirtualAttributeProvider

public UserDefinedVirtualAttributeProvider()
Creates a new instance of this member virtual attribute provider.

Method Detail

initializeVirtualAttributeProvider

public void initializeVirtualAttributeProvider(UserDefinedVirtualAttributeCfg configuration)
                                        throws ConfigException,
                                               InitializationException
Initializes this virtual attribute based on the information in the provided configuration entry.

Specified by:
initializeVirtualAttributeProvider in class VirtualAttributeProvider<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()
Performs any finalization that may be necessary whenever this virtual attribute provider is taken out of service.

Overrides:
finalizeVirtualAttributeProvider in class VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>

isMultiValued

public boolean isMultiValued()
Indicates whether this virtual attribute provider may generate multiple values.

Specified by:
isMultiValued in class VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
Returns:
true if this virtual attribute provider may generate multiple values, or false if not.

getValues

public java.util.LinkedHashSet<AttributeValue> getValues(Entry entry,
                                                         VirtualAttributeRule rule)
Generates a set of values for the provided entry.

Specified by:
getValues in class VirtualAttributeProvider<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 set of values generated for the provided entry. It may be empty, but it must not be null.

isSearchable

public boolean isSearchable(VirtualAttributeRule rule,
                            SearchOperation searchOperation)
Indicates whether this attribute may be included in search filters as part of the criteria for locating entries.

Specified by:
isSearchable in class VirtualAttributeProvider<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.
Returns:
true if this attribute may be included in search filters, or false if not.

processSearch

public void processSearch(VirtualAttributeRule rule,
                          SearchOperation searchOperation)
Processes the provided search operation in which the search criteria includes an operation targeted at this virtual attribute. This method should only be called if isSearchable returns true and it is not possible to construct a manageable candidate list by processing other elements of the search criteria.

Specified by:
processSearch in class VirtualAttributeProvider<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,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<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 true if the proposed change is acceptable, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(UserDefinedVirtualAttributeCfg configuration)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<UserDefinedVirtualAttributeCfg>
Parameters:
configuration - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.