01: /**
02: * Copyright (C) 2006 NetMind Consulting Bt.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 3 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package hu.netmind.persistence;
18:
19: import java.util.Map;
20:
21: /**
22: * All objects implementing this interface are considered "dynamic", which
23: * means they can define their own attributes,attribute types and the
24: * table their "class" dynamically.<br>
25: * Note however, that when you change the set of attributes for this kind of
26: * objects, their representation in the database will change. All attributes
27: * in dynamic objects are held in the same table (no separate value tables), so
28: * if an attribute becomes deleted, it will resolve in a table column to be
29: * dropped. The data dropped will not be available, even through historical
30: * selects (because the table schema changed).<br>
31: * Dynamic objects can be in their own namespace, meaning they can have
32: * each it's own table, so caller may define different types dynamically
33: * with dynamic objects.<br>
34: * Note however, that dynamic objects can't have super- or sub-classes.
35: * @author Brautigam Robert
36: * @version Revision: $Revision$
37: */
38: public interface DynamicObject extends Map {
39: /**
40: * Get the dynamic name of the class. If this is not null and non-empty,
41: * the library will create this name as it were a classname in the
42: * package designated by the real class' name. After saving such a
43: * class, the caller will be able to select for these kind of classes
44: * with the name specified inside find statements.
45: * @return The dynamic name of class. Any string which is null, or
46: * does not start with a letter is treated as an empty string, in which
47: * case the class' real name will be used.
48: */
49: String getPersistenceDynamicName();
50:
51: /**
52: * This method is called by the library during a select from database.
53: * During the unmarshalling of the object, the library will set the
54: * dynamic name to the object,
55: * @param cl The class the name is queried for.
56: * @param dynamicName The dynamic name of the class as given when
57: * it was saved. If no (empty) dynamic name was given, it will be
58: * called with an empty string.
59: */
60: void setPersistenceDynamicName(String dynamicName);
61: }
|