harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r386087 [7/45] - in /incubator/harmony/enhanced/classlib/trunk: make/ make/patternsets/ modules/jndi/ modules/jndi/META-INF/ modules/jndi/make/ modules/jndi/make/common/ modules/jndi/src/ modules/jndi/src/main/ modules/jndi/src/main/java/ m...
Date Wed, 15 Mar 2006 14:57:17 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InvalidSearchFilterException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InvalidSearchFilterException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InvalidSearchFilterException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/InvalidSearchFilterException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,73 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.directory;
+
+import javax.naming.NamingException;
+
+/**
+ * Thrown when the search filter specification is invalid.
+ * <p>
+ * Search filters are part of the search API on a <code>DirContext</code>.
+ * If the API is invoked with a search filter that has invalid syntax, or
+ * an invalid parameter, etc. then the <code>InvalidSearchFilterException</code>
+ * is thrown.</p>
+ * <p>
+ * Serialization and multithreaded issues for <code>NamingException</code>
+ * apply equally here.</p>
+ * 
+ * @see NamingException
+ */
+public class InvalidSearchFilterException extends NamingException {
+	
+	/*
+	 * -------------------------------------------------------------------
+	 * Constants
+	 * -------------------------------------------------------------------
+	 */
+	 	
+	/* Serialization information - start. */
+	private static final long serialVersionUID = 0x284877205a985231L;
+	/* Serialization information - end. */
+
+	/*
+	 * -------------------------------------------------------------------
+	 * Constructors
+	 * -------------------------------------------------------------------
+	 */
+	 
+	/**
+	 * Default constructor. 
+	 * <p>
+	 * All fields are initialized to null.</p>
+	 */	 	 
+	public InvalidSearchFilterException() {
+		super();
+	}
+	
+	/**
+	 * Constructs an <code>InvalidSearchFilterException</code> instance 
+     * using the supplied text of the message.
+     * <p>
+	 * All fields are initialized to null.</p>
+     * 
+	 * @param s				message about the problem
+	 */
+	public InvalidSearchFilterException(String s) {
+		super(s);
+	}
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/ModificationItem.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,155 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.directory;
+
+import java.io.Serializable;
+
+/**
+ * This class is a combination of a modification code and attribute.
+ * <p>
+ * It is used by exception reporting (see 
+ * <code>AttributeModificationException</code> for an example).</p>
+ * <p>
+ * The class is not thread-safe.</p>
+ * 
+ * 
+ */
+public class ModificationItem implements Serializable {
+
+    /*
+     * -------------------------------------------------------------------
+     * Constants
+     * -------------------------------------------------------------------
+     */
+
+    /*
+     * This constant is used during deserialization to check the J2SE version which
+     * created the serialized object
+     */
+    private static final long serialVersionUID = 0x69199e89ac11aae2L;
+
+    /*
+     * -------------------------------------------------------------------
+     * Instance variables
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Contains the modification to be performed.
+     * 
+     * @serial
+     * @see DirContext
+     */
+    private int mod_op;
+
+    /**
+     * The Attribute or value that is the source of the modification.
+     * 
+     * @serial 
+     */
+    private Attribute attr;
+
+    /*
+     * -------------------------------------------------------------------
+     * Constructors
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Constructs a <code>ModificaitionItem</code> instance with all parameters.
+     * 
+     * @param operation		an operation code chosen from <code>DirContext.ADD_ATTRIBUTE</code>,
+     * 						<code>DirContext.REPLACE_ATTRIBUTE</code>, 
+     *                      <code>DirContext.REMOVE_ATTRIBUTE</code>
+     * @param attribute		the <code>Attribute</code> or value that is the 
+     * 						source of the modification
+     */
+    public ModificationItem(int operation, Attribute attribute) {
+        if (null == attribute) {
+            throw new IllegalArgumentException("Non-null attribute is required for modification"); //$NON-NLS-1$
+        }
+        if (!(DirContext.ADD_ATTRIBUTE == operation
+            || DirContext.REPLACE_ATTRIBUTE == operation
+            || DirContext.REMOVE_ATTRIBUTE == operation)) {
+            throw new IllegalArgumentException(
+                "Modification code " //$NON-NLS-1$
+                    + operation
+                    + " must be one of DirContext.ADD_ATTRIBUTE, DirContext.REPLACE_ATTRIBUTE and DirContext.REMOVE_ATTRIBUTE"); //$NON-NLS-1$
+        }
+        this.mod_op = operation;
+        this.attr = attribute;
+    }
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Gets the <code>Attribute</code> or value that is the source of the 
+     * modification.
+     * 
+     * @return 				the <code>Attribute</code> or value that is the
+     *                      source of the modification
+     */
+    public Attribute getAttribute() {
+        return this.attr;
+    }
+
+    /**
+     * Gets the operation code.
+     * 
+     * @return 				an operation code chosen from <code>
+     *                      DirContext.ADD_ATTRIBUTE</code>, <code>
+     * 						DirContext.REPLACE_ATTRIBUTE</code>, <code>
+     *                      DirContext.REMOVE_ATTRIBUTE</code>
+     */
+    public int getModificationOp() {
+        return this.mod_op;
+    }
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods override parent class Object
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Returns string representations of this <code>ModificationItem</code> 
+     * instance.
+     *
+     * @return 				a concatenation of string values for the operation 
+     * 						and the attribute
+     */
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        switch (mod_op) {
+            case DirContext.ADD_ATTRIBUTE :
+                sb.append("Operation is add attribute: "); //$NON-NLS-1$
+                break;
+            case DirContext.REMOVE_ATTRIBUTE :
+                sb.append("Operation is remove attribute: "); //$NON-NLS-1$
+                break;
+            case DirContext.REPLACE_ATTRIBUTE :
+                sb.append("Operation is replace attribute: "); //$NON-NLS-1$
+                break;
+        }
+        return sb.append(attr.toString()).toString();
+    }
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/NoSuchAttributeException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/NoSuchAttributeException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/NoSuchAttributeException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/NoSuchAttributeException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,59 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.directory;
+
+import javax.naming.NamingException;
+
+/**
+ * Thrown when an attempt is made to access a non-existant attribute.
+ */
+public class NoSuchAttributeException extends NamingException {
+
+	/*
+	 * -------------------------------------------------------------------
+	 * Constants
+	 * -------------------------------------------------------------------
+	 */
+	 
+	/* Serialization information - start. */
+	private static final long serialVersionUID = 0x431e6668495bfb09L;
+	/* Serialization information - end. */
+
+	/*
+	 * -------------------------------------------------------------------
+	 * Constructors
+	 * -------------------------------------------------------------------
+	 */
+	 
+	/**
+	 * This is the default constructor. All fields are initialized to null.
+	 */		 
+	public NoSuchAttributeException() {
+		super();
+	}
+
+	/**
+	 * Construct a <code>NoSuchAttributeException</code> with given message.
+	 * @param s a message about the exception detail
+	 */
+	public NoSuchAttributeException(String s) {
+		super(s);
+	}
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SchemaViolationException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SchemaViolationException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SchemaViolationException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SchemaViolationException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,70 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.directory;
+
+import javax.naming.NamingException;
+
+/**
+ * Thrown when attempting to make a modification that contravenes the directory
+ * schema.<p>
+ * 
+ * For example, this exception is thrown if an attempt is made to modify the set
+ * of attributes that is defined on an entry to a state that is invalid by the
+ * object attributes schema.  Another example is if the naming schema is contravened
+ * by attempting to move the entry to a new part of the directory.<p>
+ * 
+ * The directory service provider throws these exceptions.<p>
+ * 
+ * The specification for serialization and thread-safety of <code>NamingException</code>
+ * applies equally to this class.<p> 
+ * 
+ */
+public class SchemaViolationException extends NamingException {
+
+    /*
+     * -------------------------------------------------------------------
+     * Constants
+     * -------------------------------------------------------------------
+     */
+
+    /* Serialization information - start. */
+    private static final long serialVersionUID = 0xd5c97d2fb107bec1L;
+    /* Serialization information - end. */
+
+    /*
+     * -------------------------------------------------------------------
+     * Constructors
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * This is the default constructor. All fields are initialized to null.
+     */
+    public SchemaViolationException() {
+        super();
+    }
+
+    /**
+     * Construct a <code>SchemaViolationException</code> with given message.
+     * @param s a message about exception detail
+     */
+    public SchemaViolationException(String s) {
+        super(s);
+    }
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchControls.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchControls.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchControls.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchControls.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,333 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.directory;
+
+import java.io.Serializable;
+
+/**
+ *
+ * This class represents the scope of a search, and the list of attributes that 
+ * the search encompasses.
+ * <p>
+ * The various scopes are defined by class constants representing Object, 
+ * Single-depth, and Full-depth searches of the directory.</p>
+ * <p>
+ * This class is not thread-safe.</p>
+ * 
+ * 
+ */
+public class SearchControls implements Serializable {
+
+    /*
+     * -------------------------------------------------------------------
+     * Constants
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Bounds the search to the object scope only.
+     * <p>
+     * The search takes place over the given object.  The resulting enumeration
+     * will therefore only contain either zero or one (the given) object depending
+     * upon whether the object matches the search criteria.</p>
+     * <p>
+     * If the object does match, its name in the enumeration will be empty since 
+     * names are specified relative to the root of the search.</p>
+     */
+    public static final int OBJECT_SCOPE = 0;
+
+    /**
+     * Bounds the search to a single level of the naming context rooted at the 
+     * given object.
+     * <p>
+     * The search will take place over the object, or if the object is a context 
+     * then the object and all objects that are one level removed from the given 
+     * context.</p>
+     * <p>
+     * Matches are named by a relative name to the given root, so will have atomic
+     * (single level valid) names.</p>
+     */
+    public static final int ONELEVEL_SCOPE = 1;
+
+    /**
+     * Bounds the search to the subtree rooted at the given object or naming 
+     * context.
+     * <p>
+     * The search will take place over the object, or if the object is a 
+     * context then the object and all objects that are reachable fromt he 
+     * given context.</p>
+     * <p>
+     * The names that are returned in the enumeration are defined to be 
+     * either relative names to the given root, or full URIs of the matching 
+     * objects.</p>
+     * <p>
+     * The seach is defined to no cross naming system boundaries.</p> 
+     */
+    public static final int SUBTREE_SCOPE = 2;
+
+    /*
+     * This constant is used during deserialization to check the J2SE version which
+     * created the serialized object
+     */
+    private static final long serialVersionUID = 0xdd935921dd0f3e33L;
+
+    /*
+     * -------------------------------------------------------------------
+     * Instance variables
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * The scope of the search.
+     * <p>
+     * Constrained to be one of ONELEVEL_SCOPE, OBJECT_SCOPE, or SUBTREE_SCOPE.</p>
+     * 
+     * @serial
+     */
+    private int searchScope;
+
+    /**
+     * Seach time limitation.
+     * <p>
+     * Maximum number of milliseconds to wait for the search to complete.</p>
+     * 
+     * @serial
+     */
+    private int timeLimit;
+
+    /**
+     * Flag showing whether searches should dereference JNDI links.
+     * 
+     * @serial
+     */
+    private boolean derefLink;
+
+    /** 
+     * Flag showing whether object is returned in the search results.
+     * 
+     * @serial
+     */
+    private boolean returnObj;
+
+    /** 
+     * Contains the maximum number of search results to return.
+     * 
+     * @serial
+     */
+    private long countLimit;
+
+    /**
+     * Lists attributes to match.
+     * <p>
+     * Contains a single entry for each attribute that is to be matches -- or it
+     * is null if all attributes are to be matched.</p>
+     * 
+     * @serial
+     */
+    private String attributesToReturn[];
+
+    /*
+     * -------------------------------------------------------------------
+     * Constructors
+     * -------------------------------------------------------------------
+     */
+     
+    /**
+     * Default constructor.
+     * <p>
+     * Equivalent to: 
+     * <code>SearchControls (ONELEVEL_SCOPE, 0, 0, null, false, false)</code>.</p>
+     */
+    public SearchControls() {
+        this(ONELEVEL_SCOPE, 0, 0, null, false, false);
+    }
+
+    /**
+     * Constructs a search control instance with all parameters.
+     * 
+     * @param searchScope	the search scope, chosen from OBJECT_SCOPE, 
+     * 						ONELEVEL_SCOPE or SUBTREE_SCOPE.
+     * @param countLimit 	the maximum number of search results. If is zero, 
+     * 						then the number of search results returned is 
+     * 						unlimited.
+     * @param timeLimit 	the maximum number of search time in milliseconds, 
+     * 						for the search.  If is zero, then there is no time 
+     * 						limit for the search.
+     * @param attributesToReturn
+     * 						an array of identifiers of attributes to return for 
+     * 						each result.  If is null, then all attributes are
+     * 						returned for each result.
+     * @param returnObj 	an flag. If true then search results contain an object, 
+     * 						otherwise they contain only a name and class pair.
+     * @param derefLink 	an flag. If true then <code>LinkRef</code> references 
+     *                      are followed in the search, otherwise they are not.
+     * 
+     */
+    public SearchControls(
+        int searchScope,
+        long countLimit,
+        int timeLimit,
+        String attributesToReturn[],
+        boolean returnObj,
+        boolean derefLink) {
+        this.searchScope = searchScope;
+        this.countLimit = countLimit;
+        this.timeLimit = timeLimit;
+        this.attributesToReturn = attributesToReturn;
+        this.derefLink = derefLink;
+        this.returnObj = returnObj;
+    }
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Gets the maximum number of search results.
+     * 
+     * @return 				the maximum number of search results to return.
+     */
+    public long getCountLimit() {
+        return countLimit;
+    }
+
+    /**
+     * Gets the flag indicates whether search will follow LinkRef references.
+     * 
+     * @return 				flag indicates whether searches will follow 
+     *                      <code>LinkRef</code> references. If true then 
+     *                      <code>LinkRef</code> references are 
+     * 						followed in the search, otherwise they are not.
+     */
+    public boolean getDerefLinkFlag() {
+        return derefLink;
+    }
+
+    /**
+     * Gets identifiers of attributes to return for each result. 
+     * 
+     * @return 				an array of identifiers of attributes to return for 
+     * 						each result.  If is null, then all attributes are
+     * 						returned for each result. 
+     */
+    public String[] getReturningAttributes() {
+        return attributesToReturn;
+    }
+
+    /**
+     * Gets the flag whether search results will include the object (true) or 
+     * not (false).
+     * 
+     * @return 				if true then search results contain an object, 
+     * 						otherwise they contain only a name and class pair.
+     */
+    public boolean getReturningObjFlag() {
+        return returnObj;
+    }
+
+    /**
+     * Gets the search scope.
+     * 
+     * @return 				the search scope, chosen from OBJECT_SCOPE, 
+     * 						ONELEVEL_SCOPE or SUBTREE_SCOPE.
+     */
+    public int getSearchScope() {
+        return searchScope;
+    }
+
+    /**
+     * Gets the the maximum number of search time.
+     * 
+     * @return 				the maximum number of search time in milliseconds, 
+     * 						for the search.  If is zero, then there is no time 
+     * 						limit for the search. 
+     */
+    public int getTimeLimit() {
+        return timeLimit;
+    }
+
+    /**
+     * Sets the maximum number of search results.
+     * 
+     * @param l				the maximum number of search results. If is zero, 
+     * 						then the number of search results returned is 
+     * 						unlimited.
+     */
+    public void setCountLimit(long l) {
+        countLimit = l;
+    }
+
+    /**
+     * Sets the flag indicates whether search will follow <code>LinkRef</code> 
+     * references.
+     * 
+     * @param flag			flag indicates whether searches will follow 
+     *                      <code>LinkRef</code> references. If true then 
+     *                      <code>LinkRef</code> references are 
+     * 						followed in the search, otherwise they are not.
+     */
+    public void setDerefLinkFlag(boolean flag) {
+        derefLink = flag;
+    }
+
+    /**
+     * Sets identifiers of attributes to return for each result. 
+     * 
+     * @param as			an array of identifiers of attributes to return for 
+     * 						each result.  If is null, then all attributes are
+     * 						returned for each result. 
+     */
+    public void setReturningAttributes(String as[]) {
+        attributesToReturn = as;
+    }
+
+    /**
+     * Sets the flag whether search results will include the object (true) or 
+     * not (false).
+     * 
+     * @param flag			if true then search results contain an object, 
+     * 						otherwise they contain only a name and class pair.
+     */
+    public void setReturningObjFlag(boolean flag) {
+        returnObj = flag;
+    }
+
+    /**
+     * Sets the search scope.
+     * 
+     * @param i				the search scope, chosen from OBJECT_SCOPE, 
+     * 						ONELEVEL_SCOPE or SUBTREE_SCOPE.
+     */
+    public void setSearchScope(int i) {
+        searchScope = i;
+    }
+
+    /**
+     * Sets the the maximum number of search time.
+     * 
+     * @param i				the maximum number of search time in milliseconds, 
+     * 						for the search.  If is zero, then there is no time 
+     * 						limit for the search. 
+     */
+    public void setTimeLimit(int i) {
+        timeLimit = i;
+    }
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchResult.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchResult.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchResult.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/SearchResult.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,226 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.directory;
+
+import javax.naming.Binding;
+
+/**
+ * <code>SearchResult</code> returned from a search on a directory context
+ * and is provided by a <code>NaminEnumeration</code>.
+ * <p>
+ * This class is not thread-safe.</p>
+ * 
+ * 
+ */
+public class SearchResult extends Binding {
+
+    /*
+     * -------------------------------------------------------------------
+     * Constants
+     * -------------------------------------------------------------------
+     */
+    /*
+     * This constant is used during deserialization to check the J2SE version which
+     * created the serialized object.
+     */
+    private static final long serialVersionUID = 0x80e805ecc9ed1c5cL;
+
+    /*
+     * -------------------------------------------------------------------
+     * Instance variables
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * The attributes that were matched for this object. 
+     * 
+     * @serial
+     */
+    private Attributes attrs;
+
+    /*
+     * -------------------------------------------------------------------
+     * Constructors
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Creates a new instance of <code>SearchResult</code> with name <code>s</code>, 
+     * bound object <code>o</code> and an <code>attributes</code>
+     * 
+     * @param s				the name of this result. <code>s</code> should be 
+     * 						relative to the	target context for the search that 
+     * 						produces this result.
+     * @param o				bound object of this result. The class of 
+     * 						<code>o</code> is the value that will 
+     * 						be returned by <code>Binding.getClassName()</code> 
+     *                      for this search result, except where 
+     *                      <code>setClassName()</code> is used to set a different 
+     *                      value. If <code>o</code> is null, 
+     * 						<code>getClassName()</code> will return null.
+     * @param attributes	The <code>attributes</code> should not be null. If 
+     * 						there are no attributes for this search result, 
+     * 						this parameter should be an empty collection.
+     */
+    public SearchResult(String s, Object o, Attributes attributes) {
+        this(s, null, o, attributes, true);
+    }
+
+    /**
+     * Creates a new instance of <code>SearchResult</code> with name <code>s</code>, 
+     * bound object <code>o</code>, an <code>attributes</code> and a boolean 
+     * <code>flag</code>
+     * 
+     * @param s				the name of this result. A true value of 
+     * 						<code>flag</code> means <code>s</code> is relative 
+     * 						to the target context of the search that produces 
+     * 						this result. A false value of <code>flag</code> 
+     * 						means that <code>s</code> is a URL string.
+     * @param o				bound object of this result. The class of 
+     * 						<code>o</code> is the value that will 
+     * 						be returned by <code>Binding.getClassName()</code>
+     *                      for this search result, except where 
+     *                      <code>setClassName()</code> is used 
+     * 						to set a different value. If <code>o</code> is null, 
+     * 						<code>getClassName()</code> will return null.
+     * @param attributes	The <code>attributes</code> should not be null. If 
+     * 						there are no attributes for this search result, 
+     * 						this parameter should be an empty collection.
+     * @param flag			A true value of <code>flag</code> means <code>s</code> 
+     * 						is relative to the target context of the search that 
+     * 						produces this result. A false value of <code>flag</code> 
+     * 						means that <code>s</code> is a URL string.
+     * 
+     */
+    public SearchResult(String s, Object o, Attributes attributes, boolean flag) {
+        this(s, null, o, attributes, flag);
+    }
+
+    /**
+     * Creates a new instance of <code>SearchResult</code> with name <code>s</code>, 
+     * class name <code>s1</code> bound object <code>o</code> and an 
+     * <code>attributes</code>
+     * 
+     * @param s				the name of this result. <code>s</code> should be 
+     * 						relative to the target context for the search that 
+     * 						produces this result.
+     * @param s1			If <code>s1</code> is not null, it specifies the 
+     * 						name of the class of the bound object <code>o</code>. 
+     * 						Passing a null value for <code>s1</code> will not 
+     * 						stop <code>Binding.getClassName()</code> returning the 
+     *                      name of the class of <code>o</code>.
+     * @param o				bound object of this result. The class of 
+     * 						<code>o</code> is the value that will 
+     * 						be returned by <code>Binding.getClassName()</code> for 
+     *                      this search result, except where 
+     *                      <code>setClassName()</code> is used 
+     * 						to set a different value. If <code>o</code> is null, 
+     * 						<code>getClassName()</code> will return null.
+     * @param attributes 	The <code>attributes</code> should not be null. If 
+     * 						there are no attributes for this search result, 
+     * 						this parameter should be an empty collection.
+     */
+    public SearchResult(String s, String s1, Object o, Attributes attributes) {
+        this(s, s1, o, attributes, true);
+    }
+
+    /**
+     * Creates a new instance of <code>SearchResult</code> with name <code>s</code>, 
+     * class name <code>s1</code> bound object <code>o</code> , an 
+     * <code>attributes</code> and a boolean <code>flag</code>
+     * 
+     * @param s				the name of this result. A true value of 
+     * 						<code>flag</code> means <code>s</code> is relative 
+     * 						to the target context of the search that produces 
+     * 						this result. A false value of <code>flag</code> 
+     * 						means that <code>s</code> is a URL string.
+     * @param s1			If <code>s1</code> is not null, it specifies the 
+     * 						name of the class of the bound object <code>o</code>. 
+     * 						Passing a null value for <code>s1</code> will not 
+     * 						stop <code>Binding.getClassName()</code> returning 
+     *                      the name of the class of <code>o</code>.
+     * @param o				bound object of this result. The class of 
+     * 						<code>o</code> is the value that will 
+     * 						be returned by <code>Binding.getClassName()</code> 
+     *                      for this search result, except where 
+     *                      <code>setClassName()</code> is used 
+     * 						to set a different value. If <code>o</code> is null, 
+     * 						<code>getClassName()</code> will return null.
+     * @param attributes	The <code>attributes</code> should not be null. If 
+     * 						there are no attributes for this search result, 
+     * 						this parameter should be an empty collection.
+     * @param flag			A true value of <code>flag</code> means <code>s</code> 
+     * 						is relative to the target context of the search that 
+     * 						produces this result. A false value of <code>flag</code> 
+     * 						means that <code>s</code> is a URL string.
+     */
+    public SearchResult(
+        String s,
+        String s1,
+        Object o,
+        Attributes attributes,
+        boolean flag) {
+        super(s, s1, o, flag);
+        this.attrs = attributes;
+    }
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Gets attributes of this search result
+     * 
+     * @return 				an attributes. It should not be null.
+     */
+    public Attributes getAttributes() {
+        return attrs;
+    }
+
+    /**
+     * Sets attributes of this search result
+     * 
+     * @param attributes	an attributes. It should not be null.	
+     */
+    public void setAttributes(Attributes attributes) {
+        attrs = attributes;
+    }
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods override parent class Object
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Return a concatenation of the <code>toString()</code> value for the 
+     * binding, and the <code>toString()</code> values for the attributes, 
+     * joined by colons.
+     * 
+     * @return 				string representation of this search result
+     */
+    public String toString() {
+        return new StringBuffer(super.toString())
+            .append(":") //$NON-NLS-1$
+            .append(attrs.toString())
+            .toString();
+    }
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventContext.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventContext.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventContext.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventContext.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,154 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.event;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+
+/**
+ * This interface is for registering and deregistering to receive events about
+ * objects that are bound in a context.
+ * <p>
+ * Listeners register an interest in a target object or objects. The context
+ * might not yet have a binding for the target, and it is optional whether a
+ * context will support registering for events about an object that is not
+ * bound. If the context does not support it then 
+ * <code>addNamingListener()</code> should throw a 
+ * <code>NameNotFoundException</code>. Alternatively, if this is not possible, 
+ * the <code>EventContext</code> should send the listener a 
+ * <code>NamingExceptionEvent</code> with the information. A 
+ * <code>NamingExceptionEvent</code> is also used to notify listeners who
+ * have registered interest in a target that is subsequently deleted, if the
+ * context only allows registration for currently bound objects.</p>
+ * <p>
+ * Listeners can register for events affecting the context itself, which as
+ * usual is referred to by the empty name.</p>
+ * <p>
+ * When a listener receives a <code>NamingExceptionEvent</code> it is deregistered.
+ * </p>
+ * <p>
+ * When <code>Context</code>.closed is called on an <code>EventContext</code>,
+ * all of its listeners are deregistered.</p>
+ * <p>
+ * Listener implementations may choose to implement more than one sub-interface
+ * of <code>NamingListener</code>, in order to be notified of more than one type 
+ * of event.</p>
+ * <p>
+ * Event context implementations are not expected to be thread safe. </p>
+ * 
+ * 
+ */
+public interface EventContext extends Context{
+
+	/*
+	 * -------------------------------------------------------------------
+	 * Constants
+	 * -------------------------------------------------------------------
+	 */	
+	 
+	/**
+	 * This constant indicates interest in the named object only.
+	 */
+	public static final int OBJECT_SCOPE = 0;
+	
+	/**
+	 * This constant indicates interest in objects bound in the named context,
+	 * but not the context itself.
+	 */
+	public static final int ONELEVEL_SCOPE = 1;
+	
+	/**
+	 * This constant indicates interest in the named object and its subtree. 
+	 * <p>
+	 * When the named object is not a context, "subtree" here refers to the 
+	 * subtree of the context that contains the bound object. Where the named 
+	 * object is itself a context, "subtree" refers to the subtree of the 
+	 * named context.</p>
+	 */
+	public static final int SUBTREE_SCOPE = 2;
+
+	/*
+	 * -----------------------------------------
+	 * methods
+	 * -----------------------------------------
+	 */
+
+	/**
+	 * Registers <code>namingListener</code> for events concerning <code>name</code>,
+     * with scope <code>i</code>. 
+	 * <p>
+	 * The scope must be one of <code>OBJECT_SCOPE</code>, 
+	 * <code>NELEVEL_SCOPE</code>, or <code>SUBTREE_SCOPE</code>.
+	 * </p>
+	 * <p>
+	 * When the scope is <code>ONELEVEL_SCOPE</code>, <code>name</code> must be a context. 
+	 * Otherwise <code>name</code> can be a context or a bound object.
+	 * </p>
+	 * <p>
+	 * Name is relative to this context.
+	 * </p>
+	 * @param name				the concerning name 
+	 * @param i					the scope
+	 * @param namingListener	the listener to be registered
+	 * @throws NamingException	If any exception occured.
+	 */
+	void addNamingListener(
+			Name name,
+			int i,
+			NamingListener namingListener)
+			throws NamingException;
+
+	/**
+	 * Registers <code>namingListener</code> for events concerning name, with 
+	 * scope <code>i</code>. 
+	 * 
+	 * @param s					the concerning name string
+	 * @param i					the scope
+	 * @param namingListener	the listener to be registered
+	 * @throws NamingException	If any exception occured.
+     * @see #addNamingListener(Name, int, NamingListener) 
+	 */
+	void addNamingListener(
+			String s,
+			int i,
+			NamingListener namingListener)
+			throws NamingException;
+
+	/**
+	 * Removes all registrations for <code>namingListener</code> in this 
+	 * <code>EventContext</code>. If there are no registrations this method 
+	 * does nothing. 
+	 * 
+	 * @param namingListener	the listener to be unregistered
+	 * @throws NamingException	If any exception occured.
+	 */	
+	void removeNamingListener(NamingListener namingListener)
+			throws NamingException;
+
+	/**
+	 * Checks if the implementation supports registration for names that are
+	 * not (yet) bound in this context.
+	 * 
+	 * @return	 				false if implemention supports this, otherwise
+     *                          true if the implementation does not support this.
+	 * @throws NamingException  If the support is not known.
+	 */
+	boolean targetMustExist() throws NamingException;
+}
+
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventDirContext.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventDirContext.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventDirContext.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/EventDirContext.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,138 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.event;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+
+/**
+ * This interface allows registering of listeners for events concerning objects
+ * bound in a directory context.
+ * <p>
+ * The registration methods take an RFC2254 search filter as a parameter, which
+ * is used to select the objects to generate events for.</p>
+ * <p>
+ * Sometimes objects that satisfy a search filter may be bound after a listener
+ * is registered, specifying the filter. Where the directory service will not
+ * support this, and generate events for objects bound after a given filter is
+ * specified, then the <code>addNamingListener</code> methods will throw an 
+ * <code>InvalidSearchFilterException</code>.</p>
+ * 
+ * 
+ */
+public interface EventDirContext extends EventContext, DirContext {
+
+    /*
+     * -----------------------------------------
+     * methods
+     * -----------------------------------------
+     */
+
+    /**
+     * Registers naming listener for events concerning objects selected by the 
+     * given search at <code>name</code>. The <code>name</code> parameter is 
+     * relative to this context.
+     * 
+     * @param name				the concerning <code>Name</code> 
+     * @param filter			a RFC2254 search filter
+     * @param filterArgs		filter arguments
+     * @param searchControls	Further specifies the selection of objects to 
+     * 							generate events for, and the information 
+     * 							contained in <code>NamingEvents</code> that may 
+     * 							be generated.
+     * @param namingListener	the <code>NamingListener</code> to be registered
+     * @throws NamingException  If any exception occured.
+     */
+    void addNamingListener(
+        Name name,
+        String filter,
+        Object filterArgs[],
+        SearchControls searchControls,
+        NamingListener namingListener)
+        throws NamingException;
+
+    /**
+     * Registers naming listener for events concerning objects selected by the 
+     * given search at <code>name</code>. The <code>name</code> parameter is 
+     * relative to this context.
+     * 
+     * @param name				the concerning <code>Name</code> 
+     * @param filter			a RFC2254 search filter string with no arguments
+     * @param searchControls	further specifies the selection of objects to 
+     * 							generate events for, and the information 
+     * 							contained in <code>NamingEvents</code> that may 
+     * 							be generated
+     * @param namingListener	the <code>NamingListener</code> to be registered
+     * @throws NamingException  If any exception occured.
+     * @see #addNamingListener(Name, String, Object[], SearchControls, NamingListener)
+     */
+    void addNamingListener(
+        Name name,
+        String filter,
+        SearchControls searchControls,
+        NamingListener namingListener)
+        throws NamingException;
+
+    /**
+     * Registers naming listener for events concerning objects selected by the 
+     * given search at name string <code>name</code>. The <code>s</code> 
+     * parameter is relative to this context.
+     * 
+     * @param name				the concerning <code>Name</code> 
+     * @param filter			a RFC2254 search filter
+     * @param filterArgs		filter arguments
+     * @param searchControls	further specifies the selection of objects to 
+     * 							generate events for, and the information 
+     * 							contained in <code>NamingEvents</code> that may 
+     * 							be generated
+     * @param namingListener	the <code>NamingListener</code> to be registered
+     * @throws NamingException  If any exception occured.
+     * @see #addNamingListener(Name, String, Object[], SearchControls, NamingListener)
+     */
+    void addNamingListener(
+        String name,
+        String filter,
+        Object filterArgs[],
+        SearchControls searchControls,
+        NamingListener namingListener)
+        throws NamingException;
+
+    /**
+     * Registers naming listener for events concerning objects selected by the 
+     * given search at name string <code>name</code>. The <code>s</code> 
+     * parameter is relative to this context.
+     * 
+     * @param name				the concerning <code>Name</code> 
+     * @param filter			a RFC2254 search filter string with no arguments
+     * @param searchControls	further specifies the selection of objects to 
+     * 							generate events for, and the information 
+     * 							contained in <code>NamingEvents</code> that may 
+     * 							be generated
+     * @param namingListener	the <code>NamingListener</code> to be registered
+     * @throws NamingException  If any exception occured.
+     * @see #addNamingListener(String, String, Object[], SearchControls, NamingListener)
+     */
+    void addNamingListener(
+        String name,
+        String filter,
+        SearchControls searchControls,
+        NamingListener namingListener)
+        throws NamingException;
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamespaceChangeListener.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamespaceChangeListener.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamespaceChangeListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamespaceChangeListener.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,59 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.event;
+/**
+ * The listener interface to get notification of namespace change events.
+ * <p>
+ * These events include naming events with event type <code>OBJECT_ADDED</code>, 
+ * <code>OBJECT_RENAMED</code>, or <code>OBJECT_REMOVED</code>. A service 
+ * provider will call one of these interface methods to notify a listener of 
+ * an event, passing in a <code>NamingEvent</code> parameter.
+ * This <code>NamingEvent</code> provides methods to get various bits 
+ * information about the event.</p>
+ * 
+ * 
+ */
+public interface NamespaceChangeListener extends NamingListener{
+	
+	/*
+	 * -----------------------------------------
+	 * methods
+	 * -----------------------------------------
+	 */
+	 
+	/**
+	 * Called by a service provider when there is a new binding.
+	 * 
+	 * @param namingevent 	the event notification
+	 */
+	void objectAdded(NamingEvent namingevent);
+
+	/**
+	 * Called by a service provider when a binding is removed.
+	 * 
+	 * @param namingevent 	the event notification
+	 */
+	void objectRemoved(NamingEvent namingevent);
+	
+	/**
+	 * Called by a service provider when a binding is renamed.
+	 * 
+	 * @param namingevent 	the event notification
+	 */
+	void objectRenamed(NamingEvent namingevent);
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingEvent.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingEvent.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingEvent.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingEvent.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,282 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.event;
+
+import java.util.EventObject;
+import javax.naming.Binding;
+
+/**
+ * An event from a directory or naming service, for passing to a listener.
+ * <p>
+ * The source of the event is always the <code>EventContext</code> that the 
+ * listener registered with. Names in the <code>NamingEvent</code> object 
+ * are all relative to this context.</p>
+ * <p>
+ * Note the discussion about threads and synchronization in the description for
+ * this package.</p>
+ * 
+ * 
+ */
+public class NamingEvent extends EventObject {
+
+    /*
+     * -----------------------------------------
+     * Constants
+     * -----------------------------------------
+     */
+
+    /**
+     * A <code>NamingEvent</code> type constant, indicating that an object was
+     * added.
+     */
+    public static final int OBJECT_ADDED = 0;
+
+    /**
+     * A <code>NamingEvent</code> type constant, indicating that an object was
+     * changed.
+     */
+    public static final int OBJECT_CHANGED = 3;
+
+    /**
+     * A <code>NamingEvent</code> type constant, indicating that an object was
+     * removed.
+     */
+    public static final int OBJECT_REMOVED = 1;
+
+    /**
+     * A <code>NamingEvent</code> type constant, indicating that an object was
+     * renamed.
+     */
+    public static final int OBJECT_RENAMED = 2;
+
+    /* 
+     * This constant is used during deserialization to check the J2SE version which
+     * created the serialized object.
+     */
+    private static final long serialVersionUID = 0x9d18b00289d22f45L; //J2SE 1.4.2
+
+    /*
+     * -------------------------------------------------------------------
+     * Instance variables
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Some information about the event, whose format is specified by the 
+     * service provider.
+     * 
+     * @serial
+     */
+    protected Object changeInfo;
+
+    /**
+     * The binding after the event.
+     * 
+     * @serial
+     */
+    protected Binding newBinding;
+
+    /**
+     * The binding before the event.
+     * 
+     * @serial
+     */
+    protected Binding oldBinding;
+
+    /**
+     * The type of this event. Its value is one of the constant event types
+     * above.
+     * 
+     * @serial
+     */
+    protected int type;
+
+    // the context that generated this event
+    private transient EventContext eventContext;
+
+    /*
+     * -----------------------------------------
+     * Constructors
+     * -----------------------------------------
+     */
+
+    /**
+     * 
+     * Constructs an <code>NamingEvent</code> with all parameters. 
+     *
+     * @param eventContext	the context that generated this event. It is the
+     * 						originator of this event and cannot be null.
+     * @param type			the constant value that specifies the type of event
+     * @param newBinding    binding after the event. <code>newBinding</code> might 
+     * 						be null depending on the value of the <code>type</code>
+     * 						paramater as follows:
+     * 						<ul>
+     * 						<li>
+     * 						<code>OBJECT_ADDED</code> - <code>newBinding</code> cannot be null
+     * 						</li>
+     * 						<li>
+     * 						<code>OBJECT_CHANGED</code> - <code>newBinding</code> cannot be null
+     * 						</li>
+     * 						<li>
+     * 						<code>OBJECT_REMOVED</code> - <code>newBinding</code> can be null
+     * 						</li>
+     * 						<li>
+     * 						<code>OBJECT_RENAMED</code> - <code>newBinding</code> can be null
+     * 						</li>
+     * 						</ul>
+     * 						The names are relative to the <code>eventContext</code>
+     * @param oldBinding	the binding before the event. <code>oldBinding</code> might 
+     * 						be null depending on the value of the <code>type</code>
+     * 						paramater as follows:
+     * 						<ul>
+     * 						<li>
+     * 						<code>OBJECT_ADDED</code> - <code>oldBinding</code> 
+     * 						can be null
+     * 						</li>
+     * 						<li>
+     * 						<code>OBJECT_CHANGED</code> - <code>oldBinding</code> 
+     * 						cannot be null
+     * 						</li>
+     * 						<li>
+     * 						<code>OBJECT_REMOVED</code> - <code>oldBinding</code> 
+     * 						cannot be null
+     * 						</li>
+     * 						<li>
+     * 						<code>OBJECT_RENAMED</code> - <code>oldBinding</code> 
+     * 						can be null
+     * 						</li>
+     * 						</ul>
+     * 						The names are relative to the <code>eventContext</code>
+     * @param changeInfo	contain some information about the event and maybe 
+     * 						null, the format of which is specified by the 
+     * 						service provider.
+     */
+    public NamingEvent(
+        EventContext eventContext,
+        int type,
+        Binding newBinding,
+        Binding oldBinding,
+        Object changeInfo) {
+        super(eventContext);
+
+        this.type = type;
+        this.changeInfo = changeInfo;
+        this.newBinding = newBinding;
+        this.oldBinding = oldBinding;
+        this.eventContext = eventContext;
+
+    }
+
+    /*
+     * -----------------------------------------
+     * Methods
+     * -----------------------------------------
+     */
+
+    /**
+     * Calls a method to notify the listener of this event. 
+     * <p>
+     * For <code>OBJECT_ADDED</code>, <code>OBJECT_REMOVED</code> or 
+     * <code>OBJECT_RENAMED</code> type events this method calls the 
+     * corresponding method in the <code>NamespaceChangedListener</code> 
+     * interface. For <code>OBJECT_CHANGED</code> type events this method calls 
+     * <code>objectChanged()</code> in the <code>ObjectChangeListener</code> 
+     * interface.</p>
+     * 
+     * @param naminglistener	the listener of this event
+     */
+    public void dispatch(NamingListener naminglistener) {
+        switch (type) {
+            case OBJECT_ADDED :
+                 ((NamespaceChangeListener) naminglistener).objectAdded(this);
+                break;
+            case OBJECT_REMOVED :
+                 ((NamespaceChangeListener) naminglistener).objectRemoved(this);
+                break;
+            case OBJECT_RENAMED :
+                 ((NamespaceChangeListener) naminglistener).objectRenamed(this);
+                break;
+            case OBJECT_CHANGED :
+                 ((ObjectChangeListener) naminglistener).objectChanged(this);
+                break;
+        }
+    }
+
+    /**
+     * Gets the change information.
+     * 
+     * @return 				the change information object provided by the 
+     * 						service provider, which may be null.
+     */
+    public Object getChangeInfo() {
+        return changeInfo;
+    }
+
+    /**
+     * Gets the <code>EventContext</code> that generated this event.
+     * 
+     * @return				the <code>EventContext</code> that generated this event.
+     */
+    public EventContext getEventContext() {
+        return eventContext;
+    }
+
+    /**
+     * Gets the binding after this event.
+     * <p>
+     * If it exists and is inside the scope that was specified when the listener 
+     * was registered using <code>EventContext.addNamimgListener</code>. 
+     * Returns null otherwise. Therefore for an <code>OBJECT_RENAMED</code> 
+     * event, the return value will be non-null if the new name places the 
+     * binding within the scope for the listener.</p>
+     *
+     * @return				the binding after this event
+     */
+    public Binding getNewBinding() {
+        return newBinding;
+    }
+
+    /**
+     * Gets the binding before this event. 
+     * <p>
+     * If it existed and was inside the scope that was specified when the 
+     * listener was registered using <code>EventContext.addNamimgListener</code>. 
+     * Returns null otherwise. Therefore for an <code>OBJECT_RENAMED</code> 
+     * event, the return value will be non-null if the old name placed the 
+     * binding within the scope for the listener.</p>
+     *
+     * @return				the binding before this event
+     */
+    public Binding getOldBinding() {
+        return oldBinding;
+    }
+
+    /**
+     * Gets the type of the event. 
+     * <p>
+     * The return value is constrained to a choice from: 
+     * <code>OBJECT_ADDED</code>, <code>OBJECT_REMOVED</code>, 
+     * <code>OBJECT_RENAMED</code>, <code>OBJECT_CHANGED</code>.</p>
+     * 
+     * @return				the type of the event
+     */
+    public int getType() {
+        return type;
+    }
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingExceptionEvent.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingExceptionEvent.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingExceptionEvent.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingExceptionEvent.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,107 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.event;
+
+import java.util.EventObject;
+
+import javax.naming.NamingException;
+
+/**
+ * An event object contains a <code>NamingException</code>. 
+ * 
+ * 
+ */
+public class NamingExceptionEvent extends EventObject {
+
+    /*
+     * -----------------------------------------
+     * Constants
+     * -----------------------------------------
+     */
+    private static final long serialVersionUID = 0xbc4f019fab3b5a30L;
+    
+    /*
+     * -------------------------------------------------------------------
+     * Instance variables
+     * -------------------------------------------------------------------
+     */
+     
+	/**
+	 * associated exception of this event
+	 * 
+	 * @serial
+	 */
+    private NamingException exception;
+
+    /*
+     * -----------------------------------------
+     * Constructors
+     * -----------------------------------------
+     */
+
+    /**
+     * Constructs a <code>NamingExceptionEvent</code> instance with 
+     * a <code>EventContext</code> and a <code>NamingException</code>.
+     * 
+     * @param eventContext	context that generated this event. It is the 
+     * 						originator of this event and cannot be null.
+     * @param namingException
+     * 						the associated exception and cannnot be null.
+     */
+    public NamingExceptionEvent(
+        EventContext eventContext,
+        NamingException namingException) {
+        super(eventContext);
+        this.exception = namingException;
+    }
+
+    /*
+     * -----------------------------------------
+     * Methods
+     * -----------------------------------------
+     */
+
+    /**
+     * Calls a method to notify the listener that a naming exception has been 
+     * thrown.
+     * 
+     * @param naminglistener	the listener to be notified
+     */
+    public void dispatch(NamingListener naminglistener) {
+        naminglistener.namingExceptionThrown(this);
+    }
+
+    /**
+     * Gets the source of the event.
+     * 
+     * @return				the source of the event 
+     */
+    public EventContext getEventContext() {
+        return (EventContext) getSource();
+    }
+
+    /**
+     * Gets the associated <code>NamingException</code>.
+     * 
+     * @return				the associated <code>NamingException</code>
+     */
+    public NamingException getException() {
+        return exception;
+    }
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingListener.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingListener.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/NamingListener.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,50 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.event;
+
+import java.util.EventListener;
+
+/**
+ * This is a root listener interface that provides a method needed by all its
+ * subinterfaces.
+ * <p>
+ * The method is <code>namingExceptionThrown</code>, which is required for
+ * notification of problems when registering a listener, or problems when
+ * getting information to send an event to a listener. When a listener is
+ * notified of a <code>NamingExceptionEvent</code> it is automatically 
+ * deregistered.</p>
+ * 
+ * 
+ */
+public interface NamingListener extends EventListener{
+	
+	/*
+	 * -----------------------------------------
+	 * methods
+	 * -----------------------------------------
+	 */
+
+	 /**
+	  * This method is called by a naming or directory service provider when a naming
+	  * exception occurs whilst the service provider is trying to register or prepare
+	  * an event notification for the listener.
+	  * 
+	  * @param namingExceptionEvent		the event notification
+	  */	
+	void namingExceptionThrown(NamingExceptionEvent namingExceptionEvent);
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/ObjectChangeListener.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/ObjectChangeListener.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/ObjectChangeListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/event/ObjectChangeListener.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,51 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.event;
+
+/**
+ * The listener interface to get notification of object change events.
+ * <p>
+ * These object change events include naming events with type 
+ * <code>OBJECT_CHANGED</code>. These events could mean that a bound object has 
+ * had its attributes changed somehow, or has been replaced altogether. The 
+ * listener can work out what has changed by querying the 
+ * <code>NamingEvent</code> object that is passed to the 
+ * <code>objectChanged</code> notification method.
+ * 
+ * 
+ */
+public interface ObjectChangeListener extends NamingListener{
+	
+	/*
+	 * -----------------------------------------
+	 * methods
+	 * -----------------------------------------
+	 */	
+	
+	/**
+	 * This method is called by a service provider to notify a listener that a 
+	 * bound object has changed in some way.
+	 * <p>
+	 * The changes can be deduced by querying <code>namingEvent</code>, especially 
+	 * <code>NamingEvent.getNewBinding()</code> and 
+	 * <code>NamingEvent.getOldBindng()</code>.</p>
+	 * 
+	 * @param namingEvent	the event notification 
+	 */ 
+	void objectChanged(NamingEvent namingEvent);
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Control.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Control.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Control.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Control.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,79 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.ldap;
+
+import java.io.Serializable;
+
+/**
+ * A <code>Control</code> corresponds to a control used in LDAPv3. Controls are 
+ * specified in RFC2251. A control provides extra information related to an 
+ * operation on the server. It may be a request control which is sent when a 
+ * request is made to the LDAPv3 server or it may be a response control which 
+ * is received from the LDAPv3 server. 
+ *
+ * 
+ */
+public interface Control extends Serializable {
+
+    /*
+     * -------------------------------------------------------------------
+     * Constants
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * The constant indicating that a <code>Control</code> is critical.
+     */
+    public static final boolean CRITICAL = true;
+
+    /**
+     * The constant indicating that a <code>Control</code> is not critical.
+     */
+    public static final boolean NONCRITICAL = false;
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Returns the object ID assigned to this <code>Control</code> instance.
+     * (see RFC2251).
+     * 
+     * @return          the object ID assigned to the control
+     */
+    String getID();
+
+    /**
+     * Indicates whether this <code>Control</code> instance is critical.
+     * 
+     * @return          true if critical, otherwise false
+     */
+    boolean isCritical();
+
+    /**
+     * Returns the value of this <code>Control</code> instance encoded using
+     * ASN.1 Basic Encoding Rules (BER).
+     * 
+     * @return          the encoded value of this <code>Control</code> instance
+     */
+    byte[] getEncodedValue();
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ControlFactory.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,174 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.ldap;
+
+import java.util.Hashtable;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import com.ibm.jndi.EnvironmentReader;
+
+/**
+ * This abstract class is used for factories which create controls as used in 
+ * LDAPv3.
+ * These factories are used by service providers to obtain control instances 
+ * when they receive a response control.
+ *
+ * @see Control
+ * 
+ */
+public abstract class ControlFactory {
+
+    /*
+     * -------------------------------------------------------------------
+     * Constructors
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Constructs a <code>ControlFactory</code> instance with no parameters.
+     */
+    protected ControlFactory() {
+    	super();
+    }
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Uses this control factory to create a particular type of <code>Control
+     * </code> based on the supplied control.
+     * It is likely that the supplied control contains data encoded in BER 
+     * format as received from an LDAP server. Returns <code>null</code> if the
+     * factory cannot create a <code>Control</code> else it returns the type of
+     * <code>Control</code> created by the factory.
+
+     * 
+     * @param c                 the supplied control
+     * @throws NamingException  If an error is encountered.
+     * @return the control
+     */
+    public abstract Control getControlInstance(Control c)
+        throws NamingException;
+
+    /**
+     * Creates a particular type of control based on the supplied control c.
+     * It is likely that the supplied control contains data encoded in BER 
+     * format as received from an LDAP server.
+     * <p>
+     * This method tries the factories in LdapContext.CONTROL_FACTORIES, 
+     * first from the supplied <code>Hashtable</code> then from the resource
+     * provider files of the supplied <code>Context</code>.</p>
+     * <p> 
+     * It returns the supplied control if no factories are loaded or a control
+     * cannot be created. Otherwise, a new <code>Control</code> instance is 
+     * returned.
+     * 
+     * @param c                 the supplied <code>Control</code> instance
+     * @param ctx               the supplied <code>Context</code> instance
+     * @param h                 the supplier JNDI environment properties
+     * @return                  the supplied control if no factories are loaded
+     *                          or a control cannot be created, otherwise a new 
+     *                          <code>Control</code> instance
+     * @throws NamingException  If an error is encountered.
+     */
+    public static Control getControlInstance(
+        Control c,
+        Context ctx,
+        Hashtable h)
+        throws NamingException {
+
+        // obtain control factories from hashtable and provider resource file
+        String fnames[] =
+            EnvironmentReader
+                .getFactoryNamesFromEnvironmentAndProviderResource(
+                h,
+                ctx,
+                LdapContext.CONTROL_FACTORIES);
+
+        // for each control factory
+        for (int i = 0; i < fnames.length; i++) {
+            // new factory instance by its class name
+            ControlFactory factory = null;
+            try {
+                factory =
+                    (ControlFactory) classForName(fnames[i]).newInstance();
+            } catch (Exception e) {
+                continue;
+            }
+            // try obtaining a Control using the factory
+            Control control = factory.getControlInstance(c);
+            // if a Control is obtained successfully, return it
+            if (null != control) {
+                return control;
+            }
+        }
+
+        // all factories failed, return the input argument c
+        return c;
+    }
+
+    /*
+     * Use the context class loader or the system class loader to load the
+     * specified class, in a privileged manner.
+     */
+    private static Class classForName(final String className)
+        throws ClassNotFoundException {
+
+        Class cls =
+            (Class) AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                // try thread context class loader first
+                try {
+                    return Class.forName(
+                        className,
+                        true,
+                        Thread.currentThread().getContextClassLoader());
+                } catch (ClassNotFoundException e) {
+                	// Ignored
+                }
+                // try system class loader second
+                try {
+                    return Class.forName(
+                        className,
+                        true,
+                        ClassLoader.getSystemClassLoader());
+                } catch (ClassNotFoundException e1) {
+                	// Ignored
+                }
+                // return null, if fail to load class
+                return null;
+            }
+        });
+
+        if (cls == null) {
+            throw new ClassNotFoundException(
+                "class " + className + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        return cls;
+
+    }
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedRequest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedRequest.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedRequest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedRequest.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,74 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.ldap;
+
+import java.io.Serializable;
+import javax.naming.NamingException;
+
+/**
+ * See RFC2251 for the definition of an <code>ExtendedRequest</code>.
+ * 
+ * @see ExtendedResponse
+ * 
+ */
+public interface ExtendedRequest extends Serializable {
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Gets the object ID assigned to this request.
+     * (see RFC2251)
+     * 
+     * @return                  the object ID assigned to this request
+     */
+    String getID();
+
+    /**
+     * Gets the request encoded using ASN.1 Basic Encoding Rules (BER).
+     * 
+     * @return                  the request encoded using ASN.1 BER
+     */
+    byte[] getEncodedValue();
+
+    /**
+     * Returns a suitable <code>ExtendedResponse</code> object for this request.
+     * The method parameters provide the data obtained by the service provider 
+     * from the LDAP server for this request.
+     * 
+     * @param s     the object identifier of the response control. May be
+     *              null.
+     * @param value holds the value of the response control as raw ASN.1 BER
+     *              encoded bytes, including the tag and length of the response
+     *              but excluding its OID.
+     * @param i     specifies the start index of useable data within array 
+     *              <code>value</code>.
+     * @param i2    specifies the number of data bytes to use within array 
+     *              <code>value</code>.
+     * @return a suitable <code>ExtendedResponse</code> object for this request.
+     * 
+     * @throws NamingException  If an error is encountered.
+     */
+    ExtendedResponse createExtendedResponse(String s, byte[] value, int i, int i2)
+        throws NamingException;
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedResponse.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedResponse.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedResponse.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ExtendedResponse.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,51 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.ldap;
+
+import java.io.Serializable;
+
+/**
+ * See RFC2251 for the definition of an <code>ExtendedResponse</code>.
+ * 
+ * 
+ */
+public interface ExtendedResponse extends Serializable {
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Gets the object ID assigned to this response.
+     * (see RFC2251)
+     * 
+     * @return          the object ID assigned to the response
+     */
+    String getID();
+
+    /**
+     * Gets the response encoded using ASN.1 Basic Encoding Rules (BER).
+     * 
+     * @return          the response encoded using ASN.1 BER
+     */
+    byte[] getEncodedValue();
+
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/HasControls.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/HasControls.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/HasControls.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/HasControls.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,48 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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 javax.naming.ldap;
+
+import java.io.Serializable;
+import javax.naming.NamingException;
+
+/**
+ * Objects implementing this interface can return an array of <code>Control</code>
+ * instances.
+ * 
+ * @see Control
+ * 
+ */
+public interface HasControls extends Serializable {
+
+    /*
+     * -------------------------------------------------------------------
+     * Methods
+     * -------------------------------------------------------------------
+     */
+
+    /**
+     * Returns an array of <code>Control</code> instances which may be null.
+     *  
+     * @return                  an array of <code>Control</code> instances which
+     *                          may be null
+     * @throws NamingException  If an error is encountered.
+     */
+    Control[] getControls() throws NamingException;
+
+}
+
+



Mime
View raw message