directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r357550 - /directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/
Date Sun, 18 Dec 2005 23:20:42 GMT
Author: elecharny
Date: Sun Dec 18 15:20:28 2005
New Revision: 357550

URL: http://svn.apache.org/viewcvs?rev=357550&view=rev
Log:
 - Added a toString() method
 - deleted the Monitor usage

Modified:
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapAttributeTypeRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapComparatorRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitContentRuleRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitStructureRuleRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapAttributeTypeRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapAttributeTypeRegistry.java?rev=357550&r1=357549&r2=357550&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapAttributeTypeRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapAttributeTypeRegistry.java
Sun Dec 18 15:20:28 2005
@@ -23,10 +23,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.AttributeType;
 import org.apache.ldap.server.schema.AttributeTypeRegistry;
-import org.apache.ldap.server.schema.AttributeTypeRegistryMonitor;
-import org.apache.ldap.server.schema.AttributeTypeRegistryMonitorAdapter;
 import org.apache.ldap.server.schema.OidRegistry;
 
 
@@ -40,12 +39,12 @@
 {
     /** maps an OID to an AttributeType */
     private final Map byOid;
+    
     /** maps an OID to a schema name*/
     private final Map oidToSchema;
+
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
-    /** monitor notified via callback events */
-    private AttributeTypeRegistryMonitor monitor;
 
 
     // ------------------------------------------------------------------------
@@ -61,21 +60,8 @@
         this.byOid = new HashMap();
         this.oidToSchema = new HashMap();
         this.oidRegistry = oidRegistry;
-        this.monitor = new AttributeTypeRegistryMonitorAdapter();
     }
 
-
-    /**
-     * Sets the monitor that is to be notified via callback events.
-     *
-     * @param monitor the new monitor to notify of notable events
-     */
-    public void setMonitor( AttributeTypeRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
-    }
-
-
     // ------------------------------------------------------------------------
     // Service Methods
     // ------------------------------------------------------------------------
@@ -87,7 +73,6 @@
         {
             NamingException e = new NamingException( "attributeType w/ OID " +
                 attributeType.getOid() + " has already been registered!" );
-            monitor.registerFailed( attributeType, e );
             throw e;
         }
 
@@ -99,7 +84,6 @@
 
         oidToSchema.put( attributeType.getOid(), schema );
         byOid.put( attributeType.getOid(), attributeType );
-        monitor.registered( attributeType );
     }
 
 
@@ -111,12 +95,10 @@
         {
             NamingException e = new NamingException( "attributeType w/ OID "
                 + id + " not registered!" );
-            monitor.lookupFailed( id, e );
             throw e;
         }
 
         AttributeType attributeType = ( AttributeType ) byOid.get( id );
-        monitor.lookedUp( attributeType );
         return attributeType;
     }
 
@@ -155,5 +137,39 @@
     public Iterator list()
     {
         return byOid.values().iterator();
+    }
+    
+    /**
+     * A String representation of this class
+     */
+    public String toString( String tabs )
+    {
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs ).append(  "BootstrapAttributeTypeRegistry : {\n" );
+    	
+    	sb.append( tabs ).append(  "  By oid : \n" );
+    	
+    	sb.append( tabs ).append(  StringUtils.mapToString( byOid, "    " ) ) .append( '\n'
);
+    	
+    	sb.append( tabs ).append(  "  Oid to schema : \n" );
+
+    	sb.append( tabs ).append(  StringUtils.mapToString( oidToSchema, "    " ) ) .append(
'\n' );
+    	
+    	sb.append( tabs ).append(  "  OidRegistry :\n" );
+    	
+    	sb.append( oidRegistry.toString( tabs + "    " ) );
+    	
+    	sb.append( tabs ).append(  "}\n" );
+    	
+    	return sb.toString();
+    }
+
+    /**
+     * A String representation of this class
+     */
+    public String toString()
+    {
+    	return toString( "" );
     }
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapComparatorRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapComparatorRegistry.java?rev=357550&r1=357549&r2=357550&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapComparatorRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapComparatorRegistry.java
Sun Dec 18 15:20:28 2005
@@ -23,9 +23,8 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.server.schema.ComparatorRegistry;
-import org.apache.ldap.server.schema.ComparatorRegistryMonitor;
-import org.apache.ldap.server.schema.ComparatorRegistryMonitorAdapter;
 import org.apache.ldap.server.schema.SerializableComparator;
 
 
@@ -39,17 +38,14 @@
 {
     /** the comparators in this registry */
     private final Map comparators;
+
     /** maps an OID to a schema name*/
     private final Map oidToSchema;
-    /** the monitor for delivering callback events */
-    private ComparatorRegistryMonitor monitor;
 
 
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
-
-
     /**
      * Creates a default ComparatorRegistry by initializing the map and the
      * montior.
@@ -58,23 +54,10 @@
     {
         this.oidToSchema = new HashMap();
         this.comparators = new HashMap();
-        this.monitor = new ComparatorRegistryMonitorAdapter();
 
         SerializableComparator.setRegistry( this );
     }
 
-
-    /**
-     * Sets the monitor used by this registry.
-     *
-     * @param monitor the monitor to set for registry event callbacks
-     */
-    public void setMonitor( ComparatorRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
-    }
-
-
     // ------------------------------------------------------------------------
     // Service Methods
     // ------------------------------------------------------------------------
@@ -86,13 +69,11 @@
         {
             NamingException e = new NamingException( "Comparator with OID "
                 + oid + " already registered!" );
-            monitor.registerFailed( oid, comparator, e );
             throw e;
         }
 
         oidToSchema.put( oid, schema );
         comparators.put( oid, comparator );
-        monitor.registered( oid, comparator );
     }
 
 
@@ -101,13 +82,11 @@
         if ( comparators.containsKey( oid ) )
         {
             Comparator c = ( Comparator ) comparators.get( oid );
-            monitor.lookedUp( oid, c );
             return c;
         }
 
 
         NamingException e = new NamingException( "Comparator not found for OID: " + oid );
-        monitor.lookupFailed( oid, e );
         throw e;
     }
 
@@ -132,5 +111,35 @@
 
         throw new NamingException( "OID " + oid + " not found in oid to " +
             "schema name map!" );
+    }
+    
+    /**
+     * A String representation of this class
+     */
+    public String toString( String tabs )
+    {
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs).append( "BootstrapComparatorRegistry : {\n" );
+    	
+    	sb.append( tabs).append( "  Comparators : \n" );
+    	
+    	sb.append( tabs).append( StringUtils.mapToString( comparators, "    " ) ) .append( '\n'
);
+    	
+    	sb.append( tabs).append( "  By schema : \n" );
+
+    	sb.append( tabs).append( StringUtils.mapToString( oidToSchema, "    " ) ) .append( '\n'
);
+
+    	sb.append( tabs).append( "}\n" );
+    	
+    	return sb.toString();
+    }
+    
+    /**
+     * A String representation of this class
+     */
+    public String toString()
+    {
+    	return toString( "" );
     }
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitContentRuleRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitContentRuleRegistry.java?rev=357550&r1=357549&r2=357550&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitContentRuleRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitContentRuleRegistry.java
Sun Dec 18 15:20:28 2005
@@ -23,10 +23,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.DITContentRule;
 import org.apache.ldap.server.schema.DITContentRuleRegistry;
-import org.apache.ldap.server.schema.DITContentRuleRegistryMonitor;
-import org.apache.ldap.server.schema.DITContentRuleRegistryMonitorAdapter;
 import org.apache.ldap.server.schema.OidRegistry;
 
 
@@ -40,19 +39,16 @@
 {
     /** maps an OID to an DITContentRule */
     private final Map byOid;
+
     /** maps an OID to a schema name*/
     private final Map oidToSchema;
+    
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
-    /** monitor notified via callback events */
-    private DITContentRuleRegistryMonitor monitor;
-
 
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
-
-
     /**
      * Creates an empty BootstrapDitContentRuleRegistry.
      */
@@ -61,21 +57,8 @@
         this.byOid = new HashMap();
         this.oidToSchema = new HashMap();
         this.oidRegistry = oidRegistry;
-        this.monitor = new DITContentRuleRegistryMonitorAdapter();
-    }
-
-
-    /**
-     * Sets the monitor that is to be notified via callback events.
-     *
-     * @param monitor the new monitor to notify of notable events
-     */
-    public void setMonitor( DITContentRuleRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
     }
 
-
     // ------------------------------------------------------------------------
     // Service Methods
     // ------------------------------------------------------------------------
@@ -87,14 +70,12 @@
         {
             NamingException e = new NamingException( "dITContentRule w/ OID " +
                 dITContentRule.getOid() + " has already been registered!" );
-            monitor.registerFailed( dITContentRule, e );
             throw e;
         }
 
         oidRegistry.register( dITContentRule.getName(), dITContentRule.getOid() ) ;
         byOid.put( dITContentRule.getOid(), dITContentRule );
         oidToSchema.put( dITContentRule.getOid(), schema );
-        monitor.registered( dITContentRule );
     }
 
 
@@ -106,12 +87,10 @@
         {
             NamingException e = new NamingException( "dITContentRule w/ OID "
                 + id + " not registered!" );
-            monitor.lookupFailed( id, e );
             throw e;
         }
 
         DITContentRule dITContentRule = ( DITContentRule ) byOid.get( id );
-        monitor.lookedUp( dITContentRule );
         return dITContentRule;
     }
 
@@ -150,5 +129,39 @@
     public Iterator list()
     {
         return byOid.values().iterator();
+    }
+    
+    /**
+     * A String representation of this class
+     */
+    public String toString( String tabs )
+    {
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs ).append( "BootstrapDitContentRuleRegistry : {\n" );
+    	
+    	sb.append( tabs ).append( "  By oid : \n" );
+    	
+    	sb.append( tabs ).append( StringUtils.mapToString( byOid, "    " ) ) .append( '\n' );
+    	
+    	sb.append( tabs ).append( "  Oid to schema : \n" );
+
+    	sb.append( tabs ).append( StringUtils.mapToString( oidToSchema, "    " ) ) .append(
'\n' );
+    	
+    	sb.append( tabs ).append( "  OidRegistry :\n" );
+    	
+    	sb.append( oidRegistry.toString( tabs + "    " ) );
+    	
+    	sb.append( tabs ).append( "}\n" );
+    	
+    	return sb.toString();
+    }
+
+    /**
+     * A String representation of this class
+     */
+    public String toString()
+    {
+    	return toString( "" );
     }
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitStructureRuleRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitStructureRuleRegistry.java?rev=357550&r1=357549&r2=357550&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitStructureRuleRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapDitStructureRuleRegistry.java
Sun Dec 18 15:20:28 2005
@@ -23,10 +23,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.DITStructureRule;
 import org.apache.ldap.server.schema.DITStructureRuleRegistry;
-import org.apache.ldap.server.schema.DITStructureRuleRegistryMonitor;
-import org.apache.ldap.server.schema.DITStructureRuleRegistryMonitorAdapter;
 import org.apache.ldap.server.schema.OidRegistry;
 
 
@@ -40,12 +39,12 @@
 {
     /** maps an OID to an DITStructureRule */
     private final Map byOid;
+
     /** maps an OID to a schema name*/
     private final Map oidToSchema;
+    
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
-    /** monitor notified via callback events */
-    private DITStructureRuleRegistryMonitor monitor;
 
 
     // ------------------------------------------------------------------------
@@ -60,22 +59,9 @@
     {
         this.byOid = new HashMap();
         this.oidToSchema = new HashMap();
-        this.monitor = new DITStructureRuleRegistryMonitorAdapter();
         this.oidRegistry = oidRegistry;
     }
 
-
-    /**
-     * Sets the monitor that is to be notified via callback events.
-     *
-     * @param monitor the new monitor to notify of notable events
-     */
-    public void setMonitor( DITStructureRuleRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
-    }
-
-
     // ------------------------------------------------------------------------
     // Service Methods
     // ------------------------------------------------------------------------
@@ -87,14 +73,12 @@
         {
             NamingException e = new NamingException( "dITStructureRule w/ OID " +
                 dITStructureRule.getOid() + " has already been registered!" );
-            monitor.registerFailed( dITStructureRule, e );
             throw e;
         }
 
         oidToSchema.put( dITStructureRule.getOid(), schema );
         oidRegistry.register( dITStructureRule.getName(), dITStructureRule.getOid() );
         byOid.put( dITStructureRule.getOid(), dITStructureRule );
-        monitor.registered( dITStructureRule );
     }
 
 
@@ -106,12 +90,11 @@
         {
             NamingException e = new NamingException( "dITStructureRule w/ OID "
                 + id + " not registered!" );
-            monitor.lookupFailed( id, e );
             throw e;
         }
 
         DITStructureRule dITStructureRule = ( DITStructureRule ) byOid.get( id );
-        monitor.lookedUp( dITStructureRule );
+
         return dITStructureRule;
     }
 
@@ -146,11 +129,42 @@
             "schema name map!" );
     }
 
-
-
-
     public Iterator list()
     {
         return byOid.values().iterator();
+    }
+    
+    /**
+     * A String representation of this class
+     */
+    public String toString( String tabs )
+    {
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs ).append( "BootstrapDitStructureRuleRegistry : {\n" );
+    	
+    	sb.append( tabs ).append(  "  By oid : \n" );
+    	
+    	sb.append( tabs ).append(  StringUtils.mapToString( byOid, "    " ) ) .append( '\n'
);
+    	
+    	sb.append( tabs ).append(  "  Oid to schema : \n" );
+
+    	sb.append( tabs ).append(  StringUtils.mapToString( oidToSchema, "    " ) ) .append(
'\n' );
+    	
+    	sb.append( tabs ).append(  "  OidRegistry :\n" );
+    	
+    	sb.append( oidRegistry.toString( tabs +  "    " ) );
+    	
+    	sb.append( tabs ).append(  "}\n" );
+    	
+    	return sb.toString();
+    }
+
+    /**
+     * A String representation of this class
+     */
+    public String toString()
+    {
+    	return toString( "" );
     }
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleRegistry.java?rev=357550&r1=357549&r2=357550&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleRegistry.java
Sun Dec 18 15:20:28 2005
@@ -23,10 +23,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.MatchingRule;
 import org.apache.ldap.server.schema.MatchingRuleRegistry;
-import org.apache.ldap.server.schema.MatchingRuleRegistryMonitor;
-import org.apache.ldap.server.schema.MatchingRuleRegistryMonitorAdapter;
 import org.apache.ldap.server.schema.OidRegistry;
 
 
@@ -40,13 +39,12 @@
 {
     /** a map using an OID for the key and a MatchingRule for the value */
     private final Map byOid;
+
     /** maps an OID to a schema name*/
     private final Map oidToSchema;
+    
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
-    /** a monitor used to track noteable registry events */
-    private MatchingRuleRegistryMonitor monitor = null;
-    
     
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -63,7 +61,6 @@
         this.oidToSchema = new HashMap();
         this.oidRegistry = oidRegistry;
         this.byOid = new HashMap();
-        this.monitor = new MatchingRuleRegistryMonitorAdapter();
     }
     
 
@@ -82,12 +79,10 @@
         if ( byOid.containsKey( id ) )
         {
             MatchingRule MatchingRule = ( MatchingRule ) byOid.get( id );
-            monitor.lookedUp( MatchingRule );
             return MatchingRule;
         }
         
         NamingException fault = new NamingException( "Unknown MatchingRule OID " + id );
-        monitor.lookupFailed( id, fault );
         throw fault;
     }
     
@@ -101,7 +96,6 @@
         {
             NamingException e = new NamingException( "matchingRule w/ OID " +
                 matchingRule.getOid() + " has already been registered!" );
-            monitor.registerFailed( matchingRule, e );
             throw e;
         }
 
@@ -114,7 +108,6 @@
         }
 
         byOid.put( matchingRule.getOid(), matchingRule );
-        monitor.registered( matchingRule );
     }
 
     
@@ -151,36 +144,42 @@
             "schema name map!" );
     }
 
-
-    // ------------------------------------------------------------------------
-    // package friendly monitor methods
-    // ------------------------------------------------------------------------
-    
-    
-    /**
-     * Gets the monitor for this registry.
-     * 
-     * @return the monitor
-     */
-    MatchingRuleRegistryMonitor getMonitor()
+    public Iterator list()
     {
-        return monitor;
+        return byOid.values().iterator();
     }
 
-    
     /**
-     * Sets the monitor for this registry.
-     * 
-     * @param monitor the monitor to set
+     * A String representation of this class
      */
-    void setMonitor( MatchingRuleRegistryMonitor monitor )
+    public String toString( String tabs )
     {
-        this.monitor = monitor;
-    }
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs ).append( "BootstrapMatchingRuleRegistry : {\n" );
+    	
+    	sb.append( tabs ).append( "  By oid : \n" );
+    	
+    	sb.append( tabs ).append( StringUtils.mapToString( byOid, "    " ) ) .append( '\n' );
+    	
+    	sb.append( tabs ).append( "  Oid to schema : \n" );
 
+    	sb.append( tabs ).append( StringUtils.mapToString( oidToSchema, "    " ) ) .append(
'\n' );
+    	
+    	sb.append( tabs ).append( "  OidRegistry :\n" );
+    	
+    	sb.append( oidRegistry.toString( tabs + "    " ) );
+    	
+    	sb.append( tabs ).append( "}\n" );
+    	
+    	return sb.toString();
+    }
 
-    public Iterator list()
+    /**
+     * A String representation of this class
+     */
+    public String toString()
     {
-        return byOid.values().iterator();
+    	return toString( "" );
     }
 }

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java?rev=357550&r1=357549&r2=357550&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java
Sun Dec 18 15:20:28 2005
@@ -23,10 +23,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.MatchingRuleUse;
 import org.apache.ldap.server.schema.MatchingRuleUseRegistry;
-import org.apache.ldap.server.schema.MatchingRuleUseRegistryMonitor;
-import org.apache.ldap.server.schema.MatchingRuleUseRegistryMonitorAdapter;
 
 
 /**
@@ -39,10 +38,9 @@
 {
     /** maps a name to an MatchingRuleUse */
     private final Map byName;
+
     /** maps a MatchingRuleUse name to a schema name*/
     private final Map nameToSchema;
-    /** monitor notified via callback events */
-    private MatchingRuleUseRegistryMonitor monitor;
 
 
     // ------------------------------------------------------------------------
@@ -57,18 +55,6 @@
     {
         this.byName = new HashMap();
         this.nameToSchema = new HashMap();
-        this.monitor = new MatchingRuleUseRegistryMonitorAdapter();
-    }
-
-
-    /**
-     * Sets the monitor that is to be notified via callback events.
-     *
-     * @param monitor the new monitor to notify of notable events
-     */
-    public void setMonitor( MatchingRuleUseRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
     }
 
 
@@ -84,13 +70,11 @@
         {
             NamingException e = new NamingException( "matchingRuleUse w/ name "
                 + matchingRuleUse.getName() + " has already been registered!" );
-            monitor.registerFailed( matchingRuleUse, e );
             throw e;
         }
 
         nameToSchema.put( matchingRuleUse.getName(), schema );
         byName.put( matchingRuleUse.getName(), matchingRuleUse );
-        monitor.registered( matchingRuleUse );
     }
 
 
@@ -100,12 +84,10 @@
         {
             NamingException e = new NamingException( "matchingRuleUse w/ name "
                 + name + " not registered!" );
-            monitor.lookupFailed( name, e );
             throw e;
         }
 
         MatchingRuleUse matchingRuleUse = ( MatchingRuleUse ) byName.get( name );
-        monitor.lookedUp( matchingRuleUse );
         return matchingRuleUse;
     }
 
@@ -131,5 +113,35 @@
     public Iterator list()
     {
         return byName.values().iterator();
+    }
+    
+    /**
+     * A String representation of this class
+     */
+    public String toString( String tabs )
+    {
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs).append(  "BootstrapMatchingRuleUseRegistry : {\n" );
+    	
+    	sb.append( tabs).append(  "  By name : \n" );
+    	
+    	sb.append( tabs).append(  StringUtils.mapToString( byName, "    " ) ) .append( '\n'
);
+    	
+    	sb.append( tabs).append(  "  Name to schema : \n" );
+
+    	sb.append( tabs).append(  StringUtils.mapToString( nameToSchema, "    " ) ) .append(
'\n' );
+    	
+    	sb.append( tabs).append(  "}\n" );
+    	
+    	return sb.toString();
+    }
+
+    /**
+     * A String representation of this class
+     */
+    public String toString()
+    {
+    	return toString( "" );
     }
 }



Mime
View raw message