org.opends.server.schema
Class GeneralizedTimeSyntax

java.lang.Object
  extended by org.opends.server.api.AttributeSyntax<AttributeSyntaxCfg>
      extended by org.opends.server.schema.GeneralizedTimeSyntax

public class GeneralizedTimeSyntax
extends AttributeSyntax<AttributeSyntaxCfg>

This class defines the generalized time attribute syntax, which is a way of representing time in a form like "YYYYMMDDhhmmssZ". The actual form is somewhat flexible, and may omit the minute and second information, or may include sub-second information. It may also replace "Z" with a time zone offset like "-0500" for representing values that are not in UTC.


Constructor Summary
GeneralizedTimeSyntax()
          Creates a new instance of this syntax.
 
Method Summary
static AttributeValue createGeneralizedTimeValue(long time)
          Retrieves an attribute value containing a generalized time representation of the provided date.
static long decodeGeneralizedTimeValue(ByteString value)
          Decodes the provided normalized value as a generalized time value and retrieves a timestamp containing its representation.
static java.lang.String format(java.util.Date d)
          Retrieves the generalized time representation of the provided date.
static java.lang.String format(long t)
          Retrieves the generalized time representation of the provided date.
 ApproximateMatchingRule getApproximateMatchingRule()
          Retrieves the default approximate matching rule that will be used for attributes with this syntax.
 java.lang.String getDescription()
          Retrieves a description for this attribute syntax.
 EqualityMatchingRule getEqualityMatchingRule()
          Retrieves the default equality matching rule that will be used for attributes with this syntax.
 java.lang.String getOID()
          Retrieves the OID for this attribute syntax.
 OrderingMatchingRule getOrderingMatchingRule()
          Retrieves the default ordering matching rule that will be used for attributes with this syntax.
 SubstringMatchingRule getSubstringMatchingRule()
          Retrieves the default substring matching rule that will be used for attributes with this syntax.
 java.lang.String getSyntaxName()
          Retrieves the common name for this attribute syntax.
 void initializeSyntax(AttributeSyntaxCfg configuration)
          Initializes this attribute syntax based on the information in the provided configuration entry.
 boolean valueIsAcceptable(ByteString value, MessageBuilder invalidReason)
          Indicates whether the provided value is acceptable for use in an attribute with this syntax.
 
Methods inherited from class org.opends.server.api.AttributeSyntax
equals, finalizeSyntax, hashCode, isConfigurationAcceptable, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeneralizedTimeSyntax

public GeneralizedTimeSyntax()
Creates a new instance of this syntax. Note that the only thing that should be done here is to invoke the default constructor for the superclass. All initialization should be performed in the initializeSyntax method.

Method Detail

initializeSyntax

public void initializeSyntax(AttributeSyntaxCfg configuration)
                      throws ConfigException
Initializes this attribute syntax based on the information in the provided configuration entry.

Specified by:
initializeSyntax in class AttributeSyntax<AttributeSyntaxCfg>
Parameters:
configuration - The configuration to use to initialize this attribute syntax.
Throws:
ConfigException - If an unrecoverable problem arises in the process of performing the initialization.

getSyntaxName

public java.lang.String getSyntaxName()
Retrieves the common name for this attribute syntax.

Specified by:
getSyntaxName in class AttributeSyntax<AttributeSyntaxCfg>
Returns:
The common name for this attribute syntax.

getOID

public java.lang.String getOID()
Retrieves the OID for this attribute syntax.

Specified by:
getOID in class AttributeSyntax<AttributeSyntaxCfg>
Returns:
The OID for this attribute syntax.

getDescription

public java.lang.String getDescription()
Retrieves a description for this attribute syntax.

Specified by:
getDescription in class AttributeSyntax<AttributeSyntaxCfg>
Returns:
A description for this attribute syntax.

getEqualityMatchingRule

public EqualityMatchingRule getEqualityMatchingRule()
Retrieves the default equality matching rule that will be used for attributes with this syntax.

Specified by:
getEqualityMatchingRule in class AttributeSyntax<AttributeSyntaxCfg>
Returns:
The default equality matching rule that will be used for attributes with this syntax, or null if equality matches will not be allowed for this type by default.

getOrderingMatchingRule

public OrderingMatchingRule getOrderingMatchingRule()
Retrieves the default ordering matching rule that will be used for attributes with this syntax.

Specified by:
getOrderingMatchingRule in class AttributeSyntax<AttributeSyntaxCfg>
Returns:
The default ordering matching rule that will be used for attributes with this syntax, or null if ordering matches will not be allowed for this type by default.

getSubstringMatchingRule

public SubstringMatchingRule getSubstringMatchingRule()
Retrieves the default substring matching rule that will be used for attributes with this syntax.

Specified by:
getSubstringMatchingRule in class AttributeSyntax<AttributeSyntaxCfg>
Returns:
The default substring matching rule that will be used for attributes with this syntax, or null if substring matches will not be allowed for this type by default.

getApproximateMatchingRule

public ApproximateMatchingRule getApproximateMatchingRule()
Retrieves the default approximate matching rule that will be used for attributes with this syntax.

Specified by:
getApproximateMatchingRule in class AttributeSyntax<AttributeSyntaxCfg>
Returns:
The default approximate matching rule that will be used for attributes with this syntax, or null if approximate matches will not be allowed for this type by default.

valueIsAcceptable

public boolean valueIsAcceptable(ByteString value,
                                 MessageBuilder invalidReason)
Indicates whether the provided value is acceptable for use in an attribute with this syntax. If it is not, then the reason may be appended to the provided buffer.

Specified by:
valueIsAcceptable in class AttributeSyntax<AttributeSyntaxCfg>
Parameters:
value - The value for which to make the determination.
invalidReason - The buffer to which the invalid reason should be appended.
Returns:
true if the provided value is acceptable for use with this syntax, or false if not.

format

public static java.lang.String format(java.util.Date d)
Retrieves the generalized time representation of the provided date.

Parameters:
d - The date to retrieve in generalized time form.
Returns:
The generalized time representation of the provided date.

format

public static java.lang.String format(long t)
Retrieves the generalized time representation of the provided date.

Parameters:
t - The timestamp to retrieve in generalized time form.
Returns:
The generalized time representation of the provided date.

createGeneralizedTimeValue

public static AttributeValue createGeneralizedTimeValue(long time)
Retrieves an attribute value containing a generalized time representation of the provided date.

Parameters:
time - The time for which to retrieve the generalized time value.
Returns:
The attribute value created from the date.

decodeGeneralizedTimeValue

public static long decodeGeneralizedTimeValue(ByteString value)
                                       throws DirectoryException
Decodes the provided normalized value as a generalized time value and retrieves a timestamp containing its representation.

Parameters:
value - The normalized value to decode using the generalized time syntax.
Returns:
The timestamp created from the provided generalized time value.
Throws:
DirectoryException - If the provided value cannot be parsed as a valid generalized time string.