Source code: ojb/broker/util/sequence/SequenceManager.java
1 /*
2 * ObJectRelationalBridge - Bridging Java Objects and Relational Databases
3 * http://objectbridge.sourceforge.net
4 * Copyright (C) 2000, 2001 Thomas Mahler, et al.
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.1 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 package ojb.broker.util.sequence;
21
22
23 /**
24 * SequenceManagers are responsible for creating new unique
25 * ID's for primary columns containing integer or String values.
26 * There is a simple Default implementation SequenceManagerDefaultImpl
27 * that provides rudimentary unique numbering.
28 * SequenceManager Objects are obtained from a Factory SequenceManagerFactory.
29 * This Factory can be configured to provide instances of user defined
30 * implementors of this interface.
31 *
32 * SequenceManagers should be aware of extends, that
33 * is: if you ask for an uid for an Interface with several implementor
34 * classes, or a baseclass with several subclasses the returned uid
35 * should be unique accross all tables representing objects of the extent in question.
36 *
37 * @author: thma
38 *
39 */
40 public interface SequenceManager
41 {
42
43 /**
44 * returns a unique int for class clazz and field fieldName.
45 * the returned uid is unique accross all tables in the extent of clazz.
46 */
47 public int getUniqueId(Class clazz, String fieldName);
48
49 /**
50 * returns a unique long value for class clazz and field fieldName.
51 * the returned number is unique accross all tables in the extent of clazz.
52 */
53 public long getUniqueLong(Class clazz, String fieldName);
54
55 /**
56 * returns a unique String for class clazz and field fieldName.
57 * the returned uid is unique accross all tables in the extent of clazz.
58 */
59 public String getUniqueString(Class clazz, String fieldName);
60
61 /**
62 * returns a unique Object for class clazz and field fieldName.
63 * the returned Object is unique accross all tables in the extent of clazz.
64 */
65 public Object getUniqueObject(Class clazz, String fieldName);
66
67
68 }