directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r628394 - in /directory/apacheds/branches/bigbang: core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java
Date Sun, 17 Feb 2008 00:12:38 GMT
Author: elecharny
Date: Sat Feb 16 16:12:37 2008
New Revision: 628394

URL: http://svn.apache.org/viewvc?rev=628394&view=rev
Log:
Improved the way MR and Syntax are handled. They are not anymore fetched each time, but initialized
only once, at the first request.

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
    directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java?rev=628394&r1=628393&r2=628394&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
Sat Feb 16 16:12:37 2008
@@ -45,10 +45,30 @@
 
     private final Registries registries;
     
+    /** The syntax OID associated with this AttributeType */
     private String syntaxOid;
+    
+    /** The syntax associated with the syntaxID */
+    private Syntax syntax;
+    
+    /** The equality OID associated with this AttributeType */
     private String equalityOid;
+
+    /** The equality MatchingRule associated with the equalityID */
+    private MatchingRule equalityMR;
+    
+    /** The substring OID associated with this AttributeType */
     private String substrOid;
+
+    /** The substring MatchingRule associated with the substringID */
+    private MatchingRule substringMR;
+    
+    /** The ordering OID associated with this AttributeType */
     private String orderingOid;
+    
+    /** The ordering MatchingRule associated with the orderingID */
+    private MatchingRule orderingMR;
+    
     private String superiorOid;
     
     
@@ -64,12 +84,19 @@
      */
     public MatchingRule getEquality() throws NamingException
     {
-        if ( equalityOid == null )
+        if ( equalityMR == null )
         {
-            return findEquality( getSuperior() );
+            if ( equalityOid == null )
+            {
+                equalityMR = findEquality( getSuperior() );
+            }
+            else
+            {
+                equalityMR = registries.getMatchingRuleRegistry().lookup( equalityOid );
+            }
         }
         
-        return registries.getMatchingRuleRegistry().lookup( equalityOid );
+        return equalityMR;
     }
 
 
@@ -88,6 +115,7 @@
         }
         
         MatchingRule mr = at.getEquality();
+        
         if ( mr == null )
         {
             return findEquality( at.getSuperior() );
@@ -104,12 +132,19 @@
      */
     public MatchingRule getOrdering() throws NamingException
     {
-        if ( orderingOid == null )
+        if ( orderingMR == null )
         {
-            return findOrdering( getSuperior() );
+            if ( orderingOid == null )
+            {
+                orderingMR = findOrdering( getSuperior() );
+            }
+            else
+            {
+                orderingMR = registries.getMatchingRuleRegistry().lookup( orderingOid );
+            }
         }
         
-        return registries.getMatchingRuleRegistry().lookup( orderingOid );
+        return orderingMR;
     }
 
 
@@ -144,12 +179,19 @@
      */
     public MatchingRule getSubstr() throws NamingException
     {
-        if ( substrOid == null )
+        if ( substringMR == null )
         {
-            return findSubstr( getSuperior() );
+            if ( substrOid == null )
+            {
+                substringMR = findSubstr( getSuperior() );
+            }
+            else
+            {
+                substringMR = registries.getMatchingRuleRegistry().lookup( substrOid );
+            }
         }
         
-        return registries.getMatchingRuleRegistry().lookup( substrOid );
+        return substringMR;
     }
 
 
@@ -198,12 +240,19 @@
      */
     public Syntax getSyntax() throws NamingException
     {
-        if ( syntaxOid == null )
+        if ( syntax == null )
         {
-            return findSyntax( getSuperior() );
+            if ( syntaxOid == null )
+            {
+                syntax = findSyntax( getSuperior() );
+            }
+            else
+            {
+                syntax = registries.getSyntaxRegistry().lookup( syntaxOid );
+            }
         }
         
-        return registries.getSyntaxRegistry().lookup( syntaxOid );
+        return syntax;
     }
     
     

Modified: directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java?rev=628394&r1=628393&r2=628394&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java
(original)
+++ directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java
Sat Feb 16 16:12:37 2008
@@ -231,10 +231,30 @@
         private final MatchingRuleRegistry matchingRuleRegistry;
         private final AttributeTypeRegistry attributeTypeRegistry;
         private String superiorId;
+        
+        /** The equality OID for this AttributeType */
         private String equalityId;
+
+        /** The MatchingRule associated with the equalityID */
+        private MatchingRule equalityMR;
+        
+        /** The substring OID for this AttributeType */
         private String substrId;
+        
+        /** The MatchingRule associated with the substrID */
+        private MatchingRule substrMR;
+        
+        /** The ordering OID for this AttributeType */
         private String orderingId;
+        
+        /** The MatchingRule associated with the orderingID */
+        private MatchingRule orderingMR;
+
+        /** The syntax OID for this attributeType */
         private String syntaxId;
+        
+        /** The Syntax associated with the syntaxID */
+        private Syntax syntax;
 
 
         public BootstrapAttributeType(String oid, Registries registries)
@@ -276,19 +296,24 @@
         }
 
 
+        /**
+         * @return The MatchingRule associated with the AttributeType
+         */
         public MatchingRule getEquality() throws NamingException
         {
-            if ( equalityId != null )
-            {
-                return this.matchingRuleRegistry.lookup( equalityId );
-            }
+        	if ( equalityMR == null )
+        	{
+	            if ( equalityId != null )
+	            {
+	                equalityMR = this.matchingRuleRegistry.lookup( equalityId );
+	            }
+	            else if ( superiorId != null )
+	            {
+	            	equalityMR = getSuperior().getEquality();
+	            }
+        	}
 
-            if ( superiorId != null )
-            {
-                return getSuperior().getEquality();
-            }
-
-            return null;
+            return equalityMR;
         }
 
 
@@ -300,17 +325,19 @@
 
         public MatchingRule getSubstr() throws NamingException
         {
-            if ( substrId != null )
-            {
-                return this.matchingRuleRegistry.lookup( substrId );
-            }
-
-            if ( superiorId != null )
+            if ( substrMR == null )
             {
-                return getSuperior().getSubstr();
+                if ( substrId != null )
+                {
+                    substrMR = matchingRuleRegistry.lookup( substrId );
+                }
+                else if ( superiorId != null )
+                {
+                    substrMR = getSuperior().getSubstr();
+                }
             }
 
-            return null;
+            return substrMR;
         }
 
 
@@ -332,19 +359,24 @@
         }
 
 
+        /**
+         * @return The Ordering Matching Rule associated with this AttributeType
+         */
         public MatchingRule getOrdering() throws NamingException
         {
-            if ( orderingId != null )
+            if ( orderingMR == null )
             {
-                return this.matchingRuleRegistry.lookup( orderingId );
+                if ( orderingId != null )
+                {
+                    orderingMR = matchingRuleRegistry.lookup( orderingId );
+                }
+                else if ( superiorId != null )
+                {
+                    orderingMR = getSuperior().getOrdering();
+                }
             }
 
-            if ( superiorId != null )
-            {
-                return getSuperior().getOrdering();
-            }
-
-            return null;
+            return orderingMR;
         }
 
 
@@ -360,19 +392,24 @@
         }
 
 
+        /**
+         * @return The Syntax associated with the AttributeType
+         */
         public Syntax getSyntax() throws NamingException
         {
-            if ( syntaxId != null )
-            {
-                return this.syntaxRegistry.lookup( syntaxId );
-            }
-
-            if ( superiorId != null )
-            {
-                return getSuperior().getSyntax();
-            }
+        	if ( syntax == null )
+        	{
+	            if ( syntaxId != null )
+	            {
+	                syntax = syntaxRegistry.lookup( syntaxId );
+	            }
+	            else if ( superiorId != null )
+	            {
+	            	syntax = getSuperior().getSyntax();
+	            }
+        	}
 
-            return null;
+        	return syntax;
         }
 
 



Mime
View raw message