directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r558464 - in /directory/shared/trunk: convert/ ldap-constants/ ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/ ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/ ldap/src/test/java/org/apache/directo...
Date Sun, 22 Jul 2007 07:16:33 GMT
Author: akarasulu
Date: Sun Jul 22 00:16:30 2007
New Revision: 558464

URL: http://svn.apache.org/viewvc?view=rev&rev=558464
Log:
changes ...

 o added some new syntax checkers for java data types: byte, int, short, char
 o added some constants to SchemaConstants for syntaxes
 o using constants in SchemaConstants in some syntax checkers instead of SC_OID
 o changed SchemaConstants into Interface to do away with public static finals



Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxCheckerTest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxCheckerTest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxCheckerTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxCheckerTest.java
Modified:
    directory/shared/trunk/convert/   (props changed)
    directory/shared/trunk/ldap-constants/   (props changed)
    directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BinarySyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BitStringSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/GeneralizedTimeSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/IntegerSyntaxChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/UtcTimeSyntaxChecker.java
    directory/shared/trunk/ldap/xdocs/index.xml

Propchange: directory/shared/trunk/convert/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jul 22 00:16:30 2007
@@ -1,4 +1,5 @@
 target
+*.iml
 .classpath
 .project
 .settings

Propchange: directory/shared/trunk/ldap-constants/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jul 22 00:16:30 2007
@@ -1,4 +1,5 @@
 .classpath
+*.iml
 .project
 target
 .settings

Modified: directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java (original)
+++ directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java Sun Jul 22 00:16:30 2007
@@ -27,224 +27,239 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev:$
  */
-public class SchemaConstants
+public interface SchemaConstants
 {
     // ---- ObjectClasses -----------------------------------------------------
     // Top
-    public static final String TOP_OC = "top";
-    public static final String TOP_OC_OID = "2.5.6.0";
+    String TOP_OC = "top";
+    String TOP_OC_OID = "2.5.6.0";
     
     // Alias
-    public static final String ALIAS_OC = "alias";
-    public static final String ALIAS_OC_OID = "2.5.6.1";
+    String ALIAS_OC = "alias";
+    String ALIAS_OC_OID = "2.5.6.1";
     
     // Country
-    public static final String COUNTRY_OC = "country";
-    public static final String COUNTRY_OC_OID = "2.5.6.2";
+    String COUNTRY_OC = "country";
+    String COUNTRY_OC_OID = "2.5.6.2";
 
     // Locality
-    public static final String LOCALITY_OC = "locality";
-    public static final String LOCALITY_OC_OID = "2.5.6.3";
+    String LOCALITY_OC = "locality";
+    String LOCALITY_OC_OID = "2.5.6.3";
 
     // Organization
-    public static final String ORGANIZATION_OC = "organization";
-    public static final String ORGANIZATION_OC_OID = "2.5.6.4";
+    String ORGANIZATION_OC = "organization";
+    String ORGANIZATION_OC_OID = "2.5.6.4";
 
     // OrganizationalUnit
-    public static final String ORGANIZATIONAL_UNIT_OC = "organizationalUnit";
-    public static final String ORGANIZATIONAL_UNIT_OC_OID = "2.5.6.5";
+    String ORGANIZATIONAL_UNIT_OC = "organizationalUnit";
+    String ORGANIZATIONAL_UNIT_OC_OID = "2.5.6.5";
 
     // Person
-    public static final String PERSON_OC = "person";
-    public static final String PERSON_OC_OID = "2.5.6.6";
+    String PERSON_OC = "person";
+    String PERSON_OC_OID = "2.5.6.6";
     
     // OrganizationalPerson
-    public static final String ORGANIZATIONAL_PERSON_OC = "organizationalPerson";
-    public static final String ORGANIZATIONAL_PERSON_OC_OID = "2.5.6.7";
+    String ORGANIZATIONAL_PERSON_OC = "organizationalPerson";
+    String ORGANIZATIONAL_PERSON_OC_OID = "2.5.6.7";
 
     // OrganizationalRole
-    public static final String ORGANIZATIONAL_ROLE_OC = "organizationalRole";
-    public static final String ORGANIZATIONAL_ROLE_OC_OID = "2.5.6.8";
+    String ORGANIZATIONAL_ROLE_OC = "organizationalRole";
+    String ORGANIZATIONAL_ROLE_OC_OID = "2.5.6.8";
 
     // GroupOfNames
-    public static final String GROUP_OF_NAMES_OC = "groupOfNames";
-    public static final String GROUP_OF_NAMES_OC_OID = "2.5.6.9";
+    String GROUP_OF_NAMES_OC = "groupOfNames";
+    String GROUP_OF_NAMES_OC_OID = "2.5.6.9";
     
     // ResidentialPerson
-    public static final String RESIDENTIAL_PERSON_OC = "residentialPerson";
-    public static final String RESIDENTIAL_PERSON_OC_OID = "2.5.6.10";
+    String RESIDENTIAL_PERSON_OC = "residentialPerson";
+    String RESIDENTIAL_PERSON_OC_OID = "2.5.6.10";
     
     // GroupOfUniqueNames
-    public static final String GROUP_OF_UNIQUE_NAMES_OC = "groupOfUniqueNames";
-    public static final String GROUP_OF_UNIQUE_NAMES_OC_OID = "2.5.6.17";
+    String GROUP_OF_UNIQUE_NAMES_OC = "groupOfUniqueNames";
+    String GROUP_OF_UNIQUE_NAMES_OC_OID = "2.5.6.17";
     
     // Subentry
-    public static final String SUBENTRY_OC = "subentry";
-    public static final String SUBENTRY_OC_OID = "2.5.17.0";
+    String SUBENTRY_OC = "subentry";
+    String SUBENTRY_OC_OID = "2.5.17.0";
     
     // AccessControlSubentry
-    public static final String ACCESS_CONTROL_SUBENTRY_OC = "accessControlSubentry";    
-    public static final String ACCESS_CONTROL_SUBENTRY_OC_OID = "2.5.17.1";    
+    String ACCESS_CONTROL_SUBENTRY_OC = "accessControlSubentry";
+    String ACCESS_CONTROL_SUBENTRY_OC_OID = "2.5.17.1";
     
     // Subschema
-    public static final String SUBSCHEMA_OC = "subschema";
-    public static final String SUBSCHEMA_OC_OID = "2.5.20.1";
+    String SUBSCHEMA_OC = "subschema";
+    String SUBSCHEMA_OC_OID = "2.5.20.1";
     
     // InetOrgPerson
-    public static final String INET_ORG_PERSON_OC = "inetOrgPerson";
-    public static final String INET_ORG_PERSON_OC_OID = "2.16.840.1.113730.3.2.2";
+    String INET_ORG_PERSON_OC = "inetOrgPerson";
+    String INET_ORG_PERSON_OC_OID = "2.16.840.1.113730.3.2.2";
     
 
     // ExtensibleObject
-    public static final String EXTENSIBLE_OBJECT_OC = "extensibleObject";
-    public static final String EXTENSIBLE_OBJECT_OC_OID = "1.3.6.1.4.1.1466.101.120.111";
+    String EXTENSIBLE_OBJECT_OC = "extensibleObject";
+    String EXTENSIBLE_OBJECT_OC_OID = "1.3.6.1.4.1.1466.101.120.111";
 
     // ---- AttributeTypes ----------------------------------------------------
     // ObjectClass
-    public static final String OBJECT_CLASS_AT = "objectClass";
-    public static final String OBJECT_CLASS_AT_OID = "2.5.4.0";
+    String OBJECT_CLASS_AT = "objectClass";
+    String OBJECT_CLASS_AT_OID = "2.5.4.0";
     
     // AliasedObjectName
-    public static final String ALIASED_OBJECT_NAME_AT = "aliasedObjectName";
-    public static final String ALIASED_OBJECT_NAME_AT_OID = "2.5.4.1";
+    String ALIASED_OBJECT_NAME_AT = "aliasedObjectName";
+    String ALIASED_OBJECT_NAME_AT_OID = "2.5.4.1";
     
     // Cn
-    public static final String CN_AT = "cn";
-    public static final String COMMON_NAME_AT = "commonName";
-    public static final String CN_AT_OID = "2.5.4.3";
+    String CN_AT = "cn";
+    String COMMON_NAME_AT = "commonName";
+    String CN_AT_OID = "2.5.4.3";
     
     // Sn
-    public static final String SN_AT = "sn";
-    public static final String SURNAME_AT = "surname";
-    public static final String SN_AT_OID = "2.5.4.4";
+    String SN_AT = "sn";
+    String SURNAME_AT = "surname";
+    String SN_AT_OID = "2.5.4.4";
     
     // Ou
-    public static final String OU_AT = "ou";
-    public static final String ORGANIZATIONAL_UNIT_NAME_AT = "organizationalUnitName";
-    public static final String OU_AT_OID = "2.5.4.11";
+    String OU_AT = "ou";
+    String ORGANIZATIONAL_UNIT_NAME_AT = "organizationalUnitName";
+    String OU_AT_OID = "2.5.4.11";
     
     // Member
-    public static final String MEMBER_AT = "member";
-    public static final String MEMBER_AT_OID = "2.5.4.31";
+    String MEMBER_AT = "member";
+    String MEMBER_AT_OID = "2.5.4.31";
 
     // UserPassword
-    public static final String USER_PASSWORD_AT = "userPassword";
-    public static final String USER_PASSWORD_AT_OID = "2.5.4.35";
+    String USER_PASSWORD_AT = "userPassword";
+    String USER_PASSWORD_AT_OID = "2.5.4.35";
 
     // UniqueMember
-    public static final String UNIQUE_MEMBER_AT = "uniqueMember";
-    public static final String UNIQUE_MEMBER_AT_OID = "2.5.4.50";
+    String UNIQUE_MEMBER_AT = "uniqueMember";
+    String UNIQUE_MEMBER_AT_OID = "2.5.4.50";
 
     // CreateTimestamp
-    public static final String CREATE_TIMESTAMP_AT = "createTimestamp";
-    public static final String CREATE_TIMESTAMP_AT_OID = "2.5.18.1";
+    String CREATE_TIMESTAMP_AT = "createTimestamp";
+    String CREATE_TIMESTAMP_AT_OID = "2.5.18.1";
     
     // ModifyTimestamp
-    public static final String MODIFY_TIMESTAMP_AT = "modifyTimestamp";
-    public static final String MODIFY_TIMESTAMP_AT_OID = "2.5.18.2";
+    String MODIFY_TIMESTAMP_AT = "modifyTimestamp";
+    String MODIFY_TIMESTAMP_AT_OID = "2.5.18.2";
     
     // CreatorsName
-    public static final String CREATORS_NAME_AT = "creatorsName";
-    public static final String CREATORS_NAME_AT_OID = "2.5.18.3";
+    String CREATORS_NAME_AT = "creatorsName";
+    String CREATORS_NAME_AT_OID = "2.5.18.3";
     
     // ModifiersName
-    public static final String MODIFIERS_NAME_AT = "modifiersName";
-    public static final String MODIFIERS_NAME_AT_OID = "2.5.18.4";
+    String MODIFIERS_NAME_AT = "modifiersName";
+    String MODIFIERS_NAME_AT_OID = "2.5.18.4";
     
     // SubtreeSpecification
-    public static final String SUBTREE_SPECIFICATION_AT = "subtreeSpecification";
-    public static final String SUBTREE_SPECIFICATION_AT_OID = "2.5.18.6";
+    String SUBTREE_SPECIFICATION_AT = "subtreeSpecification";
+    String SUBTREE_SPECIFICATION_AT_OID = "2.5.18.6";
 
     // SubschemaSubentry
-    public static final String SUBSCHEMA_SUBENTRY_AT = "subschemaSubentry";
-    public static final String SUBSCHEMA_SUBENTRY_AT_OID = "2.5.18.10";
+    String SUBSCHEMA_SUBENTRY_AT = "subschemaSubentry";
+    String SUBSCHEMA_SUBENTRY_AT_OID = "2.5.18.10";
 
     // CollectiveAttributeSubentries
-    public static final String COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = "collectiveAttributeSubentries";
-    public static final String COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT_OID = "2.5.18.12";
+    String COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = "collectiveAttributeSubentries";
+    String COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT_OID = "2.5.18.12";
 
     // DitStructureRules
-    public static final String DIT_STRUCTURE_RULES_AT = "ditStructureRules";
-    public static final String DIT_STRUCTURE_RULES_AT_OID = "2.5.21.1";
+    String DIT_STRUCTURE_RULES_AT = "ditStructureRules";
+    String DIT_STRUCTURE_RULES_AT_OID = "2.5.21.1";
     
     // DitContentRules
-    public static final String DIT_CONTENT_RULES_AT = "ditContentRules";
-    public static final String DIT_CONTENT_RULES_AT_OID = "2.5.21.2";
+    String DIT_CONTENT_RULES_AT = "ditContentRules";
+    String DIT_CONTENT_RULES_AT_OID = "2.5.21.2";
     
     // MatchingRules
-    public static final String MATCHING_RULES_AT = "matchingRules";
-    public static final String MATCHING_RULES_AT_OID = "2.5.21.4";
+    String MATCHING_RULES_AT = "matchingRules";
+    String MATCHING_RULES_AT_OID = "2.5.21.4";
     
     // AttributeTypes
-    public static final String ATTRIBUTE_TYPES_AT = "attributeTypes";
-    public static final String ATTRIBUTE_TYPES_AT_OID = "2.5.21.5";
+    String ATTRIBUTE_TYPES_AT = "attributeTypes";
+    String ATTRIBUTE_TYPES_AT_OID = "2.5.21.5";
     
     // ObjectClasses
-    public static final String OBJECT_CLASSES_AT = "objectClasses";
-    public static final String OBJECT_CLASSES_AT_OID = "2.5.21.6";
+    String OBJECT_CLASSES_AT = "objectClasses";
+    String OBJECT_CLASSES_AT_OID = "2.5.21.6";
 
     // NameForms
-    public static final String NAME_FORMS_AT = "nameForms";
-    public static final String NAME_FORMS_AT_OID = "2.5.21.7";
+    String NAME_FORMS_AT = "nameForms";
+    String NAME_FORMS_AT_OID = "2.5.21.7";
 
     // MatchingRuleUse
-    public static final String MATCHING_RULE_USE_AT = "matchingRuleUse";
-    public static final String MATCHING_RULE_USE_AT_OID = "2.5.21.8";
+    String MATCHING_RULE_USE_AT = "matchingRuleUse";
+    String MATCHING_RULE_USE_AT_OID = "2.5.21.8";
     
     // StructuralObjectClass
-    public static final String STRUCTURAL_OBJECT_CLASS_AT = "structuralObjectClass";
-    public static final String STRUCTURAL_OBJECT_CLASS_AT_OID = "2.5.21.9";
+    String STRUCTURAL_OBJECT_CLASS_AT = "structuralObjectClass";
+    String STRUCTURAL_OBJECT_CLASS_AT_OID = "2.5.21.9";
     
     // AccessControlScheme
-    public static final String ACCESS_CONTROL_SCHEME_AT = "accessControlScheme";
-    public static final String ACCESS_CONTROL_SCHEME_OID = "2.5.24.1";
+    String ACCESS_CONTROL_SCHEME_AT = "accessControlScheme";
+    String ACCESS_CONTROL_SCHEME_OID = "2.5.24.1";
     
     // PrescriptiveACI
-    public static final String PRESCRIPTIVE_ACI_AT = "prescriptiveACI";
-    public static final String PRESCRIPTIVE_ACI_AT_OID = "2.5.24.4";
+    String PRESCRIPTIVE_ACI_AT = "prescriptiveACI";
+    String PRESCRIPTIVE_ACI_AT_OID = "2.5.24.4";
     
     // EntryACI
-    public static final String ENTRY_ACI_AT = "entryACI";
-    public static final String ENTRY_ACI_AT_OID = "2.5.24.5";
+    String ENTRY_ACI_AT = "entryACI";
+    String ENTRY_ACI_AT_OID = "2.5.24.5";
     
     // SubentryACI
-    public static final String SUBENTRY_ACI_AT = "subentryACI";
-    public static final String SUBENTRY_ACI_AT_OID = "2.5.24.6";
+    String SUBENTRY_ACI_AT = "subentryACI";
+    String SUBENTRY_ACI_AT_OID = "2.5.24.6";
     
     // Uid
-    public static final String UID_AT = "uid";
-    public static final String USER_ID_AT = "userid";
-    public static final String UID_AT_OID = "0.9.2342.19200300.100.1.1";
+    String UID_AT = "uid";
+    String USER_ID_AT = "userid";
+    String UID_AT_OID = "0.9.2342.19200300.100.1.1";
 
     // UidObject
-    public static final String UID_OBJECT_AT = "uidObject";
-    public static final String UID_OBJECT_AT_OID = "1.3.6.1.1.3.1";
+    String UID_OBJECT_AT = "uidObject";
+    String UID_OBJECT_AT_OID = "1.3.6.1.1.3.1";
 
     // LdapSyntaxes
-    public static final String LDAP_SYNTAXES_AT = "ldapSyntaxes";
-    public static final String LDAP_SYNTAXES_AT_OID = "1.3.6.1.4.1.1466.101.120.16";
+    String LDAP_SYNTAXES_AT = "ldapSyntaxes";
+    String LDAP_SYNTAXES_AT_OID = "1.3.6.1.4.1.1466.101.120.16";
 
     // AccessControlSubentries
-    public static final String ACCESS_CONTROL_SUBENTRIES_AT = "accessControlSubentries";
-    public static final String ACCESS_CONTROL_SUBENTRIES_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.11";
+    String ACCESS_CONTROL_SUBENTRIES_AT = "accessControlSubentries";
+    String ACCESS_CONTROL_SUBENTRIES_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.11";
 
     // TriggerExecutionSubentries
-    public static final String TRIGGER_EXECUTION_SUBENTRIES_AT = "triggerExecutionSubentries";
-    public static final String TRIGGER_EXECUTION_SUBENTRIES_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.27";
+    String TRIGGER_EXECUTION_SUBENTRIES_AT = "triggerExecutionSubentries";
+    String TRIGGER_EXECUTION_SUBENTRIES_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.27";
 
     // Comparators
-    public static final String COMPARATORS_AT = "comparators";
-    public static final String COMPARATORS_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.32";
+    String COMPARATORS_AT = "comparators";
+    String COMPARATORS_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.32";
     
     // Normalizers
-    public static final String NORMALIZERS_AT = "normalizers";
-    public static final String NORMALIZERS_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.33";
+    String NORMALIZERS_AT = "normalizers";
+    String NORMALIZERS_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.33";
 
     // SyntaxCheckers
-    public static final String SYNTAX_CHECKERS_AT = "syntaxCheckers";
-    public static final String SYNTAX_CHECKERS_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.34";
+    String SYNTAX_CHECKERS_AT = "syntaxCheckers";
+    String SYNTAX_CHECKERS_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.34";
 
     // DisplayName
-    public static final String DISPLAY_NAME_AT = "displayName";
-    public static final String DISPLAY_NAME_AT_OID = "2.16.840.1.113730.3.1.241";
+    String DISPLAY_NAME_AT = "displayName";
+    String DISPLAY_NAME_AT_OID = "2.16.840.1.113730.3.1.241";
+
+    // ---- Syntaxes -----------------------------------------------------
+
+    String BINARY_SYNTAX = "1.3.6.1.4.1.1466.115.121.1.5";
+    String BIT_STRING_SYNTAX = "1.3.6.1.4.1.1466.115.121.1.6";
+    String BOOLEAN_SYNTAX = "1.3.6.1.4.1.1466.115.121.1.7";
+    String GENERALIZED_TIME_SYNTAX = "1.3.6.1.4.1.1466.115.121.1.24";
+    String INTEGER_SYNTAX = "1.3.6.1.4.1.1466.115.121.1.27";
+    String UTC_TIME_SYNTAX = "1.3.6.1.4.1.1466.115.121.1.53";
+
+    String JAVA_BYTE_SYNTAX = "1.3.6.1.4.1.18060.0.4.1.0.0";
+    String JAVA_CHAR_SYNTAX = "1.3.6.1.4.1.18060.0.4.1.0.1";
+    String JAVA_SHORT_SYNTAX = "1.3.6.1.4.1.18060.0.4.1.0.2";
+    String JAVA_LONG_SYNTAX = "1.3.6.1.4.1.18060.0.4.1.0.3";
+    String JAVA_INT_SYNTAX = "1.3.6.1.4.1.18060.0.4.1.0.4";
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java Sun Jul 22 00:16:30 2007
@@ -92,4 +92,20 @@
         extensions.put( key, values );
     }
 
+
+    public int hashCode()
+    {
+        return numericOid.hashCode();
+    }
+
+
+    public boolean equals( Object obj )
+    {
+        if ( ! ( obj instanceof AbstractSchemaDescription ) )
+        {
+            return false;
+        }
+
+        return ( ( AbstractSchemaDescription ) obj ).numericOid.equals( numericOid );
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BinarySyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BinarySyntaxChecker.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BinarySyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BinarySyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.shared.ldap.schema.syntax;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+
 
 /**
  * A binary value (universal value acceptor) syntax checker.
@@ -29,8 +31,6 @@
 public class BinarySyntaxChecker extends AbstractSyntaxChecker
 {
     /** the Apache assigned internal OID for this syntax checker */
-    private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.5";
-
     public static final SyntaxChecker INSTANCE = new BinarySyntaxChecker();
 
 
@@ -39,7 +39,7 @@
      */
     public BinarySyntaxChecker()
     {
-        super( SC_OID );
+        super( SchemaConstants.BINARY_SYNTAX );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BitStringSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BitStringSyntaxChecker.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BitStringSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BitStringSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 
 
 /**
@@ -38,9 +39,6 @@
  */
 public class BitStringSyntaxChecker extends AbstractSyntaxChecker
 {
-    /** The Syntax OID, according to RFC 4517, par. 3.3.2 */
-    private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.6";
-    
     /**
      * 
      * Creates a new instance of BitStringSyntaxChecker.
@@ -48,7 +46,7 @@
      */
     public BitStringSyntaxChecker()
     {
-        super( SC_OID );
+        super( SchemaConstants.BIT_STRING_SYNTAX );
     }
     
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/BooleanSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 
 
 /**
@@ -36,9 +37,6 @@
  */
 public class BooleanSyntaxChecker extends AbstractSyntaxChecker
 {
-    /** The Syntax OID, according to RFC 4517, par. 3.3.3 */
-    private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.7";
-    
     /**
      * 
      * Creates a new instance of BooleanSyntaxChecker.
@@ -46,7 +44,7 @@
      */
     public BooleanSyntaxChecker()
     {
-        super( SC_OID );
+        super( SchemaConstants.BOOLEAN_SYNTAX );
     }
     
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/GeneralizedTimeSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/GeneralizedTimeSyntaxChecker.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/GeneralizedTimeSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/GeneralizedTimeSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -23,6 +23,7 @@
 import java.util.regex.Pattern;
 
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 
 
 /**
@@ -66,9 +67,6 @@
  */
 public class GeneralizedTimeSyntaxChecker extends AbstractSyntaxChecker
 {
-    /** The Syntax OID, according to RFC 4517, par. 3.3.13 */
-    private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.24";
-    
     /** The GeneralizedDate pattern matching */
     private static final String GENERALIZED_TIME_PATTERN = 
                 "^\\d{4}" +                                 // century + year : 0000 to 9999
@@ -92,7 +90,7 @@
      */
     public GeneralizedTimeSyntaxChecker()
     {
-        super( SC_OID );
+        super( SchemaConstants.GENERALIZED_TIME_SYNTAX );
     }
     
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/IntegerSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/IntegerSyntaxChecker.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/IntegerSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/IntegerSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 
 
 /**
@@ -42,9 +43,6 @@
  */
 public class IntegerSyntaxChecker extends AbstractSyntaxChecker
 {
-    /** The Syntax OID, according to RFC 4517, par. 3.3.16 */
-    private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.27";
-    
     /**
      * 
      * Creates a new instance of IntegerSyntaxChecker.
@@ -52,7 +50,7 @@
      */
     public IntegerSyntaxChecker()
     {
-        super( SC_OID );
+        super( SchemaConstants.INTEGER_SYNTAX );
     }
     
     

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxChecker.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxChecker.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,159 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+/**
+ * A SyntaxChecker which verifies that a value is a valid Java primitive short or
+ * the Short wrapper.  Essentially this constrains the min and max values of
+ * the Integer.
+ *
+ * From RFC 4517 :
+ *
+ * Integer = ( HYPHEN LDIGIT *DIGIT ) | number
+ *
+ * From RFC 4512 :
+ * number  = DIGIT | ( LDIGIT 1*DIGIT )
+ * DIGIT   = %x30 | LDIGIT       ; "0"-"9"
+ * LDIGIT  = %x31-39             ; "1"-"9"
+ * HYPHEN  = %x2D                ; hyphen ("-")
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaByteSyntaxChecker extends AbstractSyntaxChecker
+{
+    /**
+     *
+     * Creates a new instance of JavaByteSyntaxChecker.
+     *
+     */
+    public JavaByteSyntaxChecker()
+    {
+        super( SchemaConstants.JAVA_BYTE_SYNTAX );
+    }
+
+
+    /**
+     *
+     * Creates a new instance of JavaByteSyntaxChecker.
+     *
+     * @param oid the oid to associate with this new SyntaxChecker
+     *
+     */
+    protected JavaByteSyntaxChecker( String oid )
+    {
+        super( oid );
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#isValidSyntax(java.lang.Object)
+     */
+    public boolean isValidSyntax( Object value )
+    {
+        String strValue;
+
+        if ( value == null )
+        {
+            return false;
+        }
+
+        if ( value instanceof String )
+        {
+            strValue = ( String ) value;
+        }
+        else if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value );
+        }
+        else
+        {
+            strValue = value.toString();
+        }
+
+        if ( strValue.length() == 0 )
+        {
+            return false;
+        }
+
+        // The first char must be either a '-' or in [0..9].
+        // If it's a '0', then there should be any other char after
+        int pos = 0;
+        char c = strValue.charAt( pos );
+
+        if ( c == '-' )
+        {
+            pos = 1;
+        }
+        else if ( !StringTools.isDigit( c ) )
+        {
+            return false;
+        }
+        else if ( c == '0' )
+        {
+            if ( strValue.length() > 1 )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+
+        // We must have at least a digit which is not '0'
+        if ( !StringTools.isDigit( strValue, pos ) )
+        {
+            return false;
+        }
+        else if ( StringTools.isCharASCII( strValue, pos, '0' ) )
+        {
+            return false;
+        }
+        else
+        {
+            pos++;
+        }
+
+        while ( StringTools.isDigit( strValue, pos) )
+        {
+            pos++;
+        }
+
+        if ( pos != strValue.length() )
+        {
+            return false;
+        }
+
+        // Should get a NumberFormatException for Byte values out of range
+        try
+        {
+            Byte.valueOf( strValue );
+            return true;
+        }
+        catch ( NumberFormatException e )
+        {
+            return false;
+        }
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxCheckerTest.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxCheckerTest.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaByteSyntaxCheckerTest.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import junit.framework.TestCase;
+
+/**
+ * Test cases for JavaByteSyntaxChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaByteSyntaxCheckerTest extends TestCase
+{
+    JavaByteSyntaxChecker checker = new JavaByteSyntaxChecker();
+
+
+    public void testNullString()
+    {
+        assertFalse( checker.isValidSyntax( null ) );
+    }
+
+
+    public void testEmptyString()
+    {
+        assertFalse( checker.isValidSyntax( "" ) );
+    }
+
+
+    public void testOneCharString()
+    {
+        assertFalse( checker.isValidSyntax( "f" ) );
+        assertFalse( checker.isValidSyntax( "-" ) );
+    }
+
+
+    public void testWrongCase()
+    {
+        assertFalse( checker.isValidSyntax( "000" ) );
+        assertFalse( checker.isValidSyntax( "-0" ) );
+        assertFalse( checker.isValidSyntax( " 1" ) );
+        assertFalse( checker.isValidSyntax( "1 " ) );
+    }
+
+
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "1" ) );
+        assertTrue( checker.isValidSyntax( "10" ) );
+        assertTrue( checker.isValidSyntax( "111" ) );
+        assertTrue( checker.isValidSyntax( "-1" ) );
+        assertTrue( checker.isValidSyntax( "-123" ) );
+        assertTrue( checker.isValidSyntax( "123" ) );
+    }
+
+
+    public void testMinValueBoundry()
+    {
+        int min = Byte.MIN_VALUE;
+        assertTrue( checker.isValidSyntax( Integer.toString( min ) ) );
+        min--;
+        assertFalse( checker.isValidSyntax( Integer.toString( min ) ) );
+        min--;
+        assertFalse( checker.isValidSyntax( Integer.toString( min ) ) );
+    }
+
+
+    public void testMaxValueBoundry()
+    {
+        int max = Byte.MAX_VALUE;
+        assertTrue( checker.isValidSyntax( Integer.toString( max ) ) );
+        max++;
+        assertFalse( checker.isValidSyntax( Integer.toString( max ) ) );
+        max++;
+        assertFalse( checker.isValidSyntax( Integer.toString( max ) ) );
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxChecker.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxChecker.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,152 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A SyntaxChecker which verifies that a value is a valid Java primitive int or
+ * the Integer wrapper.  Essentially this constrains the min and max values of
+ * the Integer.
+ *
+ * From RFC 4517 :
+ *
+ * Integer = ( HYPHEN LDIGIT *DIGIT ) | number
+ *
+ * From RFC 4512 :
+ * number  = DIGIT | ( LDIGIT 1*DIGIT )
+ * DIGIT   = %x30 | LDIGIT       ; "0"-"9"
+ * LDIGIT  = %x31-39             ; "1"-"9"
+ * HYPHEN  = %x2D                ; hyphen ("-")
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaIntegerSyntaxChecker extends AbstractSyntaxChecker
+{
+    /**
+     *
+     * Creates a new instance of IntegerSyntaxChecker.
+     *
+     */
+    public JavaIntegerSyntaxChecker()
+    {
+        super( SchemaConstants.JAVA_INT_SYNTAX );
+    }
+
+
+    /**
+     *
+     * Creates a new instance of IntegerSyntaxChecker.
+     *
+     * @param oid the oid to associate with this new SyntaxChecker
+     *
+     */
+    protected JavaIntegerSyntaxChecker( String oid )
+    {
+        super( oid );
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#isValidSyntax(java.lang.Object)
+     */
+    public boolean isValidSyntax( Object value )
+    {
+        String strValue;
+
+        if ( value == null )
+        {
+            return false;
+        }
+
+        if ( value instanceof String )
+        {
+            strValue = ( String ) value;
+        }
+        else if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value );
+        }
+        else
+        {
+            strValue = value.toString();
+        }
+
+        if ( strValue.length() == 0 )
+        {
+            return false;
+        }
+
+        // The first char must be either a '-' or in [0..9].
+        // If it's a '0', then there should be any other char after
+        int pos = 0;
+        char c = strValue.charAt( pos );
+
+        if ( c == '-' )
+        {
+            pos = 1;
+        }
+        else if ( !StringTools.isDigit( c ) )
+        {
+            return false;
+        }
+        else if ( c == '0' )
+        {
+            return strValue.length() <= 1;
+        }
+
+        // We must have at least a digit which is not '0'
+        if ( !StringTools.isDigit( strValue, pos ) )
+        {
+            return false;
+        }
+        else if ( StringTools.isCharASCII( strValue, pos, '0' ) )
+        {
+            return false;
+        }
+        else
+        {
+            pos++;
+        }
+
+        while ( StringTools.isDigit( strValue, pos) )
+        {
+            pos++;
+        }
+
+        if ( pos != strValue.length() )
+        {
+            return false;
+        }
+
+        try
+        {
+            Integer.valueOf( strValue );
+            return true;
+        }
+        catch ( NumberFormatException e )
+        {
+            return false;
+        }
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxChecker.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxChecker.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,159 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+/**
+ * A SyntaxChecker which verifies that a value is a valid Java primitive long or
+ * the Long wrapper.  Essentially this constrains the min and max values of
+ * the Integer.
+ *
+ * From RFC 4517 :
+ *
+ * Integer = ( HYPHEN LDIGIT *DIGIT ) | number
+ *
+ * From RFC 4512 :
+ * number  = DIGIT | ( LDIGIT 1*DIGIT )
+ * DIGIT   = %x30 | LDIGIT       ; "0"-"9"
+ * LDIGIT  = %x31-39             ; "1"-"9"
+ * HYPHEN  = %x2D                ; hyphen ("-")
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaLongSyntaxChecker extends AbstractSyntaxChecker
+{
+    /**
+     *
+     * Creates a new instance of JavaLongSyntaxChecker.
+     *
+     */
+    public JavaLongSyntaxChecker()
+    {
+        super( SchemaConstants.JAVA_LONG_SYNTAX );
+    }
+
+
+    /**
+     *
+     * Creates a new instance of JavaLongSyntaxChecker.
+     *
+     * @param oid the oid to associate with this new SyntaxChecker
+     *
+     */
+    protected JavaLongSyntaxChecker( String oid )
+    {
+        super( oid );
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#isValidSyntax(java.lang.Object)
+     */
+    public boolean isValidSyntax( Object value )
+    {
+        String strValue;
+
+        if ( value == null )
+        {
+            return false;
+        }
+
+        if ( value instanceof String )
+        {
+            strValue = ( String ) value;
+        }
+        else if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value );
+        }
+        else
+        {
+            strValue = value.toString();
+        }
+
+        if ( strValue.length() == 0 )
+        {
+            return false;
+        }
+
+        // The first char must be either a '-' or in [0..9].
+        // If it's a '0', then there should be any other char after
+        int pos = 0;
+        char c = strValue.charAt( pos );
+
+        if ( c == '-' )
+        {
+            pos = 1;
+        }
+        else if ( !StringTools.isDigit( c ) )
+        {
+            return false;
+        }
+        else if ( c == '0' )
+        {
+            if ( strValue.length() > 1 )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+
+        // We must have at least a digit which is not '0'
+        if ( !StringTools.isDigit( strValue, pos ) )
+        {
+            return false;
+        }
+        else if ( StringTools.isCharASCII( strValue, pos, '0' ) )
+        {
+            return false;
+        }
+        else
+        {
+            pos++;
+        }
+
+        while ( StringTools.isDigit( strValue, pos) )
+        {
+            pos++;
+        }
+
+        if ( pos != strValue.length() )
+        {
+            return false;
+        }
+
+        // Should get a NumberFormatException for Byte values out of range
+        try
+        {
+            Long.valueOf( strValue );
+            return true;
+        }
+        catch ( NumberFormatException e )
+        {
+            return false;
+        }
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxCheckerTest.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxCheckerTest.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaLongSyntaxCheckerTest.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import junit.framework.TestCase;
+
+import java.math.BigInteger;
+
+/**
+ * Test cases for JavaLongSyntaxChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaLongSyntaxCheckerTest extends TestCase
+{
+    JavaLongSyntaxChecker checker = new JavaLongSyntaxChecker();
+
+
+    public void testNullString()
+    {
+        assertFalse( checker.isValidSyntax( null ) );
+    }
+
+
+    public void testEmptyString()
+    {
+        assertFalse( checker.isValidSyntax( "" ) );
+    }
+
+
+    public void testOneCharString()
+    {
+        assertFalse( checker.isValidSyntax( "f" ) );
+        assertFalse( checker.isValidSyntax( "-" ) );
+    }
+
+
+    public void testWrongCase()
+    {
+        assertFalse( checker.isValidSyntax( "000" ) );
+        assertFalse( checker.isValidSyntax( "-0" ) );
+        assertFalse( checker.isValidSyntax( " 1" ) );
+        assertFalse( checker.isValidSyntax( "1 " ) );
+    }
+
+
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "1" ) );
+        assertTrue( checker.isValidSyntax( "10" ) );
+        assertTrue( checker.isValidSyntax( "111" ) );
+        assertTrue( checker.isValidSyntax( "-1" ) );
+        assertTrue( checker.isValidSyntax( "-123" ) );
+        assertTrue( checker.isValidSyntax( "123" ) );
+    }
+
+
+    public void testMinValueBoundry()
+    {
+        BigInteger min = new BigInteger( Long.toString( Long.MIN_VALUE ) );
+        assertTrue( checker.isValidSyntax( min.toString() ) );
+        min = min.subtract( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( min.toString() ) );
+        min = min.subtract( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( min.toString() ) );
+    }
+
+
+    public void testMaxValueBoundry()
+    {
+        BigInteger max = new BigInteger( Long.toString( Long.MAX_VALUE ) );
+        assertTrue( checker.isValidSyntax( max.toString() ) );
+        max = max.add( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( max.toString() ) );
+        max = max.add( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( max.toString() ) );
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxChecker.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxChecker.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,159 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+/**
+ * A SyntaxChecker which verifies that a value is a valid Java primitive int or
+ * the Integer wrapper.  Essentially this constrains the min and max values of
+ * the Integer.
+ *
+ * From RFC 4517 :
+ *
+ * Integer = ( HYPHEN LDIGIT *DIGIT ) | number
+ *
+ * From RFC 4512 :
+ * number  = DIGIT | ( LDIGIT 1*DIGIT )
+ * DIGIT   = %x30 | LDIGIT       ; "0"-"9"
+ * LDIGIT  = %x31-39             ; "1"-"9"
+ * HYPHEN  = %x2D                ; hyphen ("-")
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaShortSyntaxChecker extends AbstractSyntaxChecker
+{
+    /**
+     *
+     * Creates a new instance of IntegerSyntaxChecker.
+     *
+     */
+    public JavaShortSyntaxChecker()
+    {
+        super( SchemaConstants.JAVA_SHORT_SYNTAX );
+    }
+
+
+    /**
+     *
+     * Creates a new instance of IntegerSyntaxChecker.
+     *
+     * @param oid the oid to associate with this new SyntaxChecker
+     *
+     */
+    protected JavaShortSyntaxChecker( String oid )
+    {
+        super( oid );
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#isValidSyntax(java.lang.Object)
+     */
+    public boolean isValidSyntax( Object value )
+    {
+        String strValue;
+
+        if ( value == null )
+        {
+            return false;
+        }
+
+        if ( value instanceof String )
+        {
+            strValue = ( String ) value;
+        }
+        else if ( value instanceof byte[] )
+        {
+            strValue = StringTools.utf8ToString( ( byte[] ) value );
+        }
+        else
+        {
+            strValue = value.toString();
+        }
+
+        if ( strValue.length() == 0 )
+        {
+            return false;
+        }
+
+        // The first char must be either a '-' or in [0..9].
+        // If it's a '0', then there should be any other char after
+        int pos = 0;
+        char c = strValue.charAt( pos );
+
+        if ( c == '-' )
+        {
+            pos = 1;
+        }
+        else if ( !StringTools.isDigit( c ) )
+        {
+            return false;
+        }
+        else if ( c == '0' )
+        {
+            if ( strValue.length() > 1 )
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+
+        // We must have at least a digit which is not '0'
+        if ( !StringTools.isDigit( strValue, pos ) )
+        {
+            return false;
+        }
+        else if ( StringTools.isCharASCII( strValue, pos, '0' ) )
+        {
+            return false;
+        }
+        else
+        {
+            pos++;
+        }
+
+        while ( StringTools.isDigit( strValue, pos) )
+        {
+            pos++;
+        }
+
+        if ( pos != strValue.length() )
+        {
+            return false;
+        }
+
+        // Should get a NumberFormatException for Byte values out of range
+        try
+        {
+            Short.valueOf( strValue );
+            return true;
+        }
+        catch ( NumberFormatException e )
+        {
+            return false;
+        }
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxCheckerTest.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxCheckerTest.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/JavaShortSyntaxCheckerTest.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import junit.framework.TestCase;
+
+/**
+ * Test cases for JavaShortSyntaxChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaShortSyntaxCheckerTest extends TestCase
+{
+    JavaShortSyntaxChecker checker = new JavaShortSyntaxChecker();
+
+
+    public void testNullString()
+    {
+        assertFalse( checker.isValidSyntax( null ) );
+    }
+
+
+    public void testEmptyString()
+    {
+        assertFalse( checker.isValidSyntax( "" ) );
+    }
+
+
+    public void testOneCharString()
+    {
+        assertFalse( checker.isValidSyntax( "f" ) );
+        assertFalse( checker.isValidSyntax( "-" ) );
+    }
+
+
+    public void testWrongCase()
+    {
+        assertFalse( checker.isValidSyntax( "000" ) );
+        assertFalse( checker.isValidSyntax( "-0" ) );
+        assertFalse( checker.isValidSyntax( " 1" ) );
+        assertFalse( checker.isValidSyntax( "1 " ) );
+    }
+
+
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "1" ) );
+        assertTrue( checker.isValidSyntax( "10" ) );
+        assertTrue( checker.isValidSyntax( "111" ) );
+        assertTrue( checker.isValidSyntax( "-1" ) );
+        assertTrue( checker.isValidSyntax( "-123" ) );
+        assertTrue( checker.isValidSyntax( "123" ) );
+    }
+
+
+    public void testMinValueBoundry()
+    {
+        int min = Short.MIN_VALUE;
+        assertTrue( checker.isValidSyntax( Integer.toString( min ) ) );
+        min--;
+        assertFalse( checker.isValidSyntax( Integer.toString( min ) ) );
+        min--;
+        assertFalse( checker.isValidSyntax( Integer.toString( min ) ) );
+    }
+
+
+    public void testMaxValueBoundry()
+    {
+        int max = Short.MAX_VALUE;
+        assertTrue( checker.isValidSyntax( Integer.toString( max ) ) );
+        max++;
+        assertFalse( checker.isValidSyntax( Integer.toString( max ) ) );
+        max++;
+        assertFalse( checker.isValidSyntax( Integer.toString( max ) ) );
+    }
+}

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/UtcTimeSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/UtcTimeSyntaxChecker.java?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/UtcTimeSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/UtcTimeSyntaxChecker.java Sun Jul 22 00:16:30 2007
@@ -23,6 +23,7 @@
 import java.util.regex.Pattern;
 
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 
 
 /**
@@ -60,9 +61,6 @@
  */
 public class UtcTimeSyntaxChecker extends AbstractSyntaxChecker
 {
-    /** The Syntax OID, according to RFC 4517, par. 3.3.34 */
-    private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.53";
-    
     /** The GeneralizedDate pattern matching */
     private static final String UTC_TIME_PATTERN = 
                 "^\\d{2}" +                                 // year : 00 to 99
@@ -85,7 +83,7 @@
      */
     public UtcTimeSyntaxChecker()
     {
-        super( SC_OID );
+        super( SchemaConstants.UTC_TIME_SYNTAX );
     }
     
     

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxCheckerTest.java?view=auto&rev=558464
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxCheckerTest.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/JavaIntegerSyntaxCheckerTest.java Sun Jul 22 00:16:30 2007
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax;
+
+import junit.framework.TestCase;
+
+import java.math.BigInteger;
+
+/**
+ * Test cases for IntegerSyntaxChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JavaIntegerSyntaxCheckerTest extends TestCase
+{
+    JavaIntegerSyntaxChecker checker = new JavaIntegerSyntaxChecker();
+
+
+    public void testNullString()
+    {
+        assertFalse( checker.isValidSyntax( null ) );
+    }
+
+
+    public void testEmptyString()
+    {
+        assertFalse( checker.isValidSyntax( "" ) );
+    }
+
+
+    public void testOneCharString()
+    {
+        assertFalse( checker.isValidSyntax( "f" ) );
+        assertFalse( checker.isValidSyntax( "-" ) );
+    }
+
+
+    public void testWrongCase()
+    {
+        assertFalse( checker.isValidSyntax( "000" ) );
+        assertFalse( checker.isValidSyntax( "-0" ) );
+        assertFalse( checker.isValidSyntax( " 1" ) );
+        assertFalse( checker.isValidSyntax( "1 " ) );
+    }
+
+
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "1" ) );
+        assertTrue( checker.isValidSyntax( "10" ) );
+        assertTrue( checker.isValidSyntax( "1111" ) );
+        assertTrue( checker.isValidSyntax( "-1" ) );
+        assertTrue( checker.isValidSyntax( "-1234567891" ) );
+        assertTrue( checker.isValidSyntax( "123456789" ) );
+    }
+
+
+    public void testMinValueBoundry()
+    {
+        BigInteger min = new BigInteger( Integer.toString( Integer.MIN_VALUE ) );
+        assertTrue( checker.isValidSyntax( min.toString() ) );
+        min = min.subtract( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( min.toString() ) );
+        min = min.subtract( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( min.toString() ) );
+    }
+
+
+    public void testMaxValueBoundry()
+    {
+        BigInteger max = new BigInteger( Integer.toString( Integer.MAX_VALUE ) );
+        assertTrue( checker.isValidSyntax( max.toString() ) );
+        max = max.add( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( max.toString() ) );
+        max = max.add( BigInteger.ONE );
+        assertFalse( checker.isValidSyntax( max.toString() ) );
+    }
+}

Modified: directory/shared/trunk/ldap/xdocs/index.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/xdocs/index.xml?view=diff&rev=558464&r1=558463&r2=558464
==============================================================================
--- directory/shared/trunk/ldap/xdocs/index.xml (original)
+++ directory/shared/trunk/ldap/xdocs/index.xml Sun Jul 22 00:16:30 2007
@@ -24,11 +24,11 @@
         <p>
           The The LDAP Data Interchange Format (LDIF) parsing 
           package Parses an LDIF into a multimap or a JNDI 
-          Attributes instance of attribute key/value pairs with 
-          potential more than one attribute value per attribute.  
+          Attributes instance of attributeToPropertyMapping key/value pairs with
+          potential more than one attributeToPropertyMapping value per attributeToPropertyMapping.
           This parser populates the MultiMap or Attributes 
-          instance with all attributes within the LDIF including 
-          control attributes like the 'dn' and the changeType.
+          instance with all attributeToPropertyMappings within the LDIF including
+          control attributeToPropertyMappings like the 'dn' and the changeType.
         </p>
         <p>
           The package contain an LDIF entry class that can be used.  Along



Mime
View raw message