| | |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2009 D. J. Hagberg, Millibits Consulting, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | * Portions Copyright 2012-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.GregorianCalendar; |
| | |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines the generalized time attribute syntax, which is a way of |
| | | * representing time in a form like "YYYYMMDDhhmmssZ". The actual form is |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | // UTC TimeZone is assumed to never change over JVM lifetime |
| | | /** UTC TimeZone is assumed to never change over JVM lifetime. */ |
| | | private static final TimeZone TIME_ZONE_UTC_OBJ = |
| | | TimeZone.getTimeZone(TIME_ZONE_UTC); |
| | | |
| | | |
| | | |
| | | // The default equality matching rule for this syntax. |
| | | /** The default equality matching rule for this syntax. */ |
| | | private MatchingRule defaultEqualityMatchingRule; |
| | | |
| | | // The default ordering matching rule for this syntax. |
| | | /** The default ordering matching rule for this syntax. */ |
| | | private MatchingRule defaultOrderingMatchingRule; |
| | | |
| | | // The default substring matching rule for this syntax. |
| | | /** The default substring matching rule for this syntax. */ |
| | | private MatchingRule defaultSubstringMatchingRule; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeSyntax(AttributeSyntaxCfg configuration) |
| | | throws ConfigException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the common name for this attribute syntax. |
| | | * |
| | |
| | | return SYNTAX_GENERALIZED_TIME_NAME; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the OID for this attribute syntax. |
| | | * |
| | |
| | | return SYNTAX_GENERALIZED_TIME_OID; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a description for this attribute syntax. |
| | | * |
| | |
| | | return SYNTAX_GENERALIZED_TIME_DESCRIPTION; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default equality matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return defaultEqualityMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default ordering matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return defaultOrderingMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default substring matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return defaultSubstringMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default approximate matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the generalized time representation of the provided date. |
| | | * |
| | |
| | | return d == null ? null : format(d.getTime()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the generalized time representation of the provided date. |
| | | * |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an attribute value containing a generalized time representation |
| | | * of the provided date. |
| | |
| | | return ByteString.valueOf(format(time)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Decodes the provided normalized value as a generalized time value and |
| | | * retrieves a timestamp containing its representation. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Completes decoding the generalized time value containing a fractional |
| | | * component. It will also decode the trailing 'Z' or offset. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Decodes a time zone offset from the provided value. |
| | | * |
| | |
| | | return TimeZone.getTimeZone("GMT" + offSetStr); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isBEREncodingRequired() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |