directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 56128 - in incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve: exception jndi
Date Sun, 31 Oct 2004 07:43:45 GMT
Author: akarasulu
Date: Sun Oct 31 00:43:44 2004
New Revision: 56128

Added:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/exception/EveConfigurationException.java
Modified:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/exception/EveAttributeInUseException.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AuthenticationService.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
Log:
replacing ConfigurationExceptions with the Eve version

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/exception/EveAttributeInUseException.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/exception/EveAttributeInUseException.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/exception/EveAttributeInUseException.java
Sun Oct 31 00:43:44 2004
@@ -31,6 +31,18 @@
  */
 public class EveAttributeInUseException extends AttributeInUseException implements EveException
 {
+    public EveAttributeInUseException()
+    {
+        super();
+    }
+
+
+    public EveAttributeInUseException( String explanation )
+    {
+        super( explanation );
+    }
+
+
     public ResultCodeEnum getResultCode()
     {
         return ResultCodeEnum.ENTRYALREADYEXISTS;

Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/exception/EveConfigurationException.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/exception/EveConfigurationException.java
Sun Oct 31 00:43:44 2004
@@ -0,0 +1,64 @@
+/*
+ *   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.exception;
+
+
+import javax.naming.ConfigurationException;
+
+import org.apache.ldap.common.message.ResultCodeEnum;
+
+
+/**
+ * A ConfigurationException which associates a resultCode namely the
+ * {@link ResultCodeEnum#OTHER} resultCode with the exception.
+ *
+ * @see EveException
+ * @see javax.naming.ConfigurationException
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class EveConfigurationException extends ConfigurationException
+        implements EveException
+{
+    /**
+     * @see javax.naming.NoPermissionException#NoPermissionException()
+     */
+    public EveConfigurationException()
+    {
+        super();
+    }
+
+
+    /**
+     * @see javax.naming.NoPermissionException#NoPermissionException(String)
+     */
+    public EveConfigurationException( String explanation )
+    {
+        super( explanation );
+    }
+
+
+    /**
+     * Always returns {@link org.apache.ldap.common.message.ResultCodeEnum#OTHER}
+     *
+     * @see EveException#getResultCode()
+     */
+    public ResultCodeEnum getResultCode()
+    {
+        return ResultCodeEnum.OTHER;
+    }
+}

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AuthenticationService.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AuthenticationService.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AuthenticationService.java
Sun Oct 31 00:43:44 2004
@@ -19,9 +19,8 @@
 
 import java.util.Hashtable;
 import java.io.IOException;
-import javax.naming.NamingException;
 import javax.naming.Context;
-import javax.naming.ConfigurationException;
+import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.Attribute;
 
@@ -30,6 +29,7 @@
 import org.apache.eve.auth.LdapPrincipal;
 import org.apache.eve.exception.EveNoPermissionException;
 import org.apache.eve.exception.EveNamingException;
+import org.apache.eve.exception.EveConfigurationException;
 import org.apache.eve.jndi.exception.EveAuthenticationNotSupportedException;
 import org.apache.eve.jndi.exception.EveNameNotFoundException;
 import org.apache.eve.jndi.exception.EveAuthenticationException;
@@ -205,7 +205,7 @@
             }
 
             // blow chuncks if we see any other authtype values
-            throw new ConfigurationException( "Unknown value for property " + TYPE + ": "
+ val );
+            throw new EveConfigurationException( "Unknown value for property " + TYPE + ":
" + val );
         }
 
         // both are set
@@ -219,7 +219,7 @@
                 String msg = "Ambiguous configuration: " + TYPE;
                 msg += " is set to none and the security principal";
                 msg += " is set using " + PRINCIPAL + " as well";
-                throw new ConfigurationException( msg );
+                throw new EveConfigurationException( msg );
             }
             // princial is set to the admin user if authType is "simple"
             else if ( "simple".equalsIgnoreCase( ( String ) val ) )
@@ -228,7 +228,7 @@
             }
 
             // blow chuncks if we see any other authtype values
-            throw new ConfigurationException( "Unknown value for property " + TYPE + ": "
+ val );
+            throw new EveConfigurationException( "Unknown value for property " + TYPE + ":
" + val );
         }
 
         // we have the principal key so we set that as the value

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
Sun Oct 31 00:43:44 2004
@@ -5,6 +5,8 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
 
 import javax.naming.Name;
 import javax.naming.Context;
@@ -19,10 +21,12 @@
 import org.apache.ldap.common.message.LockableAttributesImpl;
 import org.apache.ldap.common.util.ArrayUtils;
 import org.apache.ldap.common.util.DateUtils;
+import org.apache.ldap.common.ldif.LdifIterator;
 
 import org.apache.eve.RootNexus;
 import org.apache.eve.SystemPartition;
 import org.apache.eve.ApplicationPartition;
+import org.apache.eve.exception.EveConfigurationException;
 import org.apache.eve.jndi.ibs.*;
 import org.apache.eve.db.*;
 import org.apache.eve.db.jdbm.JdbmDatabase;
@@ -167,13 +171,13 @@
                 String msg = "Ambiguous configuration: " + TYPE;
                 msg += " is set to none and the security principal";
                 msg += " is set using " + PRINCIPAL + " as well";
-                throw new ConfigurationException( msg );
+                throw new EveConfigurationException( msg );
             }
             else if ( ! initialEnv.containsKey( PRINCIPAL ) &&
                    initialEnv.containsKey( TYPE ) &&
                    initialEnv.get( TYPE ).equals( "none" ) )
             {
-                throw new ConfigurationException( "using authentication type none "
+                throw new EveConfigurationException( "using authentication type none "
                         + "for anonymous binds while trying to bootstrap Eve "
                         + "- this is not allowed ONLY the admin can bootstrap" );
             }
@@ -181,7 +185,7 @@
                       ! initialEnv.get( PRINCIPAL ).equals(
                               SystemPartition.ADMIN_PRINCIPAL ) )
             {
-                throw new ConfigurationException( "user "
+                throw new EveConfigurationException( "user "
                         + initialEnv.get( PRINCIPAL )
                         + " is not allowed to bootstrap the system. ONLY the "
                         + "admin can bootstrap" );
@@ -499,5 +503,20 @@
         }
 
         return file.exists();
+    }
+
+
+    protected void importLdif() throws NamingException
+    {
+        InputStream in = ( InputStream ) getClass().getResourceAsStream( "system.ldif" );
+
+        try
+        {
+            LdifIterator iterator = new LdifIterator( in );
+        }
+        catch ( IOException e )
+        {
+            NamingException ne = new EveConfigurationException();
+        }
     }
 }

Mime
View raw message