KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > metainfo > api > CommonClassMapping


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.metainfo.api;
25
26 import java.util.Iterator JavaDoc;
27 import java.util.Collection JavaDoc;
28 import java.util.List JavaDoc;
29
30 /**
31  * This interface gather methods to the ClassMapping and GenClassMapping
32  * interfaces. It defines getter/setter for
33  * - mapping rule name: it defines how the class on the database structures.
34  * it is usefull when a class can be mapped in different ways.
35  * For instance, with a mapping to relational tables, a class
36  * can be mapped to one or more joined tables.
37  * Even though this method is shared by all class mapping implementation,
38  * values set and get are only meaningfull in those implementations
39  * - identifier mapping: it defines how the identifier of the class is mapped
40  * - primitive element mappings (PEMs): they defined how primitive elements are
41  * mapped at this level. Note that the referenced primitive element can
42  * be defined at an upper level in the inheritance hierarchy. Also note
43  * that PEMs are inherited and that inherited PEMs can be retrieved using the
44  * <code> getAllPrimitiveElements() </code> method
45  * - reference mappings (RMs): TODO: description
46  * - dependencies: TODO: description
47  *
48  */

49 public interface CommonClassMapping extends MappingStructure {
50
51     /**
52      * Returns the name of the rule used to map the class.
53      * @return the name of the class mapping rule.
54      */

55     String JavaDoc getRuleName();
56
57     /**
58      * Sets the name of the rule used to map the class.
59      * @param rulename the class mapping rule name.
60      */

61     void setRuleName(String JavaDoc rulename);
62
63     /**
64      * Returns the IdentifierMapping in this class mapping.
65      * @return the IdentifierMapping in this class mapping.
66      */

67     IdentifierMapping getIdentifierMapping();
68
69     /**
70      * Sets the IdentifierMapping object.
71      * @param idmapping the IdentifierMapping object.
72      */

73     void setIdentifierMapping(IdentifierMapping idmapping);
74
75     /**
76      * Returns the collection of PEM of the current class only defined at the
77      * inheritance level, that is, without the inherited ones.
78      * @return a collection.
79      */

80     Collection JavaDoc getPrimitiveElementMappings();
81
82     /**
83      * Returns the list of PEM of the current class and its super classes. The
84      * list is ordered by field names.
85      * @return a collection.
86      */

87     List JavaDoc getAllPrimitiveElementMappings();
88     
89     /**
90      * Returns the PrimitiveElementMapping objects (hidden or not) matching a
91      * given fieldName.
92      * @param fieldName the name of the primitivite field (hidden or not) of
93      * the class of which the PEM must be returned
94      * @return the PEM matching the given field name
95      */

96     PrimitiveElementMapping getPrimitiveElementMapping(String JavaDoc fieldName);
97
98     /**
99      * Adds a PrimitiveElementMapping object.
100      * @param pemapping the PrimitiveElementMapping object to add to the list.
101      */

102     void addPrimitiveElementMapping(PrimitiveElementMapping pemapping);
103
104     /**
105      * Adds a PrimitiveElementMapping object.
106      * @param pemapping the PrimitiveElementMapping object to add to the list.
107      */

108     void addPrimitiveElementMapping(String JavaDoc fieldName, PrimitiveElementMapping pemapping);
109
110     /**
111      * Returns an Iterator over PrimitiveElementMapping objects.
112      * @return an Iterator.
113      */

114     Iterator JavaDoc primitiveElementMappingsIterator();
115
116     /**
117      * Creates a new IdentifierMapping object.
118      * @param nd the NameDef object that defines an object identifier.
119      * @return an IdentifierMapping object.
120      */

121     IdentifierMapping createIdentifierMapping(NameDef nd);
122
123     /**
124      * Creates a new ReferenceMapping object.
125      * @param ruleName the name of the rule used to map the reference,
126      * nd the NameDef object that defines an object reference.
127      * @return a ReferenceMapping object.
128      */

129     ReferenceMapping createReferenceMapping(String JavaDoc ruleName, NameDef nd);
130
131     /**
132      * add a dependency to a given jorm class
133      * @param jormClassName the name of the class to which depends the class mapping
134      */

135     void addDependency(String JavaDoc jormClassName);
136
137     /**
138      * remove a dependency to a given jorm class
139      * @param jormClassName the name of the class to which the class mapping does
140      * not depend anymore
141      */

142     void removeDependency(String JavaDoc jormClassName);
143
144     /**
145      * Returns the set of class names (Strings) of which the class mapping is dependent
146      * @return the set of class names (Strings) of which the class mapping is dependent
147      */

148     Collection JavaDoc getDependencies();
149 }
150
Popular Tags