directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r807016 - in /directory/shared/branches/shared-schema/ldap/src/main: antlr/ java/org/apache/directory/shared/ldap/schema/parsers/
Date Sun, 23 Aug 2009 20:55:17 GMT
Author: elecharny
Date: Sun Aug 23 20:55:17 2009
New Revision: 807016

URL: http://svn.apache.org/viewvc?rev=807016&view=rev
Log:
Fixed the MatchingRule[Description[Parser]] classes

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/antlr/schema.g
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescription.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescriptionSchemaParser.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/antlr/schema.g
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/antlr/schema.g?rev=807016&r1=807015&r2=807016&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/antlr/schema.g (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/antlr/schema.g Sun Aug 23 20:55:17
2009
@@ -513,13 +513,13 @@
      *    extensions WSP RPAREN      ; extensions
      * </pre>
     */
-matchingRuleDescription returns [MatchingRuleDescription mrd = new MatchingRuleDescription()]
+matchingRuleDescription returns [MatchingRuleDescription mrd]
     {
         matchedProduction( "matchingRuleDescription()" );
         ElementTracker et = new ElementTracker();
     }
     :
-    ( oid:STARTNUMERICOID { mrd.setNumericOid(numericoid(oid.getText())); } )
+    ( oid:STARTNUMERICOID { mrd = new MatchingRuleDescription(numericoid(oid.getText()));
} )
     (
         ( name:NAME { et.track("NAME", name); mrd.setNames(qdescrs(name.getText())); } )
         |

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescription.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescription.java?rev=807016&r1=807015&r2=807016&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescription.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescription.java
Sun Aug 23 20:55:17 2009
@@ -20,6 +20,9 @@
 
 package org.apache.directory.shared.ldap.schema.parsers;
 
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
 
 /**
  * RFC 4512 - 4.1.3. Matching Rule Description
@@ -27,20 +30,20 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class MatchingRuleDescription extends AbstractSchemaDescription
+public class MatchingRuleDescription extends SchemaObject
 {
-    /** The matching rule's description */
-    private String syntax;
+    /** The serialVersionUID */
+    private static final long serialVersionUID = 1L;
 
+    /** The matching rule's Syntax element */
+    private String syntax;
 
     /**
-     * 
-     * Creates a new instance of MatchingRuleDescription.
-     *
+     * Creates a new instance of MatcfhingRuleDescription
      */
-    public MatchingRuleDescription()
+    public MatchingRuleDescription( String oid )
     {
-        syntax = null;
+        super(  SchemaObjectType.MATCHING_RULE, oid );
     }
 
 
@@ -62,5 +65,4 @@
     {
         this.syntax = syntax;
     }
-
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescriptionSchemaParser.java?rev=807016&r1=807015&r2=807016&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescriptionSchemaParser.java
Sun Aug 23 20:55:17 2009
@@ -22,6 +22,9 @@
 
 import java.text.ParseException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
@@ -35,6 +38,8 @@
  */
 public class MatchingRuleDescriptionSchemaParser extends AbstractSchemaParser
 {
+    /** The LoggerFactory used by this class */
+    protected static final Logger LOG = LoggerFactory.getLogger( MatchingRuleDescriptionSchemaParser.class
);
 
     /**
      * Creates a schema parser instance.
@@ -70,6 +75,7 @@
 
         if ( matchingRuleDescription == null )
         {
+            LOG.error( "Cannot parse a null MatchingRule" );
             throw new ParseException( "Null", 0 );
         }
 
@@ -82,24 +88,30 @@
         }
         catch ( RecognitionException re )
         {
-            String msg = "Parser failure on matching rule description:\n\t" + matchingRuleDescription;
-            msg += "\nAntlr message: " + re.getMessage();
-            msg += "\nAntlr column: " + re.getColumn();
+            String msg = "Parser failure on matching rule description:\n\t" + matchingRuleDescription
+
+                "\nAntlr message: " + re.getMessage() +
+                "\nAntlr column: " + re.getColumn();
+            LOG.error( msg );
             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();
+            String msg = "Parser failure on matching rule description:\n\t" + matchingRuleDescription
+
+                "\nAntlr message: " + tse.getMessage();
+            LOG.error( msg );
             throw new ParseException( msg, 0 );
         }
-
     }
 
 
-    public AbstractSchemaDescription parse( String schemaDescription ) throws ParseException
+    /**
+     * Parses a MatchingRul description
+     * 
+     * @param The MatchingRul description to parse
+     * @return An instance of MatchingRulDescription
+     */
+    public MatchingRuleDescription parse( String schemaDescription ) throws ParseException
     {
         return parseMatchingRuleDescription( schemaDescription );
     }
-
 }



Mime
View raw message