directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r357543 - in /directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap: BootstrapStateFactoryRegistry.java BootstrapSyntaxCheckerRegistry.java BootstrapSyntaxRegistry.java
Date Sun, 18 Dec 2005 23:13:31 GMT
Author: elecharny
Date: Sun Dec 18 15:13:23 2005
New Revision: 357543

URL: http://svn.apache.org/viewcvs?rev=357543&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/BootstrapStateFactoryRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxCheckerRegistry.java
    directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxRegistry.java

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapStateFactoryRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapStateFactoryRegistry.java?rev=357543&r1=357542&r2=357543&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapStateFactoryRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapStateFactoryRegistry.java
Sun Dec 18 15:13:23 2005
@@ -21,6 +21,7 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.server.jndi.ServerDirStateFactory;
 import org.apache.ldap.server.schema.StateFactoryRegistry;
 
@@ -75,5 +76,31 @@
     public void register( ServerDirStateFactory factory )
     {
         byClass.put( factory.getAssociatedClass(), factory );
+    }
+    
+    /**
+     * A String representation of this class
+     */
+    public String toString( String tabs )
+    {
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs ).append(  "BootstrapStateFactoryRegistry : {\n" );
+    	
+    	sb.append( tabs ).append(  "  By class : \n" );
+    	
+    	sb.append( tabs ).append(  StringUtils.mapToString( byClass, "    " ) ) .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/BootstrapSyntaxCheckerRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxCheckerRegistry.java?rev=357543&r1=357542&r2=357543&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxCheckerRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxCheckerRegistry.java
Sun Dec 18 15:13:23 2005
@@ -22,10 +22,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.SyntaxChecker;
 import org.apache.ldap.server.schema.SyntaxCheckerRegistry;
-import org.apache.ldap.server.schema.SyntaxCheckerRegistryMonitor;
-import org.apache.ldap.server.schema.SyntaxCheckerRegistryMonitorAdapter;
 
 
 /**
@@ -38,11 +37,9 @@
 {
     /** a map by OID of SyntaxCheckers */
     private final Map byOid;
+    
     /** maps an OID to a schema name*/
     private final Map oidToSchema;
-    /** the monitor to use for callback event notifications */
-    private SyntaxCheckerRegistryMonitor monitor;
-
 
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -56,18 +53,6 @@
     {
         this.byOid = new HashMap();
         this.oidToSchema = new HashMap();
-        this.monitor = new SyntaxCheckerRegistryMonitorAdapter();
-    }
-
-
-    /**
-     * Sets the monitor used to deliver notification events to via callbacks.
-     *
-     * @param monitor the monitor to recieve callback events
-     */
-    public void setMonitor( SyntaxCheckerRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
     }
 
 
@@ -83,13 +68,11 @@
         {
             NamingException e = new NamingException( "SyntaxChecker with OID " +
                 oid + " already registered!" );
-            monitor.registerFailed( oid, syntaxChecker,e );
             throw e;
         }
 
         byOid.put( oid, syntaxChecker );
         oidToSchema.put( oid, schema );
-        monitor.registered( oid, syntaxChecker );
     }
 
 
@@ -99,13 +82,11 @@
         {
             NamingException e = new NamingException( "SyntaxChecker for OID "
                 + oid + " not found!" );
-            monitor.lookupFailed( oid, e );
             throw e;
         }
 
         SyntaxChecker syntaxChecker = ( SyntaxChecker ) byOid.get( oid );
-        monitor.lookedUp( oid, syntaxChecker );
-        return null;
+        return syntaxChecker;
     }
 
 
@@ -129,5 +110,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( "BootstrapSyntaxCheckerRegistry : {\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( "}\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/BootstrapSyntaxRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxRegistry.java?rev=357543&r1=357542&r2=357543&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapSyntaxRegistry.java
Sun Dec 18 15:13:23 2005
@@ -23,11 +23,10 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.Syntax;
 import org.apache.ldap.server.schema.OidRegistry;
 import org.apache.ldap.server.schema.SyntaxRegistry;
-import org.apache.ldap.server.schema.SyntaxRegistryMonitor;
-import org.apache.ldap.server.schema.SyntaxRegistryMonitorAdapter;
 
 
 /**
@@ -41,13 +40,12 @@
 {
     /** a map of entries using an OID for the key and a Syntax for the value */
     private final Map byOid;
+
     /** maps an OID to a schema name*/
     private final Map oidToSchema;
+    
     /** the OID oidRegistry this oidRegistry uses to register new syntax OIDs */
     private final OidRegistry oidRegistry;
-    /** a monitor used to track noteable oidRegistry events */
-    private SyntaxRegistryMonitor monitor = null;
-    
     
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -62,7 +60,6 @@
         this.oidRegistry = registry;
         this.byOid = new HashMap();
         this.oidToSchema = new HashMap();
-        this.monitor = new SyntaxRegistryMonitorAdapter();
     }
     
 
@@ -81,12 +78,10 @@
         if ( byOid.containsKey( id ) )
         {
             Syntax syntax = ( Syntax ) byOid.get( id );
-            monitor.lookedUp( syntax );
             return syntax;
         }
         
         NamingException fault = new NamingException( "Unknown syntax OID " + id );
-        monitor.lookupFailed( id, fault );
         throw fault;
     }
     
@@ -100,14 +95,12 @@
         {
             NamingException e = new NamingException( "syntax w/ OID " +
                 syntax.getOid() + " has already been registered!" );
-            monitor.registerFailed( syntax, e );
             throw e;
         }
 
         oidRegistry.register( syntax.getName(), syntax.getOid() );
         byOid.put( syntax.getOid(), syntax );
         oidToSchema.put( syntax.getOid(), schema );
-        monitor.registered( syntax );
     }
 
     
@@ -144,36 +137,42 @@
             "schema name map!" );
     }
 
+    public Iterator list()
+    {
+        return byOid.values().iterator();
+    }
 
-    // ------------------------------------------------------------------------
-    // package friendly monitor methods
-    // ------------------------------------------------------------------------
-    
-    
     /**
-     * Gets the monitor for this oidRegistry.
-     * 
-     * @return the monitor
+     * A String representation of this class
      */
-    SyntaxRegistryMonitor getMonitor()
+    public String toString( String tabs )
     {
-        return monitor;
-    }
+    	StringBuffer sb = new StringBuffer();
+    	
+    	sb.append( tabs ).append( "BootstrapSyntaxRegistry : {\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();
+    }
     
     /**
-     * Sets the monitor for this oidRegistry.
-     * 
-     * @param monitor the monitor to set
+     * A String representation of this class
      */
-    void setMonitor( SyntaxRegistryMonitor monitor )
+    public String toString()
     {
-        this.monitor = monitor;
-    }
-
-
-    public Iterator list()
-    {
-        return byOid.values().iterator();
+    	return toString( "" );
     }
 }



Mime
View raw message