directory-commits mailing list archives

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

Added:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultDITContentRuleRegistry.java
  (contents, props changed)
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultDITStructureRuleRegistry.java
  (contents, props changed)
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultMatchingRuleUseRegistry.java
  (contents, props changed)
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/MatchingRuleUseRegistry.java
      - copied, changed from rev 47458, incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/MatchineRuleUseRegistry.java
Removed:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/MatchineRuleUseRegistry.java
Log:
Commit changes ...

 o added default POJO implementations for registries of:
   o DITStructureRules
   o DITContentRules
   o MatchingRuleUses
 o renamed misnamed MatchineRuleUseRegistry 



Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultDITContentRuleRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultDITContentRuleRegistry.java
Tue Sep 28 22:15:12 2004
@@ -0,0 +1,107 @@
+/*
+ *   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.DITContentRule;
+
+import java.util.Map;
+import java.util.HashMap;
+import javax.naming.NamingException;
+
+
+/**
+ * A plain old java object implementation of an DITContentRuleRegistry.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultDITContentRuleRegistry implements DITContentRuleRegistry
+{
+    /** maps an OID to an DITContentRule */
+    private final Map byOid;
+    /** monitor notified via callback events */
+    private DITContentRuleRegistryMonitor monitor;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Creates an empty DefaultDITContentRuleRegistry.
+     */
+    public DefaultDITContentRuleRegistry()
+    {
+        byOid = new HashMap();
+        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
+    // ------------------------------------------------------------------------
+
+
+    public void register( DITContentRule dITContentRule ) throws NamingException
+    {
+        if ( byOid.containsKey( dITContentRule.getOid() ) )
+        {
+            NamingException e = new NamingException( "dITContentRule w/ OID " +
+                dITContentRule.getOid() + " has already been registered!" );
+            monitor.registerFailed( dITContentRule, e );
+            throw e;
+        }
+
+        byOid.put( dITContentRule.getOid(), dITContentRule );
+        monitor.registered( dITContentRule );
+    }
+
+
+    public DITContentRule lookup( String oid ) throws NamingException
+    {
+        if ( ! byOid.containsKey( oid ) )
+        {
+            NamingException e = new NamingException( "dITContentRule w/ OID "
+                + oid + " not registered!" );
+            monitor.lookupFailed( oid, e );
+            throw e;
+        }
+
+        DITContentRule dITContentRule = ( DITContentRule ) byOid.get( oid );
+        monitor.lookedUp( dITContentRule );
+        return dITContentRule;
+    }
+
+
+    public boolean hasDITContentRule( String oid )
+    {
+        return byOid.containsKey( oid );
+    }
+}

Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultDITStructureRuleRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultDITStructureRuleRegistry.java
Tue Sep 28 22:15:12 2004
@@ -0,0 +1,107 @@
+/*
+ *   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.DITStructureRule;
+
+import java.util.Map;
+import java.util.HashMap;
+import javax.naming.NamingException;
+
+
+/**
+ * A plain old java object implementation of an DITStructureRuleRegistry.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultDITStructureRuleRegistry implements DITStructureRuleRegistry
+{
+    /** maps an OID to an DITStructureRule */
+    private final Map byOid;
+    /** monitor notified via callback events */
+    private DITStructureRuleRegistryMonitor monitor;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Creates an empty DefaultDITStructureRuleRegistry.
+     */
+    public DefaultDITStructureRuleRegistry()
+    {
+        byOid = new HashMap();
+        monitor = new DITStructureRuleRegistryMonitorAdapter();
+    }
+
+
+    /**
+     * 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
+    // ------------------------------------------------------------------------
+
+
+    public void register( DITStructureRule dITStructureRule ) throws NamingException
+    {
+        if ( byOid.containsKey( dITStructureRule.getOid() ) )
+        {
+            NamingException e = new NamingException( "dITStructureRule w/ OID " +
+                dITStructureRule.getOid() + " has already been registered!" );
+            monitor.registerFailed( dITStructureRule, e );
+            throw e;
+        }
+
+        byOid.put( dITStructureRule.getOid(), dITStructureRule );
+        monitor.registered( dITStructureRule );
+    }
+
+
+    public DITStructureRule lookup( String oid ) throws NamingException
+    {
+        if ( ! byOid.containsKey( oid ) )
+        {
+            NamingException e = new NamingException( "dITStructureRule w/ OID "
+                + oid + " not registered!" );
+            monitor.lookupFailed( oid, e );
+            throw e;
+        }
+
+        DITStructureRule dITStructureRule = ( DITStructureRule ) byOid.get( oid );
+        monitor.lookedUp( dITStructureRule );
+        return dITStructureRule;
+    }
+
+
+    public boolean hasDITStructureRule( String oid )
+    {
+        return byOid.containsKey( oid );
+    }
+}

Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultMatchingRuleUseRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/DefaultMatchingRuleUseRegistry.java
Tue Sep 28 22:15:12 2004
@@ -0,0 +1,107 @@
+/*
+ *   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.MatchingRuleUse;
+
+import java.util.Map;
+import java.util.HashMap;
+import javax.naming.NamingException;
+
+
+/**
+ * A plain old java object implementation of an MatchingRuleUseRegistry.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultMatchingRuleUseRegistry implements MatchingRuleUseRegistry
+{
+    /** maps an OID to an MatchingRuleUse */
+    private final Map byOid;
+    /** monitor notified via callback events */
+    private MatchingRuleUseRegistryMonitor monitor;
+
+
+    // ------------------------------------------------------------------------
+    // C O N S T R U C T O R S
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Creates an empty DefaultMatchingRuleUseRegistry.
+     */
+    public DefaultMatchingRuleUseRegistry()
+    {
+        byOid = new HashMap();
+        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;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Service Methods
+    // ------------------------------------------------------------------------
+
+
+    public void register( MatchingRuleUse attributeType ) throws NamingException
+    {
+        if ( byOid.containsKey( attributeType.getOid() ) )
+        {
+            NamingException e = new NamingException( "attributeType w/ OID " +
+                attributeType.getOid() + " has already been registered!" );
+            monitor.registerFailed( attributeType, e );
+            throw e;
+        }
+
+        byOid.put( attributeType.getOid(), attributeType );
+        monitor.registered( attributeType );
+    }
+
+
+    public MatchingRuleUse lookup( String oid ) throws NamingException
+    {
+        if ( ! byOid.containsKey( oid ) )
+        {
+            NamingException e = new NamingException( "attributeType w/ OID "
+                + oid + " not registered!" );
+            monitor.lookupFailed( oid, e );
+            throw e;
+        }
+
+        MatchingRuleUse attributeType = ( MatchingRuleUse ) byOid.get( oid );
+        monitor.lookedUp( attributeType );
+        return attributeType;
+    }
+
+
+    public boolean hasMatchingRuleUse( String oid )
+    {
+        return byOid.containsKey( oid );
+    }
+}

Copied: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/MatchingRuleUseRegistry.java
(from rev 47458, incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/MatchineRuleUseRegistry.java)
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/MatchineRuleUseRegistry.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/MatchingRuleUseRegistry.java
Tue Sep 28 22:15:12 2004
@@ -28,7 +28,7 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface MatchineRuleUseRegistry
+public interface MatchingRuleUseRegistry
 {
     /**
      * Registers a Comparator with this registry.

Mime
View raw message