Source Code Cross Referenced for EJBQLException.java in  » Database-ORM » toplink » oracle » toplink » essentials » exceptions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » toplink » oracle.toplink.essentials.exceptions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         * 
004:         * // Copyright (c) 1998, 2007, Oracle. All rights reserved.
005:         * 
006:         *
007:         * The contents of this file are subject to the terms of either the GNU
008:         * General Public License Version 2 only ("GPL") or the Common Development
009:         * and Distribution License("CDDL") (collectively, the "License").  You
010:         * may not use this file except in compliance with the License. You can obtain
011:         * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
012:         * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
013:         * language governing permissions and limitations under the License.
014:         * 
015:         * When distributing the software, include this License Header Notice in each
016:         * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
017:         * Sun designates this particular file as subject to the "Classpath" exception
018:         * as provided by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code.  If applicable, add the following below the License
020:         * Header, with the fields enclosed by brackets [] replaced by your own
021:         * identifying information: "Portions Copyrighted [year]
022:         * [name of copyright owner]"
023:         * 
024:         * Contributor(s):
025:         * 
026:         * If you wish your version of this file to be governed by only the CDDL or
027:         * only the GPL Version 2, indicate your decision by adding "[Contributor]
028:         * elects to include this software in this distribution under the [CDDL or GPL
029:         * Version 2] license."  If you don't indicate a single choice of license, a
030:         * recipient has the option to distribute your version of this file under
031:         * either the CDDL, the GPL Version 2 or to extend the choice of license to
032:         * its licensees as provided above.  However, if you add GPL Version 2 code
033:         * and therefore, elected the GPL Version 2 license, then the option applies
034:         * only if the new code is made subject to such option by the copyright
035:         * holder.
036:         */
037:        package oracle.toplink.essentials.exceptions;
038:
039:        import java.util.*;
040:        import oracle.toplink.essentials.exceptions.i18n.*;
041:
042:        /**
043:         * <P><B>Purpose</B>: EJBQL parsing and resolution problems will raise this exception
044:         */
045:        public class EJBQLException extends TopLinkException {
046:            public static final int recognitionException = 8001;
047:            public static final int generalParsingException = 8002;
048:            public static final int classNotFoundException = 8003;
049:            public static final int aliasResolutionException = 8004;
050:            public static final int resolutionClassNotFoundException = 8005;
051:            public static final int missingDescriptorException = 8006;
052:            public static final int missingMappingException = 8007;
053:            public static final int invalidContextKeyException = 8008;
054:            public static final int expressionNotSupported = 8009;
055:            public static final int generalParsingException2 = 8010;
056:            public static final int invalidCollectionMemberDecl = 8011;
057:            public static final int notYetImplemented = 8012;
058:            public static final int constructorClassNotFound = 8013;
059:            public static final int invalidSizeArgument = 8014;
060:            public static final int invalidEnumLiteral = 8015;
061:            public static final int invalidSelectForGroupByQuery = 8016;
062:            public static final int invalidHavingExpression = 8017;
063:            public static final int invalidMultipleUseOfSameParameter = 8018;
064:            public static final int multipleVariableDeclaration = 8019;
065:            public static final int invalidFunctionArgument = 8020;
066:            public static final int expectedOrderableOrderByItem = 8021;
067:            public static final int invalidExpressionArgument = 8022;
068:            public static final int syntaxError = 8023;
069:            public static final int syntaxErrorAt = 8024;
070:            public static final int unexpectedToken = 8025;
071:            public static final int unexpectedChar = 8026;
072:            public static final int expectedCharFound = 8027;
073:            public static final int unexpectedEOF = 8028;
074:            public static final int invalidNavigation = 8029;
075:            public static final int unknownAttribute = 8030;
076:            public static final int unsupportJoinArgument = 8031;
077:            public static final int invalidSetClauseTarget = 8032;
078:            public static final int invalidSetClauseNavigation = 8033;
079:            public static final int unknownAbstractSchemaType = 8034;
080:            public static final int invalidEnumEqualExpression = 8035;
081:            public static final int invalidCollectionNavigation = 8036;
082:            public static final int unknownAbstractSchemaType2 = 8037;
083:            public static final int resolutionClassNotFoundException2 = 8038;
084:            public Collection internalExceptions = null;
085:
086:            /**
087:             * INTERNAL
088:             * Only TopLink can throw and create these excpetions
089:             */
090:            protected EJBQLException() {
091:                super ();
092:            }
093:
094:            /**
095:             * INTERNAL
096:             * Only TopLink can throw and create these excpetions
097:             */
098:            protected EJBQLException(String theMessage) {
099:                super (theMessage);
100:            }
101:
102:            /**
103:             * INTERNAL
104:             * Only TopLink can throw and create these excpetions
105:             */
106:            protected EJBQLException(String message, Exception internalException) {
107:                super (message, internalException);
108:            }
109:
110:            /**
111:             * INTERNAL
112:             * Only TopLink can throw and create these excpetions
113:             */
114:            protected EJBQLException(String message,
115:                    Exception internalException, int theErrorCode) {
116:                this (message, internalException);
117:                this .setErrorCode(theErrorCode);
118:            }
119:
120:            /**
121:             * INTERNAL
122:             * Create an exception to wrap the recognition exception thrown
123:             */
124:            public static EJBQLException recognitionException(String theEjbql,
125:                    String theMessage) {
126:                Object[] args = { theEjbql, theMessage };
127:
128:                String message = ExceptionMessageGenerator.buildMessage(
129:                        EJBQLException.class, recognitionException, args);
130:                EJBQLException exception = new EJBQLException(message);
131:                exception.setErrorCode(recognitionException);
132:                return exception;
133:            }
134:
135:            /**
136:             * INTERNAL
137:             * Create an exception to wrap a general parsing exception
138:             */
139:            public static EJBQLException generalParsingException(
140:                    String theEjbql, Exception theException) {
141:                Object[] args = { theEjbql, theException.getMessage() };
142:
143:                String message = ExceptionMessageGenerator.buildMessage(
144:                        EJBQLException.class, generalParsingException, args);
145:                EJBQLException exception = new EJBQLException(message,
146:                        theException, generalParsingException);
147:                exception.setErrorCode(generalParsingException);
148:                return exception;
149:            }
150:
151:            /**
152:             * INTERNAL
153:             * Create an exception to wrap a general parsing exception
154:             */
155:            public static EJBQLException generalParsingException(String theEjbql) {
156:                Object[] args = { theEjbql };
157:
158:                String message = ExceptionMessageGenerator.buildMessage(
159:                        EJBQLException.class, generalParsingException2, args);
160:                EJBQLException exception = new EJBQLException(message);
161:                exception.setErrorCode(generalParsingException);
162:                return exception;
163:            }
164:
165:            public static EJBQLException classNotFoundException(
166:                    String theClassName, String theMessage,
167:                    Exception theException) {
168:                Object[] args = { theClassName, theMessage };
169:
170:                String message = ExceptionMessageGenerator.buildMessage(
171:                        EJBQLException.class, classNotFoundException, args);
172:                EJBQLException exception = new EJBQLException(message,
173:                        theException, classNotFoundException);
174:                exception.setErrorCode(classNotFoundException);
175:                return exception;
176:            }
177:
178:            public static EJBQLException resolutionClassNotFoundException(
179:                    String query, String theClassName) {
180:                Object[] args = { query, theClassName };
181:
182:                String message = ExceptionMessageGenerator.buildMessage(
183:                        EJBQLException.class, resolutionClassNotFoundException,
184:                        args);
185:                EJBQLException exception = new EJBQLException(message);
186:                exception.setErrorCode(resolutionClassNotFoundException);
187:                return exception;
188:            }
189:
190:            public static EJBQLException resolutionClassNotFoundException2(
191:                    String query, int line, int column, String theClassName) {
192:                Object[] args = { query, line, column, theClassName };
193:
194:                String message = ExceptionMessageGenerator.buildMessage(
195:                        EJBQLException.class,
196:                        resolutionClassNotFoundException2, args);
197:                EJBQLException exception = new EJBQLException(message);
198:                exception.setErrorCode(resolutionClassNotFoundException2);
199:                return exception;
200:            }
201:
202:            public static EJBQLException missingDescriptorException(
203:                    String query, String theClassName) {
204:                Object[] args = { query, theClassName };
205:
206:                String message = ExceptionMessageGenerator.buildMessage(
207:                        EJBQLException.class, missingDescriptorException, args);
208:                EJBQLException exception = new EJBQLException(message);
209:                exception.setErrorCode(missingDescriptorException);
210:
211:                return exception;
212:            }
213:
214:            public static EJBQLException missingMappingException(String query,
215:                    String theAttributeName) {
216:                Object[] args = { query, theAttributeName };
217:
218:                String message = ExceptionMessageGenerator.buildMessage(
219:                        EJBQLException.class, missingMappingException, args);
220:                EJBQLException exception = new EJBQLException(message);
221:                exception.setErrorCode(missingMappingException);
222:
223:                return exception;
224:            }
225:
226:            public static EJBQLException aliasResolutionException(String query,
227:                    int line, int column, String theAlias) {
228:                Object[] args = { query, line, column, theAlias };
229:
230:                String message = ExceptionMessageGenerator.buildMessage(
231:                        EJBQLException.class, aliasResolutionException, args);
232:                EJBQLException exception = new EJBQLException(message);
233:                exception.setErrorCode(aliasResolutionException);
234:                return exception;
235:            }
236:
237:            public static EJBQLException invalidContextKeyException(
238:                    String query, String theKey) {
239:                Object[] args = { query, theKey };
240:
241:                String message = ExceptionMessageGenerator.buildMessage(
242:                        EJBQLException.class, invalidContextKeyException, args);
243:                EJBQLException exception = new EJBQLException(message);
244:                exception.setErrorCode(invalidContextKeyException);
245:                return exception;
246:            }
247:
248:            public static EJBQLException expressionNotSupported(String query,
249:                    String unsupportedExpression) {
250:                Object[] args = { query, unsupportedExpression };
251:
252:                String message = ExceptionMessageGenerator.buildMessage(
253:                        EJBQLException.class, expressionNotSupported, args);
254:                EJBQLException exception = new EJBQLException(message);
255:                exception.setErrorCode(expressionNotSupported);
256:                return exception;
257:            }
258:
259:            public static EJBQLException invalidCollectionMemberDecl(
260:                    String query, int line, int column, String attributeName) {
261:                Object[] args = { query, line, column, attributeName };
262:
263:                String message = ExceptionMessageGenerator
264:                        .buildMessage(EJBQLException.class,
265:                                invalidCollectionMemberDecl, args);
266:                EJBQLException exception = new EJBQLException(message);
267:                exception.setErrorCode(invalidCollectionMemberDecl);
268:                return exception;
269:            }
270:
271:            public static EJBQLException notYetImplemented(String query,
272:                    String detail) {
273:                Object[] args = { query, detail };
274:
275:                String message = ExceptionMessageGenerator.buildMessage(
276:                        EJBQLException.class, notYetImplemented, args);
277:                EJBQLException exception = new EJBQLException(message);
278:                exception.setErrorCode(notYetImplemented);
279:                return exception;
280:            }
281:
282:            public static EJBQLException constructorClassNotFound(String query,
283:                    int line, int column, String className) {
284:                Object[] args = { query, line, column, className };
285:
286:                String message = ExceptionMessageGenerator.buildMessage(
287:                        EJBQLException.class, constructorClassNotFound, args);
288:                EJBQLException exception = new EJBQLException(message);
289:                exception.setErrorCode(constructorClassNotFound);
290:                return exception;
291:            }
292:
293:            public static EJBQLException invalidSizeArgument(String query,
294:                    int line, int column, String attributeName) {
295:                Object[] args = { query, line, column, attributeName };
296:
297:                String message = ExceptionMessageGenerator.buildMessage(
298:                        EJBQLException.class, invalidSizeArgument, args);
299:                EJBQLException exception = new EJBQLException(message);
300:                exception.setErrorCode(invalidSizeArgument);
301:                return exception;
302:            }
303:
304:            public static EJBQLException invalidEnumLiteral(String query,
305:                    int line, int column, String enumType, String literal) {
306:                Object[] args = { query, line, column, enumType, literal };
307:
308:                String message = ExceptionMessageGenerator.buildMessage(
309:                        EJBQLException.class, invalidEnumLiteral, args);
310:                EJBQLException exception = new EJBQLException(message);
311:                exception.setErrorCode(invalidEnumLiteral);
312:                return exception;
313:            }
314:
315:            public static EJBQLException invalidSelectForGroupByQuery(
316:                    String query, int line, int column, String select,
317:                    String groupBy) {
318:                Object[] args = { query, line, column, select, groupBy };
319:
320:                String message = ExceptionMessageGenerator.buildMessage(
321:                        EJBQLException.class, invalidSelectForGroupByQuery,
322:                        args);
323:                EJBQLException exception = new EJBQLException(message);
324:                exception.setErrorCode(invalidSelectForGroupByQuery);
325:                return exception;
326:            }
327:
328:            public static EJBQLException invalidHavingExpression(String query,
329:                    int line, int column, String having, String groupBy) {
330:                Object[] args = { query, line, column, having, groupBy };
331:
332:                String message = ExceptionMessageGenerator.buildMessage(
333:                        EJBQLException.class, invalidHavingExpression, args);
334:                EJBQLException exception = new EJBQLException(message);
335:                exception.setErrorCode(invalidHavingExpression);
336:                return exception;
337:            }
338:
339:            public static EJBQLException invalidMultipleUseOfSameParameter(
340:                    String query, int line, int column, String parameter,
341:                    String oldType, String newType) {
342:                Object[] args = { query, line, column, parameter, oldType,
343:                        newType };
344:
345:                String message = ExceptionMessageGenerator.buildMessage(
346:                        EJBQLException.class,
347:                        invalidMultipleUseOfSameParameter, args);
348:                EJBQLException exception = new EJBQLException(message);
349:                exception.setErrorCode(invalidMultipleUseOfSameParameter);
350:                return exception;
351:            }
352:
353:            public static EJBQLException multipleVariableDeclaration(
354:                    String query, int line, int column, String variable,
355:                    String oldDecl) {
356:                Object[] args = { query, line, column, variable, oldDecl };
357:
358:                String message = ExceptionMessageGenerator
359:                        .buildMessage(EJBQLException.class,
360:                                multipleVariableDeclaration, args);
361:                EJBQLException exception = new EJBQLException(message);
362:                exception.setErrorCode(multipleVariableDeclaration);
363:                return exception;
364:            }
365:
366:            public static EJBQLException invalidFunctionArgument(String query,
367:                    int line, int column, String functionName,
368:                    String attributeName, String type) {
369:                Object[] args = { query, line, column, functionName,
370:                        attributeName, type };
371:
372:                String message = ExceptionMessageGenerator.buildMessage(
373:                        EJBQLException.class, invalidFunctionArgument, args);
374:                EJBQLException exception = new EJBQLException(message);
375:                exception.setErrorCode(invalidFunctionArgument);
376:                return exception;
377:            }
378:
379:            public static EJBQLException invalidExpressionArgument(
380:                    String query, int line, int column, String expression,
381:                    String attributeName, String type) {
382:                Object[] args = { query, line, column, expression,
383:                        attributeName, type };
384:
385:                String message = ExceptionMessageGenerator.buildMessage(
386:                        EJBQLException.class, invalidExpressionArgument, args);
387:                EJBQLException exception = new EJBQLException(message);
388:                exception.setErrorCode(invalidExpressionArgument);
389:                return exception;
390:            }
391:
392:            public static EJBQLException unsupportJoinArgument(String query,
393:                    int line, int column, String join, String type) {
394:                Object[] args = { query, line, column, join, type };
395:
396:                String message = ExceptionMessageGenerator.buildMessage(
397:                        EJBQLException.class, unsupportJoinArgument, args);
398:                EJBQLException exception = new EJBQLException(message);
399:                exception.setErrorCode(unsupportJoinArgument);
400:                return exception;
401:            }
402:
403:            public static EJBQLException expectedOrderableOrderByItem(
404:                    String query, int line, int column, String item, String type) {
405:                Object[] args = { query, line, column, item, type };
406:
407:                String message = ExceptionMessageGenerator.buildMessage(
408:                        EJBQLException.class, expectedOrderableOrderByItem,
409:                        args);
410:                EJBQLException exception = new EJBQLException(message);
411:                exception.setErrorCode(expectedOrderableOrderByItem);
412:                return exception;
413:            }
414:
415:            public static EJBQLException syntaxError(String query, Exception ex) {
416:                Object[] args = { query };
417:
418:                String message = ExceptionMessageGenerator.buildMessage(
419:                        EJBQLException.class, syntaxError, args);
420:                EJBQLException exception = new EJBQLException(message, ex);
421:                exception.setErrorCode(syntaxError);
422:                return exception;
423:            }
424:
425:            public static EJBQLException syntaxErrorAt(String query, int line,
426:                    int column, String token, Exception ex) {
427:                Object[] args = { query, line, column, token };
428:
429:                String message = ExceptionMessageGenerator.buildMessage(
430:                        EJBQLException.class, syntaxErrorAt, args);
431:                EJBQLException exception = new EJBQLException(message, ex);
432:                exception.setErrorCode(syntaxErrorAt);
433:                return exception;
434:            }
435:
436:            public static EJBQLException unexpectedToken(String query,
437:                    int line, int column, String token, Exception ex) {
438:                Object[] args = { query, line, column, token };
439:
440:                String message = ExceptionMessageGenerator.buildMessage(
441:                        EJBQLException.class, unexpectedToken, args);
442:                EJBQLException exception = new EJBQLException(message, ex);
443:                exception.setErrorCode(unexpectedToken);
444:                return exception;
445:            }
446:
447:            public static EJBQLException unexpectedChar(String query, int line,
448:                    int column, String unexpected, Exception ex) {
449:                Object[] args = { query, line, column, unexpected };
450:
451:                String message = ExceptionMessageGenerator.buildMessage(
452:                        EJBQLException.class, unexpectedChar, args);
453:                EJBQLException exception = new EJBQLException(message);
454:                exception.setErrorCode(unexpectedChar);
455:                return exception;
456:            }
457:
458:            public static EJBQLException expectedCharFound(String query,
459:                    int line, int column, String expected, String found,
460:                    Exception ex) {
461:                Object[] args = { query, line, column, expected, found };
462:
463:                String message = ExceptionMessageGenerator.buildMessage(
464:                        EJBQLException.class, expectedCharFound, args);
465:                EJBQLException exception = new EJBQLException(message, ex);
466:                exception.setErrorCode(expectedCharFound);
467:                return exception;
468:            }
469:
470:            public static EJBQLException unexpectedEOF(String query, int line,
471:                    int column, Exception ex) {
472:                Object[] args = { query, line, column };
473:
474:                String message = ExceptionMessageGenerator.buildMessage(
475:                        EJBQLException.class, unexpectedEOF, args);
476:                EJBQLException exception = new EJBQLException(message, ex);
477:                exception.setErrorCode(unexpectedEOF);
478:                return exception;
479:            }
480:
481:            public static EJBQLException invalidNavigation(String query,
482:                    int line, int column, String expr, String lhs, String type) {
483:                Object[] args = { query, line, column, expr, lhs, type };
484:
485:                String message = ExceptionMessageGenerator.buildMessage(
486:                        EJBQLException.class, invalidNavigation, args);
487:                EJBQLException exception = new EJBQLException(message);
488:                exception.setErrorCode(invalidNavigation);
489:                return exception;
490:            }
491:
492:            public static EJBQLException invalidCollectionNavigation(
493:                    String query, int line, int column, String expr,
494:                    String attribute) {
495:                Object[] args = { query, line, column, expr, attribute };
496:
497:                String message = ExceptionMessageGenerator
498:                        .buildMessage(EJBQLException.class,
499:                                invalidCollectionNavigation, args);
500:                EJBQLException exception = new EJBQLException(message);
501:                exception.setErrorCode(invalidCollectionNavigation);
502:                return exception;
503:            }
504:
505:            public static EJBQLException invalidSetClauseTarget(String query,
506:                    int line, int column, String expr, String attribute) {
507:                Object[] args = { query, line, column, attribute, expr };
508:
509:                String message = ExceptionMessageGenerator.buildMessage(
510:                        EJBQLException.class, invalidSetClauseTarget, args);
511:                EJBQLException exception = new EJBQLException(message);
512:                exception.setErrorCode(invalidSetClauseTarget);
513:                return exception;
514:            }
515:
516:            public static EJBQLException invalidSetClauseNavigation(
517:                    String query, int line, int column, String expr,
518:                    String relationship) {
519:                Object[] args = { query, line, column, expr, relationship };
520:
521:                String message = ExceptionMessageGenerator.buildMessage(
522:                        EJBQLException.class, invalidSetClauseNavigation, args);
523:                EJBQLException exception = new EJBQLException(message);
524:                exception.setErrorCode(invalidSetClauseNavigation);
525:                return exception;
526:            }
527:
528:            public static EJBQLException unknownAttribute(String query,
529:                    int line, int column, String attribute, String type) {
530:                Object[] args = { query, line, column, attribute, type };
531:
532:                String message = ExceptionMessageGenerator.buildMessage(
533:                        EJBQLException.class, unknownAttribute, args);
534:                EJBQLException exception = new EJBQLException(message);
535:                exception.setErrorCode(unknownAttribute);
536:                return exception;
537:            }
538:
539:            public static EJBQLException invalidEnumEqualExpression(
540:                    String query, int line, int column, String enumType,
541:                    String type) {
542:                Object[] args = { query, line, column, enumType, type };
543:
544:                String message = ExceptionMessageGenerator.buildMessage(
545:                        EJBQLException.class, invalidEnumEqualExpression, args);
546:                EJBQLException exception = new EJBQLException(message);
547:                exception.setErrorCode(invalidEnumEqualExpression);
548:                return exception;
549:            }
550:
551:            public static EJBQLException unknownAbstractSchemaType(
552:                    String query, String type) {
553:                Object[] args = { query, type };
554:
555:                String message = ExceptionMessageGenerator.buildMessage(
556:                        EJBQLException.class, unknownAbstractSchemaType, args);
557:                EJBQLException exception = new EJBQLException(message);
558:                exception.setErrorCode(unknownAbstractSchemaType);
559:                return exception;
560:            }
561:
562:            public static EJBQLException unknownAbstractSchemaType2(
563:                    String query, int line, int column, String type) {
564:                Object[] args = { query, line, column, type };
565:
566:                String message = ExceptionMessageGenerator.buildMessage(
567:                        EJBQLException.class, unknownAbstractSchemaType2, args);
568:                EJBQLException exception = new EJBQLException(message);
569:                exception.setErrorCode(unknownAbstractSchemaType2);
570:                return exception;
571:            }
572:
573:            /**
574:             * INTERNAL
575:             * Add an internal Exception to the collection of
576:             * internal Exceptions
577:             */
578:            public Object addInternalException(Object theException) {
579:                getInternalExceptions().add(theException);
580:                return theException;
581:            }
582:
583:            /**
584:             * INTERNAL
585:             * Does this exception have any internal errors?
586:             */
587:            public boolean hasInternalExceptions() {
588:                return !getInternalExceptions().isEmpty();
589:            }
590:
591:            /**
592:             * INTERNAL
593:             * Return the collection of internal Exceptions.
594:             * Intialize if there are no exceptions
595:             */
596:            public Collection getInternalExceptions() {
597:                if (internalExceptions == null) {
598:                    setInternalExceptions(new Vector());
599:                }
600:                return internalExceptions;
601:            }
602:
603:            /**
604:             * INTERNAL
605:             * Store the exceptions related to this exception
606:             */
607:            public void setInternalExceptions(Collection theExceptions) {
608:                internalExceptions = theExceptions;
609:            }
610:
611:            /**
612:             * PUBLIC
613:             * Print the stack trace for each error generated by the
614:             * parser. This method is intended to assist in debugging
615:             * problems in EJBQL
616:             */
617:            public void printFullStackTrace() {
618:                if (hasInternalExceptions()) {
619:                    Iterator exceptions = getInternalExceptions().iterator();
620:                    while (exceptions.hasNext()) {
621:                        Throwable error = (Throwable) exceptions.next();
622:                        error.printStackTrace();
623:                    }
624:                }
625:            }
626:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.