1 | |
package org.apache.ojb.broker.metadata; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
import org.apache.ojb.broker.accesslayer.QueryCustomizer; |
19 | |
import org.apache.ojb.broker.locking.IsolationLevels; |
20 | |
import org.apache.ojb.broker.locking.LockHelper; |
21 | |
import org.apache.ojb.broker.metadata.fieldaccess.PersistentField; |
22 | |
import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory; |
23 | |
import org.apache.ojb.broker.util.ClassHelper; |
24 | |
import org.apache.ojb.broker.util.logging.Logger; |
25 | |
import org.apache.ojb.broker.util.logging.LoggerFactory; |
26 | |
import org.xml.sax.Attributes; |
27 | |
import org.xml.sax.SAXException; |
28 | |
import org.xml.sax.SAXParseException; |
29 | |
import org.xml.sax.helpers.DefaultHandler; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
public class RepositoryXmlHandler |
46 | |
extends DefaultHandler |
47 | |
implements RepositoryElements, IsolationLevels |
48 | |
{ |
49 | |
private Logger logger = LoggerFactory.getLogger(RepositoryXmlHandler.class); |
50 | |
|
51 | |
private DescriptorRepository m_repository; |
52 | |
private ClassDescriptor m_CurrentCLD; |
53 | |
private ProcedureDescriptor m_CurrentProcedure; |
54 | |
private FieldDescriptor m_CurrentFLD; |
55 | |
private ObjectReferenceDescriptor m_CurrentORD; |
56 | |
private CollectionDescriptor m_CurrentCOD; |
57 | |
private IndexDescriptor m_CurrentIndexDescriptor; |
58 | |
private String m_CurrentString; |
59 | |
|
60 | |
private AttributeContainer m_CurrentAttrContainer; |
61 | |
|
62 | |
private int defProxyPrefetchingLimit = 50; |
63 | |
|
64 | |
|
65 | |
|
66 | |
private int m_lastId; |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
private RepositoryTags tags = RepositoryTags.getInstance(); |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
private int getLiteralId(String literal) throws MetadataException |
85 | |
{ |
86 | |
|
87 | |
try |
88 | |
{ |
89 | |
return tags.getIdByTag(literal); |
90 | |
} |
91 | |
catch (NullPointerException t) |
92 | |
{ |
93 | |
throw new MetadataException("Found Unknown literal '" + literal + |
94 | |
"' in the repository file. Check repository file or/and RepositoryTags.java", t); |
95 | |
} |
96 | |
|
97 | |
} |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
public RepositoryXmlHandler(DescriptorRepository dr) |
104 | |
{ |
105 | |
if (dr != null) |
106 | |
{ |
107 | |
m_repository = dr; |
108 | |
} |
109 | |
else |
110 | |
{ |
111 | |
throw new MetadataException("Given DescriptorRepository argument was null"); |
112 | |
} |
113 | |
} |
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
public void startDocument() |
119 | |
{ |
120 | |
logger.debug("startDoc"); |
121 | |
} |
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
public void endDocument() |
127 | |
{ |
128 | |
|
129 | |
|
130 | |
logger.debug("endDoc"); |
131 | |
} |
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
public void startElement(String uri, String name, String qName, Attributes atts) |
139 | |
{ |
140 | |
boolean isDebug = logger.isDebugEnabled(); |
141 | |
|
142 | |
m_CurrentString = null; |
143 | |
try |
144 | |
{ |
145 | |
switch (getLiteralId(qName)) |
146 | |
{ |
147 | |
case MAPPING_REPOSITORY: |
148 | |
{ |
149 | |
if (isDebug) logger.debug(" > " + tags.getTagById(MAPPING_REPOSITORY)); |
150 | |
this.m_CurrentAttrContainer = m_repository; |
151 | |
|
152 | |
String defIso = atts.getValue(tags.getTagById(ISOLATION_LEVEL)); |
153 | |
this.m_repository.setDefaultIsolationLevel(LockHelper.getIsolationLevelFor(defIso)); |
154 | |
if (isDebug) logger.debug(" " + tags.getTagById(ISOLATION_LEVEL) + ": " + defIso); |
155 | |
|
156 | |
|
157 | |
String proxyPrefetchingLimit = atts.getValue(tags.getTagById(PROXY_PREFETCHING_LIMIT)); |
158 | |
if (isDebug) logger.debug(" " + tags.getTagById(PROXY_PREFETCHING_LIMIT) + ": " + proxyPrefetchingLimit); |
159 | |
if (proxyPrefetchingLimit != null) |
160 | |
{ |
161 | |
defProxyPrefetchingLimit = Integer.parseInt(proxyPrefetchingLimit); |
162 | |
} |
163 | |
|
164 | |
|
165 | |
String version = atts.getValue(tags.getTagById(REPOSITORY_VERSION)); |
166 | |
if (DescriptorRepository.getVersion().equals(version)) |
167 | |
{ |
168 | |
if (isDebug) logger.debug(" " + tags.getTagById(REPOSITORY_VERSION) + ": " + version); |
169 | |
} |
170 | |
else |
171 | |
{ |
172 | |
throw new MetadataException("Repository version does not match. expected " + |
173 | |
DescriptorRepository.getVersion() + " but found: " + |
174 | |
version+". Please update your repository.dtd and your repository.xml"+ |
175 | |
" version attribute entry"); |
176 | |
} |
177 | |
break; |
178 | |
} |
179 | |
case CLASS_DESCRIPTOR: |
180 | |
{ |
181 | |
if (isDebug) logger.debug(" > " + tags.getTagById(CLASS_DESCRIPTOR)); |
182 | |
m_CurrentCLD = new ClassDescriptor(m_repository); |
183 | |
|
184 | |
|
185 | |
this.m_CurrentAttrContainer = this.m_CurrentCLD; |
186 | |
|
187 | |
|
188 | |
String isoLevel = atts.getValue(tags.getTagById(ISOLATION_LEVEL)); |
189 | |
if (isDebug) logger.debug(" " + tags.getTagById(ISOLATION_LEVEL) + ": " + isoLevel); |
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
if(checkString(isoLevel)) m_CurrentCLD.setIsolationLevel(LockHelper.getIsolationLevelFor(isoLevel)); |
196 | |
|
197 | |
|
198 | |
String classname = atts.getValue(tags.getTagById(CLASS_NAME)); |
199 | |
if (isDebug) logger.debug(" " + tags.getTagById(CLASS_NAME) + ": " + classname); |
200 | |
try |
201 | |
{ |
202 | |
m_CurrentCLD.setClassOfObject(ClassHelper.getClass(classname)); |
203 | |
} |
204 | |
catch (ClassNotFoundException e) |
205 | |
{ |
206 | |
m_CurrentCLD = null; |
207 | |
throw new MetadataException("Class "+classname+" could not be found" |
208 | |
+" in the classpath. This could cause unexpected behaviour of OJB,"+ |
209 | |
" please remove or comment out this class descriptor" + |
210 | |
" in the repository.xml file.", e); |
211 | |
} |
212 | |
|
213 | |
|
214 | |
String schema = atts.getValue(tags.getTagById(SCHEMA_NAME)); |
215 | |
if (schema != null) |
216 | |
{ |
217 | |
if (isDebug) logger.debug(" " + tags.getTagById(SCHEMA_NAME) + ": " + schema); |
218 | |
m_CurrentCLD.setSchema(schema); |
219 | |
} |
220 | |
|
221 | |
|
222 | |
String proxy = atts.getValue(tags.getTagById(CLASS_PROXY)); |
223 | |
if (isDebug) logger.debug(" " + tags.getTagById(CLASS_PROXY) + ": " + proxy); |
224 | |
if (checkString(proxy)) |
225 | |
{ |
226 | |
if (proxy.equalsIgnoreCase(ClassDescriptor.DYNAMIC_STR)) |
227 | |
{ |
228 | |
m_CurrentCLD.setProxyClassName(ClassDescriptor.DYNAMIC_STR); |
229 | |
} |
230 | |
else |
231 | |
{ |
232 | |
m_CurrentCLD.setProxyClassName(proxy); |
233 | |
} |
234 | |
} |
235 | |
|
236 | |
|
237 | |
String proxyPrefetchingLimit = atts.getValue(tags.getTagById(PROXY_PREFETCHING_LIMIT)); |
238 | |
if (isDebug) logger.debug(" " + tags.getTagById(PROXY_PREFETCHING_LIMIT) + ": " + proxyPrefetchingLimit); |
239 | |
if (proxyPrefetchingLimit == null) |
240 | |
{ |
241 | |
m_CurrentCLD.setProxyPrefetchingLimit(defProxyPrefetchingLimit); |
242 | |
} |
243 | |
else |
244 | |
{ |
245 | |
m_CurrentCLD.setProxyPrefetchingLimit(Integer.parseInt(proxyPrefetchingLimit)); |
246 | |
} |
247 | |
|
248 | |
|
249 | |
String table = atts.getValue(tags.getTagById(TABLE_NAME)); |
250 | |
if (isDebug) logger.debug(" " + tags.getTagById(TABLE_NAME) + ": " + table); |
251 | |
m_CurrentCLD.setTableName(table); |
252 | |
if (table == null) |
253 | |
{ |
254 | |
m_CurrentCLD.setIsInterface(true); |
255 | |
} |
256 | |
|
257 | |
|
258 | |
String rowreader = atts.getValue(tags.getTagById(ROW_READER)); |
259 | |
if (isDebug) logger.debug(" " + tags.getTagById(ROW_READER) + ": " + rowreader); |
260 | |
if (rowreader != null) |
261 | |
{ |
262 | |
m_CurrentCLD.setRowReader(rowreader); |
263 | |
} |
264 | |
|
265 | |
|
266 | |
|
267 | |
String extendsAtt = atts.getValue(tags.getTagById(EXTENDS)); |
268 | |
if (isDebug) logger.debug(" " + tags.getTagById(EXTENDS) + ": " + extendsAtt); |
269 | |
if (checkString(extendsAtt)) |
270 | |
{ |
271 | |
m_CurrentCLD.setSuperClass(extendsAtt); |
272 | |
} |
273 | |
|
274 | |
|
275 | |
String acceptLocks = atts.getValue(tags.getTagById(ACCEPT_LOCKS)); |
276 | |
if (acceptLocks==null) |
277 | |
acceptLocks="true"; |
278 | |
logger.debug(" " + tags.getTagById(ACCEPT_LOCKS) + ": " + acceptLocks); |
279 | |
if (isDebug) logger.debug(" " + tags.getTagById(ACCEPT_LOCKS) + ": " + acceptLocks); |
280 | |
boolean b = (Boolean.valueOf(acceptLocks)).booleanValue(); |
281 | |
m_CurrentCLD.setAcceptLocks(b); |
282 | |
|
283 | |
|
284 | |
String initializationMethod = atts.getValue(tags.getTagById(INITIALIZATION_METHOD)); |
285 | |
if (isDebug) logger.debug(" " + tags.getTagById(INITIALIZATION_METHOD) + ": " + initializationMethod); |
286 | |
if (initializationMethod != null) |
287 | |
{ |
288 | |
m_CurrentCLD.setInitializationMethod(initializationMethod); |
289 | |
} |
290 | |
|
291 | |
|
292 | |
String factoryClass = atts.getValue(tags.getTagById(FACTORY_CLASS)); |
293 | |
if (isDebug) |
294 | |
logger.debug(" " + tags.getTagById(FACTORY_CLASS) + ": " + factoryClass); |
295 | |
if (factoryClass != null) |
296 | |
{ |
297 | |
m_CurrentCLD.setFactoryClass(factoryClass); |
298 | |
} |
299 | |
|
300 | |
|
301 | |
String factoryMethod = atts.getValue(tags.getTagById(FACTORY_METHOD)); |
302 | |
if (isDebug) |
303 | |
logger.debug(" " + tags.getTagById(FACTORY_METHOD) + ": " + factoryMethod); |
304 | |
if (factoryMethod != null) |
305 | |
{ |
306 | |
m_CurrentCLD.setFactoryMethod(factoryMethod); |
307 | |
} |
308 | |
|
309 | |
|
310 | |
String refresh = atts.getValue(tags.getTagById(REFRESH)); |
311 | |
if (isDebug) logger.debug(" " + tags.getTagById(REFRESH) + ": " + refresh); |
312 | |
b = (Boolean.valueOf(refresh)).booleanValue(); |
313 | |
m_CurrentCLD.setAlwaysRefresh(b); |
314 | |
|
315 | |
|
316 | |
|
317 | |
String pfClassName = atts.getValue("persistent-field-class"); |
318 | |
if (isDebug) logger.debug(" persistent-field-class: " + pfClassName); |
319 | |
m_CurrentCLD.setPersistentFieldClassName(pfClassName); |
320 | |
|
321 | |
|
322 | |
m_repository.put(classname, m_CurrentCLD); |
323 | |
break; |
324 | |
} |
325 | |
case OBJECT_CACHE: |
326 | |
{ |
327 | |
|
328 | |
|
329 | |
if(m_CurrentCLD != null) |
330 | |
{ |
331 | |
String className = atts.getValue(tags.getTagById(CLASS_NAME)); |
332 | |
if(checkString(className)) |
333 | |
{ |
334 | |
if (isDebug) logger.debug(" > " + tags.getTagById(OBJECT_CACHE)); |
335 | |
ObjectCacheDescriptor ocd = new ObjectCacheDescriptor(); |
336 | |
this.m_CurrentAttrContainer = ocd; |
337 | |
ocd.setObjectCache(ClassHelper.getClass(className)); |
338 | |
if(m_CurrentCLD != null) |
339 | |
{ |
340 | |
m_CurrentCLD.setObjectCacheDescriptor(ocd); |
341 | |
} |
342 | |
if (isDebug) logger.debug(" " + tags.getTagById(CLASS_NAME) + ": " + className); |
343 | |
} |
344 | |
} |
345 | |
break; |
346 | |
} |
347 | |
case CLASS_EXTENT: |
348 | |
{ |
349 | |
String classname = atts.getValue("class-ref"); |
350 | |
if (isDebug) logger.debug(" " + tags.getTagById(CLASS_EXTENT) + ": " + classname); |
351 | |
m_CurrentCLD.addExtentClass(classname); |
352 | |
break; |
353 | |
} |
354 | |
|
355 | |
case FIELD_DESCRIPTOR: |
356 | |
{ |
357 | |
if (isDebug) logger.debug(" > " + tags.getTagById(FIELD_DESCRIPTOR)); |
358 | |
|
359 | |
String strId = atts.getValue(tags.getTagById(ID)); |
360 | |
m_lastId = (strId == null ? m_lastId + 1 : Integer.parseInt(strId)); |
361 | |
|
362 | |
String strAccess = atts.getValue(tags.getTagById(ACCESS)); |
363 | |
|
364 | |
if (RepositoryElements.TAG_ACCESS_ANONYMOUS.equalsIgnoreCase(strAccess)) |
365 | |
{ |
366 | |
m_CurrentFLD = new AnonymousFieldDescriptor(m_CurrentCLD, m_lastId); |
367 | |
} |
368 | |
else |
369 | |
{ |
370 | |
m_CurrentFLD = new FieldDescriptor(m_CurrentCLD, m_lastId); |
371 | |
} |
372 | |
m_CurrentFLD.setAccess(strAccess); |
373 | |
m_CurrentCLD.addFieldDescriptor(m_CurrentFLD); |
374 | |
|
375 | |
|
376 | |
this.m_CurrentAttrContainer = this.m_CurrentFLD; |
377 | |
|
378 | |
String fieldName = atts.getValue(tags.getTagById(FIELD_NAME)); |
379 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_NAME) + ": " + fieldName); |
380 | |
|
381 | |
if (RepositoryElements.TAG_ACCESS_ANONYMOUS.equalsIgnoreCase(strAccess)) |
382 | |
{ |
383 | |
AnonymousFieldDescriptor anonymous = (AnonymousFieldDescriptor) m_CurrentFLD; |
384 | |
anonymous.setPersistentField(null,fieldName); |
385 | |
} |
386 | |
else |
387 | |
{ |
388 | |
String classname = m_CurrentCLD.getClassNameOfObject(); |
389 | |
PersistentField pf = PersistentFieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),ClassHelper.getClass(classname),fieldName); |
390 | |
m_CurrentFLD.setPersistentField(pf); |
391 | |
} |
392 | |
|
393 | |
String columnName = atts.getValue(tags.getTagById(COLUMN_NAME)); |
394 | |
if (isDebug) logger.debug(" " + tags.getTagById(COLUMN_NAME) + ": " + columnName); |
395 | |
m_CurrentFLD.setColumnName(columnName); |
396 | |
|
397 | |
String jdbcType = atts.getValue(tags.getTagById(JDBC_TYPE)); |
398 | |
if (isDebug) logger.debug(" " + tags.getTagById(JDBC_TYPE) + ": " + jdbcType); |
399 | |
m_CurrentFLD.setColumnType(jdbcType); |
400 | |
|
401 | |
String primaryKey = atts.getValue(tags.getTagById(PRIMARY_KEY)); |
402 | |
if (isDebug) logger.debug(" " + tags.getTagById(PRIMARY_KEY) + ": " + primaryKey); |
403 | |
boolean b = (Boolean.valueOf(primaryKey)).booleanValue(); |
404 | |
m_CurrentFLD.setPrimaryKey(b); |
405 | |
|
406 | |
String nullable = atts.getValue(tags.getTagById(NULLABLE)); |
407 | |
if (nullable != null) |
408 | |
{ |
409 | |
if (isDebug) logger.debug(" " + tags.getTagById(NULLABLE) + ": " + nullable); |
410 | |
b = !(Boolean.valueOf(nullable)).booleanValue(); |
411 | |
m_CurrentFLD.setRequired(b); |
412 | |
} |
413 | |
|
414 | |
String indexed = atts.getValue(tags.getTagById(INDEXED)); |
415 | |
if (isDebug) logger.debug(" " + tags.getTagById(INDEXED) + ": " + indexed); |
416 | |
b = (Boolean.valueOf(indexed)).booleanValue(); |
417 | |
m_CurrentFLD.setIndexed(b); |
418 | |
|
419 | |
String autoincrement = atts.getValue(tags.getTagById(AUTO_INCREMENT)); |
420 | |
if (isDebug) logger.debug(" " + tags.getTagById(AUTO_INCREMENT) + ": " + autoincrement); |
421 | |
b = (Boolean.valueOf(autoincrement)).booleanValue(); |
422 | |
m_CurrentFLD.setAutoIncrement(b); |
423 | |
|
424 | |
String sequenceName = atts.getValue(tags.getTagById(SEQUENCE_NAME)); |
425 | |
if (isDebug) logger.debug(" " + tags.getTagById(SEQUENCE_NAME) + ": " + sequenceName); |
426 | |
m_CurrentFLD.setSequenceName(sequenceName); |
427 | |
|
428 | |
String locking = atts.getValue(tags.getTagById(LOCKING)); |
429 | |
if (isDebug) logger.debug(" " + tags.getTagById(LOCKING) + ": " + locking); |
430 | |
b = (Boolean.valueOf(locking)).booleanValue(); |
431 | |
m_CurrentFLD.setLocking(b); |
432 | |
|
433 | |
String updateLock = atts.getValue(tags.getTagById(UPDATE_LOCK)); |
434 | |
if (isDebug) logger.debug(" " + tags.getTagById(UPDATE_LOCK) + ": " + updateLock); |
435 | |
if(checkString(updateLock)) |
436 | |
{ |
437 | |
b = (Boolean.valueOf(updateLock)).booleanValue(); |
438 | |
m_CurrentFLD.setUpdateLock(b); |
439 | |
} |
440 | |
|
441 | |
String fieldConversion = atts.getValue(tags.getTagById(FIELD_CONVERSION)); |
442 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_CONVERSION) + ": " + fieldConversion); |
443 | |
if (fieldConversion != null) |
444 | |
{ |
445 | |
m_CurrentFLD.setFieldConversionClassName(fieldConversion); |
446 | |
} |
447 | |
|
448 | |
|
449 | |
String length = atts.getValue(tags.getTagById(LENGTH)); |
450 | |
if (length != null) |
451 | |
{ |
452 | |
int i = Integer.parseInt(length); |
453 | |
if (isDebug) logger.debug(" " + tags.getTagById(LENGTH) + ": " + i); |
454 | |
m_CurrentFLD.setLength(i); |
455 | |
m_CurrentFLD.setLengthSpecified(true); |
456 | |
} |
457 | |
|
458 | |
|
459 | |
String precision = atts.getValue(tags.getTagById(PRECISION)); |
460 | |
if (precision != null) |
461 | |
{ |
462 | |
int i = Integer.parseInt(precision); |
463 | |
if (isDebug) logger.debug(" " + tags.getTagById(PRECISION) + ": " + i); |
464 | |
m_CurrentFLD.setPrecision(i); |
465 | |
m_CurrentFLD.setPrecisionSpecified(true); |
466 | |
} |
467 | |
|
468 | |
|
469 | |
String scale = atts.getValue(tags.getTagById(SCALE)); |
470 | |
if (scale != null) |
471 | |
{ |
472 | |
int i = Integer.parseInt(scale); |
473 | |
if (isDebug) logger.debug(" " + tags.getTagById(SCALE) + ": " + i); |
474 | |
m_CurrentFLD.setScale(i); |
475 | |
m_CurrentFLD.setScaleSpecified(true); |
476 | |
} |
477 | |
|
478 | |
break; |
479 | |
} |
480 | |
|
481 | |
case REFERENCE_DESCRIPTOR: |
482 | |
{ |
483 | |
if (isDebug) logger.debug(" > " + tags.getTagById(REFERENCE_DESCRIPTOR)); |
484 | |
|
485 | |
name = atts.getValue(tags.getTagById(FIELD_NAME)); |
486 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_NAME) + ": " + name); |
487 | |
|
488 | |
|
489 | |
String classRef = atts.getValue(tags.getTagById(REFERENCED_CLASS)); |
490 | |
if (isDebug) logger.debug(" " + tags.getTagById(REFERENCED_CLASS) + ": " + classRef); |
491 | |
|
492 | |
ObjectReferenceDescriptor ord; |
493 | |
if (name.equals(TAG_SUPER)) |
494 | |
{ |
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
ord = new SuperReferenceDescriptor(m_CurrentCLD); |
503 | |
} |
504 | |
else |
505 | |
{ |
506 | |
ord = new ObjectReferenceDescriptor(m_CurrentCLD); |
507 | |
PersistentField pf = PersistentFieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),m_CurrentCLD.getClassOfObject(),name); |
508 | |
ord.setPersistentField(pf); |
509 | |
} |
510 | |
m_CurrentORD = ord; |
511 | |
|
512 | |
|
513 | |
m_CurrentCLD.addObjectReferenceDescriptor(m_CurrentORD); |
514 | |
m_CurrentORD.setItemClass(ClassHelper.getClass(classRef)); |
515 | |
|
516 | |
|
517 | |
this.m_CurrentAttrContainer = m_CurrentORD; |
518 | |
|
519 | |
|
520 | |
String proxy = atts.getValue(tags.getTagById(PROXY_REFERENCE)); |
521 | |
if (isDebug) logger.debug(" " + tags.getTagById(PROXY_REFERENCE) + ": " + proxy); |
522 | |
boolean b = (Boolean.valueOf(proxy)).booleanValue(); |
523 | |
m_CurrentORD.setLazy(b); |
524 | |
|
525 | |
|
526 | |
String proxyPrefetchingLimit = atts.getValue(tags.getTagById(PROXY_PREFETCHING_LIMIT)); |
527 | |
if (isDebug) logger.debug(" " + tags.getTagById(PROXY_PREFETCHING_LIMIT) + ": " + proxyPrefetchingLimit); |
528 | |
if (proxyPrefetchingLimit == null) |
529 | |
{ |
530 | |
m_CurrentORD.setProxyPrefetchingLimit(defProxyPrefetchingLimit); |
531 | |
} |
532 | |
else |
533 | |
{ |
534 | |
m_CurrentORD.setProxyPrefetchingLimit(Integer.parseInt(proxyPrefetchingLimit)); |
535 | |
} |
536 | |
|
537 | |
|
538 | |
String refresh = atts.getValue(tags.getTagById(REFRESH)); |
539 | |
if (isDebug) logger.debug(" " + tags.getTagById(REFRESH) + ": " + refresh); |
540 | |
b = (Boolean.valueOf(refresh)).booleanValue(); |
541 | |
m_CurrentORD.setRefresh(b); |
542 | |
|
543 | |
|
544 | |
String autoRetrieve = atts.getValue(tags.getTagById(AUTO_RETRIEVE)); |
545 | |
if (isDebug) logger.debug(" " + tags.getTagById(AUTO_RETRIEVE) + ": " + autoRetrieve); |
546 | |
b = (Boolean.valueOf(autoRetrieve)).booleanValue(); |
547 | |
m_CurrentORD.setCascadeRetrieve(b); |
548 | |
|
549 | |
|
550 | |
String autoUpdate = atts.getValue(tags.getTagById(AUTO_UPDATE)); |
551 | |
if (isDebug) logger.debug(" " + tags.getTagById(AUTO_UPDATE) + ": " + autoUpdate); |
552 | |
if(autoUpdate != null) |
553 | |
{ |
554 | |
m_CurrentORD.setCascadingStore(autoUpdate); |
555 | |
} |
556 | |
|
557 | |
|
558 | |
String autoDelete = atts.getValue(tags.getTagById(AUTO_DELETE)); |
559 | |
if (isDebug) logger.debug(" " + tags.getTagById(AUTO_DELETE) + ": " + autoDelete); |
560 | |
|
561 | |
if(autoDelete != null) |
562 | |
{ |
563 | |
m_CurrentORD.setCascadingDelete(autoDelete); |
564 | |
} |
565 | |
|
566 | |
|
567 | |
String otmDependent = atts.getValue(tags.getTagById(OTM_DEPENDENT)); |
568 | |
if (isDebug) logger.debug(" " + tags.getTagById(OTM_DEPENDENT) + ": " + otmDependent); |
569 | |
b = (Boolean.valueOf(otmDependent)).booleanValue(); |
570 | |
m_CurrentORD.setOtmDependent(b); |
571 | |
|
572 | |
break; |
573 | |
} |
574 | |
|
575 | |
case FOREIGN_KEY: |
576 | |
{ |
577 | |
if (isDebug) logger.debug(" > " + tags.getTagById(FOREIGN_KEY)); |
578 | |
String fieldIdRef = atts.getValue(tags.getTagById(FIELD_ID_REF)); |
579 | |
|
580 | |
if (fieldIdRef != null) |
581 | |
{ |
582 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_ID_REF) + ": " + fieldIdRef); |
583 | |
|
584 | |
try |
585 | |
{ |
586 | |
int fieldId; |
587 | |
fieldId = Integer.parseInt(fieldIdRef); |
588 | |
m_CurrentORD.addForeignKeyField(fieldId); |
589 | |
} |
590 | |
catch (NumberFormatException rex) |
591 | |
{ |
592 | |
throw new MetadataException(tags.getTagById(FIELD_ID_REF) |
593 | |
+ " attribute must be an int. Found: " |
594 | |
+ fieldIdRef + ". Please check your repository file.", rex); |
595 | |
} |
596 | |
} |
597 | |
else |
598 | |
{ |
599 | |
String fieldRef = atts.getValue(tags.getTagById(FIELD_REF)); |
600 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_REF) + ": " + fieldRef); |
601 | |
m_CurrentORD.addForeignKeyField(fieldRef); |
602 | |
} |
603 | |
break; |
604 | |
} |
605 | |
|
606 | |
case COLLECTION_DESCRIPTOR: |
607 | |
{ |
608 | |
if (isDebug) logger.debug(" > " + tags.getTagById(COLLECTION_DESCRIPTOR)); |
609 | |
m_CurrentCOD = new CollectionDescriptor(m_CurrentCLD); |
610 | |
|
611 | |
|
612 | |
|
613 | |
this.m_CurrentAttrContainer = m_CurrentCOD; |
614 | |
|
615 | |
|
616 | |
name = atts.getValue(tags.getTagById(FIELD_NAME)); |
617 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_NAME) + ": " + name); |
618 | |
PersistentField pf = PersistentFieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),m_CurrentCLD.getClassOfObject(),name); |
619 | |
m_CurrentCOD.setPersistentField(pf); |
620 | |
|
621 | |
|
622 | |
String collectionClassName = atts.getValue(tags.getTagById(COLLECTION_CLASS)); |
623 | |
if (collectionClassName != null) |
624 | |
{ |
625 | |
if (isDebug) logger.debug(" " + tags.getTagById(COLLECTION_CLASS) + ": " + collectionClassName); |
626 | |
m_CurrentCOD.setCollectionClass(ClassHelper.getClass(collectionClassName)); |
627 | |
} |
628 | |
|
629 | |
String elementClassRef = atts.getValue(tags.getTagById(ITEMS_CLASS)); |
630 | |
if (isDebug) logger.debug(" " + tags.getTagById(ITEMS_CLASS) + ": " + elementClassRef); |
631 | |
if (elementClassRef != null) |
632 | |
{ |
633 | |
m_CurrentCOD.setItemClass(ClassHelper.getClass(elementClassRef)); |
634 | |
} |
635 | |
|
636 | |
|
637 | |
String orderby = atts.getValue(tags.getTagById(ORDERBY)); |
638 | |
String sort = atts.getValue(tags.getTagById(SORT)); |
639 | |
if (isDebug) logger.debug(" " + tags.getTagById(SORT) + ": " + orderby + ", " + sort); |
640 | |
if (orderby != null) |
641 | |
{ |
642 | |
m_CurrentCOD.addOrderBy(orderby, "ASC".equalsIgnoreCase(sort)); |
643 | |
} |
644 | |
|
645 | |
|
646 | |
String indirectionTable = atts.getValue(tags.getTagById(INDIRECTION_TABLE)); |
647 | |
if (isDebug) logger.debug(" " + tags.getTagById(INDIRECTION_TABLE) + ": " + indirectionTable); |
648 | |
m_CurrentCOD.setIndirectionTable(indirectionTable); |
649 | |
|
650 | |
|
651 | |
String proxy = atts.getValue(tags.getTagById(PROXY_REFERENCE)); |
652 | |
if (isDebug) logger.debug(" " + tags.getTagById(PROXY_REFERENCE) + ": " + proxy); |
653 | |
boolean b = (Boolean.valueOf(proxy)).booleanValue(); |
654 | |
m_CurrentCOD.setLazy(b); |
655 | |
|
656 | |
|
657 | |
String proxyPrefetchingLimit = atts.getValue(tags.getTagById(PROXY_PREFETCHING_LIMIT)); |
658 | |
if (isDebug) logger.debug(" " + tags.getTagById(PROXY_PREFETCHING_LIMIT) + ": " + proxyPrefetchingLimit); |
659 | |
if (proxyPrefetchingLimit == null) |
660 | |
{ |
661 | |
m_CurrentCOD.setProxyPrefetchingLimit(defProxyPrefetchingLimit); |
662 | |
} |
663 | |
else |
664 | |
{ |
665 | |
m_CurrentCOD.setProxyPrefetchingLimit(Integer.parseInt(proxyPrefetchingLimit)); |
666 | |
} |
667 | |
|
668 | |
|
669 | |
String refresh = atts.getValue(tags.getTagById(REFRESH)); |
670 | |
if (isDebug) logger.debug(" " + tags.getTagById(REFRESH) + ": " + refresh); |
671 | |
b = (Boolean.valueOf(refresh)).booleanValue(); |
672 | |
m_CurrentCOD.setRefresh(b); |
673 | |
|
674 | |
|
675 | |
String autoRetrieve = atts.getValue(tags.getTagById(AUTO_RETRIEVE)); |
676 | |
if (isDebug) logger.debug(" " + tags.getTagById(AUTO_RETRIEVE) + ": " + autoRetrieve); |
677 | |
b = (Boolean.valueOf(autoRetrieve)).booleanValue(); |
678 | |
m_CurrentCOD.setCascadeRetrieve(b); |
679 | |
|
680 | |
|
681 | |
String autoUpdate = atts.getValue(tags.getTagById(AUTO_UPDATE)); |
682 | |
if (isDebug) logger.debug(" " + tags.getTagById(AUTO_UPDATE) + ": " + autoUpdate); |
683 | |
if(autoUpdate != null) |
684 | |
{ |
685 | |
m_CurrentCOD.setCascadingStore(autoUpdate); |
686 | |
} |
687 | |
|
688 | |
|
689 | |
String autoDelete = atts.getValue(tags.getTagById(AUTO_DELETE)); |
690 | |
if (isDebug) logger.debug(" " + tags.getTagById(AUTO_DELETE) + ": " + autoDelete); |
691 | |
if(autoDelete != null) |
692 | |
{ |
693 | |
m_CurrentCOD.setCascadingDelete(autoDelete); |
694 | |
} |
695 | |
|
696 | |
|
697 | |
String otmDependent = atts.getValue(tags.getTagById(OTM_DEPENDENT)); |
698 | |
if (isDebug) logger.debug(" " + tags.getTagById(OTM_DEPENDENT) + ": " + otmDependent); |
699 | |
b = (Boolean.valueOf(otmDependent)).booleanValue(); |
700 | |
m_CurrentCOD.setOtmDependent(b); |
701 | |
|
702 | |
m_CurrentCLD.addCollectionDescriptor(m_CurrentCOD); |
703 | |
|
704 | |
break; |
705 | |
} |
706 | |
case ORDERBY : |
707 | |
{ |
708 | |
if (isDebug) logger.debug(" > " + tags.getTagById(ORDERBY)); |
709 | |
name = atts.getValue(tags.getTagById(FIELD_NAME)); |
710 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_NAME) + ": " + name); |
711 | |
String sort = atts.getValue(tags.getTagById(SORT)); |
712 | |
if (isDebug) logger.debug(" " + tags.getTagById(SORT) + ": " + name + ", " + sort); |
713 | |
|
714 | |
m_CurrentCOD.addOrderBy(name, "ASC".equalsIgnoreCase(sort)); |
715 | |
break; |
716 | |
} |
717 | |
case INVERSE_FK: |
718 | |
{ |
719 | |
if (isDebug) logger.debug(" > " + tags.getTagById(INVERSE_FK)); |
720 | |
String fieldIdRef = atts.getValue(tags.getTagById(FIELD_ID_REF)); |
721 | |
|
722 | |
if (fieldIdRef != null) |
723 | |
{ |
724 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_ID_REF) + ": " + fieldIdRef); |
725 | |
|
726 | |
try |
727 | |
{ |
728 | |
int fieldId; |
729 | |
fieldId = Integer.parseInt(fieldIdRef); |
730 | |
m_CurrentCOD.addForeignKeyField(fieldId); |
731 | |
} |
732 | |
catch (NumberFormatException rex) |
733 | |
{ |
734 | |
throw new MetadataException(tags.getTagById(FIELD_ID_REF) |
735 | |
+ " attribute must be an int. Found: " |
736 | |
+ fieldIdRef + " Please check your repository file.", rex); |
737 | |
} |
738 | |
} |
739 | |
else |
740 | |
{ |
741 | |
String fieldRef = atts.getValue(tags.getTagById(FIELD_REF)); |
742 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_REF) + ": " + fieldRef); |
743 | |
m_CurrentCOD.addForeignKeyField(fieldRef); |
744 | |
} |
745 | |
break; |
746 | |
} |
747 | |
|
748 | |
case FK_POINTING_TO_THIS_CLASS: |
749 | |
{ |
750 | |
if (isDebug) logger.debug(" > " + tags.getTagById(FK_POINTING_TO_THIS_CLASS)); |
751 | |
String column = atts.getValue("column"); |
752 | |
if (isDebug) logger.debug(" " + "column" + ": " + column); |
753 | |
m_CurrentCOD.addFkToThisClass(column); |
754 | |
break; |
755 | |
} |
756 | |
|
757 | |
case FK_POINTING_TO_ITEMS_CLASS: |
758 | |
{ |
759 | |
if (isDebug) logger.debug(" > " + tags.getTagById(FK_POINTING_TO_ITEMS_CLASS)); |
760 | |
String column = atts.getValue("column"); |
761 | |
if (isDebug) logger.debug(" " + "column" + ": " + column); |
762 | |
m_CurrentCOD.addFkToItemClass(column); |
763 | |
break; |
764 | |
} |
765 | |
case ATTRIBUTE: |
766 | |
{ |
767 | |
|
768 | |
String attributeName = atts.getValue(tags.getTagById(ATTRIBUTE_NAME)); |
769 | |
String attributeValue = atts.getValue(tags.getTagById(ATTRIBUTE_VALUE)); |
770 | |
|
771 | |
if (this.m_CurrentAttrContainer != null) |
772 | |
{ |
773 | |
if (isDebug) logger.debug(" > " + tags.getTagById(ATTRIBUTE)); |
774 | |
if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_NAME) + ": " + attributeName); |
775 | |
if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_VALUE) + ": " + attributeValue); |
776 | |
this.m_CurrentAttrContainer.addAttribute(attributeName, attributeValue); |
777 | |
} |
778 | |
else |
779 | |
{ |
780 | |
|
781 | |
|
782 | |
} |
783 | |
break; |
784 | |
} |
785 | |
|
786 | |
|
787 | |
|
788 | |
|
789 | |
|
790 | |
|
791 | |
|
792 | |
|
793 | |
|
794 | |
case QUERY_CUSTOMIZER: |
795 | |
{ |
796 | |
|
797 | |
String className = atts.getValue("class"); |
798 | |
QueryCustomizer queryCust; |
799 | |
|
800 | |
if (className != null) |
801 | |
{ |
802 | |
if (isDebug) logger.debug(" " + "class" + ": " + className); |
803 | |
queryCust = (QueryCustomizer)ClassHelper.newInstance(className); |
804 | |
m_CurrentAttrContainer = queryCust; |
805 | |
m_CurrentCOD.setQueryCustomizer(queryCust); |
806 | |
} |
807 | |
break; |
808 | |
} |
809 | |
case INDEX_DESCRIPTOR: |
810 | |
{ |
811 | |
m_CurrentIndexDescriptor = new IndexDescriptor(); |
812 | |
m_CurrentIndexDescriptor.setName(atts.getValue(tags.getTagById(NAME))); |
813 | |
m_CurrentIndexDescriptor.setUnique(Boolean.valueOf(atts.getValue(tags.getTagById(UNIQUE))).booleanValue()); |
814 | |
break; |
815 | |
} |
816 | |
case INDEX_COLUMN: |
817 | |
{ |
818 | |
m_CurrentIndexDescriptor.getIndexColumns().add(atts.getValue(tags.getTagById(NAME))); |
819 | |
break; |
820 | |
} |
821 | |
case INSERT_PROCEDURE: |
822 | |
{ |
823 | |
if (isDebug) logger.debug(" > " + tags.getTagById(INSERT_PROCEDURE)); |
824 | |
|
825 | |
|
826 | |
String procName = atts.getValue(tags.getTagById(NAME)); |
827 | |
String includeAllFields = atts.getValue(tags.getTagById(INCLUDE_ALL_FIELDS)); |
828 | |
if (isDebug) logger.debug(" " + tags.getTagById(NAME) + |
829 | |
": " + procName); |
830 | |
if (isDebug) logger.debug(" " + tags.getTagById(INCLUDE_ALL_FIELDS) + |
831 | |
": " + includeAllFields); |
832 | |
|
833 | |
|
834 | |
InsertProcedureDescriptor proc = |
835 | |
new InsertProcedureDescriptor(m_CurrentCLD, |
836 | |
procName, |
837 | |
Boolean.valueOf(includeAllFields).booleanValue()); |
838 | |
m_CurrentProcedure = proc; |
839 | |
|
840 | |
|
841 | |
|
842 | |
String returnFieldRefName = atts.getValue(tags.getTagById(RETURN_FIELD_REF)); |
843 | |
if (isDebug) logger.debug(" " + tags.getTagById(RETURN_FIELD_REF) + |
844 | |
": " + returnFieldRefName); |
845 | |
proc.setReturnValueFieldRef(returnFieldRefName); |
846 | |
|
847 | |
break; |
848 | |
} |
849 | |
case UPDATE_PROCEDURE: |
850 | |
{ |
851 | |
if (isDebug) logger.debug(" > " + tags.getTagById(UPDATE_PROCEDURE)); |
852 | |
|
853 | |
|
854 | |
String procName = atts.getValue(tags.getTagById(NAME)); |
855 | |
String includeAllFields = atts.getValue(tags.getTagById(INCLUDE_ALL_FIELDS)); |
856 | |
if (isDebug) logger.debug(" " + tags.getTagById(NAME) + |
857 | |
": " + procName); |
858 | |
if (isDebug) logger.debug(" " + tags.getTagById(INCLUDE_ALL_FIELDS) + |
859 | |
": " + includeAllFields); |
860 | |
|
861 | |
|
862 | |
UpdateProcedureDescriptor proc = |
863 | |
new UpdateProcedureDescriptor(m_CurrentCLD, |
864 | |
procName, |
865 | |
Boolean.valueOf(includeAllFields).booleanValue()); |
866 | |
m_CurrentProcedure = proc; |
867 | |
|
868 | |
|
869 | |
|
870 | |
String returnFieldRefName = atts.getValue(tags.getTagById(RETURN_FIELD_REF)); |
871 | |
if (isDebug) logger.debug(" " + tags.getTagById(RETURN_FIELD_REF) + |
872 | |
": " + returnFieldRefName); |
873 | |
proc.setReturnValueFieldRef(returnFieldRefName); |
874 | |
|
875 | |
break; |
876 | |
} |
877 | |
case DELETE_PROCEDURE: |
878 | |
{ |
879 | |
if (isDebug) logger.debug(" > " + tags.getTagById(DELETE_PROCEDURE)); |
880 | |
|
881 | |
|
882 | |
String procName = atts.getValue(tags.getTagById(NAME)); |
883 | |
String includeAllPkFields = atts.getValue(tags.getTagById(INCLUDE_PK_FIELDS_ONLY)); |
884 | |
if (isDebug) logger.debug(" " + tags.getTagById(NAME) + |
885 | |
": " + procName); |
886 | |
if (isDebug) logger.debug(" " + tags.getTagById(INCLUDE_PK_FIELDS_ONLY) + |
887 | |
": " + includeAllPkFields); |
888 | |
|
889 | |
|
890 | |
DeleteProcedureDescriptor proc = |
891 | |
new DeleteProcedureDescriptor(m_CurrentCLD, |
892 | |
procName, |
893 | |
Boolean.valueOf(includeAllPkFields).booleanValue()); |
894 | |
m_CurrentProcedure = proc; |
895 | |
|
896 | |
|
897 | |
|
898 | |
String returnFieldRefName = atts.getValue(tags.getTagById(RETURN_FIELD_REF)); |
899 | |
if (isDebug) logger.debug(" " + tags.getTagById(RETURN_FIELD_REF) + |
900 | |
": " + returnFieldRefName); |
901 | |
proc.setReturnValueFieldRef(returnFieldRefName); |
902 | |
|
903 | |
break; |
904 | |
|
905 | |
} |
906 | |
case CONSTANT_ARGUMENT: |
907 | |
{ |
908 | |
if (isDebug) logger.debug(" > " + tags.getTagById(CONSTANT_ARGUMENT)); |
909 | |
ArgumentDescriptor arg = new ArgumentDescriptor(m_CurrentProcedure); |
910 | |
|
911 | |
|
912 | |
String value = atts.getValue(tags.getTagById(VALUE)); |
913 | |
if (isDebug) logger.debug(" " + tags.getTagById(VALUE) + ": " + value); |
914 | |
|
915 | |
|
916 | |
arg.setValue(value); |
917 | |
|
918 | |
|
919 | |
m_CurrentProcedure.addArgument(arg); |
920 | |
break; |
921 | |
} |
922 | |
case RUNTIME_ARGUMENT: |
923 | |
{ |
924 | |
if (isDebug) logger.debug(" > " + tags.getTagById(RUNTIME_ARGUMENT)); |
925 | |
ArgumentDescriptor arg = new ArgumentDescriptor(m_CurrentProcedure); |
926 | |
|
927 | |
|
928 | |
String fieldRefName = atts.getValue(tags.getTagById(FIELD_REF)); |
929 | |
if (isDebug) logger.debug(" " + tags.getTagById(FIELD_REF) + |
930 | |
": " + fieldRefName); |
931 | |
|
932 | |
|
933 | |
String returnValue = atts.getValue(tags.getTagById(RETURN)); |
934 | |
if (isDebug) logger.debug(" " + tags.getTagById(RETURN) + |
935 | |
": " + returnValue); |
936 | |
|
937 | |
|
938 | |
if ((fieldRefName != null) && (fieldRefName.trim().length() != 0)) { |
939 | |
arg.setValue(fieldRefName, |
940 | |
Boolean.valueOf(returnValue).booleanValue()); |
941 | |
} |
942 | |
|
943 | |
|
944 | |
m_CurrentProcedure.addArgument(arg); |
945 | |
break; |
946 | |
} |
947 | |
|
948 | |
default : |
949 | |
{ |
950 | |
|
951 | |
} |
952 | |
} |
953 | |
} |
954 | |
catch (Exception ex) |
955 | |
{ |
956 | |
logger.error("Exception while read metadata", ex); |
957 | |
if(ex instanceof MetadataException) throw (MetadataException)ex; |
958 | |
else throw new MetadataException("Exception when reading metadata information,"+ |
959 | |
" please check your repository.xml file", ex); |
960 | |
} |
961 | |
} |
962 | |
|
963 | |
|
964 | |
|
965 | |
|
966 | |
public void endElement(String uri, String name, String qName) |
967 | |
{ |
968 | |
boolean isDebug = logger.isDebugEnabled(); |
969 | |
try |
970 | |
{ |
971 | |
switch (getLiteralId(qName)) |
972 | |
{ |
973 | |
case MAPPING_REPOSITORY: |
974 | |
{ |
975 | |
if (isDebug) logger.debug(" < " + tags.getTagById(MAPPING_REPOSITORY)); |
976 | |
this.m_CurrentAttrContainer = null; |
977 | |
m_CurrentCLD = null; |
978 | |
break; |
979 | |
} |
980 | |
case CLASS_DESCRIPTOR: |
981 | |
{ |
982 | |
if (isDebug) logger.debug(" < " + tags.getTagById(CLASS_DESCRIPTOR)); |
983 | |
m_CurrentCLD = null; |
984 | |
this.m_CurrentAttrContainer = null; |
985 | |
break; |
986 | |
} |
987 | |
case OBJECT_CACHE: |
988 | |
{ |
989 | |
if(m_CurrentAttrContainer != null) |
990 | |
{ |
991 | |
if (isDebug) logger.debug(" < " + tags.getTagById(OBJECT_CACHE)); |
992 | |
} |
993 | |
this.m_CurrentAttrContainer = m_CurrentCLD; |
994 | |
break; |
995 | |
} |
996 | |
case CLASS_EXTENT: |
997 | |
{ |
998 | |
break; |
999 | |
} |
1000 | |
case FIELD_DESCRIPTOR: |
1001 | |
{ |
1002 | |
if (isDebug) logger.debug(" < " + tags.getTagById(FIELD_DESCRIPTOR)); |
1003 | |
m_CurrentFLD = null; |
1004 | |
m_CurrentAttrContainer = m_CurrentCLD; |
1005 | |
break; |
1006 | |
} |
1007 | |
case REFERENCE_DESCRIPTOR: |
1008 | |
{ |
1009 | |
if (isDebug) logger.debug(" < " + tags.getTagById(REFERENCE_DESCRIPTOR)); |
1010 | |
m_CurrentORD = null; |
1011 | |
m_CurrentAttrContainer = m_CurrentCLD; |
1012 | |
break; |
1013 | |
} |
1014 | |
case FOREIGN_KEY: |
1015 | |
{ |
1016 | |
if (isDebug) logger.debug(" < " + tags.getTagById(FOREIGN_KEY)); |
1017 | |
break; |
1018 | |
} |
1019 | |
case COLLECTION_DESCRIPTOR: |
1020 | |
{ |
1021 | |
if (isDebug) logger.debug(" < " + tags.getTagById(COLLECTION_DESCRIPTOR)); |
1022 | |
m_CurrentCOD = null; |
1023 | |
m_CurrentAttrContainer = m_CurrentCLD; |
1024 | |
break; |
1025 | |
} |
1026 | |
case INVERSE_FK: |
1027 | |
{ |
1028 | |
if (isDebug) logger.debug(" < " + tags.getTagById(INVERSE_FK)); |
1029 | |
break; |
1030 | |
} |
1031 | |
case ORDERBY : |
1032 | |
{ |
1033 | |
if (isDebug) logger.debug(" < " + tags.getTagById(ORDERBY)); |
1034 | |
break; |
1035 | |
} |
1036 | |
case FK_POINTING_TO_THIS_CLASS: |
1037 | |
{ |
1038 | |
if (isDebug) logger.debug(" < " + tags.getTagById(FK_POINTING_TO_THIS_CLASS)); |
1039 | |
break; |
1040 | |
} |
1041 | |
case FK_POINTING_TO_ITEMS_CLASS: |
1042 | |
{ |
1043 | |
if (isDebug) logger.debug(" < " + tags.getTagById(FK_POINTING_TO_ITEMS_CLASS)); |
1044 | |
break; |
1045 | |
} |
1046 | |
case ATTRIBUTE: |
1047 | |
{ |
1048 | |
if(m_CurrentAttrContainer != null) |
1049 | |
{ |
1050 | |
if (isDebug) logger.debug(" < " + tags.getTagById(ATTRIBUTE)); |
1051 | |
} |
1052 | |
break; |
1053 | |
} |
1054 | |
case DOCUMENTATION: |
1055 | |
{ |
1056 | |
if (isDebug) logger.debug(" < " + tags.getTagById(DOCUMENTATION)); |
1057 | |
break; |
1058 | |
} |
1059 | |
|
1060 | |
|
1061 | |
|
1062 | |
|
1063 | |
|
1064 | |
|
1065 | |
|
1066 | |
|
1067 | |
|
1068 | |
|
1069 | |
|
1070 | |
|
1071 | |
|
1072 | |
|
1073 | |
|
1074 | |
|
1075 | |
|
1076 | |
|
1077 | |
|
1078 | |
|
1079 | |
|
1080 | |
case QUERY_CUSTOMIZER: |
1081 | |
{ |
1082 | |
m_CurrentAttrContainer = m_CurrentCOD; |
1083 | |
break; |
1084 | |
} |
1085 | |
case INDEX_DESCRIPTOR: |
1086 | |
{ |
1087 | |
m_CurrentCLD.getIndexes().add(m_CurrentIndexDescriptor); |
1088 | |
m_CurrentIndexDescriptor = null; |
1089 | |
break; |
1090 | |
} |
1091 | |
case INDEX_COLUMN: |
1092 | |
{ |
1093 | |
|
1094 | |
break; |
1095 | |
} |
1096 | |
case INSERT_PROCEDURE: |
1097 | |
{ |
1098 | |
if (isDebug) logger.debug(" < " + tags.getTagById(INSERT_PROCEDURE)); |
1099 | |
m_CurrentCLD.setInsertProcedure((InsertProcedureDescriptor)m_CurrentProcedure); |
1100 | |
m_CurrentProcedure = null; |
1101 | |
break; |
1102 | |
} |
1103 | |
case UPDATE_PROCEDURE: |
1104 | |
{ |
1105 | |
if (isDebug) logger.debug(" < " + tags.getTagById(UPDATE_PROCEDURE)); |
1106 | |
m_CurrentCLD.setUpdateProcedure((UpdateProcedureDescriptor)m_CurrentProcedure); |
1107 | |
m_CurrentProcedure = null; |
1108 | |
break; |
1109 | |
} |
1110 | |
case DELETE_PROCEDURE: |
1111 | |
{ |
1112 | |
if (isDebug) logger.debug(" < " + tags.getTagById(DELETE_PROCEDURE)); |
1113 | |
m_CurrentCLD.setDeleteProcedure((DeleteProcedureDescriptor)m_CurrentProcedure); |
1114 | |
m_CurrentProcedure = null; |
1115 | |
break; |
1116 | |
} |
1117 | |
case CONSTANT_ARGUMENT: |
1118 | |
{ |
1119 | |
if (isDebug) logger.debug(" < " + tags.getTagById(CONSTANT_ARGUMENT)); |
1120 | |
break; |
1121 | |
} |
1122 | |
case RUNTIME_ARGUMENT: |
1123 | |
{ |
1124 | |
if (isDebug) logger.debug(" < " + tags.getTagById(RUNTIME_ARGUMENT)); |
1125 | |
break; |
1126 | |
} |
1127 | |
|
1128 | |
|
1129 | |
default : |
1130 | |
{ |
1131 | |
logger.debug("Ignoring unused Element " + qName); |
1132 | |
} |
1133 | |
} |
1134 | |
} |
1135 | |
catch (Exception ex) |
1136 | |
{ |
1137 | |
if(ex instanceof MetadataException) throw (MetadataException) ex; |
1138 | |
else throw new MetadataException("Exception when reading metadata information,"+ |
1139 | |
" please check your repository.xml file", ex); |
1140 | |
} |
1141 | |
} |
1142 | |
|
1143 | |
|
1144 | |
|
1145 | |
|
1146 | |
public void characters(char ch[], int start, int length) |
1147 | |
{ |
1148 | |
if (m_CurrentString == null) |
1149 | |
m_CurrentString = new String(ch, start, length); |
1150 | |
else |
1151 | |
m_CurrentString += new String(ch, start, length); |
1152 | |
} |
1153 | |
|
1154 | |
|
1155 | |
|
1156 | |
|
1157 | |
public void error(SAXParseException e) throws SAXException |
1158 | |
{ |
1159 | |
logger.error(e); |
1160 | |
throw e; |
1161 | |
} |
1162 | |
|
1163 | |
|
1164 | |
|
1165 | |
|
1166 | |
public void fatalError(SAXParseException e) throws SAXException |
1167 | |
{ |
1168 | |
logger.fatal(e); |
1169 | |
throw e; |
1170 | |
} |
1171 | |
|
1172 | |
|
1173 | |
|
1174 | |
|
1175 | |
public void warning(SAXParseException e) throws SAXException |
1176 | |
{ |
1177 | |
logger.warn(e); |
1178 | |
throw e; |
1179 | |
} |
1180 | |
|
1181 | |
|
1182 | |
|
1183 | |
private boolean checkString(String str) |
1184 | |
{ |
1185 | |
return (str != null && !str.trim().equals("")); |
1186 | |
} |
1187 | |
} |