You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2005/09/03 00:46:50 UTC

svn commit: r267341 - in /directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common: exception/LdapInvalidAttributeValueException.java exception/LdapNoSuchAttributeException.java message/ControlImpl.java message/SubentryRequestControl.java

Author: akarasulu
Date: Fri Sep  2 15:46:45 2005
New Revision: 267341

URL: http://svn.apache.org/viewcvs?rev=267341&view=rev
Log:
changes ...

 o added constructor overload to ControlImpl
 o added specific control for the subentry control 1.3.6.1.4.1.4203.1.10.1
   see http://www.faqs.org/rfcs/rfc3672.html for details
 o added some Ldap subclasses for JNDI exception types that were not present


Added:
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapInvalidAttributeValueException.java   (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapNoSuchAttributeException.java   (with props)
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/SubentryRequestControl.java   (with props)
Modified:
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/ControlImpl.java   (contents, props changed)

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapInvalidAttributeValueException.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapInvalidAttributeValueException.java?rev=267341&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapInvalidAttributeValueException.java (added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapInvalidAttributeValueException.java Fri Sep  2 15:46:45 2005
@@ -0,0 +1,91 @@
+/*
+ *   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.ldap.common.exception;
+
+
+import javax.naming.directory.SchemaViolationException;
+import javax.naming.directory.InvalidAttributeValueException;
+
+import org.apache.ldap.common.message.ResultCodeEnum;
+
+
+/**
+ * Makes a InvalidAttributeValueException unambiguous with respect to the result code it corresponds to
+ * by associating an LDAP specific result code with it.
+ *
+ * @see <a href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
+ * LDAP ResultCode to JNDI Exception Mappings</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class LdapInvalidAttributeValueException extends InvalidAttributeValueException implements LdapException
+{
+    static final long serialVersionUID = 5763624876999168014L;
+    /** the LDAP resultCode this exception is associated with */
+    private final ResultCodeEnum resultCode;
+
+
+    /**
+     * Creates an Ldap InvalidAttributeValueException using a result code.
+     *
+     * @param resultCode the LDAP resultCode this exception is associated with
+     * @throws IllegalArgumentException if the resultCode argument is not ResultCodeEnum.CONSTRAINTVIOLATION, or
+     * ResultCodeEnum.INVALIDATTRIBUTESYNTAX
+     */
+    public LdapInvalidAttributeValueException( ResultCodeEnum resultCode )
+    {
+        super();
+
+        switch( resultCode.getValue() )
+        {
+            case( ResultCodeEnum.CONSTRAINTVIOLATION_VAL ):
+                break;
+            case( ResultCodeEnum.INVALIDATTRIBUTESYNTAX_VAL ):
+                break;
+            default:
+
+                throw new IllegalArgumentException( resultCode.getName() + " is not an acceptable result code." );
+        }
+
+        this.resultCode = resultCode;
+    }
+
+
+    /**
+     * Creates an Ldap InvalidAttributeValueException using a result code and a specific message.
+     *
+     * @param explanation an explanation for the failure
+     * @param resultCode the LDAP resultCode this exception is associated with
+     */
+    public LdapInvalidAttributeValueException( String explanation, ResultCodeEnum resultCode )
+    {
+        super( explanation );
+
+        this.resultCode = resultCode;
+    }
+
+
+    /**
+     * Gets the LDAP resultCode this exception is associated with.
+     *
+     * @return the LDAP resultCode this exception is associated with
+     */
+    public ResultCodeEnum getResultCode()
+    {
+        return this.resultCode;
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapInvalidAttributeValueException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapNoSuchAttributeException.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapNoSuchAttributeException.java?rev=267341&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapNoSuchAttributeException.java (added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapNoSuchAttributeException.java Fri Sep  2 15:46:45 2005
@@ -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.ldap.common.exception;
+
+
+import javax.naming.directory.NoSuchAttributeException;
+
+import org.apache.ldap.common.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of NoSuchAttributeException which holds the LDAP resultCode
+ * associated with the exception.
+ *
+ * @see <a href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
+ * LDAP ResultCode to JNDI Exception Mappings</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class LdapNoSuchAttributeException extends NoSuchAttributeException implements LdapException
+{
+    static final long serialVersionUID = 886120483680893537L;
+
+
+    /**
+     * @see javax.naming.directory.NoSuchAttributeException#NoSuchAttributeException()
+     */
+    public LdapNoSuchAttributeException()
+    {
+        super();
+    }
+
+
+    /**
+     * @see javax.naming.directory.NoSuchAttributeException#NoSuchAttributeException(String)
+     */
+    public LdapNoSuchAttributeException( String explanation )
+    {
+        super( explanation );
+    }
+
+
+    /**
+     * @see LdapException#getResultCode()
+     */
+    public ResultCodeEnum getResultCode()
+    {
+        return ResultCodeEnum.NOSUCHATTRIBUTE;
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/exception/LdapNoSuchAttributeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/ControlImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/ControlImpl.java?rev=267341&r1=267340&r2=267341&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/ControlImpl.java (original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/ControlImpl.java Fri Sep  2 15:46:45 2005
@@ -55,6 +55,16 @@
     }
 
 
+    /**
+     * Creates a non-root Lockable Control implementation whose state is
+     * overriden by a parent Lockable.
+     */
+    public ControlImpl()
+    {
+        super() ;
+    }
+
+
     // ------------------------------------------------------------------------
     // Control Interface Method Implementations
     // ------------------------------------------------------------------------

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/ControlImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/SubentryRequestControl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/SubentryRequestControl.java?rev=267341&view=auto
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/SubentryRequestControl.java (added)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/SubentryRequestControl.java Fri Sep  2 15:46:45 2005
@@ -0,0 +1,77 @@
+/*
+ *   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.ldap.common.message;
+
+
+import org.apache.ldap.common.Lockable;
+
+
+/**
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SubentryRequestControl extends ControlImpl
+{
+    /** */
+    private final boolean subentryVisibility;
+
+
+    /**
+     *
+     * @param subentryVisibility
+     */
+    public SubentryRequestControl( boolean subentryVisibility )
+    {
+        super();
+        this.subentryVisibility = subentryVisibility;
+    }
+
+
+    /**
+     *
+     * @param parent
+     * @param subentryVisibility
+     */
+    public SubentryRequestControl( Lockable parent, boolean subentryVisibility )
+    {
+        super( parent );
+        this.subentryVisibility = subentryVisibility;
+    }
+
+
+    /**
+     * @todo need to properly implement this
+     *
+     * @return
+     */
+    public byte[] getEncodedValue()
+    {
+        return new byte[0];
+    }
+
+
+    /**
+     *
+     * @return
+     */
+    public boolean getSubentryVisibility()
+    {
+        return subentryVisibility;
+    }
+}

Propchange: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/message/SubentryRequestControl.java
------------------------------------------------------------------------------
    svn:eol-style = native