Index: shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescriptionSyntaxCheckerTest.java
===================================================================
--- shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescriptionSyntaxCheckerTest.java	(Revision 0)
+++ shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescriptionSyntaxCheckerTest.java	(Revision 0)
@@ -0,0 +1,88 @@
+/*
+ *  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 MatchingRuleUseDescriptionSyntaxChecker.
+ * 
+ * There are also many test cases in SchemaParserMatchingRuleUseDescriptionTest.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MatchingRuleUseDescriptionSyntaxCheckerTest extends TestCase
+{
+    private MatchingRuleUseDescriptionSyntaxChecker checker = new MatchingRuleUseDescriptionSyntaxChecker();
+
+
+    public void testValid()
+    {
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.17 APPLIES userPassword )" ) ) );
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.17 APPLIES ( javaSerializedData $ userPassword ) )" ) ) );
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.17 NAME 'octetStringMatch' APPLIES ( javaSerializedData $ userPassword ) )" ) ) );
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.17 NAME 'octetStringMatch' DESC 'octetStringMatch' APPLIES ( javaSerializedData $ userPassword ) )" ) ) );
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.17 NAME 'octetStringMatch' DESC 'octetStringMatch' APPLIES ( javaSerializedData $ userPassword ) X-ABC-DEF 'test' )" ) ) );
+
+        // spaces
+        assertTrue( checker.isValidSyntax( ( "(2.5.13.17 APPLIES userPassword)" ) ) );
+        assertTrue( checker.isValidSyntax( ( "(   2.5.13.17   NAME   'octetStringMatch'   DESC   'octetStringMatch'   APPLIES   (javaSerializedData   $    userPassword)  X-ABC-DEF     'test'   )" ) ) );
+    }
+
+
+    public void testInvalid()
+    {
+        // null 
+        assertFalse( checker.isValidSyntax( null ) );
+        
+        // empty 
+        assertFalse( checker.isValidSyntax( "" ) );
+        
+        // missing/invalid OID
+        assertFalse( checker.isValidSyntax( "()" ) );
+        assertFalse( checker.isValidSyntax( "(  )" ) );
+        assertFalse( checker.isValidSyntax( "( . )" ) );
+        assertFalse( checker.isValidSyntax( "( 1 )" ) );
+        assertFalse( checker.isValidSyntax( "( 1. )" ) );
+        assertFalse( checker.isValidSyntax( "( 1.2. )" ) );
+        assertFalse( checker.isValidSyntax( "( 1.A )" ) );
+        assertFalse( checker.isValidSyntax( "( A.B )" ) );
+
+        // missing right parenthesis
+        assertFalse( checker.isValidSyntax( "( 2.5.13.17 APPLIES userPassword " ) );
+
+        // missing quotes
+        assertFalse( checker.isValidSyntax( "( 2.5.13.17 DESC Directory String APPLIES userPassword )" ) );
+
+        // lowercase DESC
+        assertFalse( checker.isValidSyntax( "( 2.5.13.17 desc 'Directory String' APPLIES userPassword )" ) );
+
+        // invalid extension
+        assertFalse( checker.isValidSyntax( "( 2.5.13.17 APPLIES userPassword X-ABC-DEF )" ) );
+        assertFalse( checker.isValidSyntax( "( 2.5.13.17 APPLIES userPassword X-ABC-123 'test' )" ) );
+        
+        // APPLIES is required
+        assertFalse( checker.isValidSyntax( ( "( 2.5.13.17 NAME 'octetStringMatch' )" ) ) );
+    }
+
+}
Index: shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java
===================================================================
--- shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java	(Revision 0)
+++ shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java	(Revision 0)
@@ -0,0 +1,297 @@
+/*
+ *  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 java.text.ParseException;
+
+import junit.framework.TestCase;
+
+import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleUseDescriptionSchemaParser;
+
+
+/**
+ * Tests the MatchingRuleUseDescriptionSchemaParser class.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class SchemaParserMatchingRuleUseDescriptionTest extends TestCase
+{
+    /** the parser instance */
+    private MatchingRuleUseDescriptionSchemaParser parser;
+
+
+    protected void setUp() throws Exception
+    {
+        parser = new MatchingRuleUseDescriptionSchemaParser();
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        parser = null;
+    }
+
+
+    public void testNumericOid() throws Exception
+    {
+        SchemaParserTestUtils.testNumericOid( parser );
+    }
+
+
+    public void testNames() throws Exception
+    {
+        SchemaParserTestUtils.testNames( parser );
+    }
+
+
+    public void testDescription() throws ParseException
+    {
+        SchemaParserTestUtils.testDescription( parser );
+    }
+
+
+    public void testObsolete() throws ParseException
+    {
+        SchemaParserTestUtils.testObsolete( parser );
+    }
+
+
+    public void testApplies() throws ParseException
+    {
+
+        String value = null;
+        MatchingRuleUseDescription mrud = null;
+
+        // no APPLIES
+        value = "( 1.1 )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 0, mrud.getApplicableAttributes().size() );
+
+        // APPLIES simple numericoid
+        value = "( 1.1 APPLIES 1.2.3.4.5.6.7.8.9.0 )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 1, mrud.getApplicableAttributes().size() );
+        assertEquals( "1.2.3.4.5.6.7.8.9.0", mrud.getApplicableAttributes().get( 0 ) );
+
+        // SUP simple descr
+        value = "( 1.1 APPLIES abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 1, mrud.getApplicableAttributes().size() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", mrud
+            .getApplicableAttributes().get( 0 ) );
+
+        // APPLIES single numericoid
+        value = "( 1.1 APPLIES ( 123.4567.890 ) )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 1, mrud.getApplicableAttributes().size() );
+        assertEquals( "123.4567.890", mrud.getApplicableAttributes().get( 0 ) );
+
+        // APPLIES single descr
+        value = "( 1.1 APPLIES ( a-z-A-Z-0-9 ) )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 1, mrud.getApplicableAttributes().size() );
+        assertEquals( "a-z-A-Z-0-9", mrud.getApplicableAttributes().get( 0 ) );
+
+        // APPLIES multi numericoid
+        value = "( 1.1 APPLIES ( 1.2.3 $ 4.5.6 $ 7.8.90 ) )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 3, mrud.getApplicableAttributes().size() );
+        assertEquals( "1.2.3", mrud.getApplicableAttributes().get( 0 ) );
+        assertEquals( "4.5.6", mrud.getApplicableAttributes().get( 1 ) );
+        assertEquals( "7.8.90", mrud.getApplicableAttributes().get( 2 ) );
+
+        // APPLIES multi descr
+        value = "( 1.1 APPLIES ( test1 $ test2 ) )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 2, mrud.getApplicableAttributes().size() );
+        assertEquals( "test1", mrud.getApplicableAttributes().get( 0 ) );
+        assertEquals( "test2", mrud.getApplicableAttributes().get( 1 ) );
+
+        // APPLIES multi mixed
+        value = "( 1.1 APPLIES ( test1 $ 1.2.3.4 $ test2 ) )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 3, mrud.getApplicableAttributes().size() );
+        assertEquals( "test1", mrud.getApplicableAttributes().get( 0 ) );
+        assertEquals( "1.2.3.4", mrud.getApplicableAttributes().get( 1 ) );
+        assertEquals( "test2", mrud.getApplicableAttributes().get( 2 ) );
+
+        // APPLIES multi mixed no space
+        value = "( 1.1 APPLIES (TEST-1$1.2.3.4$TEST-2) )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 3, mrud.getApplicableAttributes().size() );
+        assertEquals( "TEST-1", mrud.getApplicableAttributes().get( 0 ) );
+        assertEquals( "1.2.3.4", mrud.getApplicableAttributes().get( 1 ) );
+        assertEquals( "TEST-2", mrud.getApplicableAttributes().get( 2 ) );
+
+        // APPLIES multi mixed many spaces
+        value = "(          1.1          APPLIES          (          test1          $          1.2.3.4$test2          )          )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+        assertEquals( 3, mrud.getApplicableAttributes().size() );
+        assertEquals( "test1", mrud.getApplicableAttributes().get( 0 ) );
+        assertEquals( "1.2.3.4", mrud.getApplicableAttributes().get( 1 ) );
+        assertEquals( "test2", mrud.getApplicableAttributes().get( 2 ) );
+
+        // no quote allowed
+        value = "( 1.1 APPLIES 'test' )";
+        try
+        {
+            mrud = parser.parseMatchingRuleUseDescription( value );
+            fail( "Exception expected, invalid APPLIES 'test' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // no quote allowed
+        value = "( 1.1 APPLIES '1.2.3.4' )";
+        try
+        {
+            mrud = parser.parseMatchingRuleUseDescription( value );
+            fail( "Exception expected, invalid APPLIES '1.2.3.4' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // invalid character
+        value = "( 1.1 APPLIES 1.2.3.4.A )";
+        try
+        {
+            mrud = parser.parseMatchingRuleUseDescription( value );
+            fail( "Exception expected, invalid APPLIES '1.2.3.4.A' (invalid character)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // invalid start
+        value = "( 1.1 APPLIES ( test1 $ -test2 ) )";
+        try
+        {
+            mrud = parser.parseMatchingRuleUseDescription( value );
+            fail( "Exception expected, invalid APPLIES '-test' (starts with hypen)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // invalid separator
+        value = "( 1.1 APPLIES ( test1 test2 ) )";
+        try
+        {
+            mrud = parser.parseMatchingRuleUseDescription( value );
+            fail( "Exception expected, invalid separator (no DOLLAR)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // empty APPLIES
+        value = "( 1.1 APPLIES )";
+        try
+        {
+            mrud = parser.parseMatchingRuleUseDescription( value );
+            fail( "Exception expected, no APPLIES value" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    public void testExtensions() throws ParseException
+    {
+        SchemaParserTestUtils.testExtensions( parser );
+    }
+
+
+    public void testFull() throws ParseException
+    {
+        String value = null;
+        MatchingRuleUseDescription mrud = null;
+
+        value = "( 1.2.3.4.5.6.7.8.9.0 NAME ( 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' 'test' ) DESC 'Descripton äöüß 部長' OBSOLETE APPLIES ( 0.1.2.3.4.5.6.7.8.9 $ abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 ) X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )";
+        mrud = parser.parseMatchingRuleUseDescription( value );
+
+        assertEquals( "1.2.3.4.5.6.7.8.9.0", mrud.getNumericOid() );
+        assertEquals( 2, mrud.getNames().size() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", mrud.getNames().get( 0 ) );
+        assertEquals( "test", mrud.getNames().get( 1 ) );
+        assertEquals( "Descripton äöüß 部長", mrud.getDescription() );
+        assertTrue( mrud.isObsolete() );
+        assertEquals( 2, mrud.getApplicableAttributes().size() );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrud.getApplicableAttributes().get( 0 ) );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", mrud
+            .getApplicableAttributes().get( 1 ) );
+        assertEquals( 2, mrud.getExtensions().size() );
+        assertNotNull( mrud.getExtensions().get( "X-TEST-a" ) );
+        assertEquals( 2, mrud.getExtensions().get( "X-TEST-a" ).size() );
+        assertEquals( "test1-1", mrud.getExtensions().get( "X-TEST-a" ).get( 0 ) );
+        assertEquals( "test1-2", mrud.getExtensions().get( "X-TEST-a" ).get( 1 ) );
+        assertNotNull( mrud.getExtensions().get( "X-TEST-b" ) );
+        assertEquals( 2, mrud.getExtensions().get( "X-TEST-b" ).size() );
+        assertEquals( "test2-1", mrud.getExtensions().get( "X-TEST-b" ).get( 0 ) );
+        assertEquals( "test2-2", mrud.getExtensions().get( "X-TEST-b" ).get( 1 ) );
+    }
+
+
+    ////////////////////////////////////////////////////////////////
+    //       Some real-world matching rule use descriptons        //
+    ////////////////////////////////////////////////////////////////
+
+    public void testOpenldap1() throws ParseException
+    {
+        String value = "( 2.5.13.17 NAME 'octetStringMatch' APPLIES ( javaSerializedData $ userPassword ) )";
+        MatchingRuleUseDescription mrud = parser.parseMatchingRuleUseDescription( value );
+
+        assertEquals( "2.5.13.17", mrud.getNumericOid() );
+        assertEquals( 1, mrud.getNames().size() );
+        assertEquals( "octetStringMatch", mrud.getNames().get( 0 ) );
+        assertEquals( "", mrud.getDescription() );
+        assertFalse( mrud.isObsolete() );
+        assertEquals( 2, mrud.getApplicableAttributes().size() );
+        assertEquals( "javaSerializedData", mrud.getApplicableAttributes().get( 0 ) );
+        assertEquals( "userPassword", mrud.getApplicableAttributes().get( 1 ) );
+        assertEquals( 0, mrud.getExtensions().size() );
+    }
+
+
+    /**
+     * Tests the multithreaded use of a single parser.
+     */
+    public void testMultiThreaded() throws Exception
+    {
+        String[] testValues = new String[]
+            {
+                "( 1.1 )",
+                "( 2.5.13.17 NAME 'octetStringMatch' APPLIES ( javaSerializedData $ userPassword ) )",
+                "( 2.5.13.1 NAME 'distinguishedNameMatch' APPLIES ( memberOf $ dITRedirect $ associatedName $ secretary $ documentAuthor $ manager $ seeAlso $ roleOccupant $ owner $ member $ distinguishedName $ aliasedObjectName $ namingContexts $ subschemaSubentry $ modifiersName $ creatorsName ) )",
+                "( 1.2.3.4.5.6.7.8.9.0 NAME ( 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' 'test' ) DESC 'Descripton äöüß 部長' OBSOLETE APPLIES ( 0.1.2.3.4.5.6.7.8.9 $ abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 ) X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )" };
+        SchemaParserTestUtils.testMultiThreaded( parser, testValues );
+    }
+
+}
Index: shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescriptionSyntaxCheckerTest.java
===================================================================
--- shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescriptionSyntaxCheckerTest.java	(Revision 0)
+++ shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescriptionSyntaxCheckerTest.java	(Revision 0)
@@ -0,0 +1,87 @@
+/*
+ *  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 MatchingRuleDescriptionSyntaxChecker.
+ * 
+ * There are also many test cases in SchemaParserMatchingRuleDescriptionTest.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MatchingRuleDescriptionSyntaxCheckerTest extends TestCase
+{
+    private MatchingRuleDescriptionSyntaxChecker checker = new MatchingRuleDescriptionSyntaxChecker();
+
+    public void testValid()
+    {
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.5 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )" ) ) );
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.5 NAME 'caseExactMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )" ) ) );
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.5 NAME 'caseExactMatch' DESC 'caseExactMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )" ) ) );
+        assertTrue( checker.isValidSyntax( ( "( 2.5.13.5 NAME 'caseExactMatch' DESC 'caseExactMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ABC-DEF 'test' )" ) ) );
+
+        // spaces
+        assertTrue( checker.isValidSyntax( "(2.5.13.5 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)" ) );
+        assertTrue( checker.isValidSyntax( "(    2.5.13.5     NAME    'caseExactMatch'     DESC    'caseExactMatch'      SYNTAX       1.3.6.1.4.1.1466.115.121.1.15     X-ABC-DEF     'test')" ) );
+    }
+
+
+    public void testInvalid()
+    {
+        // null 
+        assertFalse( checker.isValidSyntax( null ) );
+        
+        // empty 
+        assertFalse( checker.isValidSyntax( "" ) );
+        
+        // missing/invalid OID
+        assertFalse( checker.isValidSyntax( "()" ) );
+        assertFalse( checker.isValidSyntax( "(  )" ) );
+        assertFalse( checker.isValidSyntax( "( . )" ) );
+        assertFalse( checker.isValidSyntax( "( 1 )" ) );
+        assertFalse( checker.isValidSyntax( "( 1. )" ) );
+        assertFalse( checker.isValidSyntax( "( 1.2. )" ) );
+        assertFalse( checker.isValidSyntax( "( 1.A )" ) );
+        assertFalse( checker.isValidSyntax( "( A.B )" ) );
+
+        // missing right parenthesis
+        assertFalse( checker.isValidSyntax( "( 2.5.13.5 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " ) );
+
+        // missing quotes
+        assertFalse( checker.isValidSyntax( "( 2.5.13.5 DESC Description SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )" ) );
+
+        // lowercase DESC
+        assertFalse( checker.isValidSyntax( "( 2.5.13.5 desc 'Directory String' )" ) );
+
+        // invalid extension
+        assertFalse( checker.isValidSyntax( "( 2.5.13.5 DESC 'Description' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ABC-DEF )" ) );
+        assertFalse( checker.isValidSyntax( "( 2.5.13.5 DESC 'Description' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ABC-123 'test' )" ) );
+        
+        // SYNTAX is required
+        assertFalse( checker.isValidSyntax( "( 2.5.13.5 NAME 'caseExactMatch' )" ) );
+
+    }
+
+}
Index: shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java
===================================================================
--- shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java	(Revision 0)
+++ shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java	(Revision 0)
@@ -0,0 +1,213 @@
+/*
+ *  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 java.text.ParseException;
+
+import junit.framework.TestCase;
+
+import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleDescriptionSchemaParser;
+
+
+/**
+ * Tests the MatchingRuleDescriptionSchemaParser class.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class SchemaParserMatchingRuleDescriptionTest extends TestCase
+{
+    /** the parser instance */
+    private MatchingRuleDescriptionSchemaParser parser;
+
+    protected void setUp() throws Exception
+    {
+        parser = new MatchingRuleDescriptionSchemaParser();
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        parser = null;
+    }
+
+
+    public void testNumericOid() throws Exception
+    {
+        SchemaParserTestUtils.testNumericOid( parser );
+    }
+
+
+    public void testNames() throws Exception
+    {
+        SchemaParserTestUtils.testNames( parser );
+    }
+
+
+    public void testDescription() throws ParseException
+    {
+        SchemaParserTestUtils.testDescription( parser );
+    }
+
+
+    public void testObsolete() throws ParseException
+    {
+        SchemaParserTestUtils.testObsolete( parser );
+    }
+
+
+    public void testSyntax() throws ParseException
+    {
+
+        String value = null;
+        MatchingRuleDescription mrd = null;
+
+        // simple
+        value = "( 1.1 SYNTAX 0.1.2.3.4.5.6.7.8.9 )";
+        mrd = parser.parseMatchingRuleDescription( value );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
+
+        // simple
+        value = "( 1.1 SYNTAX 123.456.789.0 )";
+        mrd = parser.parseMatchingRuleDescription( value );
+        assertEquals( "123.456.789.0", mrd.getSyntax() );
+
+        // simple with spaces
+        value = "( 1.1    SYNTAX    0.1.2.3.4.5.6.7.8.9    )";
+        mrd = parser.parseMatchingRuleDescription( value );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
+
+        // non-numeric not allowed
+        value = "( test )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid SYNTAX test" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+    }
+
+
+    public void testExtensions() throws ParseException
+    {
+        SchemaParserTestUtils.testExtensions( parser );
+    }
+
+
+    public void testFull() throws ParseException
+    {
+        String value = null;
+        MatchingRuleDescription mrd = null;
+
+        value = "( 1.2.3.4.5.6.7.8.9.0 NAME ( 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' 'test' ) DESC 'Descripton äöüß 部長' OBSOLETE SYNTAX 0.1.2.3.4.5.6.7.8.9 X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )";
+        mrd = parser.parseMatchingRuleDescription( value );
+
+        assertEquals( "1.2.3.4.5.6.7.8.9.0", mrd.getNumericOid() );
+        assertEquals( 2, mrd.getNames().size() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", mrd.getNames().get( 0 ) );
+        assertEquals( "test", mrd.getNames().get( 1 ) );
+        assertEquals( "Descripton äöüß 部長", mrd.getDescription() );
+        assertTrue( mrd.isObsolete() );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
+        assertEquals( 2, mrd.getExtensions().size() );
+        assertNotNull( mrd.getExtensions().get( "X-TEST-a" ) );
+        assertEquals( 2, mrd.getExtensions().get( "X-TEST-a" ).size() );
+        assertEquals( "test1-1", mrd.getExtensions().get( "X-TEST-a" ).get( 0 ) );
+        assertEquals( "test1-2", mrd.getExtensions().get( "X-TEST-a" ).get( 1 ) );
+        assertNotNull( mrd.getExtensions().get( "X-TEST-b" ) );
+        assertEquals( 2, mrd.getExtensions().get( "X-TEST-b" ).size() );
+        assertEquals( "test2-1", mrd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
+        assertEquals( "test2-2", mrd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
+    }
+
+
+    ////////////////////////////////////////////////////////////////
+    //         Some real-world matching rule descriptons          //
+    ////////////////////////////////////////////////////////////////
+
+    public void testRfc1() throws ParseException
+    {
+        String value = "( 2.5.13.5 NAME 'caseExactMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )";
+        MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );
+
+        assertEquals( "2.5.13.5", mrd.getNumericOid() );
+        assertEquals( 1, mrd.getNames().size() );
+        assertEquals( "caseExactMatch", mrd.getNames().get( 0 ) );
+        assertEquals( "", mrd.getDescription() );
+        assertFalse( mrd.isObsolete() );
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", mrd.getSyntax() );
+        assertEquals( 0, mrd.getExtensions().size() );
+    }
+
+
+    public void testSun1() throws ParseException
+    {
+        String value = "( 2.5.13.5 NAME 'caseExactMatch' DESC 'Case Exact Matching on Directory String [defined in X.520]' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )";
+        MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );
+
+        assertEquals( "2.5.13.5", mrd.getNumericOid() );
+        assertEquals( 1, mrd.getNames().size() );
+        assertEquals( "caseExactMatch", mrd.getNames().get( 0 ) );
+        assertEquals( "Case Exact Matching on Directory String [defined in X.520]", mrd.getDescription() );
+        assertFalse( mrd.isObsolete() );
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", mrd.getSyntax() );
+        assertEquals( 0, mrd.getExtensions().size() );
+    }
+
+
+    /**
+     * This is a real matching rule from Sun Directory 5.2. It has an invalid 
+     * syntax, no DOTs allowed in NAME value. 
+     */
+    public void testSun2() throws ParseException
+    {
+        String value = "( 1.3.6.1.4.1.42.2.27.9.4.34.3.6 NAME 'caseExactSubstringMatch-2.16.840.1.113730.3.3.2.11.3' DESC 'en' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )";
+        try
+        {
+            parser.parseMatchingRuleDescription( value );
+            TestCase
+                .fail( "Exception expected, invalid NAME value 'caseExactSubstringMatch-2.16.840.1.113730.3.3.2.11.3' (contains DOTs)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests the multithreaded use of a single parser.
+     */
+    public void testMultiThreaded() throws Exception
+    {
+        String[] testValues = new String[]
+            {
+                "( 1.1 )",
+                "( 2.5.13.5 NAME 'caseExactMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
+                "( 2.5.13.5 NAME 'caseExactMatch' DESC 'Case Exact Matching on Directory String [defined in X.520]' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
+                "( 1.2.3.4.5.6.7.8.9.0 NAME ( 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' 'test' ) DESC 'Descripton äöüß 部長' OBSOLETE SYNTAX 0.1.2.3.4.5.6.7.8.9 X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )" };
+        SchemaParserTestUtils.testMultiThreaded( parser, testValues );
+    }
+
+}
Index: shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java
===================================================================
--- shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java	(Revision 0)
+++ shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java	(Revision 0)
@@ -0,0 +1,531 @@
+package org.apache.directory.shared.ldap.schema.syntax;
+
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.directory.shared.ldap.schema.syntax.parser.AbstractSchemaParser;
+
+
+public abstract class SchemaParserTestUtils 
+{
+
+    /**
+     * Test numericoid
+     * 
+     * @throws ParseException
+     */
+    public static void testNumericOid( AbstractSchemaParser parser ) throws ParseException
+    {
+        String value = null;
+        AbstractSchemaDescription asd = null;
+
+        // null test
+        value = null;
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, null" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // no oid
+        value = "( )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, no NUMERICOID" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // simple
+        value = "( 0.1.2.3.4.5.6.7.8.9 )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "0.1.2.3.4.5.6.7.8.9", asd.getNumericOid() );
+
+        // simple
+        value = "( 123.4567.890 )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "123.4567.890", asd.getNumericOid() );
+        
+        // simple with spaces
+        value = "(          0.1.2.3.4.5.6.7.8.9          )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "0.1.2.3.4.5.6.7.8.9", asd.getNumericOid() );
+
+        // non-numeric not allowed
+        value = "( test )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NUMERICOID test" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // to short
+        value = "( 1 )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NUMERICOID 1" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // dot only
+        value = "( . )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NUMERICOID ." );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // ends with dot
+        value = "( 1.1. )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NUMERICOID 1.1." );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // quotes not allowed
+        value = "( '1.1' )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NUMERICOID '1.1' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // leading 0 not allowed
+        value = "( 01.1 )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NUMERICOID 01.1 (leading zero)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // alpha not allowed
+        value = "( 1.2.a.4 )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NUMERICOID 1.2.a.4 (alpha not allowed)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+    }
+    
+    /**
+     * Tests NAME and its values
+     * 
+     * @throws ParseException
+     */
+    public static void testNames( AbstractSchemaParser parser ) throws ParseException
+    {
+        String value = null;
+        AbstractSchemaDescription asd = null;
+
+        // alpha
+        value = "( 1.1 NAME 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 1, asd.getNames().size() );
+        TestCase.assertEquals( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", asd.getNames().get( 0 ) );
+
+        // alpha-num-hypen
+        value = "( 1.1 NAME 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 1, asd.getNames().size() );
+        TestCase.assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", asd.getNames().get( 0 ) );
+
+        // with parentheses
+        value = "( 1.1 NAME ( 'a-z-0-9' ) )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 1, asd.getNames().size() );
+        TestCase.assertEquals( "a-z-0-9", asd.getNames().get( 0 ) );
+
+        // with parentheses, without space
+        value = "( 1.1 NAME ('a-z-0-9') )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 1, asd.getNames().size() );
+        TestCase.assertEquals( "a-z-0-9", asd.getNames().get( 0 ) );
+
+        // multi with space
+        value = "( 1.1 NAME ( 'test1' 'test2' ) )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 2, asd.getNames().size() );
+        TestCase.assertEquals( "test1", asd.getNames().get( 0 ) );
+        TestCase.assertEquals( "test2", asd.getNames().get( 1 ) );
+
+        // multi without space
+        value = "( 1.1 NAME ('test1' 'test2' 'test3') )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 3, asd.getNames().size() );
+        TestCase.assertEquals( "test1", asd.getNames().get( 0 ) );
+        TestCase.assertEquals( "test2", asd.getNames().get( 1 ) );
+        TestCase.assertEquals( "test3", asd.getNames().get( 2 ) );
+
+        // multi with many spaces
+        value = "(          1.1          NAME          (          'test1'          'test2'          'test3'          )          )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 3, asd.getNames().size() );
+        TestCase.assertEquals( "test1", asd.getNames().get( 0 ) );
+        TestCase.assertEquals( "test2", asd.getNames().get( 1 ) );
+        TestCase.assertEquals( "test3", asd.getNames().get( 2 ) );
+
+        // lowercase
+        value = "( 1.1 name 'test' )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, NAME is lowercase" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // unquoted
+        value = "( 1.1 NAME test )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NAME test (unquoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // start with number
+        value = "( 1.1 NAME '1test' )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NAME 1test (starts with number)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // start with hypen
+        value = "( 1.1 NAME '-test' )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NAME -test (starts with hypen)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // invalid character
+        value = "( 1.1 NAME 'te_st' )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NAME te_st (contains invalid character)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // NAM unknown
+        value = "( 1.1 NAM 'test' )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid token NAM" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // one valid, one invalid
+        value = "( 1.1 NAME ( 'test' 'te_st' ) )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NAME te_st (contains invalid character)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // no space between values
+        value = "( 1.1 NAME ( 'test1''test2' ) )";
+        try
+        {
+            asd = parser.parse( value );
+            TestCase.fail( "Exception expected, invalid NAME values (no space between values)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+    
+    
+    /**
+     * Tests DESC
+     * 
+     * @throws ParseException
+     */
+    public static void testDescription( AbstractSchemaParser parser ) throws ParseException
+    {
+        String value = null;
+        AbstractSchemaDescription asd = null;
+
+        // simple
+        value = "(1.1 DESC 'Descripton')";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "Descripton", asd.getDescription() );
+
+        // unicode
+        value = "( 1.1 DESC 'Descripton äöüß 部長' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( "Descripton äöüß 部長", asd.getDescription() );
+
+        // lowercase
+        value = "( 1.1 desc 'Descripton' )";
+        try
+        {
+            parser.parse( value );
+            TestCase.fail( "Exception expected, DESC is lowercase" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+    }
+    
+    
+    /**
+     * Test extensions.
+     * 
+     * @throws ParseException
+     */
+    public static void testExtensions( AbstractSchemaParser parser ) throws ParseException
+    {
+        String value = null;
+        AbstractSchemaDescription asd = null;
+
+        // no extension
+        value = "( 1.1 )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 0, asd.getExtensions().size() );
+
+        // single extension with one value
+        value = "( 1.1 X-TEST 'test' )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 1, asd.getExtensions().size() );
+        TestCase.assertNotNull( asd.getExtensions().get( "X-TEST" ) );
+        TestCase.assertEquals( 1, asd.getExtensions().get( "X-TEST" ).size() );
+        TestCase.assertEquals( "test", asd.getExtensions().get( "X-TEST" ).get( 0 ) );
+
+        // single extension with multiple values
+        value = "( 1.1 X-TEST-ABC ('test1' 'test äöüß'       'test 部長' ) )";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 1, asd.getExtensions().size() );
+        TestCase.assertNotNull( asd.getExtensions().get( "X-TEST-ABC" ) );
+        TestCase.assertEquals( 3, asd.getExtensions().get( "X-TEST-ABC" ).size() );
+        TestCase.assertEquals( "test1", asd.getExtensions().get( "X-TEST-ABC" ).get( 0 ) );
+        TestCase.assertEquals( "test äöüß", asd.getExtensions().get( "X-TEST-ABC" ).get( 1 ) );
+        TestCase.assertEquals( "test 部長", asd.getExtensions().get( "X-TEST-ABC" ).get( 2 ) );
+
+        // multiple extensions
+        value = "(1.1 X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2'))";
+        asd = parser.parse( value );
+        TestCase.assertEquals( 2, asd.getExtensions().size() );
+        TestCase.assertNotNull( asd.getExtensions().get( "X-TEST-a" ) );
+        TestCase.assertEquals( 2, asd.getExtensions().get( "X-TEST-a" ).size() );
+        TestCase.assertEquals( "test1-1", asd.getExtensions().get( "X-TEST-a" ).get( 0 ) );
+        TestCase.assertEquals( "test1-2", asd.getExtensions().get( "X-TEST-a" ).get( 1 ) );
+        TestCase.assertNotNull( asd.getExtensions().get( "X-TEST-b" ) );
+        TestCase.assertEquals( 2, asd.getExtensions().get( "X-TEST-b" ).size() );
+        TestCase.assertEquals( "test2-1", asd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
+        TestCase.assertEquals( "test2-2", asd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
+
+        // invalid extension, no number allowed
+        value = "( 1.1 X-TEST1 'test' )";
+        try
+        {
+            asd = parser.parse( value );
+            TestCase.fail( "Exception expected, invalid extension X-TEST1 (no number allowed)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+    }
+
+    
+    /**
+     * Tests OBSOLETE
+     * 
+     * @throws ParseException
+     */
+    public static void testObsolete( AbstractSchemaParser parser ) throws ParseException
+    {
+        String value = null;
+        AbstractSchemaDescription asd = null;
+
+        // not obsolete
+        value = "( 1.1 )";
+        asd = parser.parse( value );
+        TestCase.assertFalse( asd.isObsolete() );
+
+        // not obsolete
+        value = "( 1.1 NAME 'test' DESC 'Descripton' )";
+        asd = parser.parse( value );
+        TestCase.assertFalse( asd.isObsolete() );
+        
+        // obsolete
+        value = "(1.1 NAME 'test' DESC 'Descripton' OBSOLETE)";
+        asd = parser.parse( value );
+        TestCase.assertTrue( asd.isObsolete() );
+
+        // obsolete 
+        value = "(1.1 OBSOLETE)";
+        asd = parser.parse( value );
+        TestCase.assertTrue( asd.isObsolete() );
+
+        // ivalid
+        value = "(1.1 NAME 'test' DESC 'Descripton' OBSOLET )";
+        try
+        {
+            asd = parser.parse( value );
+            TestCase.fail( "Exception expected, invalid OBSOLETE value" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+        // trailing value not allowed
+        value = "(1.1 NAME 'test' DESC 'Descripton' OBSOLETE 'true' )";
+        try
+        {
+            asd = parser.parse( value );
+            TestCase.fail( "Exception expected, trailing value ('true') now allowed" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+    }
+    
+    
+    
+    /**
+     * Tests the multithreaded use of a single parser.
+     */
+    public static void testMultiThreaded( AbstractSchemaParser parser, String[] testValues ) throws ParseException
+    {
+        final boolean[] isSuccessMultithreaded = new boolean[1];
+        isSuccessMultithreaded[0] = true;
+        
+        // start up and track all threads (40 threads)
+        List<Thread> threads = new ArrayList<Thread>();
+        for ( int ii = 0; ii < 10; ii++ )
+        {
+            for ( int i = 0; i < testValues.length; i++ )
+            {
+                Thread t = new Thread( new ParseSpecification( parser, testValues[i], isSuccessMultithreaded ) );
+                threads.add( t );
+                t.start();
+            }
+        }
+
+        // wait until all threads have died
+        boolean hasLiveThreads = false;
+        do
+        {
+            hasLiveThreads = false;
+
+            for ( int ii = 0; ii < threads.size(); ii++ )
+            {
+                Thread t = ( Thread ) threads.get( ii );
+                hasLiveThreads = hasLiveThreads || t.isAlive();
+            }
+        }
+        while ( hasLiveThreads );
+
+        // check that no one thread failed to parse and generate a SS object
+        TestCase.assertTrue( isSuccessMultithreaded[0] );
+        
+    }
+
+    static class ParseSpecification implements Runnable
+    {
+        private final AbstractSchemaParser parser;
+        private final String value;
+        private final boolean[] isSuccessMultithreaded;
+        
+        private AbstractSchemaDescription result;
+        
+        public ParseSpecification( AbstractSchemaParser parser, String value, boolean[] isSuccessMultithreaded )
+        {
+            this.parser = parser;
+            this.value = value;
+            this.isSuccessMultithreaded = isSuccessMultithreaded;
+        }
+        
+        
+        public void run()
+        {
+            try
+            {
+                result = parser.parse( value );
+            }
+            catch ( ParseException e )
+            {
+                e.printStackTrace();
+            }
+            
+            isSuccessMultithreaded[0] = isSuccessMultithreaded[0] && ( result != null );
+        }
+    }
+    
+    
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescriptionSyntaxChecker.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescriptionSyntaxChecker.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescriptionSyntaxChecker.java	(Revision 0)
@@ -0,0 +1,135 @@
+/*
+ *  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 java.text.ParseException;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleUseDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A SyntaxChecker which verifies that a value follows the
+ * matching rule use descripton syntax according to RFC 4512, par 4.2.4:
+ * 
+ *  <pre>
+ * MatchingRuleUseDescription = LPAREN WSP
+ *    numericoid                 ; object identifier
+ *    [ SP "NAME" SP qdescrs ]   ; short names (descriptors)
+ *    [ SP "DESC" SP qdstring ]  ; description
+ *    [ SP "OBSOLETE" ]          ; not active
+ *    SP "APPLIES" SP oids       ; attribute types
+ *    extensions WSP RPAREN      ; extensions
+ * 
+ * </pre>
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MatchingRuleUseDescriptionSyntaxChecker implements SyntaxChecker
+{
+
+    /** The Syntax OID, according to RFC 4517, par. 3.3.20 */
+    public static final String OID = "1.3.6.1.4.1.1466.115.121.1.31";
+
+	/** The schema parser used to parse the MatchingRuleUseDescription Syntax */
+    private MatchingRuleUseDescriptionSchemaParser schemaParser = new MatchingRuleUseDescriptionSchemaParser();
+
+
+    /**
+     * 
+     * Creates a new instance of MatchingRuleUseDescriptionSchemaParser.
+     *
+     */
+    public MatchingRuleUseDescriptionSyntaxChecker()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#getSyntaxOid()
+     */
+    public String getSyntaxOid()
+    {
+        return OID;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#assertSyntax(java.lang.Object)
+     */
+    public void assertSyntax( Object value ) throws NamingException
+    {
+        if ( !isValidSyntax( value ) )
+        {
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+        }
+    }
+
+
+    /* (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();
+        }
+
+        try
+        {
+            MatchingRuleUseDescription mrud = schemaParser.parseMatchingRuleUseDescription( strValue );
+            
+            // APPLIES must be present
+            if ( ( mrud.getApplicableAttributes()== null ) || ( mrud.getApplicableAttributes().isEmpty() ) ) 
+            {
+                return false;
+            }
+                
+            return true;
+        }
+        catch ( ParseException pe )
+        {
+            return false;
+        }
+    }
+    
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescription.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescription.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleUseDescription.java	(Revision 0)
@@ -0,0 +1,61 @@
+/*
+ *  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 java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+
+/**
+ * RFC 4512 - 4.1.4. Matching Rule Use Description
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class MatchingRuleUseDescription extends AbstractSchemaDescription
+{
+    private List<String> applicableAttributes;
+
+
+    public MatchingRuleUseDescription()
+    {
+        numericOid = "";
+        names = new ArrayList<String>();
+        description = "";
+        isObsolete = false;
+        applicableAttributes = new ArrayList<String>();
+        extensions = new LinkedHashMap<String, List<String>>();
+    }
+
+
+    public List<String> getApplicableAttributes()
+    {
+        return applicableAttributes;
+    }
+
+
+    public void setApplicableAttributes( List<String> applicableAttributes )
+    {
+        this.applicableAttributes = applicableAttributes;
+    }
+
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/AbstractSchemaParser.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/AbstractSchemaParser.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/AbstractSchemaParser.java	(Revision 0)
@@ -0,0 +1,38 @@
+package org.apache.directory.shared.ldap.schema.syntax.parser;
+
+import java.io.StringReader;
+import java.text.ParseException;
+
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
+
+public abstract class AbstractSchemaParser
+{
+
+
+    /** the antlr generated parser being wrapped */
+    protected ReusableAntlrSchemaParser parser;
+
+    /** the antlr generated lexer being wrapped */
+    protected ReusableAntlrSchemaLexer lexer;
+    
+    
+    protected AbstractSchemaParser() 
+    {
+        lexer = new ReusableAntlrSchemaLexer( new StringReader( "" ) );
+        parser = new ReusableAntlrSchemaParser( lexer );
+    }
+    
+    /**
+     * Initializes the plumbing by creating a pipe and coupling the parser/lexer
+     * pair with it. param spec the specification to be parsed
+     */
+    protected void reset( String spec )
+    {
+        StringReader in = new StringReader( spec );
+        lexer.prepareNextInput( in );
+        parser.resetState();
+    }
+    
+    public abstract AbstractSchemaDescription parse( String schemaDescription ) throws ParseException;
+    
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParser.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParser.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParser.java	(Revision 0)
@@ -0,0 +1,107 @@
+/*
+ *  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.parser;
+
+
+import java.text.ParseException;
+
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleUseDescription;
+
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+
+
+/**
+ * A parser for RFC 4512 matching rule use descriptions.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class MatchingRuleUseDescriptionSchemaParser extends AbstractSchemaParser
+{
+
+    /**
+     * Creates a schema parser instance.
+     */
+    public MatchingRuleUseDescriptionSchemaParser()
+    {
+        super();
+    }
+
+
+    /**
+     * Parses a matching rule use description according to RFC 4512:
+     * 
+     * <pre>
+     * MatchingRuleUseDescription = LPAREN WSP
+     *    numericoid                 ; object identifier
+     *    [ SP "NAME" SP qdescrs ]   ; short names (descriptors)
+     *    [ SP "DESC" SP qdstring ]  ; description
+     *    [ SP "OBSOLETE" ]          ; not active
+     *    SP "APPLIES" SP oids       ; attribute types
+     *    extensions WSP RPAREN      ; extensions
+     * 
+     * extensions = *( SP xstring SP qdstrings )
+     * xstring = "X" HYPHEN 1*( ALPHA / HYPHEN / USCORE ) 
+     * </pre>
+     * 
+     * @param matchingRuleUseDescription the matching rule use description to be parsed
+     * @return the parsed MatchingRuleUseDescription bean
+     * @throws ParseException if there are any recognition errors (bad syntax)
+     */
+    public synchronized MatchingRuleUseDescription parseMatchingRuleUseDescription( String matchingRuleUseDescription )
+        throws ParseException
+    {
+
+        if ( matchingRuleUseDescription == null )
+        {
+            throw new ParseException( "Null", 0 );
+        }
+
+        reset( matchingRuleUseDescription ); // reset and initialize the parser / lexer pair
+
+        try
+        {
+            MatchingRuleUseDescription mrud = parser.matchingRuleUseDescription();
+            return mrud;
+        }
+        catch ( RecognitionException re )
+        {
+            String msg = "Parser failure on matching rule description:\n\t" + matchingRuleUseDescription;
+            msg += "\nAntlr message: " + re.getMessage();
+            msg += "\nAntlr column: " + re.getColumn();
+            throw new ParseException( msg, re.getColumn() );
+        }
+        catch ( TokenStreamException tse )
+        {
+            String msg = "Parser failure on matching rule description:\n\t" + matchingRuleUseDescription;
+            msg += "\nAntlr message: " + tse.getMessage();
+            throw new ParseException( msg, 0 );
+        }
+
+    }
+
+
+    public AbstractSchemaDescription parse( String schemaDescription ) throws ParseException
+    {
+        return parseMatchingRuleUseDescription( schemaDescription );
+    }
+
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParser.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParser.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParser.java	(Revision 0)
@@ -0,0 +1,107 @@
+/*
+ *  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.parser;
+
+
+import java.text.ParseException;
+
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
+
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+
+
+/**
+ * A parser for RFC 4512 matching rule descriptions.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class MatchingRuleDescriptionSchemaParser extends AbstractSchemaParser
+{
+
+    /**
+     * Creates a schema parser instance.
+     */
+    public MatchingRuleDescriptionSchemaParser()
+    {
+        super();
+    }
+
+
+    /**
+     * Parses a matching rule description according to RFC 4512:
+     * 
+     * <pre>
+     * MatchingRuleDescription = LPAREN WSP
+     *    numericoid                 ; object identifier
+     *    [ SP "NAME" SP qdescrs ]   ; short names (descriptors)
+     *    [ SP "DESC" SP qdstring ]  ; description
+     *    [ SP "OBSOLETE" ]          ; not active
+     *    SP "SYNTAX" SP numericoid  ; assertion syntax
+     *    extensions WSP RPAREN      ; extensions
+     * 
+     * extensions = *( SP xstring SP qdstrings )
+     * xstring = "X" HYPHEN 1*( ALPHA / HYPHEN / USCORE ) 
+     * </pre>
+     * 
+     * @param matchingRuleDescription the matching rule description to be parsed
+     * @return the parsed MatchingRuleDescription bean
+     * @throws ParseException if there are any recognition errors (bad syntax)
+     */
+    public synchronized MatchingRuleDescription parseMatchingRuleDescription( String matchingRuleDescription )
+        throws ParseException
+    {
+
+        if ( matchingRuleDescription == null )
+        {
+            throw new ParseException( "Null", 0 );
+        }
+
+        reset( matchingRuleDescription ); // reset and initialize the parser / lexer pair
+
+        try
+        {
+            MatchingRuleDescription mrd = parser.matchingRuleDescription();
+            return mrd;
+        }
+        catch ( RecognitionException re )
+        {
+            String msg = "Parser failure on matching rule description:\n\t" + matchingRuleDescription;
+            msg += "\nAntlr message: " + re.getMessage();
+            msg += "\nAntlr column: " + re.getColumn();
+            throw new ParseException( msg, re.getColumn() );
+        }
+        catch ( TokenStreamException tse )
+        {
+            String msg = "Parser failure on matching rule description:\n\t" + matchingRuleDescription;
+            msg += "\nAntlr message: " + tse.getMessage();
+            throw new ParseException( msg, 0 );
+        }
+
+    }
+
+
+    public AbstractSchemaDescription parse( String schemaDescription ) throws ParseException
+    {
+        return parseMatchingRuleDescription( schemaDescription );
+    }
+
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescriptionSyntaxChecker.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescriptionSyntaxChecker.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescriptionSyntaxChecker.java	(Revision 0)
@@ -0,0 +1,138 @@
+/*
+ *  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 java.text.ParseException;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * A SyntaxChecker which verifies that a value follows the
+ * matching rule descripton syntax according to RFC 4512, par 4.2.3:
+ * 
+ *  <pre>
+ * MatchingRuleDescription = LPAREN WSP
+ *    numericoid                 ; object identifier
+ *    [ SP "NAME" SP qdescrs ]   ; short names (descriptors)
+ *    [ SP "DESC" SP qdstring ]  ; description
+ *    [ SP "OBSOLETE" ]          ; not active
+ *    SP "SYNTAX" SP numericoid  ; assertion syntax
+ *    extensions WSP RPAREN      ; extensions
+ * 
+ * extensions = *( SP xstring SP qdstrings )
+ * xstring = "X" HYPHEN 1*( ALPHA / HYPHEN / USCORE ) 
+ * 
+ * </pre>
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MatchingRuleDescriptionSyntaxChecker implements SyntaxChecker
+{
+
+    /** The Syntax OID, according to RFC 4517, par. 3.3.19 */
+    public static final String OID = "1.3.6.1.4.1.1466.115.121.1.30";
+
+	/** The schema parser used to parse the MatchingRuleDescription Syntax */
+    private MatchingRuleDescriptionSchemaParser schemaParser = new MatchingRuleDescriptionSchemaParser();
+
+
+    /**
+     * 
+     * Creates a new instance of MatchingRuleDescriptionSchemaParser.
+     *
+     */
+    public MatchingRuleDescriptionSyntaxChecker()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#getSyntaxOid()
+     */
+    public String getSyntaxOid()
+    {
+        return OID;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.SyntaxChecker#assertSyntax(java.lang.Object)
+     */
+    public void assertSyntax( Object value ) throws NamingException
+    {
+        if ( !isValidSyntax( value ) )
+        {
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
+        }
+    }
+
+
+    /* (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();
+        }
+
+        try
+        {
+            MatchingRuleDescription mrd = schemaParser.parseMatchingRuleDescription( strValue );
+            
+            // SYNTAX must be present
+            if ( ( mrd.getSyntax() == null ) ) 
+            {
+                return false;
+            }
+            
+            return true;
+        }
+        catch ( ParseException pe )
+        {
+            return false;
+        }
+    }
+    
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescription.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescription.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MatchingRuleDescription.java	(Revision 0)
@@ -0,0 +1,52 @@
+/*
+ *  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;
+
+
+/**
+ * RFC 4512 - 4.1.3. Matching Rule Description
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class MatchingRuleDescription extends AbstractSchemaDescription
+{
+
+    private String syntax;
+
+
+    public MatchingRuleDescription()
+    {
+        syntax = null;
+    }
+
+
+    public String getSyntax()
+    {
+        return syntax;
+    }
+
+
+    public void setSyntax( String syntax )
+    {
+        this.syntax = syntax;
+    }
+
+}
Index: shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java
===================================================================
--- shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java	(Revision 0)
+++ shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/AbstractSchemaDescription.java	(Revision 0)
@@ -0,0 +1,95 @@
+package org.apache.directory.shared.ldap.schema.syntax;
+
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+
+public class AbstractSchemaDescription
+{
+
+    protected String numericOid;
+    protected List<String> names;
+    protected String description;
+    protected boolean isObsolete;
+    protected Map<String, List<String>> extensions;
+
+
+    protected AbstractSchemaDescription()
+    {
+        numericOid = "";
+        names = new ArrayList<String>();
+        description = "";
+        isObsolete = false;
+        extensions = new LinkedHashMap<String, List<String>>();
+    }
+
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+
+    public Map<String, List<String>> getExtensions()
+    {
+        return extensions;
+    }
+
+
+    public void setExtensions( Map<String, List<String>> extensions )
+    {
+        this.extensions = extensions;
+    }
+
+
+    public boolean isObsolete()
+    {
+        return isObsolete;
+    }
+
+
+    public void setObsolete( boolean isObsolete )
+    {
+        this.isObsolete = isObsolete;
+    }
+
+
+    public List<String> getNames()
+    {
+        return names;
+    }
+
+
+    public void setNames( List<String> names )
+    {
+        this.names = names;
+    }
+
+
+    public String getNumericOid()
+    {
+        return numericOid;
+    }
+
+
+    public void setNumericOid( String oid )
+    {
+        this.numericOid = oid;
+    }
+
+
+    public void addExtension( String key, List<String> values )
+    {
+        extensions.put( key, values );
+    }
+
+}
