KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > naming > directory > AttributeModificationException


1 /*
2  * @(#)AttributeModificationException.java 1.9 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.naming.directory;
9
10 import javax.naming.NamingException JavaDoc;
11
12 /**
13   * This exception is thrown when an attempt is
14   * made to add, or remove, or modify an attribute, its identifier,
15   * or its values that conflicts with the attribute's (schema) definition
16   * or the attribute's state.
17   * It is thrown in response to DirContext.modifyAttributes().
18   * It contains a list of modifications that have not been performed, in the
19   * order that they were supplied to modifyAttributes().
20   * If the list is null, none of the modifications were performed successfully.
21   *<p>
22   * An AttributeModificationException instance is not synchronized
23   * against concurrent multithreaded access. Multiple threads trying
24   * to access and modify a single AttributeModification instance
25   * should lock the object.
26   *
27   * @author Rosanna Lee
28   * @author Scott Seligman
29   * @version 1.9 03/12/19
30   *
31   * @see DirContext#modifyAttributes
32   * @since 1.3
33   */

34
35 /*
36   *<p>
37   * The serialized form of an AttributeModificationException object
38   * consists of the serialized fields of its NamingException
39   * superclass, followed by an array of ModificationItem objects.
40   *
41 */

42
43
44 public class AttributeModificationException extends NamingException JavaDoc {
45     /**
46      * Contains the possibly null list of unexecuted modifications.
47      * @serial
48      */

49     private ModificationItem JavaDoc[] unexecs = null;
50
51     /**
52      * Constructs a new instance of AttributeModificationException using
53      * an explanation. All other fields are set to null.
54      *
55      * @param explanation Possibly null additional detail about this exception.
56      * If null, this exception has no detail message.
57
58      * @see java.lang.Throwable#getMessage
59      */

60     public AttributeModificationException(String JavaDoc explanation) {
61     super(explanation);
62     }
63
64     /**
65       * Constructs a new instance of AttributeModificationException.
66       * All fields are set to null.
67       */

68     public AttributeModificationException() {
69     super();
70     }
71
72     /**
73       * Sets the unexecuted modification list to be e.
74       * Items in the list must appear in the same order in which they were
75       * originally supplied in DirContext.modifyAttributes().
76       * The first item in the list is the first one that was not executed.
77       * If this list is null, none of the operations originally submitted
78       * to modifyAttributes() were executed.
79
80       * @param e The possibly null list of unexecuted modifications.
81       * @see #getUnexecutedModifications
82       */

83     public void setUnexecutedModifications(ModificationItem JavaDoc[] e) {
84     unexecs = e;
85     }
86
87     /**
88       * Retrieves the unexecuted modification list.
89       * Items in the list appear in the same order in which they were
90       * originally supplied in DirContext.modifyAttributes().
91       * The first item in the list is the first one that was not executed.
92       * If this list is null, none of the operations originally submitted
93       * to modifyAttributes() were executed.
94
95       * @return The possibly null unexecuted modification list.
96       * @see #setUnexecutedModifications
97       */

98     public ModificationItem JavaDoc[] getUnexecutedModifications() {
99     return unexecs;
100     }
101
102     /**
103       * The string representation of this exception consists of
104       * information about where the error occurred, and
105       * the first unexecuted modification.
106       * This string is meant for debugging and not mean to be interpreted
107       * programmatically.
108       * @return The non-null string representation of this exception.
109       */

110     public String JavaDoc toString() {
111     String JavaDoc orig = super.toString();
112     if (unexecs != null) {
113         orig += ("First unexecuted modification: " +
114              unexecs[0].toString());
115     }
116     return orig;
117     }
118
119     /**
120      * Use serialVersionUID from JNDI 1.1.1 for interoperability
121      */

122     private static final long serialVersionUID = 8060676069678710186L;
123 }
124
Popular Tags