KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > descriptors > RelationalDescriptor


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
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
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 in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.descriptors;
23
24 import java.util.*;
25 import oracle.toplink.essentials.exceptions.*;
26
27 /**
28  * <p><b>Purpose</b>: TopLink has been designed to take advantage of the similarities between
29  * relational databases and objects while accommodating for their differences, providing an object
30  * oriented wrapper for relational databases. This is accomplished through the use of Descriptors.
31  * A descriptor is a pure specification class with all its behaviour deputized to DescriptorEventManager,
32  * DescriptorQueryManager and ObjectBuilder. Look at the following variables for the list
33  * of specification on the descriptor.
34  * <p>
35  * A Descriptor is a set of mappings that describe how an objects's data is to be represented in a
36  * relational database. It contains mappings from the class instance variables to the table's fields,
37  * as well as the transformation routines necessary for storing and retrieving attributes. As such
38  * the descriptor acts as the link between the Java object and its database representaiton.
39  * <p>
40  * Every descripor is initialized with the following information:
41  * <ul>
42  * <li> The Java class its describes, and the corresponding table(s) for storing instances of the class.
43  * <li> The primary key of the table.
44  * <li> A list of query keys for field names.
45  * <li> A description of the objects's attributes and relationships. This information is stored in mappings.
46  * <li> A set of user selectable properties for tailoring the behaviour of the descriptor.
47  * </ul>
48  *
49  * <p> This descriptor subclass should be used for object-relational mapping,
50  * and allows for other datatype mappings to be done in the XML, EIS and OR sibling classes.
51  *
52  * @see DescriptorEventManager
53  * @see DescriptorQueryManager
54  * @see InheritancePolicy
55  * @see InterfacePolicy
56  */

57 public class RelationalDescriptor extends ClassDescriptor {
58
59     /**
60      * PUBLIC:
61      * Return a new descriptor.
62      */

63     public RelationalDescriptor() {
64         super();
65     }
66
67     /**
68      * PUBLIC:
69      * Specify the table name for the class of objects the receiver describes.
70      * If the table has a qualifier it should be specified using the dot notation,
71      * (i.e. "userid.employee"). This method is used if there is more than one table.
72      */

73     public void addTableName(String JavaDoc tableName) {
74         super.addTableName(tableName);
75     }
76
77     /**
78      * PUBLIC:
79      * Return the name of the descriptor's first table.
80      * This method must only be called on single table descriptors.
81      */

82     public String JavaDoc getTableName() {
83         return super.getTableName();
84     }
85
86     /**
87      * PUBLIC:
88      * Return the table names.
89      */

90     public Vector getTableNames() {
91         return super.getTableNames();
92     }
93
94     /**
95      * PUBLIC:
96      * The descriptors default table can be configured if the first table is not desired.
97      */

98     public void setDefaultTableName(String JavaDoc defaultTableName) {
99         super.setDefaultTableName(defaultTableName);
100     }
101
102     /**
103      * PUBLIC:
104      * Specify the table name for the class of objects the receiver describes.
105      * If the table has a qualifier it should be specified using the dot notation,
106      * (i.e. "userid.employee"). This method is used for single table.
107      */

108     public void setTableName(String JavaDoc tableName) throws DescriptorException {
109         super.setTableName(tableName);
110     }
111
112     /**
113      * PUBLIC:
114      * Specify the all table names for the class of objects the receiver describes.
115      * If the table has a qualifier it should be specified using the dot notation,
116      * (i.e. "userid.employee"). This method is used for multiple tables
117      */

118     public void setTableNames(Vector tableNames) {
119         super.setTableNames(tableNames);
120     }
121
122     /**
123      * PUBLIC: Set the table Qualifier for this descriptor. This table creator will be used for
124      * all tables in this descriptor
125      */

126     public void setTableQualifier(String JavaDoc tableQualifier) {
127         super.setTableQualifier(tableQualifier);
128     }
129 }
130
Popular Tags