KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > naming > api > PName


1 /**
2  * JORM: an implementation of a generic mapping system for persistent Java
3  * objects. Two mapping are supported: to RDBMS and to binary files.
4  * Copyright (C) 2001-2003 France Telecom R&D - INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Contact: jorm-team@objectweb.org
21  *
22  */

23
24 package org.objectweb.jorm.naming.api;
25
26 import org.objectweb.jorm.api.PException;
27 import org.objectweb.jorm.api.PExceptionIO;
28 import org.objectweb.jorm.type.api.PType;
29
30 import java.util.Date JavaDoc;
31 import java.io.Serializable JavaDoc;
32 import java.math.BigDecimal JavaDoc;
33 import java.math.BigInteger JavaDoc;
34
35 /**
36  * The <b>PName</b> interface defines the behaviour of a persistent name as
37  * it is managed by its associated naming context. Indeed, such a behaviour
38  * is supported partly within the name implementation, and partly within its
39  * naming context.
40  * @author R. Basset, P. D?chamboux
41  */

42 public interface PName extends Cloneable JavaDoc, Serializable JavaDoc {
43     /**
44      * It tests if a given coding type is supported for this PName.
45      * @param codingtype One of the coding type defined by
46      * PNamingContext.CTxxx constants defined within the
47      * PNamingContext interface.
48      * @return It returns true if the coding type is supported for this PName.
49      */

50     boolean codingSupported(int codingtype);
51
52     /**
53      * The <b>encode</b> method produces an encoded representation of this
54      * PName within its naming context. The encoding format in the case of this
55      * method is an array of bytes.
56      * @return The array of bytes corresponding to the encoded representation.
57      */

58     byte[] encode() throws PExceptionNaming;
59
60     /**
61      * The <b>encodeAbstract</b> method produces an encoded representation of
62      * this PName. The encoding format is the case of this method is a Java
63      * object of any complexity. Example of such object is a getter interface
64      * giving access of the fields of a composite relational primary key.
65      * @return The Object corresponding to the encoded representation.
66      */

67     Object JavaDoc encodeAbstract() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
68
69     /**
70      * The <b>encodeByte</b> method produces an encoded representation of this
71      * PName within its naming context. The encoding format in the case of this
72      * method is a byte.
73      * @return The byte corresponding to the encoded representation.
74      */

75     byte encodeByte() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
76
77     /**
78      * The <b>encodeObyte</b> method produces an encoded representation of this
79      * PName within its naming context. The encoding format in the case of this
80      * method is a Byte.
81      * @return The Byte corresponding to the encoded representation.
82      */

83     Byte JavaDoc encodeObyte() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
84
85     /**
86      * The <b>encodeChar</b> method produces an encoded representation of this
87      * PName within its naming context. The encoding format in the case of this
88      * method is a char.
89      * @return The char corresponding to the encoded representation.
90      */

91     char encodeChar() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
92
93     /**
94      * The <b>encodeOchar</b> method produces an encoded representation of this
95      * PName within its naming context. The encoding format in the case of this
96      * method is a Character.
97      * @return The Character corresponding to the encoded representation.
98      */

99     Character JavaDoc encodeOchar() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
100
101     /**
102      * The <b>encodeInt</b> method produces an encoded representation of this
103      * PName within its naming context. The encoding format in the case of this
104      * method is a int.
105      * @return The int corresponding to the encoded representation.
106      */

107     int encodeInt() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
108
109     /**
110      * The <b>encodeOint</b> method produces an encoded representation of this
111      * PName within its naming context. The encoding format in the case of this
112      * method is a Integer.
113      * @return The Integer corresponding to the encoded representation.
114      */

115     Integer JavaDoc encodeOint() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
116
117     /**
118      * The <b>encodeLong</b> method produces an encoded representation of this
119      * PName within its naming context. The encoding format in the case of this
120      * method is a long.
121      * @return The long corresponding to the encoded representation.
122      */

123     long encodeLong() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
124
125     /**
126      * The <b>encodeOlong</b> method produces an encoded representation of this
127      * PName within its naming context. The encoding format in the case of this
128      * method is a Long.
129      * @return The Long corresponding to the encoded representation.
130      */

131     Long JavaDoc encodeOlong() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
132
133     /**
134      * The <b>encodeShort</b> method produces an encoded representation of this
135      * PName within its naming context. The encoding format in the case of this
136      * method is a short.
137      * @return The short corresponding to the encoded representation.
138      */

139     short encodeShort() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
140
141     /**
142      * The <b>encodeOshort</b> method produces an encoded representation of this
143      * PName within its naming context. The encoding format in the case of this
144      * method is a Short.
145      * @return The Short corresponding to the encoded representation.
146      */

147     Short JavaDoc encodeOshort() throws PExceptionNaming, UnsupportedOperationException JavaDoc;
148
149     /**
150      * The <b>encodeString</b> method produces an encoded representation of this
151      * PName within its naming context. The encoding format in the case of this
152      * method is a String.
153      * @return The String corresponding to the encoded representation.
154      */

155     String JavaDoc encodeString() throws PExceptionNaming;
156
157     /**
158      * The <b>encodeCharArray</b> method produces an encoded representation of this
159      * PName within its naming context. The encoding format in the case of this
160      * method is a char[].
161      * @return The char[] corresponding to the encoded representation.
162      */

163     char[] encodeCharArray() throws PExceptionNaming;
164
165     /**
166      * The <b>encodeDate</b> method produces an encoded representation of this
167      * PName within its naming context. The encoding format in the case of this
168      * method is a Date.
169      * @return The Date corresponding to the encoded representation.
170      */

171     Date JavaDoc encodeDate() throws PExceptionNaming;
172
173     /**
174      * The <b>encodeBigInteger</b> method produces an encoded representation of this
175      * PName within its naming context. The encoding format in the case of this
176      * method is a BigInteger.
177      * @return The BigInteger corresponding to the encoded representation.
178      */

179     BigInteger JavaDoc encodeBigInteger() throws PExceptionNaming;
180
181     /**
182      * The <b>encodeBigDecimal</b> method produces an encoded representation of this
183      * PName within its naming context. The encoding format in the case of this
184      * method is a BigDecimal.
185      * @return The BigDecimal corresponding to the encoded representation.
186      */

187     BigDecimal JavaDoc encodeBigDecimal() throws PExceptionNaming;
188
189     /**
190      * It associates a PName to an information item within a naming context.
191      * @param conn The connection that can be used to access the data store.
192      * @param pnc Thhe naming context which must provide a PName for
193      * this PName.
194      * @return The new PName associated to this PName.
195      * @exception PExceptionNaming Raised in case of problem within the
196      * naming context.
197      * @exception PExceptionIO Raised in case of problem during the access of
198      * the data store
199      */

200     PName export(Object JavaDoc conn, PNamingContext pnc) throws PException;
201
202     /**
203      * It associates a PName to an information item within a naming context.
204      * @param conn The connection that can be used to access the data store.
205      * @param pnc Thhe naming context which must provide a PName for
206      * this PName.
207      * @param hints Any information relevant for name creation.
208      * @return The new PName associated to this PName.
209      * @exception PExceptionNaming Raised in case of problem within the
210      * naming context.
211      * @exception PExceptionIO Raised in case of problem during the access of
212      * the data store
213      */

214     PName export(Object JavaDoc conn, PNamingContext pnc, Object JavaDoc hints)
215             throws PException;
216
217     /**
218      * It retrieves the name manager associated to this PName.
219      * @return The naming context which provide this pname
220      */

221     PNameManager getPNameManager();
222
223     /**
224      * It retrieves the PType associated to this PName if any exists. If none
225      * is associated, it returns null.
226      * @return The PType associated to this PName.
227      */

228     PType getPType();
229
230     /**
231      * It tells if this name corresponds to "null" representation within a
232      * its naming context.
233      * @return true if it represents a "null" name.
234      */

235     boolean isNull();
236
237     /**
238      * It retrieves the information item associated to the given PName (if any
239      * exists).
240      * @param conn The connection that can be used to access the data store.
241      * @return The information item associated with the given PName within
242      * a naming context.
243      * @exception PExceptionNaming Raised in case of problem within the
244      * naming context.
245      * @exception PExceptionIO Raised in case of problem during the access of
246      * the data store
247      */

248     PName resolve(Object JavaDoc conn) throws UnsupportedOperationException JavaDoc, PException;
249
250     /**
251      * It removes this PName and all the associated information within a naming
252      * context (i.e., the association between the PName and its information
253      * item).
254      * @param conn The connection that can be used to access the data store.
255      * @exception PExceptionNaming Raised in case of problem within the
256      * naming context.
257      * @exception PExceptionIO Raised in case of problem during the access of
258      * the data store
259      */

260     void unexport(Object JavaDoc conn) throws PException;
261
262     /**
263      * It removes this PName and all the associated information within a naming
264      * context (i.e., the association between the PName and its information
265      * item).
266      * @param conn The connection that can be used to access the data store.
267      * @param hints Any information relevant for name removing.
268      * @exception PExceptionNaming Raised in case of problem within the
269      * naming context.
270      * @exception PExceptionIO Raised in case of problem during the access of
271      * the data store
272      */

273     void unexport(Object JavaDoc conn, Object JavaDoc hints) throws PException;
274 }
275
Popular Tags