KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > enhancer > meta > JDOMetaData


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package com.sun.jdo.api.persistence.enhancer.meta;
26
27
28 /**
29  * Provides the JDO meta information neccessary for byte-code enhancement.
30  * <p>
31  * <b>Please note: This interface deals with fully qualified names in the
32  * JVM notation, that is, with '/' as package separator character&nbsp; (instead
33  * of '.').</b>
34  * <p>
35  * The following convention is used to specify the format of a given name:
36  * Something called ...
37  * <ul>
38  * <li>
39  * <i>name</i> represents a non-qualified name (e.g. <code>JDOPersistenceCapableName</code>
40  * = "<code>PersistenceCapable</code>")</li>
41  * <li>
42  * <i>type</i> represents a Java-qualified class name (e.g. <code>JDOPersistenceCapablePath</code>
43  * = '<code>com.sun.jdo.spi.persistence.support.sqlstore.PersistenceCapable</code>")</li>
44  * <li>
45  * <i>path</i> represents a JVM-qualified name (e.g. <code>JDOPersistenceCapablePath</code>
46  * = '<code>com/sun/jdo/spi/persistence/support/sqlstore/PersistenceCapable</code>")</li>
47  * <li>
48  * <i>sig</i> (for <i>signature</i>) represents a JVM-qualified type-signature
49  * name (e.g. <code>JDOPersistenceCapableSig</code>
50  * = "L<code>com/sun/jdo/spi/persistence/support/sqlstore/PersistenceCapable;</code>")</li>
51  * </ul>
52  */

53 //@olsen: new interface
54
public interface JDOMetaData
55 {
56     String JavaDoc JDOExternalPath = "com/sun/jdo/api/persistence/support/";//NOI18N
57
String JavaDoc JDOPath = "com/sun/jdo/spi/persistence/support/sqlstore/";//NOI18N
58

59     String JavaDoc JDOPersistenceCapableName = "PersistenceCapable";//NOI18N
60
String JavaDoc JDOPersistenceCapablePath
61     = JDOPath + JDOPersistenceCapableName;//NOI18N
62
String JavaDoc JDOPersistenceCapableSig
63     = "L" + JDOPersistenceCapablePath + ";";//NOI18N
64
String JavaDoc JDOPersistenceCapableType
65         = JDOPersistenceCapablePath.replace('/', '.');
66
67     static String JavaDoc javaLangCloneablePath = "java/lang/Cloneable";
68
69     String JavaDoc JDOInstanceCallbacksName = "InstanceCallbacks";//NOI18N
70
String JavaDoc JDOInstanceCallbacksPath
71     = JDOPath + JDOInstanceCallbacksName;//NOI18N
72
String JavaDoc JDOInstanceCallbacksSig
73     = "L" + JDOInstanceCallbacksPath + ";";//NOI18N
74
String JavaDoc JDOInstanceCallbacksType
75         = JDOInstanceCallbacksPath.replace('/', '.');
76
77     String JavaDoc JDOSecondClassObjectBaseName = "SCO";//NOI18N
78
String JavaDoc JDOSecondClassObjectBasePath
79     = JDOPath + JDOSecondClassObjectBaseName;//NOI18N
80
String JavaDoc JDOSecondClassObjectBaseSig
81     = "L" + JDOSecondClassObjectBasePath + ";";//NOI18N
82
String JavaDoc JDOSecondClassObjectBaseType
83         = JDOSecondClassObjectBasePath.replace('/', '.');
84
85     String JavaDoc JDOPersistenceManagerName = "PersistenceManager";//NOI18N
86
// we use the external, "public" PersistenceManager interface only
87
String JavaDoc JDOPersistenceManagerPath
88     = JDOExternalPath + JDOPersistenceManagerName;//NOI18N
89
String JavaDoc JDOPersistenceManagerSig
90     = "L" + JDOPersistenceManagerPath + ";";//NOI18N
91
String JavaDoc JDOPersistenceManagerType
92         = JDOPersistenceManagerPath.replace('/', '.');
93
94     String JavaDoc JDOStateManagerName = "StateManager";//NOI18N
95
String JavaDoc JDOStateManagerPath
96     = JDOPath + JDOStateManagerName;//NOI18N
97
String JavaDoc JDOStateManagerSig
98     = "L" + JDOStateManagerPath + ";";//NOI18N
99
String JavaDoc JDOStateManagerType
100         = JDOStateManagerPath.replace('/', '.');
101
102     String JavaDoc JDOStateManagerFieldName = "jdoStateManager";//NOI18N
103
String JavaDoc JDOStateManagerFieldType = JDOStateManagerType;
104     String JavaDoc JDOStateManagerFieldSig = JDOStateManagerSig;
105
106     String JavaDoc JDOFlagsFieldName = "jdoFlags";//NOI18N
107
String JavaDoc JDOFlagsFieldType = "byte";//NOI18N
108
String JavaDoc JDOFlagsFieldSig = "B";//NOI18N
109

110     /**
111      * Tests whether a class is known to be transient.
112      * <P>
113      * The following invariant holds:
114      * isTransientClass(classPath)
115      * => !isPersistenceCapableClass(classPath)
116      * @param classPath the JVM-qualified name of the class
117      * @return true if this class is known to be transient; otherwise false
118      */

119     boolean isTransientClass(String JavaDoc classPath)
120         throws JDOMetaDataUserException, JDOMetaDataFatalError;
121
122     /**
123      * Tests whether a class is known to be persistence-capable.
124      * <P>
125      * The following invariant holds:
126      * isPersistenceCapableClass(classPath)
127      * => !isTransientClass(classPath)
128      * && !isSecondClassObjectType(classPath)
129      * @param classPath the JVM-qualified name of the class
130      * @return true if this class is persistence-capable; otherwise false
131      */

132     boolean isPersistenceCapableClass(String JavaDoc classPath)
133         throws JDOMetaDataUserException, JDOMetaDataFatalError;
134
135     /**
136      * Tests whether a class is known as a persistence-capable root class.
137      * <P>
138      * @param classPath the JVM-qualified name of the class
139      * @return true if this class is persistence-capable and does not
140      * derive from another persistence-capable class; otherwise false
141      */

142     boolean isPersistenceCapableRootClass(String JavaDoc classPath)
143         throws JDOMetaDataUserException, JDOMetaDataFatalError;
144
145     /**
146      * Returns the name of the persistence-capable root class of a class.
147      * <P>
148      * @param classPath the JVM-qualified name of the class
149      * @return the name of the least-derived persistence-capable class that
150      * is equal to or a super class of the argument class; if the
151      * argument class is not persistence-capable, null is returned.
152      */

153     String JavaDoc getPersistenceCapableRootClass(String JavaDoc classPath)
154         throws JDOMetaDataUserException, JDOMetaDataFatalError;
155
156     /**
157      * Returns the name of the superclass of a class.
158      * <P>
159      * @param classPath the JVM-qualified name of the class
160      * @return the name of the superclass.
161      */

162     String JavaDoc getSuperClass(String JavaDoc classPath)
163         throws JDOMetaDataUserException, JDOMetaDataFatalError;
164
165     /**
166      * Tests whether a class is known as type for Second Class Objects.
167      * <P>
168      * The following invariant holds:
169      * isSecondClassObjectType(classPath)
170      * => !isPersistenceCapableClass(classPath)
171      * @param classPath the JVM-qualified name of the type
172      * @return true if this type is known for second class objects;
173      * otherwise false
174      */

175     boolean isSecondClassObjectType(String JavaDoc classPath)
176         throws JDOMetaDataUserException, JDOMetaDataFatalError;
177
178     /**
179      * Tests whether a class is known as type for Mutable Second Class Objects.
180      * <P>
181      * @param classPath the JVM-qualified name of the type
182      * @return true if this type is known for mutable second class objects;
183      * otherwise false
184      */

185     boolean isMutableSecondClassObjectType(String JavaDoc classPath)
186         throws JDOMetaDataUserException, JDOMetaDataFatalError;
187
188     /**
189      * Tests whether a field of a class is known to be persistent.
190      * <P>
191      * @param classPath the JVM-qualified name of the class
192      * @param fieldName the name of the field
193      * @return true if this field is known to be persistent; otherwise false
194      */

195     boolean isPersistentField(String JavaDoc classPath, String JavaDoc fieldName)
196         throws JDOMetaDataUserException, JDOMetaDataFatalError;
197
198     /**
199      * Tests whether a field of a class is known to be transactional.
200      * <P>
201      * @param classPath the JVM-qualified name of the class
202      * @param fieldName the name of the field
203      * @return true if this field is known to be transactional; otherwise false
204      */

205     boolean isTransactionalField(String JavaDoc classPath, String JavaDoc fieldName)
206         throws JDOMetaDataUserException, JDOMetaDataFatalError;
207
208     /**
209      * Tests whether a field of a class is known to be Primary Key.
210      * <P>
211      * @param classPath the JVM-qualified name of the class
212      * @param fieldName the name of the field
213      * @return true if this field is known to be primary key; otherwise false
214      */

215     boolean isPrimaryKeyField(String JavaDoc classPath, String JavaDoc fieldName)
216         throws JDOMetaDataUserException, JDOMetaDataFatalError;
217
218     /**
219      * Tests whether a field of a class is known to be part of the
220      * Default Fetch Group.
221      * <P>
222      * @param classPath the JVM-qualified name of the class
223      * @param fieldName the name of the field
224      * @return true if this field is known to be part of the
225      * default fetch group; otherwise false
226      */

227     boolean isDefaultFetchGroupField(String JavaDoc classPath, String JavaDoc fieldName)
228         throws JDOMetaDataUserException, JDOMetaDataFatalError;
229
230     /**
231      * Returns the unique field index of a declared, persistent field of a
232      * class.
233      * <P>
234      * @param classPath the JVM-qualified name of the class
235      * @param fieldName the name of the field
236      * @return the non-negative, unique field index
237      */

238     int getFieldNo(String JavaDoc classPath, String JavaDoc fieldName)
239         throws JDOMetaDataUserException, JDOMetaDataFatalError;
240
241     /**
242      * Returns an array of field names of all declared persistent and
243      * transactional fields of a class.
244      * <P>
245      * The position of the field names in the result array corresponds
246      * to their unique field index as returned by getFieldNo such that
247      * these equations holds:
248      * <P> getFieldNo(getManagedFields(classPath)[i]) == i
249      * <P> getManagedFields(classPath)[getFieldNo(fieldName)] == fieldName
250      * <P>
251      * @param classPath the JVM-qualified name of the class
252      * @return an array of all declared persistent and transactional
253      * fields of a class
254      */

255     String JavaDoc[] getManagedFields(String JavaDoc classPath)
256         throws JDOMetaDataUserException, JDOMetaDataFatalError;
257 }
258
Popular Tags