directory-commits mailing list archives

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

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

Modified: directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapNameFormRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapNameFormRegistry.java?rev=357547&r1=357546&r2=357547&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapNameFormRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapNameFormRegistry.java
Sun Dec 18 15:18:25 2005
@@ -23,10 +23,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.NameForm;
 import org.apache.ldap.server.schema.NameFormRegistry;
-import org.apache.ldap.server.schema.NameFormRegistryMonitor;
-import org.apache.ldap.server.schema.NameFormRegistryMonitorAdapter;
 import org.apache.ldap.server.schema.OidRegistry;
 
 
@@ -40,12 +39,12 @@
 {
     /** maps an OID to an NameForm */
     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 NameFormRegistryMonitor monitor;
 
 
     // ------------------------------------------------------------------------
@@ -61,40 +60,24 @@
         this.byOid = new HashMap();
         this.oidToSchema = new HashMap();
         this.oidRegistry = oidRegistry;
-        this.monitor = new NameFormRegistryMonitorAdapter();
     }
 
-
-    /**
-     * Sets the monitor that is to be notified via callback events.
-     *
-     * @param monitor the new monitor to notify of notable events
-     */
-    public void setMonitor( NameFormRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
-    }
-
-
     // ------------------------------------------------------------------------
     // Service Methods
     // ------------------------------------------------------------------------
 
-
     public void register( String schema, NameForm nameForm ) throws NamingException
     {
         if ( byOid.containsKey( nameForm.getOid() ) )
         {
             NamingException e = new NamingException( "nameForm w/ OID " +
                 nameForm.getOid() + " has already been registered!" );
-            monitor.registerFailed( nameForm, e );
             throw e;
         }
 
         oidToSchema.put( nameForm.getOid(), schema );
         oidRegistry.register( nameForm.getName(), nameForm.getOid() );
         byOid.put( nameForm.getOid(), nameForm );
-        monitor.registered( nameForm );
     }
 
 
@@ -106,12 +89,10 @@
         {
             NamingException e = new NamingException( "nameForm w/ OID " + id
                 + " not registered!" );
-            monitor.lookupFailed( id, e );
             throw e;
         }
 
         NameForm nameForm = ( NameForm ) byOid.get( id );
-        monitor.lookedUp( nameForm );
         return nameForm;
     }
 
@@ -150,5 +131,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( "BootstrapNameFormRegistry : {\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/BootstrapObjectClassRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapObjectClassRegistry.java?rev=357547&r1=357546&r2=357547&view=diff
==============================================================================
--- directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapObjectClassRegistry.java
(original)
+++ directory/apacheds/branches/DN-refactoring/core/src/main/java/org/apache/ldap/server/schema/bootstrap/BootstrapObjectClassRegistry.java
Sun Dec 18 15:18:25 2005
@@ -23,10 +23,9 @@
 
 import javax.naming.NamingException;
 
+import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.schema.ObjectClass;
 import org.apache.ldap.server.schema.ObjectClassRegistry;
-import org.apache.ldap.server.schema.ObjectClassRegistryMonitor;
-import org.apache.ldap.server.schema.ObjectClassRegistryMonitorAdapter;
 import org.apache.ldap.server.schema.OidRegistry;
 
 
@@ -40,13 +39,12 @@
 {
     /** maps an OID to an ObjectClass */
     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 ObjectClassRegistryMonitor monitor;
-
 
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -61,21 +59,8 @@
         this.byOid = new HashMap();
         this.oidToSchema = new HashMap();
         this.oidRegistry = oidRegistry;
-        this.monitor = new ObjectClassRegistryMonitorAdapter();
     }
 
-
-    /**
-     * Sets the monitor that is to be notified via callback events.
-     *
-     * @param monitor the new monitor to notify of notable events
-     */
-    public void setMonitor( ObjectClassRegistryMonitor monitor )
-    {
-        this.monitor = monitor;
-    }
-
-
     // ------------------------------------------------------------------------
     // Service Methods
     // ------------------------------------------------------------------------
@@ -87,14 +72,12 @@
         {
             NamingException e = new NamingException( "objectClass w/ OID " +
                 objectClass.getOid() + " has already been registered!" );
-            monitor.registerFailed( objectClass, e );
             throw e;
         }
 
         oidRegistry.register( objectClass.getName(), objectClass.getOid() );
         byOid.put( objectClass.getOid(), objectClass );
         oidToSchema.put( objectClass.getOid(), schema );
-        monitor.registered( objectClass );
     }
 
 
@@ -106,12 +89,10 @@
         {
             NamingException e = new NamingException( "objectClass w/ OID "
                 + id + " not registered!" );
-            monitor.lookupFailed( id, e );
             throw e;
         }
 
         ObjectClass objectClass = ( ObjectClass ) byOid.get( id );
-        monitor.lookedUp( objectClass );
         return objectClass;
     }
 
@@ -150,5 +131,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( "BootstrapObjectClassRegistry : {\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( "" );
     }
 }



Mime
View raw message