directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r892895 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/
Date Mon, 21 Dec 2009 17:41:13 GMT
Author: elecharny
Date: Mon Dec 21 17:41:12 2009
New Revision: 892895

URL: http://svn.apache.org/viewvc?rev=892895&view=rev
Log:
Injected the schemaName into the created SchemaObject, or put "other" if none

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AbstractSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AttributeTypeDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITContentRuleDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITStructureRuleDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapComparatorDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapSyntaxDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleUseDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NameFormDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NormalizerDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ObjectClassDescriptionSchemaParser.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/SyntaxCheckerDescriptionSchemaParser.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AbstractSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AbstractSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AbstractSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AbstractSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -22,8 +22,11 @@
 
 import java.io.StringReader;
 import java.text.ParseException;
+import java.util.List;
 
+import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 
@@ -111,4 +114,34 @@
      * @throws ParseException If the parsing failed
      */
     public abstract SchemaObject parse( String schemaDescription ) throws ParseException;
+    
+    
+    /**
+     * Update the schemaName for this SchemaObject, accordingly to the X-SCHEMA parameter.
If
+     * not present, default to 'other'
+     */
+    protected void setSchemaName( SchemaObject schemaObject )
+    {
+        
+        // Update the Schema if we have the X-SCHEMA extension
+        List<String> schemaExtension = schemaObject.getExtensions().get( MetaSchemaConstants.X_SCHEMA
);
+        
+        if ( schemaExtension != null )
+        {
+            String schemaName = schemaExtension.get( 0 );
+            
+            if ( StringTools.isEmpty( schemaName ) )
+            {
+                schemaObject.setSchemaName( MetaSchemaConstants.SCHEMA_OTHER );
+            }
+            else
+            {
+                schemaObject.setSchemaName( schemaName );
+            }
+        }
+        else
+        {
+            schemaObject.setSchemaName( MetaSchemaConstants.SCHEMA_OTHER );
+        }
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AttributeTypeDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AttributeTypeDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AttributeTypeDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/AttributeTypeDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -26,7 +26,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 import antlr.TokenStreamRecognitionException;
@@ -101,6 +100,10 @@
         try
         {
             AttributeType attributeType = parser.attributeTypeDescription();
+            
+            // Update the schemaName
+            setSchemaName( attributeType );
+
             return attributeType;
         }
         catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITContentRuleDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITContentRuleDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITContentRuleDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITContentRuleDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -26,7 +26,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -86,6 +85,10 @@
         try
         {
             DITContentRule ditContentRule = parser.ditContentRuleDescription();
+            
+            // Update the schemaName
+            setSchemaName( ditContentRule );
+
             return ditContentRule;
         }
         catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITStructureRuleDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITStructureRuleDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITStructureRuleDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/DITStructureRuleDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -26,7 +26,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -90,6 +89,10 @@
         try
         {
             DITStructureRule ditStructureRule = parser.ditStructureRuleDescription();
+
+            // Update the schemaName
+            setSchemaName( ditStructureRule );
+
             return ditStructureRule;
         }
         catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapComparatorDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapComparatorDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapComparatorDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapComparatorDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -25,7 +25,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -94,6 +93,10 @@
                 LdapComparatorDescription ldapComparatorDescription = parser.ldapComparator();
                 LOG.debug( "Parsed a LdapComparator : {}", ldapComparatorDescription );
                 
+
+                // Update the schemaName
+                setSchemaName( ldapComparatorDescription );
+
                 return ldapComparatorDescription;
             }
             catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapSyntaxDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapSyntaxDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapSyntaxDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/LdapSyntaxDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -80,6 +80,10 @@
         {
             LdapSyntax ldapSyntax = parser.ldapSyntaxDescription();
             ldapSyntax.setSpecification( ldapSyntaxDescription );
+
+            // Update the schemaName
+            setSchemaName( ldapSyntax );
+                
             return ldapSyntax;
         }
         catch ( RecognitionException re )

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=892895&r1=892894&r2=892895&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
Mon Dec 21 17:41:12 2009
@@ -26,7 +26,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -86,6 +85,10 @@
         try
         {
             MatchingRule matchingRule = parser.matchingRuleDescription();
+            
+            // Update the schemaName
+            setSchemaName( matchingRule );
+
             return matchingRule;
         }
         catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleUseDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleUseDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleUseDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/MatchingRuleUseDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -26,7 +26,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -87,6 +86,10 @@
         try
         {
             MatchingRuleUse matchingRuleUse = parser.matchingRuleUseDescription();
+            
+            // Update the schemaName
+            setSchemaName( matchingRuleUse );
+
             return matchingRuleUse;
         }
         catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NameFormDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NameFormDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NameFormDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NameFormDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -26,7 +26,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -85,6 +84,10 @@
         try
         {
             NameForm nameForm = parser.nameFormDescription();
+            
+            // Update the schemaName
+            setSchemaName( nameForm );
+
             return nameForm;
         }
         catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NormalizerDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NormalizerDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NormalizerDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/NormalizerDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -25,7 +25,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -90,8 +89,12 @@
 
         try
         {
-            NormalizerDescription nd = parser.normalizerDescription();
-            return nd;
+            NormalizerDescription normalizer = parser.normalizerDescription();
+
+            // Update the schemaName
+            setSchemaName( normalizer );
+
+            return normalizer;
         }
         catch ( RecognitionException re )
         {

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ObjectClassDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ObjectClassDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ObjectClassDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/ObjectClassDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -26,7 +26,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -93,6 +92,10 @@
         try
         {
             ObjectClass objectClass = parser.objectClassDescription();
+
+            // Update the schemaName
+            setSchemaName( objectClass );
+
             return objectClass;
         }
         catch ( RecognitionException re )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/SyntaxCheckerDescriptionSchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/SyntaxCheckerDescriptionSchemaParser.java?rev=892895&r1=892894&r2=892895&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/SyntaxCheckerDescriptionSchemaParser.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/parsers/SyntaxCheckerDescriptionSchemaParser.java
Mon Dec 21 17:41:12 2009
@@ -25,7 +25,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 
@@ -89,6 +88,10 @@
         try
         {
         	SyntaxCheckerDescription syntaxChecker = parser.syntaxCheckerDescription();
+
+            // Update the schemaName
+            setSchemaName( syntaxChecker );
+
             return syntaxChecker;
         }
         catch ( RecognitionException re )



Mime
View raw message