Statistics
| Revision:

svn-gvsig-desktop / tmp / trunk / servidor / WorkSpace_Servidor / ows-parsers / src / org / tigris / frogs / parsers / ows / Analyse.java @ 26481

History | View | Annotate | Download (22.4 KB)

1 26481 kike
package org.tigris.frogs.parsers.ows;
2
3
import org.tigris.frogs.commons.*;
4
import org.tigris.frogs.ows.reportexception.*;
5
import java.util.List;
6
import java.util.ListIterator;
7
8
public class Analyse {
9
10
        public static String OWS_VERSION_0_3_0 = "0.3.0";
11
        public static String OWS_VERSION_0_3_20 = "0.3.20";
12
        public static String OWS_VERSION_1_0_0 = "1.0.0";
13
        public static String OWS_VERSION_1_1_0 = "1.1.0";
14
        public static String OWS_DEFAULT_VERSION = OWS_VERSION_0_3_20;
15
16
17
         /**
18
          * Get the default
19
          *
20
          * @return String
21
          */
22
        public static String getDefault() {
23
                return OWS_DEFAULT_VERSION;
24
        }
25
26
         /**
27
          * Get the default
28
          *
29
          * @return String
30
          */
31
        public static String getAllSupported() {
32
                return "[" + OWS_VERSION_0_3_0 + "," + OWS_VERSION_0_3_20 + "," + OWS_VERSION_1_0_0 + "," + OWS_VERSION_1_1_0 + "]";
33
        }
34
35
         /**
36
          * Generate a OWS PackageName corresponding to the OWS Implemetation asked.
37
          * Usually use to be serialized
38
          *
39
          * @param listError
40
          * @param otherLinkedException
41
          * @param exceptionCode
42
          * @param exceptionText
43
          * @param language
44
          * @param locator
45
          * @param owsVersion (default 0.3.20)
46
          * @return net.opengeospatial.ows.ExceptionReport
47
          *
48
          */
49
        public static Object
50
                                        generateExceptionReport(
51
                                                        org.tigris.frogs.OWSException owsReport,
52
                                                        String owsVersion) {
53
54
                // Take the default 0.3.20
55
                if ( Utils.isEmptyString(owsVersion) ) owsVersion =  new String(OWS_DEFAULT_VERSION);
56
                // Take the default 0.3.20 is not supported
57
                if ( ! isOwsVersionSupported(owsVersion) ) owsVersion =  new String(OWS_DEFAULT_VERSION);
58
59
                // Add all message found and non-duplicated
60
                String[] messageList = DocumentErrors.generateExceptionReport(owsReport.getDocumentErrors(),null,owsReport.getMessage(),owsReport.getLanguage());
61
62
                if ( owsVersion.equalsIgnoreCase(OWS_VERSION_1_1_0) ) {
63
64
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
65
                        net.schema.ows.impl1_1_0.ExceptionReport owsError1_1_0 =
66
                                new net.schema.ows.impl1_1_0.ExceptionReport();
67
68
                        // SetUp Language and Version
69
                        owsError1_1_0.setVersion(OWS_VERSION_1_1_0);
70
                        if ( Language.isValid(owsReport.getLanguage()) ) {
71
                                owsError1_1_0.setLanguage(owsReport.getLanguage().toUpperCase());
72
                        }
73
                        else {
74
                                owsError1_1_0.setLanguage( Language.getDefaultCode() );
75
                        }
76
77
                        // Add one Exception Code and Text
78
                        owsError1_1_0.getException().add(new net.schema.ows.impl1_1_0.ExceptionType());
79
                        net.schema.ows.impl1_1_0.ExceptionType owsException =
80
                                (net.schema.ows.impl1_1_0.ExceptionType)owsError1_1_0.getException().get(0);
81
                        if ( ! Utils.isEmptyString(owsReport.getCodeError()) ) {
82
                                owsException.setExceptionCode(normalizeName(owsReport.getCodeError()));
83
                        }
84
85
                        if ( ! Utils.isEmptyString(owsReport.getLocator()) ) {
86
                                owsException.setLocator(normalizeName(owsReport.getLocator()));
87
                        }
88
89
                        if ( messageList != null ) {
90
                                for (int index=0; index<messageList.length; index++) {
91
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
92
                                }
93
                        }
94
                        return owsError1_1_0;
95
                }
96
97
                else if ( owsVersion.equalsIgnoreCase(OWS_VERSION_1_0_0) ) {
98
99
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
100
                        net.schema.ows.impl1_0_0.ExceptionReport owsError1_0_0 =
101
                                new net.schema.ows.impl1_0_0.ExceptionReport();
102
103
                        // SetUp Language and Version
104
                        owsError1_0_0.setVersion(OWS_VERSION_1_0_0);
105
                        if ( Language.isValid(owsReport.getLanguage()) ) {
106
                                owsError1_0_0.setLanguage(owsReport.getLanguage().toUpperCase());
107
                        }
108
                        else {
109
                                owsError1_0_0.setLanguage( Language.getDefaultCode() );
110
                        }
111
112
                        // Add one Exception Code and Text
113
                        owsError1_0_0.getException().add(new net.schema.ows.impl1_0_0.ExceptionType());
114
                        net.schema.ows.impl1_0_0.ExceptionType owsException =
115
                                (net.schema.ows.impl1_0_0.ExceptionType)owsError1_0_0.getException().get(0);
116
                        if ( ! Utils.isEmptyString(owsReport.getCodeError()) ) {
117
                                owsException.setExceptionCode(normalizeName(owsReport.getCodeError()));
118
                        }
119
120
                        if ( ! Utils.isEmptyString(owsReport.getLocator()) ) {
121
                                owsException.setLocator(normalizeName(owsReport.getLocator()));
122
                        }
123
124
                        // Add all message found and non-duplicated
125
                        if ( messageList != null ) {
126
                                for (int index=0; index<messageList.length; index++) {
127
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
128
                                }
129
                        }
130
                        return owsError1_0_0;
131
                }
132
133
                else if ( owsVersion.equalsIgnoreCase(OWS_VERSION_0_3_0) ) {
134
135
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
136
                        net.schema.ows.impl0_3_0.ExceptionReport owsError0_3_0 =
137
                                new net.schema.ows.impl0_3_0.ExceptionReport();
138
139
                        // SetUp Language and Version
140
                        owsError0_3_0.setVersion(OWS_VERSION_0_3_0);
141
                        if ( Language.isValid(owsReport.getLanguage()) ) {
142
                                owsError0_3_0.setLanguage(owsReport.getLanguage().toUpperCase());
143
                        }
144
                        else {
145
                                owsError0_3_0.setLanguage( Language.getDefaultCode() );
146
                        }
147
148
                        // Add one Exception Code and Text
149
                        owsError0_3_0.getException().add(new net.schema.ows.impl0_3_0.ExceptionType());
150
                        net.schema.ows.impl0_3_0.ExceptionType owsException =
151
                                (net.schema.ows.impl0_3_0.ExceptionType)owsError0_3_0.getException().get(0);
152
                        if ( ! Utils.isEmptyString(owsReport.getCodeError()) ) {
153
                                owsException.setExceptionCode(normalizeName(owsReport.getCodeError()));
154
                        }
155
156
                        if ( ! Utils.isEmptyString(owsReport.getLocator()) ) {
157
                                owsException.setLocator(normalizeName(owsReport.getLocator()));
158
                        }
159
160
                        // Add all message found and non-duplicated
161
                        if ( messageList != null ) {
162
                                for (int index=0; index<messageList.length; index++) {
163
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
164
                                }
165
                        }
166
                        return owsError0_3_0;
167
                }
168
                else { // Default behavior
169
170
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
171
                        net.schema.ows.impl0_3_20.ExceptionReport owsError0_3_20 =
172
                                new net.schema.ows.impl0_3_20.ExceptionReport();
173
174
                        // SetUp Language and Version
175
                        owsError0_3_20.setVersion(OWS_VERSION_0_3_20);
176
                        if ( Language.isValid(owsReport.getLanguage()) ) {
177
                                owsError0_3_20.setLanguage(owsReport.getLanguage().toUpperCase());
178
                        }
179
                        else {
180
                                owsError0_3_20.setLanguage( Language.getDefaultCode() );
181
                        }
182
183
                        // Add one Exception Code and Text
184
                        owsError0_3_20.getException().add(new net.schema.ows.impl0_3_20.ExceptionType());
185
                        net.schema.ows.impl0_3_20.ExceptionType owsException =
186
                                (net.schema.ows.impl0_3_20.ExceptionType)owsError0_3_20.getException().get(0);
187
                        if ( ! Utils.isEmptyString(owsReport.getCodeError()) ) {
188
                                owsException.setExceptionCode(normalizeName(owsReport.getCodeError()));
189
                        }
190
191
                        if ( ! Utils.isEmptyString(owsReport.getLocator()) ) {
192
                                owsException.setLocator(normalizeName(owsReport.getLocator()));
193
                        }
194
195
                        // Add all message found and non-duplicated
196
                        if ( messageList != null ) {
197
                                for (int index=0; index<messageList.length; index++) {
198
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
199
                                }
200
                        }
201
                        return owsError0_3_20;
202
                }
203
204
        }
205
206
207
         /**
208
          * Generate a OWS PackageName corresponding to the OWS Implemetation asked.
209
          * Usually use to be serialized
210
          *
211
          * @param listError
212
          * @param otherLinkedException
213
          * @param exceptionCode
214
          * @param exceptionText
215
          * @param language
216
          * @param locator
217
          * @param owsVersion (default 0.3.20)
218
          * @return net.opengeospatial.ows.ExceptionReport
219
          *
220
          */
221
        public static Object
222
                                        generateExceptionReport(
223
                                                        org.tigris.frogs.ows.reportexception.DocumentErrors listError,
224
                                                        Throwable otherLinkedException,
225
                                                        String exceptionCode,
226
                                                        String exceptionText,
227
                                                        String language,
228
                                                        String locator,
229
                                                        String owsVersion) {
230
231
                // Take the default 0.3.20
232
                if ( Utils.isEmptyString(owsVersion) ) owsVersion =  new String(OWS_DEFAULT_VERSION);
233
                // Take the default 0.3.20 is not supported
234
                if ( ! isOwsVersionSupported(owsVersion) ) owsVersion =  new String(OWS_DEFAULT_VERSION);
235
236
                // Add all message found and non-duplicated
237
                String[] messageList = DocumentErrors.generateExceptionReport(listError,otherLinkedException,exceptionText,language);
238
239
                if ( owsVersion.equalsIgnoreCase(OWS_VERSION_1_1_0) ) {
240
241
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
242
                        net.schema.ows.impl1_1_0.ExceptionReport owsError1_1_0 =
243
                                new net.schema.ows.impl1_1_0.ExceptionReport();
244
245
                        // SetUp Language and Version
246
                        owsError1_1_0.setVersion(OWS_VERSION_1_1_0);
247
                        if ( Language.isValid(language) ) {
248
                                owsError1_1_0.setLanguage(language.toUpperCase());
249
                        }
250
                        else {
251
                                owsError1_1_0.setLanguage( Language.getDefaultCode() );
252
                        }
253
254
                        // Add one Exception Code and Text
255
                        owsError1_1_0.getException().add(new net.schema.ows.impl1_1_0.ExceptionType());
256
                        net.schema.ows.impl1_1_0.ExceptionType owsException =
257
                                (net.schema.ows.impl1_1_0.ExceptionType)owsError1_1_0.getException().get(0);
258
                        if ( exceptionCode != null ) {
259
                                owsException.setExceptionCode(normalizeName(exceptionCode));
260
                        }
261
262
                        if (locator != null) {
263
                                owsException.setLocator(normalizeName(locator));
264
                        }
265
266
                        if ( messageList != null ) {
267
                                for (int index=0; index<messageList.length; index++) {
268
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
269
                                }
270
                        }
271
                        return owsError1_1_0;
272
                }
273
274
                else if ( owsVersion.equalsIgnoreCase(OWS_VERSION_1_0_0) ) {
275
276
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
277
                        net.schema.ows.impl1_0_0.ExceptionReport owsError1_0_0 =
278
                                new net.schema.ows.impl1_0_0.ExceptionReport();
279
280
                        // SetUp Language and Version
281
                        owsError1_0_0.setVersion(OWS_VERSION_1_0_0);
282
                        if ( Language.isValid(language) ) {
283
                                owsError1_0_0.setLanguage(language.toUpperCase());
284
                        }
285
                        else {
286
                                owsError1_0_0.setLanguage( Language.getDefaultCode() );
287
                        }
288
289
                        // Add one Exception Code and Text
290
                        owsError1_0_0.getException().add(new net.schema.ows.impl1_0_0.ExceptionType());
291
                        net.schema.ows.impl1_0_0.ExceptionType owsException =
292
                                (net.schema.ows.impl1_0_0.ExceptionType)owsError1_0_0.getException().get(0);
293
                        if ( exceptionCode != null ) {
294
                                owsException.setExceptionCode(normalizeName(exceptionCode));
295
                        }
296
297
                        if (locator != null) {
298
                                owsException.setLocator(normalizeName(locator));
299
                        }
300
301
                        // Add all message found and non-duplicated
302
                        if ( messageList != null ) {
303
                                for (int index=0; index<messageList.length; index++) {
304
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
305
                                }
306
                        }
307
                        return owsError1_0_0;
308
                }
309
310
                else if ( owsVersion.equalsIgnoreCase(OWS_VERSION_0_3_0) ) {
311
312
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
313
                        net.schema.ows.impl0_3_0.ExceptionReport owsError0_3_0 =
314
                                new net.schema.ows.impl0_3_0.ExceptionReport();
315
316
                        // SetUp Language and Version
317
                        owsError0_3_0.setVersion(OWS_VERSION_0_3_0);
318
                        if ( Language.isValid(language) ) {
319
                                owsError0_3_0.setLanguage(language.toUpperCase());
320
                        }
321
                        else {
322
                                owsError0_3_0.setLanguage( Language.getDefaultCode() );
323
                        }
324
325
                        // Add one Exception Code and Text
326
                        owsError0_3_0.getException().add(new net.schema.ows.impl0_3_0.ExceptionType());
327
                        net.schema.ows.impl0_3_0.ExceptionType owsException =
328
                                (net.schema.ows.impl0_3_0.ExceptionType)owsError0_3_0.getException().get(0);
329
                        if ( exceptionCode != null ) {
330
                                owsException.setExceptionCode(normalizeName(exceptionCode));
331
                        }
332
333
                        if (locator != null) {
334
                                owsException.setLocator(normalizeName(locator));
335
                        }
336
337
                        // Add all message found and non-duplicated
338
                        if ( messageList != null ) {
339
                                for (int index=0; index<messageList.length; index++) {
340
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
341
                                }
342
                        }
343
                        return owsError0_3_0;
344
                }
345
                else { // Default behavior
346
347
                        // create the class ExceptionReport based on the schema definition owsExceptionReport
348
                        net.schema.ows.impl0_3_20.ExceptionReport owsError0_3_20 =
349
                                new net.schema.ows.impl0_3_20.ExceptionReport();
350
351
                        // SetUp Language and Version
352
                        owsError0_3_20.setVersion(OWS_VERSION_0_3_20);
353
                        if ( Language.isValid(language) ) {
354
                                owsError0_3_20.setLanguage(language.toUpperCase());
355
                        }
356
                        else {
357
                                owsError0_3_20.setLanguage( Language.getDefaultCode() );
358
                        }
359
360
                        // Add one Exception Code and Text
361
                        owsError0_3_20.getException().add(new net.schema.ows.impl0_3_20.ExceptionType());
362
                        net.schema.ows.impl0_3_20.ExceptionType owsException =
363
                                (net.schema.ows.impl0_3_20.ExceptionType)owsError0_3_20.getException().get(0);
364
                        if ( exceptionCode != null ) {
365
                                owsException.setExceptionCode(normalizeName(exceptionCode));
366
                        }
367
368
                        if (locator != null) {
369
                                owsException.setLocator(normalizeName(locator));
370
                        }
371
372
                        // Add all message found and non-duplicated
373
                        if ( messageList != null ) {
374
                                for (int index=0; index<messageList.length; index++) {
375
                                        Utils.insertNonDuplicateMessage(owsException.getExceptionText(),normalizeText(messageList[index]));
376
                                }
377
                        }
378
                        return owsError0_3_20;
379
                }
380
381
        }
382
383
         /**
384
          * Create FROGS OWS Exception Handle for all OWS Exception Report supported
385
          *
386
          * @param jaxb
387
          * @return org.tigris.frogs.OWSException
388
          */
389
        public static org.tigris.frogs.OWSException createExceptionReport(Object jaxb) {
390
                org.tigris.frogs.OWSException owsReport = null;
391
392
                if ( isVersion1_0_0(jaxb) ) {
393
                        owsReport = new org.tigris.frogs.OWSException();
394
395
                        net.schema.ows.impl1_0_0.ExceptionReport errorReport =
396
                                (net.schema.ows.impl1_0_0.ExceptionReport)jaxb;
397
398
                        if ( Language.isValid(errorReport.getLanguage()) ) {
399
                                owsReport.setLanguage(errorReport.getLanguage());
400
                        }
401
                        else {
402
                                owsReport.setLanguage(Language.getDefaultCode());
403
                        }
404
405
                ListIterator listErrors = errorReport.getException().listIterator();
406
                while (listErrors.hasNext()) {
407
                        net.schema.ows.impl1_0_0.ExceptionType error =
408
                                (net.schema.ows.impl1_0_0.ExceptionType)listErrors.next();
409
410
                        // Only set once this detail
411
                        if ( Utils.isEmptyString(owsReport.getLocator()) )
412
                                owsReport.setLocator(error.getLocator());
413
414
                        // Only set once this detail
415
                        if ( Utils.isEmptyString(owsReport.getCodeError()) )
416
                                owsReport.setCodeError(error.getExceptionCode());
417
418
                        // Append all text
419
                        String fullMessage = org.tigris.frogs.commons.Convert.arrayToString( error.getExceptionText(), "", "", "", "," );
420
                        if ( Utils.isEmptyString(owsReport.getMessage()) ){
421
                                owsReport.setMessage( fullMessage );
422
                        }
423
                        else {
424
                                owsReport.setMessage(owsReport.getMessage() + "\n" + fullMessage );
425
                        }
426
                }
427
428
                }
429
                else if ( isVersion1_1_0(jaxb) ) {
430
                        owsReport = new org.tigris.frogs.OWSException();
431
432
                        net.schema.ows.impl1_1_0.ExceptionReport errorReport =
433
                                (net.schema.ows.impl1_1_0.ExceptionReport)jaxb;
434
435
                        if ( Language.isValid(errorReport.getLanguage()) ) {
436
                                owsReport.setLanguage(errorReport.getLanguage());
437
                        }
438
                        else {
439
                                owsReport.setLanguage(Language.getDefaultCode());
440
                        }
441
442
                ListIterator listErrors = errorReport.getException().listIterator();
443
                while (listErrors.hasNext()) {
444
                        net.schema.ows.impl1_1_0.ExceptionType error =
445
                                (net.schema.ows.impl1_1_0.ExceptionType)listErrors.next();
446
447
                        // Only set once this detail
448
                        if ( Utils.isEmptyString(owsReport.getLocator()) )
449
                                owsReport.setLocator(error.getLocator());
450
451
                        // Only set once this detail
452
                        if ( Utils.isEmptyString(owsReport.getCodeError()) )
453
                                owsReport.setCodeError(error.getExceptionCode());
454
455
                        // Append all text
456
                        String fullMessage = org.tigris.frogs.commons.Convert.arrayToString( error.getExceptionText(), "", "", "", "," );
457
                        if ( Utils.isEmptyString(owsReport.getMessage()) ){
458
                                owsReport.setMessage( fullMessage );
459
                        }
460
                        else {
461
                                owsReport.setMessage(owsReport.getMessage() + "\n" + fullMessage );
462
                        }
463
                }
464
465
                }
466
                else if ( isVersion0_3_20(jaxb) ) {
467
                        owsReport = new org.tigris.frogs.OWSException();
468
469
                        net.schema.ows.impl0_3_20.ExceptionReport errorReport =
470
                                (net.schema.ows.impl0_3_20.ExceptionReport)jaxb;
471
472
                        if ( Language.isValid(errorReport.getLanguage()) ) {
473
                                owsReport.setLanguage(errorReport.getLanguage());
474
                        }
475
                        else {
476
                                owsReport.setLanguage(Language.getDefaultCode());
477
                        }
478
479
                ListIterator listErrors = errorReport.getException().listIterator();
480
                while (listErrors.hasNext()) {
481
                        net.schema.ows.impl0_3_20.ExceptionType error =
482
                                (net.schema.ows.impl0_3_20.ExceptionType)listErrors.next();
483
484
                        // Only set once this detail
485
                        if ( Utils.isEmptyString(owsReport.getLocator()) )
486
                                owsReport.setLocator(error.getLocator());
487
488
                        // Only set once this detail
489
                        if ( Utils.isEmptyString(owsReport.getCodeError()) )
490
                                owsReport.setCodeError(error.getExceptionCode());
491
492
                        // Append all text
493
                        String fullMessage = org.tigris.frogs.commons.Convert.arrayToString( error.getExceptionText(), "", "", "", "," );
494
                        if ( Utils.isEmptyString(owsReport.getMessage()) ){
495
                                owsReport.setMessage( fullMessage );
496
                        }
497
                        else {
498
                                owsReport.setMessage(owsReport.getMessage() + "\n" + fullMessage );
499
                        }
500
                }
501
                }
502
                else if ( isVersion0_3_0(jaxb) ) {
503
                        owsReport = new org.tigris.frogs.OWSException();
504
505
                        net.schema.ows.impl0_3_0.ExceptionReport errorReport =
506
                                (net.schema.ows.impl0_3_0.ExceptionReport)jaxb;
507
508
                        if ( Language.isValid(errorReport.getLanguage()) ) {
509
                                owsReport.setLanguage(errorReport.getLanguage());
510
                        }
511
                        else {
512
                                owsReport.setLanguage(Language.getDefaultCode());
513
                        }
514
515
                ListIterator listErrors = errorReport.getException().listIterator();
516
                while (listErrors.hasNext()) {
517
                        net.schema.ows.impl0_3_0.ExceptionType error =
518
                                (net.schema.ows.impl0_3_0.ExceptionType)listErrors.next();
519
520
                        // Only set once this detail
521
                        if ( Utils.isEmptyString(owsReport.getLocator()) )
522
                                owsReport.setLocator(error.getLocator());
523
524
                        // Only set once this detail
525
                        if ( Utils.isEmptyString(owsReport.getCodeError()) )
526
                                owsReport.setCodeError(error.getExceptionCode());
527
528
                        // Append all text
529
                        String fullMessage = org.tigris.frogs.commons.Convert.arrayToString( error.getExceptionText(), "", "", "", "," );
530
                        if ( Utils.isEmptyString(owsReport.getMessage()) ){
531
                                owsReport.setMessage( fullMessage );
532
                        }
533
                        else {
534
                                owsReport.setMessage(owsReport.getMessage() + "\n" + fullMessage );
535
                        }
536
                }
537
                }
538
539
                return owsReport;
540
541
        }
542
543
         /**
544
          * Is it simply OWS Exception Report?
545
          *
546
          * @param jaxb
547
          * @return boolean
548
          */
549
        public static boolean isOwsVersionSupported(String version) {
550
551
                if ( ! Utils.isEmptyString(version) ) {
552
                        if ( version.equalsIgnoreCase(OWS_VERSION_0_3_0) ||
553
                                 version.equalsIgnoreCase(OWS_VERSION_0_3_20) ||
554
                                 version.equalsIgnoreCase(OWS_VERSION_1_0_0) ||
555
                                 version.equalsIgnoreCase(OWS_VERSION_1_1_0) ) return true;
556
                }
557
558
                return false;
559
        }
560
561
         /**
562
          * Is it simply OWS Exception Report?
563
          *
564
          * @param jaxb
565
          * @return boolean
566
          */
567
        public static boolean isAnExceptionReport(Object jaxb) {
568
                if ( isVersion0_3_0(jaxb) ||
569
                     isVersion0_3_20(jaxb) ||
570
                     isVersion1_0_0(jaxb) ||
571
                     isVersion1_1_0(jaxb) ) return true;
572
573
                return false;
574
        }
575
576
         /**
577
          * Get the version of the OWS Exception Report
578
          *
579
          * @param jaxb
580
          * @return boolean
581
          */
582
        public static String getVersion(Object jaxb) {
583
                if ( isVersion0_3_0(jaxb) ) return OWS_VERSION_0_3_0;
584
                if ( isVersion0_3_20(jaxb) ) return OWS_VERSION_0_3_20;
585
                if ( isVersion1_0_0(jaxb) ) return OWS_VERSION_1_0_0;
586
                if ( isVersion1_1_0(jaxb) ) return OWS_VERSION_1_1_0;
587
588
                return "";
589
        }
590
591
         /**
592
          * Is it a OWS Exception Report 0.3.0?
593
          *
594
          * @param jaxb
595
          * @return boolean
596
          */
597
        public static boolean isVersion0_3_0(Object jaxb) {
598
                return ( isJAXBObjectImpl( jaxb, net.schema.ows.impl0_3_0.ExceptionReport.class.getName() ) );
599
        }
600
601
         /**
602
          * Is it a OWS Exception Report 0.3.20?
603
          *
604
          * @param jaxb
605
          * @return boolean
606
          */
607
        public static boolean isVersion0_3_20(Object jaxb) {
608
                return ( isJAXBObjectImpl( jaxb, net.schema.ows.impl0_3_20.ExceptionReport.class.getName() ) );
609
        }
610
611
         /**
612
          * Is it a OWS Exception Report 1.0.0?
613
          *
614
          * @param jaxb
615
          * @return boolean
616
          */
617
        public static boolean isVersion1_0_0(Object jaxb) {
618
                return ( isJAXBObjectImpl( jaxb, net.schema.ows.impl1_0_0.ExceptionReport.class.getName() ) );
619
        }
620
621
         /**
622
          * Is it a OWS Exception Report 1.1.0?
623
          *
624
          * @param jaxb
625
          * @return boolean
626
          */
627
        public static boolean isVersion1_1_0(Object jaxb) {
628
                return ( isJAXBObjectImpl( jaxb, net.schema.ows.impl1_1_0.ExceptionReport.class.getName() ) );
629
        }
630
631
    /**
632
     * To be documented
633
     *
634
     * @param jaxb
635
     * @param className
636
     * @return boolean
637
     *
638
     */
639
   private static boolean isJAXBObjectImpl(Object jaxb, String className) {
640
           boolean isOk = false;
641
642
           if ( jaxb != null && ! Utils.isEmptyString(className) ) {
643
                   isOk = jaxb.getClass().getName().equals( className);
644
           }
645
646
           return (isOk);
647
   }
648
649
   /**
650
    * Standidize element name with <> and remove them
651
    *
652
    * @param name
653
    * @return String
654
    *
655
    */
656
   public static String normalizeName(String name) {
657
                   name = normalizeText(name);
658
                   name = name.replaceAll("<","");
659
                return name.replaceAll(">","");
660
   }
661
662
   /**
663
    * Standidize test, no zero binary allowed
664
    *
665
    * @param text
666
    * @return String
667
    *
668
    */
669
   public static String normalizeText(String text) {
670
                   return text.replace((char)0,' ');
671
   }
672
673
}