001: /*
002: * $Header: /export/home/cvsroot/MyPersonalizerRepository/MyPersonalizer/Subsystems/Kernel/Sources/es/udc/mypersonalizer/kernel/model/repository/sql/config/DatabaseConventionsConfig.java,v 1.1.1.1 2004/03/25 12:08:36 fbellas Exp $
003: * $Revision: 1.1.1.1 $
004: * $Date: 2004/03/25 12:08:36 $
005: *
006: * =============================================================================
007: *
008: * Copyright (c) 2003, The MyPersonalizer Development Group
009: * (http://www.tic.udc.es/~fbellas/mypersonalizer/index.html) at
010: * University Of A Coruņa
011: * All rights reserved.
012: *
013: * Redistribution and use in source and binary forms, with or without
014: * modification, are permitted provided that the following conditions are met:
015: *
016: * - Redistributions of source code must retain the above copyright notice,
017: * this list of conditions and the following disclaimer.
018: *
019: * - Redistributions in binary form must reproduce the above copyright notice,
020: * this list of conditions and the following disclaimer in the documentation
021: * and/or other materials provided with the distribution.
022: *
023: * - Neither the name of the University Of A Coruņa nor the names of its
024: * contributors may be used to endorse or promote products derived from
025: * this software without specific prior written permission.
026: *
027: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
028: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
029: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
030: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
031: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
032: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
033: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
034: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
035: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
036: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
037: * POSSIBILITY OF SUCH DAMAGE.
038: *
039: */
040:
041: package es.udc.mypersonalizer.kernel.model.repository.sql.config;
042:
043: import es.udc.mypersonalizer.kernel.util.config.Configuration;
044:
045: /**
046: * Configuration bean maintaining the database naming conventions.
047: * Instances are initialized with sensible values.
048: *
049: * @author Abel Muinho Vizcaino
050: * @since 1.0
051: */
052: public class DatabaseConventionsConfig implements Configuration {
053:
054: /**
055: * Suffix for sequences (when sequences are supported by the database,
056: * for example, Oracle).
057: * <p>Default value: <code>Seq</code>
058: */
059: private String sequenceSuffix = "Seq";
060:
061: /**
062: * Extra infix for generated identifiers for sequences (when supported
063: * by the database, for example, Oracle).
064: * <p>Default value: <code>G</code>
065: */
066: private String generatedIdentifierSequenceInfix = "G";
067:
068: /**
069: * Prefix for primary key naming.
070: * <p>Default value: <code>pk_</code>
071: */
072: private String primaryKeyNamePrefix = "pk_";
073:
074: /**
075: * Prefix for foreign key naming.
076: * <p>Default value: <code>fk_</code>
077: */
078: private String foreignKeyNamePrefix = "fk_";
079:
080: /**
081: * Name of the table storing cached service replies.
082: * <p>Default value: <code>CachedServReply</code>
083: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.CachedServiceReplyStorer
084: */
085: private String cachedServiceReplyTable = "CachedServReply";
086:
087: /**
088: * Name of the table storing serializable objects.
089: * <p>Default value: <code>SerializedObject</code>
090: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.SerializableObjectStorer
091: */
092: private String serializedTable = "SerializedObject";
093:
094: /**
095: * Name of the column for service identifiers. It must correspond to the
096: * JDBC type {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
097: * <p>Default value: <code>serviceId</code>
098: */
099: private String serviceIdentifierColumn = "serviceId";
100:
101: /**
102: * Name of the column for property identifiers. It must correspond to the
103: * JDBC type {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}, with
104: * precision enough to store a Java <code>long</code> integer.
105: * <p>Default value: <code>propId</code>
106: */
107: private String propertyIdentifierColumn = "propId";
108:
109: /**
110: * Name of the column for generated identifiers. It must correspond to the
111: * JDBC type {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}, with
112: * precision enough to store a Java <code>long</code> integer.
113: * <p>Default value: <code>genId</code>
114: */
115: private String generatedIdentifierColumn = "genId";
116:
117: /**
118: * Name of the column for serialized object identifiers. It must
119: * correspond to the JDBC type
120: * {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
121: * <p>Default value: <code>serializedId</code>
122: */
123: private String serializedIdentifierColumn = "serializedId";
124:
125: /**
126: * Name of the column for time stamps. It must correspond to the JDBC type
127: * {@link java.sql.Types#TIMESTAMP java.sql.Types.TIMESTAMP}.
128: * <p>Default value: <code>timeStamp</code>
129: */
130: private String timeStampColumn = "timeStamp";
131:
132: /**
133: * Name of the column for service replies. It must correspond to the JDBC
134: * type {@link java.sql.Types#CLOB java.sql.Types.CLOB}.
135: * <p>Default value: <code>serviceReply</code>
136: */
137: private String serviceReplyColumn = "serviceReply";
138:
139: /**
140: * Name of the column for user login names. It must correspond to the JDBC
141: * type {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
142: * <p>Default value: <code>loginNameKey</code>
143: */
144: private String loginColumn = "loginNameKey";
145:
146: /**
147: * Name of the column for storing arrays of bytes representing a
148: * Java serialized object. It must correspond to the JDBC type
149: * {@link java.sql.Types#BLOB java.sql.Types.BLOB}.
150: * <p>Default value: <code>serialized</code>
151: */
152: private String serializedColumn = "serialized";
153:
154: /**
155: * Name of the table storing user groups.
156: * <p>Default value: <code>UserGroups</code>
157: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.UserGroupStorer
158: */
159: private String userGroupsTable = "UserGroups";
160:
161: /**
162: * Name of the table storing user assignments to user groups.
163: * <p>Default value: <code>UserGroupsAssignments</code>
164: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.UserGroupStorer
165: */
166: private String userGroupsAssignmentsTable = "UserGroupsAssignments";
167:
168: /**
169: * Name of the column for storing user groups identifiers.
170: * It must correspond to the JDBC type
171: * {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}.
172: * <p>Default value: <code>groupId</code>
173: */
174: private String userGroupIdentifierColumn = "groupId";
175:
176: /**
177: * Name of the column for storing user groups names. It must correspond
178: * to the JDBC type {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
179: * <p>Default value: <code>groupName</code>
180: */
181: private String userGroupNameColumn = "groupName";
182:
183: /**
184: * Constructor for the bean.
185: */
186: public DatabaseConventionsConfig() {
187: /* Empty, use default behaviour. */
188: }
189:
190: /**
191: * Gets the name of the table storing cached service replies.
192: * @return the name of the table storing cached service replies.
193: */
194: public String getCachedServiceReplyTable() {
195: return cachedServiceReplyTable;
196: }
197:
198: /**
199: * Sets the name of the table storing cached service replies.
200: * @param table the name of the table storing cached service replies.
201: */
202: public void setCachedServiceReplyTable(String table) {
203: cachedServiceReplyTable = table;
204: }
205:
206: /**
207: * Obtains the suffix for sequences (when sequences are supported by the
208: * database, for example, Oracle).
209: * @return the suffix for sequences.
210: */
211: public String getSequenceSuffix() {
212: return sequenceSuffix;
213: }
214:
215: /**
216: * Sets the suffix for sequences (when sequences are supported by the
217: * database, for example, Oracle).
218: * @return the suffix for sequences.
219: * @param suffix the suffix for sequences.
220: */
221: public void setSequenceSuffix(String suffix) {
222: sequenceSuffix = suffix;
223: }
224:
225: /**
226: * Obtains the prefix for foreign key naming.
227: * @return the prefix for foreign key naming.
228: */
229: public String getForeignKeyNamePrefix() {
230: return foreignKeyNamePrefix;
231: }
232:
233: /**
234: * Sets the prefix for foreign key naming.
235: * @param prefix the prefix for foreign key naming.
236: */
237: public void setForeignKeyNamePrefix(String prefix) {
238: foreignKeyNamePrefix = prefix;
239: }
240:
241: /**
242: * Obtains the name of the column for generated identifiers. It must
243: * correspond to the JDBC type
244: * {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}, with
245: * precision enough to store a Java <code>long</code> integer.
246: * @return the name of the column for generated identifiers.
247: */
248: public String getGeneratedIdentifierColumn() {
249: return generatedIdentifierColumn;
250: }
251:
252: /**
253: * Obtains the name of the column for generated identifiers. It must
254: * correspond to the JDBC type
255: * {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}, with
256: * precision enough to store a Java <code>long</code> integer.
257: * @param column the name of the column for generated identifiers.
258: */
259: public void setGeneratedIdentifierColumn(String column) {
260: generatedIdentifierColumn = column;
261: }
262:
263: /**
264: * Obtains the extra infix for generated identifiers for sequences (when
265: * supported by the database, for example, Oracle).
266: * @return the extra infix for generated identifiers for sequences.
267: */
268: public String getGeneratedIdentifierSequenceInfix() {
269: return generatedIdentifierSequenceInfix;
270: }
271:
272: /**
273: * Sets the extra infix for generated identifiers for sequences (when
274: * supported by the database, for example, Oracle).
275: * @param infix the extra infix for generated identifiers for sequences.
276: */
277: public void setGeneratedIdentifierSequenceInfix(String infix) {
278: generatedIdentifierSequenceInfix = infix;
279: }
280:
281: /**
282: * Retuns the name of the column for user login names. It must correspond
283: * to the JDBC type {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
284: * @return the name of the column for user login names.
285: */
286: public String getLoginColumn() {
287: return loginColumn;
288: }
289:
290: /**
291: * Sets the name of the column for user login names. It must correspond
292: * to the JDBC type {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
293: * @param column the name of the column for user login names.
294: */
295: public void setLoginColumn(String column) {
296: loginColumn = column;
297: }
298:
299: /**
300: * Obtains the prefix for primary key naming.
301: * @return the prefix for primary key naming.
302: */
303: public String getPrimaryKeyNamePrefix() {
304: return primaryKeyNamePrefix;
305: }
306:
307: /**
308: * Sets the prefix for primary key naming.
309: * @param prefix the prefix for primary key naming.
310: */
311: public void setPrimaryKeyNamePrefix(String prefix) {
312: primaryKeyNamePrefix = prefix;
313: }
314:
315: /**
316: * Obtains the name of the column for property identifiers. It must
317: * correspond to the
318: * JDBC type {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}, with
319: * precision enough to store a Java <code>long</code> integer.
320: * @return the name of the column for property identifiers.
321: */
322: public String getPropertyIdentifierColumn() {
323: return propertyIdentifierColumn;
324: }
325:
326: /**
327: * Sets the name of the column for property identifiers. It must
328: * correspond to the
329: * JDBC type {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}, with
330: * precision enough to store a Java <code>long</code> integer.
331: * @param column the name of the column for property identifiers.
332: */
333: public void setPropertyIdentifierColumn(String column) {
334: propertyIdentifierColumn = column;
335: }
336:
337: /**
338: * Obtains the name of the column for storing arrays of bytes representing a
339: * Java serialized object. It must correspond to the JDBC type
340: * {@link java.sql.Types#BLOB java.sql.Types.BLOB}.
341: * @return the name of the column.
342: */
343: public String getSerializedColumn() {
344: return serializedColumn;
345: }
346:
347: /**
348: * Sets the name of the column for storing arrays of bytes representing a
349: * Java serialized object. It must correspond to the JDBC type
350: * {@link java.sql.Types#BLOB java.sql.Types.BLOB}.
351: * @param column the name of the column.
352: */
353: public void setSerializedColumn(String column) {
354: serializedColumn = column;
355: }
356:
357: /**
358: * Obtains the name of the column for serialized object identifiers. It must
359: * correspond to the JDBC type
360: * {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
361: * @return the name of the column.
362: */
363: public String getSerializedIdentifierColumn() {
364: return serializedIdentifierColumn;
365: }
366:
367: /**
368: * Sets the name of the column for serialized object identifiers. It must
369: * correspond to the JDBC type
370: * {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
371: * @param column the name of the column.
372: */
373: public void setSerializedIdentifierColumn(String column) {
374: serializedIdentifierColumn = column;
375: }
376:
377: /**
378: * Obtains the name of the table storing serializable objects.
379: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.SerializableObjectStorer
380: * @return the name of the table.
381: */
382: public String getSerializedTable() {
383: return serializedTable;
384: }
385:
386: /**
387: * Sets the name of the table storing serializable objects.
388: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.SerializableObjectStorer
389: * @param table the name of the table.
390: */
391: public void setSerializedTable(String table) {
392: serializedTable = table;
393: }
394:
395: /**
396: * Obtains the name of the column for service identifiers. It must
397: * correspond to the JDBC type
398: * {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
399: * @return the name of the column.
400: */
401: public String getServiceIdentifierColumn() {
402: return serviceIdentifierColumn;
403: }
404:
405: /**
406: * Sets the name of the column for service identifiers. It must
407: * correspond to the JDBC type
408: * {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
409: * @param column the name of the column.
410: */
411: public void setServiceIdentifierColumn(String column) {
412: serviceIdentifierColumn = column;
413: }
414:
415: /**
416: * Obtains the name of the column for service replies. It must correspond
417: * to the JDBC type {@link java.sql.Types#CLOB java.sql.Types.CLOB}.
418: * @return the name of the column.
419: */
420: public String getServiceReplyColumn() {
421: return serviceReplyColumn;
422: }
423:
424: /**
425: * Sets the name of the column for service replies. It must correspond
426: * to the JDBC type {@link java.sql.Types#CLOB java.sql.Types.CLOB}.
427: * @param column the name of the column.
428: */
429: public void setServiceReplyColumn(String column) {
430: serviceReplyColumn = column;
431: }
432:
433: /**
434: * Obtains the name of the column for time stamps. It must correspond to
435: * the JDBC type {@link java.sql.Types#TIMESTAMP java.sql.Types.TIMESTAMP}.
436: * @return the name of the column.
437: */
438: public String getTimeStampColumn() {
439: return timeStampColumn;
440: }
441:
442: /**
443: * Sets the name of the column for time stamps. It must correspond to
444: * the JDBC type {@link java.sql.Types#TIMESTAMP java.sql.Types.TIMESTAMP}.
445: * @param column the name of the column.
446: */
447: public void setTimeStampColumn(String column) {
448: timeStampColumn = column;
449: }
450:
451: /**
452: * Obtains the name of the column for storing user groups identifiers.
453: * It must correspond to the JDBC type
454: * {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}.
455: * @return the name of the column.
456: */
457: public String getUserGroupIdentifierColumn() {
458: return userGroupIdentifierColumn;
459: }
460:
461: /**
462: * Sets the name of the column for storing user groups identifiers.
463: * It must correspond to the JDBC type
464: * {@link java.sql.Types#BIGINT java.sql.Types.BIGINT}.
465: * @param column the name of the column.
466: */
467: public void setUserGroupIdentifierColumn(String column) {
468: userGroupIdentifierColumn = column;
469: }
470:
471: /**
472: * Obtains the name of the column for storing user groups names. It must
473: * correspond to the JDBC type
474: * {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
475: * @return the name of the column.
476: */
477: public String getUserGroupNameColumn() {
478: return userGroupNameColumn;
479: }
480:
481: /**
482: * Sets the name of the column for storing user groups names. It must
483: * correspond to the JDBC type
484: * {@link java.sql.Types#VARCHAR java.sql.Types.VARCHAR}.
485: * @param column the name of the column.
486: */
487: public void setUserGroupNameColumn(String column) {
488: userGroupNameColumn = column;
489: }
490:
491: /**
492: * Obtains the name of the table storing user assignments to user groups.
493: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.UserGroupStorer
494: * @return the name of the table.
495: */
496: public String getUserGroupsAssignmentsTable() {
497: return userGroupsAssignmentsTable;
498: }
499:
500: /**
501: * Sets the name of the table storing user assignments to user groups.
502: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.UserGroupStorer
503: * @param table the name of the table.
504: */
505: public void setUserGroupsAssignmentsTable(String table) {
506: userGroupsAssignmentsTable = table;
507: }
508:
509: /**
510: * Obtains the name of the table storing user groups.
511: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.UserGroupStorer
512: * @return the name of the table.
513: */
514: public String getUserGroupsTable() {
515: return userGroupsTable;
516: }
517:
518: /**
519: * Sets the name of the table storing user groups.
520: * @see es.udc.mypersonalizer.kernel.model.repository.sql.storers.UserGroupStorer
521: * @param table the name of the table.
522: */
523: public void setUserGroupsTable(String table) {
524: userGroupsTable = table;
525: }
526:
527: }
|