Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / dynobject / DynObjectManager.java @ 112

History | View | Annotate | Download (5.31 KB)

1
package org.gvsig.tools.dynobject;
2

    
3
import java.io.IOException;
4
import java.io.InputStream;
5
import java.util.Iterator;
6
import java.util.List;
7
import java.util.Map;
8

    
9
import org.gvsig.tools.dynobject.exception.DuplicateDynClassException;
10
import org.gvsig.tools.dynobject.exception.DynMethodException;
11
import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
12
import org.xmlpull.v1.XmlPullParser;
13
import org.xmlpull.v1.XmlPullParserException;
14

    
15

    
16
public interface DynObjectManager {
17

    
18
        public int NULLCODE = -1;
19

    
20
        public DynClass createDynClass(String name, String description);
21

    
22
        public DynClass createDynClass(String namespace, String name, String description);
23

    
24
        public Map importDynClassDefinitions(InputStream resource, ClassLoader loader)throws XmlPullParserException, IOException;
25
        public Map importDynClassDefinitions(XmlPullParser parser, ClassLoader loader)throws XmlPullParserException, IOException;
26
        
27
        /**
28
         * A?ade la dynClass a la lista de clases registradas.
29
         * Falla lanzando una excepcion si ya existe una clase registrada con ese
30
         * nombre en ese namespace.
31
         * 
32
         * @param dynClass
33
         * @throws DuplicateDynClassException
34
         */
35
        public void add(DynClass dynClass) throws DuplicateDynClassException;
36

    
37
        /**
38
         * Create and add to the manager a class with the name
39
         * passed as parameter in the default namespace.
40
         *  
41
         * @param name
42
         * @param description
43
         * @return the new class created.
44
         */
45
        public DynClass add(String name, String description);
46

    
47
        /**
48
         * Create and add to the manager a class with the name
49
         * passed as parameter in the default namespace.
50
         *  
51
         * @param name
52
         * @param description
53
         * @return the new class created.
54
         */
55
        public DynClass add(String name);
56

    
57
        public void remove(DynStruct dynClass);
58
        
59
        /**
60
         * Obtiene  la clase asociado al nombre indicado del namespace
61
         * por defecto..
62
         *
63
         * @param name
64
         *            , nombre de la clase que queremos obtener.
65
         * @return la clase requerida.
66
         */
67
        public DynClass get(String name);
68
        
69
        /**
70
         * Obtiene el la clase asociado al nombre indicado dentro del
71
         * namespace pedido.
72
         *
73
         * @param name
74
         *            , nombre de la clase que queremos obtener.
75
         * @return la clase requerida.
76
         */
77
        public DynClass get(String namespace, String name);
78

    
79
        /**
80
         * Comprueba si esta registrada una clase.
81
         *
82
         * @return true si la clase "name" esta registrada, false si no.
83
         */
84
        public boolean has(String name);
85

    
86
        /**
87
         * Comprueba si esta registrada una clase.
88
         *
89
         * @return true si la clase "name" esta registrada, false si no.
90
         */
91
        public boolean has(String namespace, String name);
92

    
93
        /**
94
         * Obtiene el numero de clases registradas.
95
         *
96
         * @return
97
         */
98
        public int getCount();
99

    
100
        /**
101
         * Obtiene un iterador sobre las clases registradas.
102
         *
103
         * @return
104
         */
105
        public Iterator interator();
106

    
107
        /**
108
         * Obtiene la lista de nombres de las clases registradas.
109
         *
110
         * @return
111
         */
112
        public List getNames();
113

    
114

    
115
        /**
116
         * Crea un nuevo objeto asociandole como clase base la indicada como
117
         * parametro.
118
         *
119
         * @param dynClass
120
         * @return el nuevo DynObject
121
         */
122
        public DynObject createDynObject(DynClass dynClass);
123

    
124
        /**
125
         * Crea un nuevo objeto asociandole como clase base la indicada que tiene el
126
         * nombre indicado.
127
         *
128
         * @param dynClassName
129
         * @return el nuevo DynObject
130
         */
131
        public DynObject createDynObject(String classname);
132

    
133
        /**
134
         * Crea un nuevo objeto asociandole como clase base la indicada que tiene el
135
         * nombre indicado.
136
         *
137
         * @param dynClassName
138
         * @return el nuevo DynObject
139
         */
140
        public DynObject createDynObject(String namespace, String classname);
141

    
142
        /**
143
         * Actualiza todas las DynClasses registradas para reflejar la
144
         * herencia de forma adecuada.
145
         */
146
        public void consolide();
147

    
148

    
149
        /**
150
         * Register the method in the dynClass.
151
         *
152
         * @param dynClass class over the method is registred
153
         * @param dynMethod method to registry
154
         * @return unique code of method
155
         */
156
        public int registerDynMethod(DynClass dynClass, DynMethod dynMethod);
157

    
158
        /**
159
         * Register the method in the class.
160
         *
161
         * @param theClass class over the method is registred
162
         * @param dynMethod method to registry
163
         * @return unique code of method
164
         */
165
        public int registerDynMethod(Class theClass, DynMethod dynMethod);
166

    
167

    
168
        /**
169
         * Obtain the method for the indicated code of the dynObject.
170
         *
171
         * @param dynObject
172
         * @param code code of the requeted method
173
         * @return the required DynMethod
174
         *
175
         * @throws DynMethodException
176
         */
177
        public DynMethod getDynMethod(DynObject dynObject, int code) throws DynMethodException ;
178

    
179
        public DynMethod getDynMethod(DynClass dynClass, int code) throws DynMethodException;
180

    
181
        public DynMethod getDynMethod(Object obj, int code) throws DynMethodException;
182

    
183
        public DynMethod getDynMethod(Class theClass, int code) throws DynMethodException;
184

    
185
        public DynMethod getDynMethod(int code) throws DynMethodException;
186

    
187
        /**
188
         * Invoke the method of the indicated code for the object self, with
189
         * parameters in context.
190
         *
191
         * @param self object over the method is invoked
192
         * @param code code for the method to invoke
193
         * @param context paramters of method
194
         * @return return value for the method
195
         * @throws DynMethodException
196
         */
197
        public Object invokeDynMethod(Object self, int code, DynObject context) throws DynMethodException;
198

    
199
        void validate(DynObject object) throws DynObjectValidateException;
200

    
201
        /**
202
         * @deprecated use DataTypesManager.getDefaultClass
203
         */
204
        Class getDefaultClassOfType(int type);
205
        
206
}