org.opends.server.admin
Class AggregationPropertyDefinition<C extends ConfigurationClient,S extends Configuration>

java.lang.Object
  extended by org.opends.server.admin.PropertyDefinition<java.lang.String>
      extended by org.opends.server.admin.AggregationPropertyDefinition<C,S>
Type Parameters:
C - The type of client managed object configuration that this aggregation property definition refers to.
S - The type of server managed object configuration that this aggregation property definition refers to.
All Implemented Interfaces:
java.lang.Comparable<PropertyDefinition<?>>, java.util.Comparator<java.lang.String>

public final class AggregationPropertyDefinition<C extends ConfigurationClient,S extends Configuration>
extends PropertyDefinition<java.lang.String>

Aggregation property definition.

An aggregation property names one or more managed objects which are required by the managed object associated with this property. An aggregation property definition takes care to perform referential integrity checks: referenced managed objects cannot be deleted. Nor can an aggregation reference non-existent managed objects. Referential integrity checks are not performed during value validation. Instead they are performed when changes to the managed object are committed.

An aggregation property definition can optionally identify two properties:

In other words, these properties can be used to make sure that referenced managed objects are not disabled while they are referenced.


Nested Class Summary
static class AggregationPropertyDefinition.Builder<C extends ConfigurationClient,S extends Configuration>
          An interface for incrementally constructing aggregation property definitions.
 
Nested classes/interfaces inherited from class org.opends.server.admin.PropertyDefinition
PropertyDefinition.AbstractBuilder<T,D extends PropertyDefinition<T>>
 
Method Summary
<R,P> R
accept(PropertyDefinitionVisitor<R,P> v, P p)
          Apply a visitor to this property definition.
<R,P> R
accept(PropertyValueVisitor<R,P> v, java.lang.String value, P p)
          Apply a visitor to a property value associated with this property definition.
static
<C extends ConfigurationClient,S extends Configuration>
AggregationPropertyDefinition.Builder<C,S>
createBuilder(AbstractManagedObjectDefinition<?,?> d, java.lang.String propertyName)
          Creates an aggregation property definition builder.
 java.lang.String decodeValue(java.lang.String value)
          Parse and validate a string representation of a property value.
 DN getChildDN(java.lang.String name)
          Constructs a DN for a referenced managed object having the provided name.
 ManagedObjectPath<C,S> getChildPath(java.lang.String name)
          Constructs a managed object path for a referenced managed object having the provided name.
 ManagedObjectPath<?,?> getParentPath()
          Gets the name of the managed object which is the parent of the aggregated managed objects.
 InstantiableRelationDefinition<C,S> getRelationDefinition()
          Gets the relation in the parent managed object which contains the aggregated managed objects.
 Constraint getSourceConstraint()
          Gets the constraint which should be enforced on the aggregating managed object.
 Message getSourceConstraintSynopsis()
          Gets the optional constraint synopsis of this aggregation property definition in the default locale.
 Message getSourceConstraintSynopsis(java.util.Locale locale)
          Gets the optional constraint synopsis of this aggregation property definition in the specified locale.The constraint synopsis describes when and how referenced managed objects must be enabled.
 Condition getTargetIsEnabledCondition()
          Gets the condition which is used to determine if a referenced managed object is enabled.
 Condition getTargetNeedsEnablingCondition()
          Gets the condition which is used to determine whether or not referenced managed objects need to be enabled.
 void initialize()
          Performs any run-time initialization required by this property definition.
 java.lang.String normalizeValue(java.lang.String value)
          Get a normalized string representation of a property value.
 void toString(java.lang.StringBuilder builder)
          Append a string representation of the property definition to the provided string builder.
 void validateValue(java.lang.String value)
          Determine if the provided property value is valid according to this property definition.
 
Methods inherited from class org.opends.server.admin.PropertyDefinition
castValue, compare, compareTo, encodeValue, equals, getAdministratorAction, getDefaultBehaviorProvider, getDescription, getDescription, getManagedObjectDefinition, getName, getSynopsis, getSynopsis, hashCode, hasOption, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createBuilder

public static <C extends ConfigurationClient,S extends Configuration> AggregationPropertyDefinition.Builder<C,S> createBuilder(AbstractManagedObjectDefinition<?,?> d,
                                                                                                                               java.lang.String propertyName)
Creates an aggregation property definition builder.

Type Parameters:
C - The type of client managed object configuration that this aggregation property definition refers to.
S - The type of server managed object configuration that this aggregation property definition refers to.
Parameters:
d - The managed object definition associated with this property definition.
propertyName - The property name.
Returns:
Returns the new aggregation property definition builder.

accept

public <R,P> R accept(PropertyDefinitionVisitor<R,P> v,
                      P p)
Apply a visitor to this property definition.

Specified by:
accept in class PropertyDefinition<java.lang.String>
Type Parameters:
R - The return type of the visitor's methods.
P - The type of the additional parameters to the visitor's methods.
Parameters:
v - The property definition visitor.
p - Optional additional visitor parameter.
Returns:
Returns a result as specified by the visitor.

accept

public <R,P> R accept(PropertyValueVisitor<R,P> v,
                      java.lang.String value,
                      P p)
Apply a visitor to a property value associated with this property definition.

Specified by:
accept in class PropertyDefinition<java.lang.String>
Type Parameters:
R - The return type of the visitor's methods.
P - The type of the additional parameters to the visitor's methods.
Parameters:
v - The property value visitor.
value - The property value.
p - Optional additional visitor parameter.
Returns:
Returns a result as specified by the visitor.

decodeValue

public java.lang.String decodeValue(java.lang.String value)
                             throws IllegalPropertyValueStringException
Parse and validate a string representation of a property value.

Specified by:
decodeValue in class PropertyDefinition<java.lang.String>
Parameters:
value - The property string value (must not be null).
Returns:
Returns the decoded property value.
Throws:
IllegalPropertyValueStringException - If the property value string is invalid.

getChildDN

public final DN getChildDN(java.lang.String name)
Constructs a DN for a referenced managed object having the provided name. This method is implemented by first calling getChildPath(String) and then invoking ManagedObjectPath.toDN() on the returned path.

Parameters:
name - The name of the child managed object.
Returns:
Returns a DN for a referenced managed object having the provided name.

getChildPath

public final ManagedObjectPath<C,S> getChildPath(java.lang.String name)
Constructs a managed object path for a referenced managed object having the provided name.

Parameters:
name - The name of the child managed object.
Returns:
Returns a managed object path for a referenced managed object having the provided name.

getParentPath

public final ManagedObjectPath<?,?> getParentPath()
Gets the name of the managed object which is the parent of the aggregated managed objects.

Returns:
Returns the name of the managed object which is the parent of the aggregated managed objects.

getRelationDefinition

public final InstantiableRelationDefinition<C,S> getRelationDefinition()
Gets the relation in the parent managed object which contains the aggregated managed objects.

Returns:
Returns the relation in the parent managed object which contains the aggregated managed objects.

getSourceConstraint

public final Constraint getSourceConstraint()
Gets the constraint which should be enforced on the aggregating managed object.

Returns:
Returns the constraint which should be enforced on the aggregating managed object.

getSourceConstraintSynopsis

public final Message getSourceConstraintSynopsis()
Gets the optional constraint synopsis of this aggregation property definition in the default locale. The constraint synopsis describes when and how referenced managed objects must be enabled. When there are no constraints between the source managed object and the objects it references through this aggregation, null is returned.

Returns:
Returns the optional constraint synopsis of this aggregation property definition in the default locale, or null if there is no constraint synopsis.

getSourceConstraintSynopsis

public final Message getSourceConstraintSynopsis(java.util.Locale locale)
Gets the optional constraint synopsis of this aggregation property definition in the specified locale.The constraint synopsis describes when and how referenced managed objects must be enabled. When there are no constraints between the source managed object and the objects it references through this aggregation, null is returned.

Parameters:
locale - The locale.
Returns:
Returns the optional constraint synopsis of this aggregation property definition in the specified locale, or null if there is no constraint synopsis.

getTargetIsEnabledCondition

public final Condition getTargetIsEnabledCondition()
Gets the condition which is used to determine if a referenced managed object is enabled.

Returns:
Returns the condition which is used to determine if a referenced managed object is enabled.

getTargetNeedsEnablingCondition

public final Condition getTargetNeedsEnablingCondition()
Gets the condition which is used to determine whether or not referenced managed objects need to be enabled.

Returns:
Returns the condition which is used to determine whether or not referenced managed objects need to be enabled.

normalizeValue

public java.lang.String normalizeValue(java.lang.String value)
                                throws IllegalPropertyValueException
Get a normalized string representation of a property value. This can then be used for comparisons and for generating hash-codes.

This method may throw an exception if the provided value is invalid. However, applications should not assume that implementations of this method will always validate a value. This task is the responsibility of PropertyDefinition.validateValue(Object).

This default implementation simply returns the string representation of the provided value. Sub-classes might want to override this method if this behavior is insufficient (for example, a string property definition might strip white-space and convert characters to lower-case).

Overrides:
normalizeValue in class PropertyDefinition<java.lang.String>
Parameters:
value - The property value to be normalized.
Returns:
Returns the normalized property value.
Throws:
IllegalPropertyValueException - If the property value is invalid.

toString

public void toString(java.lang.StringBuilder builder)
Append a string representation of the property definition to the provided string builder.

This simple implementation just outputs the propertyName of the property definition. Sub-classes should override this method to provide more complete string representations.

Overrides:
toString in class PropertyDefinition<java.lang.String>
Parameters:
builder - The string builder where the string representation should be appended.

validateValue

public void validateValue(java.lang.String value)
                   throws IllegalPropertyValueException
Determine if the provided property value is valid according to this property definition.

Specified by:
validateValue in class PropertyDefinition<java.lang.String>
Parameters:
value - The property value (must not be null).
Throws:
IllegalPropertyValueException - If the property value is invalid.

initialize

public void initialize()
                throws java.lang.Exception
Performs any run-time initialization required by this property definition. This may include resolving managed object paths and property names.

Overrides:
initialize in class PropertyDefinition<java.lang.String>
Throws:
java.lang.Exception - If this property definition could not be initialized.