directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 47434 - incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema
Date Tue, 28 Sep 2004 22:39:00 GMT
Author: akarasulu
Date: Tue Sep 28 15:38:57 2004
New Revision: 47434

Added:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultNormalizerRegistry.java
  (contents, props changed)
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultSyntaxCheckerRegistry.java
  (contents, props changed)
Modified:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistry.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitor.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitorAdapter.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistry.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitor.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitorAdapter.java
Log:
Commit changes ...

 o added the default POJO impl for the Normalizer registry 
 o added the default POJO impl for the SyntaxChecker registry
 o made changes to monitor interfaces that did not include the oid both
   Normalizers and of SyntaxCheckers
 o propagated monitor interface changes to adapter implementations



Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultNormalizerRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultNormalizerRegistry.java
Tue Sep 28 15:38:57 2004
@@ -0,0 +1,108 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.schema;
+
+
+import org.apache.ldap.common.schema.Normalizer;
+
+import java.util.Map;
+import java.util.HashMap;
+import javax.naming.NamingException;
+
+
+/**
+ * The POJO implementation for the NormalizerRegistry service.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultNormalizerRegistry implements NormalizerRegistry
+{
+    /** a map of Normalizers looked up by OID */
+    private final Map byOid;
+    /** the monitor used to deliver callback notification events */
+    private NormalizerRegistryMonitor monitor;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Creates a default normalizer registry.
+     */
+    public DefaultNormalizerRegistry()
+    {
+        byOid = new HashMap();
+        monitor = new NormalizerRegistryMonitorAdapter();
+    }
+
+
+    /**
+     * Sets the monitor used to deliver notification events to via callbacks.
+     *
+     * @param monitor the monitor to recieve callback events
+     */
+    public void setMonitor( NormalizerRegistryMonitor monitor )
+    {
+        this.monitor = monitor;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Service Methods
+    // ------------------------------------------------------------------------
+
+
+    public void register( String oid, Normalizer normalizer )
+        throws NamingException
+    {
+        if ( byOid.containsKey( oid ) )
+        {
+            NamingException e = new NamingException( "Normalizer already " +
+                "registered for OID " + oid );
+            monitor.registerFailed( oid, normalizer, e );
+            throw e;
+        }
+
+        byOid.put( oid, normalizer );
+        monitor.registered( oid, normalizer );
+    }
+
+
+    public Normalizer lookup( String oid ) throws NamingException
+    {
+        if ( ! byOid.containsKey( oid ) )
+        {
+            NamingException e = new NamingException( "Normalizer for OID "
+                + oid + " does not exist!" );
+            monitor.lookupFailed( oid, e );
+            throw e;
+        }
+
+        Normalizer normalizer = ( Normalizer ) byOid.get( oid );
+        monitor.lookedUp( oid, normalizer );
+        return normalizer;
+    }
+
+
+    public boolean hasNormalizer( String oid )
+    {
+        return byOid.containsKey( oid );
+    }
+}

Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultSyntaxCheckerRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultSyntaxCheckerRegistry.java
Tue Sep 28 15:38:57 2004
@@ -0,0 +1,108 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.schema;
+
+
+import org.apache.ldap.common.schema.SyntaxChecker;
+
+import java.util.Map;
+import java.util.HashMap;
+import javax.naming.NamingException;
+
+
+/**
+ * The POJO implementation for the SyntaxCheckerRegistry service.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultSyntaxCheckerRegistry implements SyntaxCheckerRegistry
+{
+    /** a map by OID of SyntaxCheckers */
+    private final Map byOid;
+    /** the monitor to use for callback event notifications */
+    private SyntaxCheckerRegistryMonitor monitor;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Creates an instance of a DefaultSyntaxRegistry.
+     */
+    public DefaultSyntaxCheckerRegistry()
+    {
+        byOid = new HashMap();
+        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;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Service Methods
+    // ------------------------------------------------------------------------
+
+
+    public void register( String oid, SyntaxChecker syntaxChecker )
+        throws NamingException
+    {
+        if ( byOid.containsKey( oid ) )
+        {
+            NamingException e = new NamingException( "SyntaxChecker with OID " +
+                oid + " already registered!" );
+            monitor.registerFailed( oid, syntaxChecker,e );
+            throw e;
+        }
+
+        byOid.put( oid, syntaxChecker );
+        monitor.registered( oid, syntaxChecker );
+    }
+
+
+    public SyntaxChecker lookup( String oid ) throws NamingException
+    {
+        if ( ! byOid.containsKey( oid ) )
+        {
+            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;
+    }
+
+
+    public boolean hasSyntaxChecker( String oid )
+    {
+        return byOid.containsKey( oid );
+    }
+}

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistry.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistry.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistry.java
Tue Sep 28 15:38:57 2004
@@ -34,10 +34,10 @@
      * Registers a Normalizer with this registry.
      * 
      * @param normalizer the Normalizer to register
-     * @throws NamingException if the Normalizer is already registered or the 
+     * @throws NamingException if the Normalizer is already registered or the
      *      registration operation is not supported
      */
-    void register( Normalizer normalizer, String oid ) throws NamingException;
+    void register( String oid, Normalizer normalizer ) throws NamingException;
     
     /**
      * Looks up a Normalizer by its unique Object Identifier.

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitor.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitor.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitor.java
Tue Sep 28 15:38:57 2004
@@ -33,16 +33,18 @@
     /**
      * Monitors when a Normalizer is registered successfully.
      * 
+     * @param oid
      * @param normalizer the Normalizer registered
      */
-    void registered( Normalizer normalizer );
+    void registered( String oid, Normalizer normalizer );
 
     /**
      * Monitors when a Normalizer is successfully looked up.
      * 
+     * @param oid
      * @param normalizer the Normalizer looked up
      */
-    void lookedUp( Normalizer normalizer );
+    void lookedUp( String oid, Normalizer normalizer );
 
     /**
      * Monitors when a lookup attempt fails.
@@ -55,8 +57,9 @@
     /**
      * Monitors when a registration attempt fails.
      * 
+     * @param oid
      * @param normalizer the Normalizer which failed registration
      * @param fault the exception to be thrown for the fault
      */
-    void registerFailed( Normalizer normalizer, NamingException fault );
+    void registerFailed( String oid, Normalizer normalizer, NamingException fault );
 }

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitorAdapter.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/NormalizerRegistryMonitorAdapter.java
Tue Sep 28 15:38:57 2004
@@ -35,7 +35,7 @@
      * @see org.apache.eve.schema.NormalizerRegistryMonitor#registered(
      * org.apache.eve.schema.Normalizer)
      */
-    public void registered( Normalizer normalizer)
+    public void registered( String oid, Normalizer normalizer )
     {
     }
 
@@ -44,7 +44,7 @@
      * @see org.apache.eve.schema.NormalizerRegistryMonitor#lookedUp(
      * org.apache.eve.schema.Normalizer)
      */
-    public void lookedUp( Normalizer normalizer )
+    public void lookedUp( String oid, Normalizer normalizer )
     {
     }
 
@@ -66,7 +66,7 @@
      * @see org.apache.eve.schema.NormalizerRegistryMonitor#registerFailed(
      * org.apache.eve.schema.Normalizer, javax.naming.NamingException)
      */
-    public void registerFailed( Normalizer normalizer, NamingException fault )
+    public void registerFailed( String oid, Normalizer normalizer, NamingException fault
)
     {
         if ( fault != null )
         {

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistry.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistry.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistry.java
Tue Sep 28 15:38:57 2004
@@ -34,10 +34,10 @@
      * Registers a SyntaxChecker with this registry.
      * 
      * @param syntaxChecker the SyntaxChecker to register
-     * @throws NamingException if the SyntaxChecker is already registered or the 
+     * @throws NamingException if the SyntaxChecker is already registered or the
      *      registration operation is not supported
      */
-    void register( SyntaxChecker syntaxChecker, String oid )
+    void register( String oid, SyntaxChecker syntaxChecker )
         throws NamingException;
     
     /**

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitor.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitor.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitor.java
Tue Sep 28 15:38:57 2004
@@ -33,16 +33,18 @@
     /**
      * Monitors when a SyntaxChecker is registered successfully.
      * 
+     * @param oid
      * @param syntaxChecker the SyntaxChecker registered
      */
-    void registered( SyntaxChecker syntaxChecker );
+    void registered( String oid, SyntaxChecker syntaxChecker );
 
     /**
      * Monitors when a SyntaxChecker is successfully looked up.
      * 
+     * @param oid
      * @param syntaxChecker the SyntaxChecker looked up
      */
-    void lookedUp( SyntaxChecker syntaxChecker );
+    void lookedUp( String oid, SyntaxChecker syntaxChecker );
 
     /**
      * Monitors when a lookup attempt fails.
@@ -55,8 +57,9 @@
     /**
      * Monitors when a registration attempt fails.
      * 
+     * @param oid
      * @param syntaxChecker the SyntaxChecker which failed registration
      * @param fault the exception to be thrown for the fault
      */
-    void registerFailed( SyntaxChecker syntaxChecker, NamingException fault );
+    void registerFailed( String oid, SyntaxChecker syntaxChecker, NamingException fault );
 }

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitorAdapter.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/SyntaxCheckerRegistryMonitorAdapter.java
Tue Sep 28 15:38:57 2004
@@ -35,7 +35,7 @@
      * @see org.apache.eve.schema.SyntaxCheckerRegistryMonitor#registered(
      * org.apache.eve.schema.SyntaxChecker)
      */
-    public void registered( SyntaxChecker syntaxChecker)
+    public void registered( String oid, SyntaxChecker syntaxChecker )
     {
     }
 
@@ -44,7 +44,7 @@
      * @see org.apache.eve.schema.SyntaxCheckerRegistryMonitor#lookedUp(
      * org.apache.eve.schema.SyntaxChecker)
      */
-    public void lookedUp( SyntaxChecker syntaxChecker )
+    public void lookedUp( String oid, SyntaxChecker syntaxChecker )
     {
     }
 
@@ -66,7 +66,7 @@
      * @see org.apache.eve.schema.SyntaxCheckerRegistryMonitor#registerFailed(
      * org.apache.eve.schema.SyntaxChecker, javax.naming.NamingException)
      */
-    public void registerFailed( SyntaxChecker syntaxChecker,
+    public void registerFailed( String oid, SyntaxChecker syntaxChecker,
                                 NamingException fault )
     {
         if ( fault != null )

Mime
View raw message