KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > genclass > api > SpeedoGenClassProxy


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * 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  */

18 package org.objectweb.speedo.genclass.api;
19
20 import org.objectweb.jorm.type.api.PType;
21 import org.objectweb.jorm.api.PBinding;
22 import org.objectweb.util.monolog.api.Logger;
23 import org.objectweb.speedo.genclass.api.SpeedoGenClassCoherence;
24 import org.objectweb.speedo.genclass.api.SpeedoGenClassListener;
25 import org.objectweb.speedo.mim.api.SpeedoProxy;
26
27 /**
28  * This interfaces represents a SpeedoProxy for a generic class (Collectio, Set,
29  * Map, ...)
30  * It permits to specify the mapper throught the generic class is persistent.
31  * The Mapper name permits to know the type of GenClassMapping and
32  * GenClassBinding (rdb, fos, ...).
33  *
34  * The PType of the generic class permit to known which is GenClassMapping
35  * instance to use.
36  *
37  * @author S.Chassande-Barrioz
38  */

39 public interface SpeedoGenClassProxy extends SpeedoProxy, SpeedoGenClassCoherence {
40
41     /**
42      * Assignes the PType of the generic class.
43      * @param ptype of the generic class
44      */

45     void jdoSetPType(PType ptype);
46
47     /**
48      * @return the PType of the generic class.
49      */

50     PType jdoGetPType();
51
52     /**
53      * @return a string which represents the fully path of the persistent field
54      * of the class with wich the generic class is persistent.
55      * If the linked fiekf is the 'f1' provided by the class 'com.foo.Bar'
56      * then the returned string will be 'com.foo.Bar/f1'
57      */

58     String JavaDoc jdoGetGenClassId();
59
60     /**
61      * Assignes the linked field name for this generic class.
62      * @param lf is tring which represents the fully path of the persistent
63      * field of the class with wich the generic class is persistent.
64      * If the linked fiekf is the 'f1' provided by the class 'com.foo.Bar'
65      * then the expected string is 'com.foo.Bar/f1'
66      */

67     void jdoSetLinkedField(String JavaDoc lf);
68
69     /**
70      * assignes the PBinding to use to load/store the generic class
71      * Call this method with null value means that the generic is no more
72      * persistent.
73      * @param pb is the PBinding.
74      */

75     void jdoSetPBinding(PBinding pb);
76
77     /**
78      * @return the pbinding associated to the generic class. The value is not
79      * used if the generic class is not persistent.
80      */

81     PBinding jdoGetPBinding();
82
83     /**
84      * Assignes the new value of the generic class (Collection, Map or Array
85      * or ...).
86      */

87     void setElements(Object JavaDoc o);
88
89     Object JavaDoc createGenClass();
90
91     /**
92      * Sets the id of this gen class instance (id of the field that references
93      * this instance).
94      *
95      * @param gcid the new id of this gen class instance.
96      */

97     void speedoSetGcId (int gcid);
98
99     /**
100      * Adds a listener to this gen class instance. This listener will be
101      * notified each time an element is added or removed for this gen class.
102      *
103      * @param l a gen class listener.
104      */

105     void speedoAddGenClassListener (SpeedoGenClassListener l);
106
107     /**
108      * Notifies the listeners of this gen class that an element has been added
109      * to this gen class.
110      *
111      * @param elem the element that has been added.
112      */

113     void fireSpeedoElementAdded (Object JavaDoc elem);
114
115     /**
116      * Notifies the listeners of this gen class that an element has been removed
117      * to this gen class.
118      *
119      * @param elem the element that has been removed.
120      */

121     void fireSpeedoElementRemoved (Object JavaDoc elem);
122
123     void clear ();
124
125     /**
126      * Initializes a Genclass instance
127      * @param ptype is the PType of the genclass
128      * @param linkedField is the name of the field referencing the genclass
129      * @param pnameHints is a helper using for the identifier allocation (export)
130      * persistent
131      * @param logger is the logger instance for logging.
132      */

133     void init(PType ptype,
134               String JavaDoc linkedField,
135               Object JavaDoc pnameHints,
136               Logger logger);
137
138     /**
139      * Assignes the hints needed to build the PName of the persistent object
140      * during the export action.
141      */

142     void jdoSetPNameHints(Object JavaDoc hints);
143 }
144
Popular Tags