You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/03/15 15:57:17 UTC
svn commit: r386087 [5/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...
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoInitialContextException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoInitialContextException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoInitialContextException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoInitialContextException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,69 @@
+/* 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;
+
+/**
+ * A <code>NoInitialContextException</code> is the exception thrown by the
+ * naming classes when an initial context cannot be created. See the
+ * specification of the <code>Context</code> interface and the
+ * <code>InitialContext</code> class regarding how initial context
+ * implementations are selected.
+ * <p>
+ * Any interaction with an <code>InitialContext</code> object may cause a
+ * <code>NoInitialContextException</code> to be thrown. The
+ * <code>InitialContext</code> implementation may choose to defer getting
+ * the initial context until any of its methods are invoked.</p>
+ * <p>
+ * Multithreaded access to a <code>NoInitialContextException</code> instance
+ * is only safe when client code locks the object first.</p>
+ *
+ */
+public class NoInitialContextException extends NamingException {
+
+ /*
+ * For serialization purposes, the following fields must appear in the
+ * order given and specified serialVersionUID must be used.
+ */
+ static final long serialVersionUID = -3413733186901258623L; // J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs an <code>NoInitialContextException</code> instance
+ * with all data initialized to null.
+ */
+ public NoInitialContextException() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>NoInitialContextException</code> instance with the
+ * specified error message.
+ *
+ * @param msg The detail message for this exception. It may be null.
+ */
+ public NoInitialContextException(String msg) {
+ super(msg);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoPermissionException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoPermissionException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoPermissionException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoPermissionException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,57 @@
+/* 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;
+
+/**
+ * An <code>NoPermissionException</code> is the <code>NamingSecurityException</code>
+ * used when a server refuses permission to the client.
+ * <p>
+ * Multithreaded access to an <code>NoPermissionException</code> instance is
+ * only safe when client code locks the object first.</p>
+ *
+ */
+public class NoPermissionException extends NamingSecurityException {
+
+ static final long serialVersionUID = 8395332708699751775L;
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a <code>NoPermissionException</code> instance
+ * with all data initialized to null.
+ */
+ public NoPermissionException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>NoPermissionException</code> instance
+ * with the specified message.
+ *
+ * @param s The detail message for this exception. It may be null.
+ */
+ public NoPermissionException(String s) {
+ super(s);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NotContextException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NotContextException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NotContextException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NotContextException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,66 @@
+/* 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;
+
+/**
+ * A <code>NotContextException</code> is the exception thrown by the naming
+ * classes when an operation on a context object cannot proceed because the
+ * resolved object is not a context type. If the operation requires a
+ * particular subclass of a context type, such as an <code>LdapContext</code>,
+ * and the resolved object is a context object, but not of the required
+ * subclass, then a <code>NotContextException</code> is thrown.
+ * <p>
+ * Multithreaded access to a <code>NotContextException</code> instance is only safe
+ * when client code locks the object first.</p>
+ *
+ */
+public class NotContextException extends NamingException {
+
+ /*
+ * For serialization purposes, the following fields must appear in the
+ * order given and specified serialVersionUID must be used.
+ */
+ static final long serialVersionUID = 849752551644540417L; // J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a <code>NotContextException</code> instance
+ * with all data initialized to null.
+ */
+ public NotContextException() {
+ super();
+
+ }
+
+ /**
+ * Constructs a <code>NotContextException</code> instance
+ * with a specified error message.
+ *
+ * @param msg The detail message for this exception. It may be null.
+ */
+ public NotContextException(String msg) {
+ super(msg);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/OperationNotSupportedException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/OperationNotSupportedException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/OperationNotSupportedException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/OperationNotSupportedException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,55 @@
+/* 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;
+
+/**
+ * This is the <code>NamingException</code> used when an operation is requested
+ * which is not supported.
+ * <p>
+ * Multithreaded access to an instance is only safe when client code locks the
+ * object first.</p>
+ *
+ */
+public class OperationNotSupportedException extends NamingException {
+
+ /*
+ * This constant is used during deserialization to check the J2SE version
+ * which created the serialized object.
+ */
+ static final long serialVersionUID = 5493232822427682064L;
+
+ /**
+ * Constructs a <code>OperationNotSupportedException</code> instance
+ * with all data initialized to null.
+ */
+ public OperationNotSupportedException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>OperationNotSupportedException</code> instance
+ * with the specified message.
+ *
+ * @param arg0 The detail message for this exception. It may be null.
+ */
+ public OperationNotSupportedException(String arg0) {
+ super(arg0);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/PartialResultException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/PartialResultException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/PartialResultException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/PartialResultException.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;
+
+/**
+ * This is the <code>NamingException</code> used when an operation returns an
+ * incomplete result.
+ * <p>
+ * Multithreaded access to an instance is only safe when client code locks the
+ * object first.</p>
+ *
+ */
+public class PartialResultException extends NamingException {
+
+ static final long serialVersionUID = 2572144970049426786L;
+
+ /**
+ * Constructs a <code>PartialResultException</code> instance
+ * with all data initialized to null.
+ */
+ public PartialResultException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>PartialResultException</code> instance
+ * with the specified message.
+ *
+ * @param s The detail message for this exception. It may be null.
+ */
+ public PartialResultException(String s) {
+ super(s);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/RefAddr.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/RefAddr.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/RefAddr.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/RefAddr.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;
+
+import java.io.Serializable;
+
+/**
+ * This is an abstract class describing the address of an object which is
+ * outside of a naming system.
+ * It contains an address type and the address itself is dealt with by its
+ * subclasses, for example, <code>BinaryRefAddr</code> and <code>StringRefAddr
+ * </code>.
+ *
+ * @see BinaryRefAddr
+ * @see StringRefAddr
+ */
+public abstract class RefAddr implements Serializable {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ /*
+ * This constant is used during deserialization to check the J2SE version
+ * which created the serialized object.
+ */
+ static final long serialVersionUID = -1468165120479154358L; //J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Instance variables
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * The type of the address.
+ *
+ * @serial
+ */
+ protected String addrType;
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a <code>RefAddr</code> instance using the supplied address
+ * type.
+ *
+ * @param type the address type which may be null
+ */
+ protected RefAddr(String type) {
+ this.addrType = type;
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Gets the type of this address.
+ *
+ * @return the type of this address which cannot be null
+ */
+ public String getType() {
+ return addrType;
+ }
+
+ /**
+ * Gets the address itself which may be null.
+ * Each subclass of <code>RefAddr</code> describes the format of the
+ * returned address.
+ *
+ * @return the address itself
+ */
+ public abstract Object getContent();
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods override parent class Object
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns true if this address is equal to the supplied object
+ * <code>o</code>.
+ * They are considered equal if the address types are equal and the address
+ * contents are equivalent.
+ * *
+ * @param o the object to compare with
+ * @return true if this address is equal to <code>o</code>,
+ * otherwise false
+ */
+ public boolean equals(Object o) {
+ if (o instanceof RefAddr) {
+ RefAddr a = (RefAddr) o;
+ return this.addrType.equals(a.addrType)
+ && (null == this.getContent()
+ ? null == a.getContent()
+ : this.getContent().equals(a.getContent()));
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hashcode for this address.
+ * The result is the sum of the hashcode of its address type and address.
+ *
+ * @return the hashcode of this address
+ */
+ public int hashCode() {
+ return this.addrType.hashCode()
+ + (null == this.getContent() ? 0 : this.getContent().hashCode());
+ }
+
+ /**
+ * Returns the string representation of this address.
+ * This contains the string representations of the address type and the
+ * address.
+ *
+ * @return the string representation of this address
+ */
+ public String toString() {
+ return "The type of the address is: " //$NON-NLS-1$
+ + this.addrType
+ + "\nThe content of the address is: " //$NON-NLS-1$
+ + (null == this.getContent() ? "null" : this.getContent().toString()) //$NON-NLS-1$
+ + "\n"; //$NON-NLS-1$
+
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,376 @@
+/* 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;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ * A <code>Reference</code> contains the class of the object which is referenced
+ * together with a list of all the addresses at which this object may be found.
+ * Additionally the <code>Reference</code> has the location of a factory which
+ * can create this object together with the classname used to create the object.
+ * <p>
+ * The <code>Reference</code> class relates to objects which are not bound in a
+ * naming service but which need to be accessed via javax.naming.
+ * <code>Reference</code>, <code>RefAddr</code> and their subclasses provide a
+ * way to access objects other than those in naming and directory systems.</p>
+ *
+ *
+ */
+public class Reference implements Cloneable, Serializable {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ /*
+ * This constant is used during deserialization to check the J2SE version which
+ * created the serialized object.
+ */
+ static final long serialVersionUID = -1673475790065791735L; //J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Instance variables
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * The class of the object which is referenced.
+ *
+ * @serial
+ */
+ protected String className;
+
+ /**
+ * A list of the addresses provided for this object.
+ * The default is null.
+ *
+ * @serial
+ */
+ protected Vector addrs;
+
+ /**
+ * The class in a factory which is used to create an object of the type
+ * which is referenced.
+ * The default is null.
+ *
+ * @serial
+ */
+ protected String classFactory;
+
+ /**
+ * The location of class <code>classFactory</code>.
+ * To find class files the URL of the classfile is given. If there is more
+ * than one URL for the class then a list of URLs appears in the string
+ * using a space as a separator. The default is null.
+ *
+ * @serial
+ */
+ protected String classFactoryLocation;
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a <code>Reference</code> instance with an empty list of
+ * addresses using the supplied class name.
+ *
+ * @param className the class of the object which is referenced. It
+ * cannot be null.
+ */
+ public Reference(String className) {
+ this(className, null, null);
+ }
+
+ /**
+ * Constructs a <code>Reference</code> instance with one entry of address.
+ *
+ * @param className the class of the object which is referenced. It
+ * cannot be null.
+ * @param addr the object's address. It cannot be null.
+ */
+ public Reference(String className, RefAddr addr) {
+ this(className, addr, null, null);
+ }
+
+ /**
+ * Constructs a <code>Reference</code> instance with an empty list of
+ * addresses using the supplied class name, factory class and factory
+ * location.
+ *
+ * @param className the class of the object which is referenced. It
+ * cannot be null.
+ * @param classFactory the class in a factory which is used to create
+ * an object of the type which is referenced. It may
+ * be null.
+ * @param classFactoryLocation
+ * the location of the class file. It may be null.
+ */
+ public Reference(
+ String className,
+ String classFactory,
+ String classFactoryLocation) {
+ this.className = className;
+ this.classFactory = classFactory;
+ this.classFactoryLocation = classFactoryLocation;
+ this.addrs = new Vector();
+ }
+
+ /**
+ * Constructs a <code>Reference</code> instance with one entry of address
+ * using the supplied class name, factory class and factory location.
+ *
+ * @param className the class of the object which is referenced. It
+ * cannot be null.
+ * @param addr the object's address. It cannot be null.
+ * @param classFactory the class in a factory which is used to create
+ * an object of the type which is referenced. It may
+ * be null.
+ * @param classFactoryLocation
+ * the location of the class file. It may be null.
+ */
+ public Reference(
+ String className,
+ RefAddr addr,
+ String classFactory,
+ String classFactoryLocation) {
+ this(className, classFactory, classFactoryLocation);
+ this.addrs.add(addr);
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Gets the class of the object which is referenced.
+ * The result cannot be null.
+ *
+ * @return the class of the object which is referenced
+ */
+ public String getClassName() {
+ return this.className;
+ }
+
+ /**
+ * Gets the class in a factory which is used to create an object of the type
+ * which is referenced.
+ * The result may be null.
+ *
+ * @return the class in a factory which is used to create the
+ * referenced object
+ */
+ public String getFactoryClassName() {
+ return this.classFactory;
+ }
+
+ /**
+ * Gets the location of the factory class.
+ * The result may be null.
+ *
+ * @return the location of the factory class
+ */
+ public String getFactoryClassLocation() {
+ return this.classFactoryLocation;
+ }
+
+ /**
+ * Gets all the addresses.
+ *
+ * @return an enumeration of all the addresses
+ */
+ public Enumeration getAll() {
+ return addrs.elements();
+ }
+
+ /**
+ * Gets an address where the address type matches the specified string.
+ * There may be more than one entry in the list with the same address type
+ * but this method returns the first one found in the list.
+ *
+ * @param type the address type to look for
+ * @return the first address whose type matches the string
+ */
+ public RefAddr get(String type) {
+ Enumeration elements = addrs.elements();
+ RefAddr refAddr = null;
+
+ while (elements.hasMoreElements()) {
+ refAddr = (RefAddr) elements.nextElement();
+ if (type.equals(refAddr.getType())) {
+ return refAddr;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the address held at the specified index in the address list.
+ *
+ * @param index the index of the required address. It must be
+ * greater than or equal to 0 and less than the number
+ * of entries in the list.
+ * @return the address held at the specified index
+ * @throws ArrayIndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ public RefAddr get(int index) {
+ return (RefAddr) addrs.get(index);
+ }
+
+ /**
+ * Appends an address to the list.
+ *
+ * @param addr the address to append. It cannot be null.
+ */
+ public void add(RefAddr addr) {
+ addrs.add(addr);
+ }
+
+ /**
+ * Inserts an address within the list at the specified index.
+ *
+ * @param addr the address to insert into the list. It cannot be
+ * null.
+ * @param index the index where to insert the address. It must be
+ * greater than or equal to 0 and less than or equal to
+ * the number of entries in the list(size()).
+ * @throws ArrayIndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ public void add(int index, RefAddr addr) {
+ addrs.add(index, addr);
+ }
+
+ /**
+ * Removes an address from the address list.
+ *
+ * @param index the index of the address to remove. It must be
+ * greater than or equal to 0 and less than size().
+ * @return the removed address
+ * @throws ArrayIndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ public Object remove(int index) {
+ return addrs.remove(index);
+ }
+
+ /**
+ * Gets the number of addresses in the address list.
+ *
+ * @return the size of the list
+ */
+ public int size() {
+ return addrs.size();
+ }
+
+ /**
+ * Deletes all the addresses from the address list.
+ */
+ public void clear() {
+ addrs.clear();
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods override parent class Object
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns a deep clone of this <code>Reference</code> instance.
+ *
+ * @return a deep clone of this object
+ */
+ public Object clone() {
+ try {
+ Reference r = (Reference) super.clone();
+ r.addrs = (Vector) this.addrs.clone();
+ return r;
+ } catch (CloneNotSupportedException e) {
+ throw new InternalError("Failed to clone object of Reference class."); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns true if this <code>Reference</code> instance is equal to the
+ * supplied object <code>o</code>.
+ * They are considered equal if their class name and list of addresses are
+ * equivalent (including the order of the addresses in the list). The
+ * factory class and location are ignored for the purposes of this
+ * comparison.
+ *
+ * @param o the object to compare with
+ * @return true if this object is equal to <code>o</code>,
+ * otherwise false
+ */
+ public boolean equals(Object o) {
+ if (o instanceof Reference) {
+ Reference r = (Reference) o;
+ return r.className.equals(this.className)
+ && r.addrs.equals(this.addrs);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hashcode for this <code>Reference</code> instance.
+ * The result is calculated by summing the hashcode of the class name and
+ * the hascodes of each of the addresses in the address list.
+ *
+ * @return the hashcode of this <code>Reference</code> instance
+ */
+ public int hashCode() {
+ int i = this.className.hashCode();
+ Enumeration e = this.addrs.elements();
+
+ while (e.hasMoreElements()) {
+ i += e.nextElement().hashCode();
+ }
+ return i;
+ }
+
+ /**
+ * Returns the string representation of the class name together with the
+ * list of addresses.
+ *
+ * @return the string representation of this object
+ */
+ public String toString() {
+ String s = "Reference class name: " + this.className; //$NON-NLS-1$
+ Enumeration e = this.addrs.elements();
+
+ s += "\nReference addresses:"; //$NON-NLS-1$
+ while (e.hasMoreElements()) {
+ s += "\n\t" + e.nextElement(); //$NON-NLS-1$
+ }
+ return s + "\n"; //$NON-NLS-1$
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Referenceable.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Referenceable.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Referenceable.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Referenceable.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,47 @@
+/* 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;
+
+/**
+ * An object which is not in a naming service, but can be referenced, implements
+ * the <code>Referenceable</code> interface.
+ * The <code>getReference()</code> method is implemented to provide details of
+ * how to find the object.
+ *
+ * @see Reference
+ *
+ */
+public interface Referenceable {
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Get the <code>Reference</code> object associated with this <code>
+ * Referenceable</code> object.
+ *
+ * @return the <code>Reference</code> object associated
+ * with this <code>Referenceable</code> object
+ * @throws NamingException if a naming error occurs
+ */
+ Reference getReference() throws NamingException;
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ReferralException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ReferralException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ReferralException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ReferralException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,116 @@
+/* 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;
+
+import java.util.Hashtable;
+
+/**
+ * A <code>ReferralException</code> is an abstract class used by service
+ * providers when dealing with referral exceptions.
+ *
+ */
+public abstract class ReferralException extends NamingException {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ /*
+ * This constant is used during deserialization to check the J2SE version
+ * which created the serialized object.
+ */
+ private static final long serialVersionUID = -2881363844695698876L; // J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a <code>ReferralException</code> instance
+ * with all data initialized to null.
+ */
+ protected ReferralException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>ReferralException</code> instance
+ * with the specified message. All other fields are initialised to null.
+ *
+ * @param s The detail message for this exception. It may be null.
+ */
+ protected ReferralException(String s) {
+ super(s);
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the <code>Context</code> where the method should be resumed
+ * following a referral exception. This should not return null.
+ *
+ * @return the <code>Context</code> where the method should be resumed
+ * following a referral exception. This should not return null.
+ * @throws NamingException
+ */
+ public abstract Context getReferralContext() throws NamingException;
+
+ /**
+ * The same as <code>getReferralContext()</code> except that a
+ * <code>Hashtable</code> containing environment properties can be taken
+ * to override the environment properties associated with the context that
+ * threw this referral exception. This should not return null.
+ *
+ * @param h the environment properties. It may be null and then behaves
+ * the same as <code>getReferralContext()</code>.
+ * @return the <code>Context</code> where the method should be resumed
+ * following a referral exception. This should not return null.
+ * @throws NamingException
+ */
+ public abstract Context getReferralContext(Hashtable h) throws NamingException;
+
+ /**
+ * Returns the information relating to the exception. This should
+ * not return null.
+ * @return the information relating to the exception. This should
+ * not return null.
+ */
+ public abstract Object getReferralInfo();
+
+ /**
+ * Returns true when further referral processing is outstanding.
+ *
+ * @return true when further referral processing is outstanding.
+ */
+ public abstract boolean skipReferral();
+
+ /**
+ * Retry this referral.
+ */
+ public abstract void retryReferral();
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ServiceUnavailableException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ServiceUnavailableException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ServiceUnavailableException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ServiceUnavailableException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,55 @@
+/* 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;
+
+/**
+ * This is the <code>NamingException</code> used when a connection to a
+ * server cannot be established.
+ * <p>
+ * Multithreaded access to an instance is only safe when client code locks the
+ * object first.</p>
+ *
+ */
+public class ServiceUnavailableException extends NamingException {
+
+ /*
+ * This constant is used during deserialization to check the J2SE version
+ * which created the serialized object.
+ */
+ static final long serialVersionUID = -4996964726566773444L; // J2SE 1.4.2
+
+ /**
+ * Constructs a <code>ServiceUnavailableException</code> instance
+ * with all data initialised to null.
+ */
+ public ServiceUnavailableException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>ServiceUnavailableException</code> instance
+ * with the specified message.
+ *
+ * @param s The detail message for this exception. It may be null.
+ */
+ public ServiceUnavailableException(String s) {
+ super(s);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/SizeLimitExceededException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/SizeLimitExceededException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/SizeLimitExceededException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/SizeLimitExceededException.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;
+
+/**
+ * This is the <code>NamingException</code> used when a size restriction is
+ * exceeded.
+ * <p>
+ * Multithreaded access to an instance is only safe when client code locks the
+ * object first.</p>
+ *
+ */
+public class SizeLimitExceededException extends LimitExceededException {
+
+ static final long serialVersionUID = 7129289564879168579L; // J2SE 1.4.2
+
+ /**
+ * Constructs a <code>SizeLimitExceededException</code> instance
+ * with all data initialized to null.
+ */
+ public SizeLimitExceededException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>SizeLimitExceededException</code> instance
+ * with the specified message.
+ *
+ * @param s The detail message for this exception. It may be null.
+ */
+ public SizeLimitExceededException(String s) {
+ super(s);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/StringRefAddr.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/StringRefAddr.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/StringRefAddr.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/StringRefAddr.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,87 @@
+/* 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;
+
+/**
+ * A <code>StringRefAddr</code> refers to an address which is represented by a
+ * string such as a URL or hostname.
+ *
+ */
+public class StringRefAddr extends RefAddr {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ /*
+ * This constant is used during deserialization to check the J2SE version which
+ * created the serialized object.
+ */
+ static final long serialVersionUID = -8913762495138505527L; //J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Instance variables
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * The address itself.
+ * For StringRefAddr the address is a string such as a URL or hostname.
+ *
+ * @serial
+ */
+ private String contents;
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a <code>StringRefAddr</code> object using the supplied
+ * address type and address.
+ *
+ * @param type the address type which cannot be null
+ * @param address the address itself which may be null
+ */
+ public StringRefAddr(String type, String address) {
+ super(type);
+ this.contents = address;
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods override parent class RefAddr
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Get the string containing this address.
+ *
+ * @return a string containing this address which may be null
+ */
+ public Object getContent() {
+ return contents;
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/TimeLimitExceededException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/TimeLimitExceededException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/TimeLimitExceededException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/TimeLimitExceededException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,55 @@
+/* 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;
+
+/**
+ * This is the <code>NamingException</code> used when a time restriction is
+ * exceeded.
+ * <p>
+ * Multithreaded access to an instance is only safe when client code locks the
+ * object first.</p>
+ *
+ */
+public class TimeLimitExceededException extends LimitExceededException {
+
+ /*
+ * This constant is used during deserialization to check the J2SE version
+ * which created the serialized object.
+ */
+ static final long serialVersionUID = -3597009011385034696L; // J2SE 1.4.2
+
+ /**
+ * Constructs a <code>TimeLimitExceededException</code> instance
+ * with all data initialized to null.
+ */
+ public TimeLimitExceededException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>TimeLimitExceededException</code> instance
+ * with the specified message.
+ *
+ * @param s The detail message for this exception. It may be null.
+ */
+ public TimeLimitExceededException(String s) {
+ super(s);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,293 @@
+/* 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;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+/**
+ * This interface defines the valid operations on a particular attribute of a
+ * directory entry.
+ * <p>
+ * An attribute can have zero or more values. The value may be null.</p>
+ * <p>
+ * When there are multiple values for a particular attribute, the collection of
+ * values may be specifically ordered or unordered. This interface provides a
+ * method for determining whether the order is maintained.</p>
+ * <p>
+ * If the values of an attribute are ordered, then duplicates are allowed. If
+ * the values are unordered then duplicates are not allowed.</p>
+ * <p>
+ * If the values are unordered then the indexed operations work as if the values
+ * added previously to the attribute had been done using ordered semantics. For
+ * example, if the values "a", "b" and "c" were previously added to an unordered
+ * attribute using "<code>add("a"); add("b"); add("c");</code>", it is
+ * equivalent to adding the same objects to an ordered attribute using
+ * "<code>add(0,"a"); add(1,"b"); add(2,"c");</code>". In this case, if we do
+ * "<code>remove(1)</code>" on the unordered list, the value "b" is removed,
+ * changing the index of "c" to 1.</p>
+ * <p>
+ * Multiple null values can be added to an attribute. It is not the same as
+ * having no values on an attribute. If a null value is added to an unordered
+ * attribute which already has a null value, the <code>add</code> method has no
+ * effect.</p>
+ * <p>
+ * A directory may optionally provide information about the syntax of an
+ * attribute's value via a schema. The methods <code>getAttributeDefinition</code>
+ * and <code>getAttributeSyntaxDefinition</code> return the schema definitions
+ * if they exist.</p>
+ * <p>
+ * Note that updates to the attribute via ths interface do not affect the
+ * directory directly. The only mechanism for modifying the directory is
+ * through the {@link DirContext}.</p>
+ * <p>
+ * Concrete implementations of this <code>Attribute</code> interface may be
+ * either static or dynamic, and this interface does not make any distinction
+ * between the two types. A static attribute implementation retrieves its value
+ * from the directory once and stores it locally, a dynamic attribute
+ * implementation will go back to the directory for each request.</p>
+ *
+ *
+ */
+public interface Attribute extends Cloneable, Serializable {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ /*
+ * This constant is used during deserialization to check the J2SE version which
+ * created the serialized object.
+ */
+ static final long serialVersionUID = 0x78d7ee3675a55244L; //J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Adds a value at the specified index.
+ * The index is only meaningful if the values are ordered. If there are
+ * already values at this index and above, they are moved up one position.
+ * <p>
+ * It is permissible to use this method when the values are not ordered but
+ * in this case, if a value equals to <code>val</code> already exists then
+ * this method throws an <code>IllegalStateException</code> because
+ * duplicates are not allowed.</p>
+ * <p>
+ * The permitted range for index is 0 <= index <= <code>size()</code>.
+ * The range allows the list to grow by one. If the index is outside this
+ * range this method throws an <code>IndexOutOfBoundsException</code>.</p>
+ *
+ * @param index the position index
+ * @param val a new value to be added which may be null
+ * @throws IllegalStateException
+ * If the new value equals to an existing value in
+ * an unordered <code>Attribute</code>.
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ void add(int index, Object val);
+
+ /**
+ * Adds a value to this attribute.
+ * For unordered attribute values this method adds the new value unless the
+ * value is already present. If the new value is already present in
+ * unordered attribute values, the method has no effect.
+ * <p>
+ * For ordered attribute values, the new value is added at the end of list
+ * of values.</p>
+ * <p>
+ * This method returns true or false to indicate whether a value was added.</p>
+ *
+ * @param val a new value to be added which may be null
+ * @return true if a value was added, otherwise false
+ */
+ boolean add(Object val);
+
+ /**
+ * Clears all values of this attribute.
+ */
+ void clear();
+
+ /**
+ * Returns a deep copy of the attribute containing all the same values.
+ * The values are not cloned.
+ *
+ * @return a deep clone of this attribute
+ */
+ Object clone();
+
+ /**
+ * Inidicates whether the specified value is one of the attribute's values.
+ *
+ * @param val the value which may be null
+ * @return true if this attribute contains the value,
+ * otherwise false
+ */
+ boolean contains(Object val);
+
+ /**
+ * Gets a value of this attribute.
+ * For unordered values, returns any of the values. For ordered values,
+ * returns the first. <code>null</code> is a valid value.
+ * <p>
+ * If the attribute has no values this method throws
+ * <code>NoSuchElementException</code>.</p>
+
+ * @return a value of this attribute
+ * @throws NamingException If the attribute has no value.
+ */
+ Object get() throws NamingException;
+
+ /**
+ * Returns the value at the specified index, even for unordered values.
+ * This method throws <code>IndexOutOfBoundsException</code> if the index is
+ * outside the valid range 0 <= index < <code>size()</code>.
+ *
+ * <p>
+ * If the attribute has no values this method throws
+ * <code>NoSuchElementException</code>.</p>
+ *
+ * @param index the position index
+ * @return the value at the specified index
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ * @throws NamingException If the attribute has no value.
+ */
+ Object get(int index) throws NamingException;
+
+ /**
+ * Returns an enumeration of all the attribute's values.
+ * The enumeration is ordered if the values are.
+ * <p>
+ * The effect on the returned enumeration of adding or removing values of
+ * the attribute is not specified.</p>
+ * <p>
+ * This method will throw any <code>NamingException</code> that occurs.</p>
+ *
+ * @return an enumeration of all values of the attribute
+ * @throws NamingException If any <code>NamingException</code> occurs.
+ */
+ NamingEnumeration getAll() throws NamingException;
+
+ /**
+ * Returns the attribute's schema definition.
+ * If this operation is not supported, an <code>
+ * OperationNotSupportedException</code> is thrown. If the implementation
+ * supports schemas but no schema is set, it is valid to return null.
+ * <p>
+ * This method will throw any <code>NamingException</code> that occurs.</p>
+ *
+ * @return the schema definitions if they exist
+ * @throws NamingException If any <code>NamingException</code> occurs.
+ */
+ DirContext getAttributeDefinition() throws NamingException;
+
+ /**
+ * Returns the attribute's syntax definition.
+ * If this operation is not supported, an <code>
+ * OperationNotSupportedException</code> is thrown. If the implementation
+ * supports syntax definitions but no syntax definition is set, it is valid
+ * to return null.
+ * <p>
+ * This method will throw any <code>NamingException</code> that occurs.</p>
+ *
+ * @return the syntax definitions if they exist
+ * @throws NamingException If any <code>NamingException</code> occurs.
+ */
+ DirContext getAttributeSyntaxDefinition() throws NamingException;
+
+ /**
+ * Returns the identity of this attribute.
+ * This method is not expected to return null.
+ *
+ * @return the ID of this attribute
+ */
+ String getID();
+
+ /**
+ * Indicates whether the values of this attribute are ordered or not.
+ *
+ * @return true if the values of this attribute are
+ * ordered, otherwise false
+ */
+ boolean isOrdered();
+
+ /**
+ * Removes the values at the specified index, even for unordered values.
+ * Values at higher indexes move one position lower.
+ * <p>
+ * If the index is outside the valid range 0 <= index < <code>size()</code>
+ * this method throws an <code>IndexOutOfBoundsException</code>.</p>
+ *
+ * @param index the position index
+ * @return the removed value
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ Object remove(int index);
+
+ /**
+ * Removes a value that is equal to the given value.
+ * There may be more than one match in ordered value, in which case the
+ * equal value with the lowest index is removed. After an ordered value is
+ * removed, values at higher indexes move one position lower.
+ * <p>
+ * Returns true if a value is removed. If there is no value equal to <code>
+ * val</code> this method simply returns false.</p>
+ *
+ * @param val the value to be removed
+ * @return true if the value is removed, otherwise false
+ */
+ boolean remove(Object val);
+
+ /**
+ * Replaces the value at the specified index with the given value.
+ * The old value (which may be null) is returned.
+ * <p>
+ * If the values are unordered and the given value is already present this
+ * method throws an <code>IllegalStateException</code>.</p>
+ * <p>
+ * The valid range for the index is 0 <= index < <code>size()</code>.
+ * This method throws an <code>IndexOutOfBoundsException</code> if the index
+ * is outside this range.</p>
+ *
+ * @param index the position index
+ * @param val the new value
+ * @return the original value at the specified index
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ Object set(int index, Object val);
+
+ /**
+ * Gets the count of the values in this attribute.
+ *
+ * @return the count of the values in this attribute
+ */
+ int size();
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeInUseException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeInUseException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeInUseException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeInUseException.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,64 @@
+/* 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 add an attribute that is already defined
+ * for an object.
+ *
+ */
+public class AttributeInUseException extends NamingException {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ private static final long serialVersionUID = 0x3d95ea02c92a5c44L;
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Default constructor.
+ * <p>
+ * All fields are initialized to null.</p>
+ */
+ public AttributeInUseException() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>AttributeInUseException</code> instance using the
+ * supplied text of the message.
+ * <p>
+ * All fields are initialized to null.</p>
+ *
+ * @param s message about the problem
+ */
+ public AttributeInUseException(String s) {
+ super(s);
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeModificationException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeModificationException.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeModificationException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeModificationException.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.directory;
+
+import javax.naming.NamingException;
+
+/**
+ * Thrown when a caller attempts to make an attribute modification that
+ * is not permitted.
+ * <p>
+ * Modifications such as addition, removal, and change of value to an entry's
+ * attributes are made via calls to the API on a <code>DirContext</code>.
+ * Where the modification is invalid by reference to the attributes' schema
+ * an <code>AttributeModificationException</code> is thrown describing the
+ * attributes that were unmodified.</p>
+ * <p>
+ * The list of attributes that were not modified are returned in the same
+ * order as the original modification request. If the list is returned as
+ * <code>null</code> then all modification requests failed.</p>
+ * <p>
+ * The class is not thread-safe. </p>
+ *
+ *
+ */
+public class AttributeModificationException extends NamingException {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ private static final long serialVersionUID = 0x6fdd462d96b0fdaaL;
+
+ /*
+ * -------------------------------------------------------------------
+ * Instance variables
+ * -------------------------------------------------------------------
+ */
+
+ /* Array of ModificationItems that were not applied. */
+ private ModificationItem unexecs[] = null;
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Default constructor.
+ * <p>
+ * All fields are initialized to null.</p>
+ */
+ public AttributeModificationException() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>AttributeModificationException</code> instance
+ * using the supplied text of the message.
+ * <p>
+ * All fields are initialized to null.</p>
+ *
+ * @param s message about the problem
+ */
+ public AttributeModificationException(String s) {
+ super(s);
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Gets <code>ModificationItems</code> that were not executed.
+ *
+ * @return an array of <code>ModificationItems</code> that were
+ * not executed, in the same order they were requested
+ * in. Null is a special return value meaning none of
+ * the requested modifications were done.
+ */
+ public ModificationItem[] getUnexecutedModifications() {
+ return unexecs;
+ }
+
+ /**
+ * Sets <code>ModificationItems</code> that were not executed.
+ *
+ * @param amodificationitem
+ * an array of <code>ModificationItems</code> that were
+ * not executed, in the same order they were requested
+ * in. Null is a special return value meaning none of
+ * the requested modifications were done.
+ */
+ public void setUnexecutedModifications(ModificationItem[] amodificationitem) {
+ this.unexecs = amodificationitem;
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods override parent class Object
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns string representation of this exception.
+ *
+ * @return text detailing the exception location and the failing modification.
+ */
+ public String toString() {
+ return toStringImpl(false);
+ }
+
+ /**
+ * Returns string representation of this exception.
+ *
+ * @param flag Indicates if the resolved object need to be returned.
+ * @return text detailing the exception location and the failing modification.
+ */
+ public String toString(boolean flag) {
+ return toStringImpl(flag);
+ }
+
+ private String toStringImpl(boolean flag) {
+ StringBuffer sb = new StringBuffer(super.toString(flag));
+ if (null != unexecs && unexecs.length > 0) {
+ sb.append(". The unexecuted modification items are: \""); //$NON-NLS-1$
+ for (int i = 0; i < unexecs.length; i++) {
+ sb.append(unexecs[i].toString()).append(";"); //$NON-NLS-1$
+ }
+ sb.append("\""); //$NON-NLS-1$
+ }
+ return sb.toString();
+ }
+
+}
+
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,145 @@
+/* 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;
+import javax.naming.NamingEnumeration;
+
+/**
+ * This is the interface to a collection of attributes associated with a directory
+ * entry.
+ * <p>
+ * This interface defines the methods that are implemented by a collection of a
+ * particular directory entry's attributes.</p>
+ * <p>
+ * A directory entry can have zero or more attributes comprising its attributes
+ * collection. The attributes are unordered within the collection. The
+ * attributes can be identified by name. The names of attributes are either
+ * case sensitive or case insensitive as indicated by the <code>isCaseIgnored</code>
+ * method. Method names refer to attribute ID (identity) rather than name,
+ * for brevity.</p>
+ * <p>
+ * The attribute collection is created when the directory entry is created.</p>
+ *
+ *
+ */
+public interface Attributes extends Cloneable, Serializable {
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns a deep copy of this <code>Attributes</code> instance.
+ * The attribute objects are not cloned.
+ *
+ * @return a deep copy of this <code>Attributes</code> instance
+ */
+ Object clone();
+
+ /**
+ * Returns the attribute with the specified name (ID).
+ * The name is case insensitive if <code>isCaseIgnored()</code> is true. The
+ * return value is <code>null</code> if no match is found.
+ *
+ * @param id attribute name (ID)
+ * @return the attribute with the specified name (ID)
+ */
+ Attribute get(String id);
+
+ /**
+ * Returns an enumeration containing the zero or more attributes in the
+ * collection.
+ * The behaviour of the enumeration is not specified if the attribute
+ * collection is changed.
+ *
+ * @return an enumeration of all contained attributes
+ *
+ */
+ NamingEnumeration getAll();
+
+ /**
+ * Returns an enumeration containing the zero or more names (IDs) of the
+ * attributes in the collection.
+ * The behaviour of the enumeration is not specified if the attribute
+ * collection is changed.
+ *
+ * @return an enumeration of the IDs of all contained attributes
+ */
+ NamingEnumeration getIDs();
+
+ /**
+ * Indicates whether case is ignored in the names of the attributes.
+ *
+ * @return true if case is ignored, otherwise false
+ */
+ boolean isCaseIgnored();
+
+ /**
+ * Places a non-null attribute in the attribute collection.
+ * If there is already an attribute with the same ID as the new attribute,
+ * the old one is removed from the collection and is returned by this
+ * method. If there was no attribute with the same ID the return value is
+ * <code>null</code>.
+ *
+ * @param attribute the attribute to be put
+ * @return the old attribute with the same ID, if exists;
+ * otherwise <code>null</code>
+ */
+ Attribute put(Attribute attribute);
+
+ /**
+ * Places a new attribuet with the supplied ID and value into the attribute
+ * collection.
+ * If there is already an attribute with the same ID, the old one is removed
+ * from the collection and is returned by this method. If there was no
+ * attribute with the same ID the return value is <code>null</code>. The
+ * case of the ID is ignored if <code>isCaseIgnored()</code> is true.
+ *
+ * This method provides a mechanism to put an attribute with a <code>null</code>
+ * value: the value of <code>obj</code> may be <code>null</code>.
+ *
+ * @param id the ID of the new attribute to be put
+ * @param obj the value of the new attribute to be put
+ * @return the old attribute with the same ID, if exists;
+ * otherwise <code>null</code>
+ */
+ Attribute put(String id, Object obj);
+
+ /**
+ * Removes the attribute with the specified ID.
+ * The removed attribute is returned by this method. If there is no
+ * attribute with the specified ID, the return value is <code>null</code>.
+ * The case of the ID is ignored if <code>isCaseIgnored()</code> is true.
+ *
+ * @param id the ID of the attribute to be removed
+ * @return the removed attribute, if exists; otherwise <code>null</code>
+ */
+ Attribute remove(String id);
+
+ /**
+ * Returns the number of attributes.
+ *
+ * @return the number of attributes
+ */
+ int size();
+
+}
+
+