Source Code Cross Referenced for MappingDefaults.java in  » Database-ORM » openjpa » org » apache » openjpa » jdbc » meta » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » openjpa » org.apache.openjpa.jdbc.meta 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements.  See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership.  The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License.  You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied.  See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.    
018:         */
019:        package org.apache.openjpa.jdbc.meta;
020:
021:        import org.apache.openjpa.jdbc.schema.Column;
022:        import org.apache.openjpa.jdbc.schema.ForeignKey;
023:        import org.apache.openjpa.jdbc.schema.Index;
024:        import org.apache.openjpa.jdbc.schema.Schema;
025:        import org.apache.openjpa.jdbc.schema.Table;
026:        import org.apache.openjpa.jdbc.schema.Unique;
027:
028:        /**
029:         * Generates default names for tables, columns, indexes, constraints, etc.
030:         *
031:         * @author Abe White
032:         */
033:        public interface MappingDefaults {
034:
035:            /**
036:             * Whether to fill in missing mapping information at runtime with the
037:             * default values supplied by this plugin. A value of false means that
038:             * all mapping information must be present at runtime.
039:             */
040:            public boolean defaultMissingInfo();
041:
042:            /**
043:             * The default for whether relations use the related object's
044:             * expected class as part of the join criteria.
045:             */
046:            public boolean useClassCriteria();
047:
048:            /**
049:             * Default mapping strategy when there is no explicit strategy
050:             * and no hierarchy strategy given.
051:             *
052:             * @param cls the class; will not be mapped, but superclass and raw
053:             * {@link MappingInfo} will be available
054:             * @param adapt whether we can adapt the mapping or schema
055:             * @return the strategy alias or a strategy instance, or null
056:             */
057:            public Object getStrategy(ClassMapping cls, boolean adapt);
058:
059:            /**
060:             * Default version mapping strategy when there is no explicit strategy.
061:             *
062:             * @param vers the version; will not be mapped, but raw
063:             * {@link MappingInfo} will be available
064:             * @param adapt whether we can adapt the mapping or schema
065:             * @return the strategy alias or a strategy instance, or null
066:             */
067:            public Object getStrategy(Version vers, boolean adapt);
068:
069:            /**
070:             * Default discriminator mapping strategy when there is no explicit
071:             * strategy.
072:             *
073:             * @param disc the discriminator; will not be mapped, but raw
074:             * {@link MappingInfo} will be available
075:             * @param adapt whether we can adapt the mapping or schema
076:             * @return the strategy alias or a strategy instance, or null
077:             */
078:            public Object getStrategy(Discriminator disc, boolean adapt);
079:
080:            /**
081:             * Custom handler or strategy for the given field, or null if none
082:             * has been registered.
083:             *
084:             * @param vm the value mapping; will not be mapped, but raw
085:             * {@link MappingInfo} will be available
086:             * @param type the value type
087:             * @param adapt whether we can adapt the mapping or schema
088:             * @return the handler/strategy alias or instance, or null
089:             */
090:            public Object getStrategy(ValueMapping vm, Class type, boolean adapt);
091:
092:            /**
093:             * Return the default discriminator value for the given instance.
094:             */
095:            public Object getDiscriminatorValue(Discriminator disc,
096:                    boolean adapt);
097:
098:            /**
099:             * Return the default table name for the given class. This method is
100:             * only called for classes mapped to their own table.
101:             */
102:            public String getTableName(ClassMapping cls, Schema defaultSchema);
103:
104:            /**
105:             * Return the default secondary table name for the given field. This
106:             * method is only called for fields whose strategy requires a secondary
107:             * table.
108:             */
109:            public String getTableName(FieldMapping fm, Schema defaultSchema);
110:
111:            /**
112:             * Fill in default information for the given datastore identity columns.
113:             * The columns' name and Java type will already be populated with generic
114:             * defaults that may be replaced.
115:             */
116:            public void populateDataStoreIdColumns(ClassMapping cls,
117:                    Table table, Column[] cols);
118:
119:            /**
120:             * Fill in default information for the given version columns.
121:             * The columns' name and Java type will already be populated with generic
122:             * defaults that may be replaced.
123:             */
124:            public void populateColumns(Version vers, Table table, Column[] cols);
125:
126:            /**
127:             * Fill in default information for the given discriminator columns.
128:             * The columns' name and Java type will already be populated with generic
129:             * defaults that may be replaced.
130:             */
131:            public void populateColumns(Discriminator disc, Table table,
132:                    Column[] cols);
133:
134:            /**
135:             * Fill in default information for the given column used to join a class
136:             * to its superclass table. The column will be a clone of the target
137:             * column, or have its name and Java type set in the case of a constant
138:             * target.
139:             *
140:             * @param target the target of this column in the join; may be
141:             * another column or a constant value
142:             * @param pos the index of this column in the logical foreign key
143:             * @param cols the number of columns in the logical foreign key
144:             */
145:            public void populateJoinColumn(ClassMapping cm, Table local,
146:                    Table foreign, Column col, Object target, int pos, int cols);
147:
148:            /**
149:             * Fill in default information for the given column used to join a field
150:             * to its defining class' table. The column will be a clone of the target
151:             * column, or have its name and Java type set in the case of a constant
152:             * target.
153:             *
154:             * @param target the target of this column in the join; may be
155:             * another column or a constant value
156:             * @param pos the index of this column in the logical foreign key
157:             * @param cols the number of columns in the logical foreign key
158:             */
159:            public void populateJoinColumn(FieldMapping fm, Table local,
160:                    Table foreign, Column col, Object target, int pos, int cols);
161:
162:            /**
163:             * Fill in default information for the given column used to join a value
164:             * to its related type. The column will be a clone of the target
165:             * column, or have its name and Java type set in the case of a constant
166:             * target.
167:             *
168:             * @param name base name for value, as decided by mapping
169:             * @param target the target of this column in the join; may be
170:             * another column or a constant value
171:             * @param inverse whether this is an inverse foreign key
172:             * @param pos the index of this column in the logical foreign key
173:             * @param cols the number of columns in the logical foreign key
174:             */
175:            public void populateForeignKeyColumn(ValueMapping vm, String name,
176:                    Table local, Table foreign, Column col, Object target,
177:                    boolean inverse, int pos, int cols);
178:
179:            /**
180:             * Fill in default information for the given value columns.
181:             * The columns' name and Java type will already be populated with generic
182:             * defaults that may be replaced.
183:             *
184:             * @param name base name for value, as decided by mapping
185:             */
186:            public void populateColumns(ValueMapping vm, String name,
187:                    Table table, Column[] cols);
188:
189:            /**
190:             * Fill in default information for the given order columns.
191:             * The columns' name and Java type will already be populated with generic
192:             * defaults that may be replaced.
193:             *
194:             * @return false if the given field should not have order columns
195:             * by default; fill in default information even when returning
196:             * false in case the user forces ordering
197:             */
198:            public boolean populateOrderColumns(FieldMapping fm, Table table,
199:                    Column[] cols);
200:
201:            /**
202:             * Fill in default information for the given null indicator columns.
203:             * The columns' name and Java type will already be populated with generic
204:             * defaults that may be replaced.
205:             *
206:             * @param name base name for value, as decided by mapping
207:             * @return false if the given value should not have null indicator
208:             * columns by default; fill in default information even
209:             * when returning false in case the user forces an indicator
210:             */
211:            public boolean populateNullIndicatorColumns(ValueMapping vm,
212:                    String name, Table table, Column[] cols);
213:
214:            /**
215:             * Return a default foreign key for the join from this class' table to its
216:             * superclass' table, or null for a logical foreign key only. Do not
217:             * add columns to the key or add the key to the table; only fill in
218:             * its information such as name, delete action, etc.
219:             */
220:            public ForeignKey getJoinForeignKey(ClassMapping cls, Table local,
221:                    Table foreign);
222:
223:            /**
224:             * Return a default foreign key for the join from this field's table to its
225:             * defining class' table, or null for a logical foreign key only. Do not
226:             * add columns to the key or add the key to the table; only fill in
227:             * its information such as name, delete action, etc.
228:             */
229:            public ForeignKey getJoinForeignKey(FieldMapping fm, Table local,
230:                    Table foreign);
231:
232:            /**
233:             * Return a default foreign key for the join from this value to its
234:             * related type, or null for a logical foreign key only. Do not
235:             * add columns to the key or add the key to the table; only fill in
236:             * its information such as name, delete action, etc.
237:             *
238:             * @param name base name for value, as decided by mapping
239:             * @param inverse whether this is an inverse key
240:             */
241:            public ForeignKey getForeignKey(ValueMapping vm, String name,
242:                    Table local, Table foreign, boolean inverse);
243:
244:            /**
245:             * Return a default index for the join, or null if the
246:             * join columns should not be indexed by default. Do not
247:             * add columns to the index or add the index to the table; only fill in
248:             * its information such as name, uniqueness, etc.
249:             */
250:            public Index getJoinIndex(FieldMapping fm, Table table,
251:                    Column[] cols);
252:
253:            /**
254:             * Return a default index for the value, or null if the value columns
255:             * should not be indexed by default. Do not add columns to the index or
256:             * add the index to the table; only fill in its information such as name,
257:             * uniqueness, etc.
258:             *
259:             * @param name base name for value, as decided by mapping
260:             */
261:            public Index getIndex(ValueMapping vm, String name, Table table,
262:                    Column[] cols);
263:
264:            /**
265:             * Return a default index for the version, or null if the
266:             * version columns should not be indexed by default. Do not
267:             * add columns to the index or add the index to the table; only fill in
268:             * its information such as name, uniqueness, etc.
269:             */
270:            public Index getIndex(Version vers, Table table, Column[] cols);
271:
272:            /**
273:             * Return a default index for the discriminator, or null if the
274:             * discriminator columns should not be indexed by default. Do not
275:             * add columns to the index or add the index to the table; only fill in
276:             * its information such as name, uniqueness, etc.
277:             */
278:            public Index getIndex(Discriminator disc, Table table, Column[] cols);
279:
280:            /**
281:             * Return a default constraint for the join, or null if the join columns
282:             * should not be constrained by default. Do not add columns to the
283:             * constraint or add the constraint to the table; only fill in its
284:             * information such as name, deferrability, etc.
285:             */
286:            public Unique getJoinUnique(FieldMapping fm, Table table,
287:                    Column[] cols);
288:
289:            /**
290:             * Return a default constraint for the value, or null if the value columns
291:             * should not be constrained by default. Do not add columns to the
292:             * constraint or add the constraint to the table; only fill in its
293:             * information such as name, deferrability, etc.
294:             *
295:             * @param name base name for value, as decided by mapping
296:             */
297:            public Unique getUnique(ValueMapping vm, String name, Table table,
298:                    Column[] cols);
299:
300:            /**
301:             * Return the name of the primary key for the table of the given class,
302:             * or null for database default.
303:             */
304:            public String getPrimaryKeyName(ClassMapping cm, Table table);
305:
306:            /**
307:             * If desired, install a primary key on the given secondary table.
308:             */
309:            public void installPrimaryKey(FieldMapping fm, Table table);
310:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.