Source Code Cross Referenced for DelegatingQuery.java in  » Database-ORM » openjpa » org » apache » openjpa » kernel » 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 » openjpa » org.apache.openjpa.kernel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements.  See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership.  The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License.  You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied.  See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.    
018:         */
019:        package org.apache.openjpa.kernel;
020:
021:        import java.util.Collection;
022:        import java.util.Map;
023:
024:        import org.apache.commons.collections.map.LinkedMap;
025:        import org.apache.openjpa.kernel.exps.AggregateListener;
026:        import org.apache.openjpa.kernel.exps.FilterListener;
027:        import org.apache.openjpa.meta.ClassMetaData;
028:        import org.apache.openjpa.util.RuntimeExceptionTranslator;
029:
030:        /**
031:         * Delegating query that can also perform exception translation
032:         * for use in facades.
033:         *
034:         * @since 0.4.0
035:         * @author Abe White
036:         * @nojavadoc
037:         */
038:        public class DelegatingQuery implements  Query {
039:            ///////////////////////////////////////////////////////////////
040:            // NOTE: when adding a public API method, be sure to add it to
041:            // JDO and JPA facades!
042:            ///////////////////////////////////////////////////////////////
043:
044:            private final Query _query;
045:            private final DelegatingQuery _del;
046:            private final RuntimeExceptionTranslator _trans;
047:
048:            /**
049:             * Constructor; supply delegate.
050:             */
051:            public DelegatingQuery(Query query) {
052:                this (query, null);
053:            }
054:
055:            /**
056:             * Constructor; supply delegate and exception translator.
057:             */
058:            public DelegatingQuery(Query query, RuntimeExceptionTranslator trans) {
059:                _query = query;
060:                if (query instanceof  DelegatingQuery)
061:                    _del = (DelegatingQuery) query;
062:                else
063:                    _del = null;
064:                _trans = trans;
065:            }
066:
067:            /**
068:             * Return the direct delegate.
069:             */
070:            public Query getDelegate() {
071:                return _query;
072:            }
073:
074:            /**
075:             * Return the native delegate.
076:             */
077:            public Query getInnermostDelegate() {
078:                return (_del == null) ? _query : _del.getInnermostDelegate();
079:            }
080:
081:            public int hashCode() {
082:                return getInnermostDelegate().hashCode();
083:            }
084:
085:            public boolean equals(Object other) {
086:                if (other == this )
087:                    return true;
088:                if (other instanceof  DelegatingQuery)
089:                    other = ((DelegatingQuery) other).getInnermostDelegate();
090:                return getInnermostDelegate().equals(other);
091:            }
092:
093:            /**
094:             * Translate the OpenJPA exception.
095:             */
096:            protected RuntimeException translate(RuntimeException re) {
097:                return (_trans == null) ? re : _trans.translate(re);
098:            }
099:
100:            public Broker getBroker() {
101:                try {
102:                    return _query.getBroker();
103:                } catch (RuntimeException re) {
104:                    throw translate(re);
105:                }
106:            }
107:
108:            public Query getQuery() {
109:                return this ;
110:            }
111:
112:            public StoreContext getStoreContext() {
113:                try {
114:                    return _query.getStoreContext();
115:                } catch (RuntimeException re) {
116:                    throw translate(re);
117:                }
118:            }
119:
120:            public int getOperation() {
121:                try {
122:                    return _query.getOperation();
123:                } catch (RuntimeException re) {
124:                    throw translate(re);
125:                }
126:            }
127:
128:            public String getLanguage() {
129:                try {
130:                    return _query.getLanguage();
131:                } catch (RuntimeException re) {
132:                    throw translate(re);
133:                }
134:            }
135:
136:            public FetchConfiguration getFetchConfiguration() {
137:                try {
138:                    return _query.getFetchConfiguration();
139:                } catch (RuntimeException re) {
140:                    throw translate(re);
141:                }
142:            }
143:
144:            public String getQueryString() {
145:                try {
146:                    return _query.getQueryString();
147:                } catch (RuntimeException re) {
148:                    throw translate(re);
149:                }
150:            }
151:
152:            public boolean getIgnoreChanges() {
153:                try {
154:                    return _query.getIgnoreChanges();
155:                } catch (RuntimeException re) {
156:                    throw translate(re);
157:                }
158:            }
159:
160:            public Object getCompilation() {
161:                try {
162:                    return _query.getCompilation();
163:                } catch (RuntimeException re) {
164:                    throw translate(re);
165:                }
166:            }
167:
168:            public String getAlias() {
169:                try {
170:                    return _query.getAlias();
171:                } catch (RuntimeException re) {
172:                    throw translate(re);
173:                }
174:            }
175:
176:            public String[] getProjectionAliases() {
177:                try {
178:                    return _query.getProjectionAliases();
179:                } catch (RuntimeException re) {
180:                    throw translate(re);
181:                }
182:            }
183:
184:            public Class[] getProjectionTypes() {
185:                try {
186:                    return _query.getProjectionTypes();
187:                } catch (RuntimeException re) {
188:                    throw translate(re);
189:                }
190:            }
191:
192:            public boolean isAggregate() {
193:                try {
194:                    return _query.isAggregate();
195:                } catch (RuntimeException re) {
196:                    throw translate(re);
197:                }
198:            }
199:
200:            public boolean hasGrouping() {
201:                try {
202:                    return _query.hasGrouping();
203:                } catch (RuntimeException re) {
204:                    throw translate(re);
205:                }
206:            }
207:
208:            public ClassMetaData[] getAccessPathMetaDatas() {
209:                try {
210:                    return _query.getAccessPathMetaDatas();
211:                } catch (RuntimeException re) {
212:                    throw translate(re);
213:                }
214:            }
215:
216:            public FilterListener getFilterListener(String tag) {
217:                try {
218:                    return _query.getFilterListener(tag);
219:                } catch (RuntimeException re) {
220:                    throw translate(re);
221:                }
222:            }
223:
224:            public AggregateListener getAggregateListener(String tag) {
225:                try {
226:                    return _query.getAggregateListener(tag);
227:                } catch (RuntimeException re) {
228:                    throw translate(re);
229:                }
230:            }
231:
232:            public Collection getFilterListeners() {
233:                try {
234:                    return _query.getFilterListeners();
235:                } catch (RuntimeException re) {
236:                    throw translate(re);
237:                }
238:            }
239:
240:            public Collection getAggregateListeners() {
241:                try {
242:                    return _query.getAggregateListeners();
243:                } catch (RuntimeException re) {
244:                    throw translate(re);
245:                }
246:            }
247:
248:            public Collection getCandidateCollection() {
249:                try {
250:                    return _query.getCandidateCollection();
251:                } catch (RuntimeException re) {
252:                    throw translate(re);
253:                }
254:            }
255:
256:            public Class getCandidateType() {
257:                try {
258:                    return _query.getCandidateType();
259:                } catch (RuntimeException re) {
260:                    throw translate(re);
261:                }
262:            }
263:
264:            public boolean hasSubclasses() {
265:                try {
266:                    return _query.hasSubclasses();
267:                } catch (RuntimeException re) {
268:                    throw translate(re);
269:                }
270:            }
271:
272:            public void setCandidateType(Class cls, boolean subs) {
273:                try {
274:                    _query.setCandidateType(cls, subs);
275:                } catch (RuntimeException re) {
276:                    throw translate(re);
277:                }
278:            }
279:
280:            public boolean isReadOnly() {
281:                try {
282:                    return _query.isReadOnly();
283:                } catch (RuntimeException re) {
284:                    throw translate(re);
285:                }
286:            }
287:
288:            public void setReadOnly(boolean readOnly) {
289:                try {
290:                    _query.setReadOnly(readOnly);
291:                } catch (RuntimeException re) {
292:                    throw translate(re);
293:                }
294:            }
295:
296:            public Class getResultMappingScope() {
297:                try {
298:                    return _query.getResultMappingScope();
299:                } catch (RuntimeException re) {
300:                    throw translate(re);
301:                }
302:            }
303:
304:            public String getResultMappingName() {
305:                try {
306:                    return _query.getResultMappingName();
307:                } catch (RuntimeException re) {
308:                    throw translate(re);
309:                }
310:            }
311:
312:            public void setResultMapping(Class scope, String name) {
313:                try {
314:                    _query.setResultMapping(scope, name);
315:                } catch (RuntimeException re) {
316:                    throw translate(re);
317:                }
318:            }
319:
320:            public boolean isUnique() {
321:                try {
322:                    return _query.isUnique();
323:                } catch (RuntimeException re) {
324:                    throw translate(re);
325:                }
326:            }
327:
328:            public void setUnique(boolean unique) {
329:                try {
330:                    _query.setUnique(unique);
331:                } catch (RuntimeException re) {
332:                    throw translate(re);
333:                }
334:            }
335:
336:            public Class getResultType() {
337:                try {
338:                    return _query.getResultType();
339:                } catch (RuntimeException re) {
340:                    throw translate(re);
341:                }
342:            }
343:
344:            public void setResultType(Class cls) {
345:                try {
346:                    _query.setResultType(cls);
347:                } catch (RuntimeException re) {
348:                    throw translate(re);
349:                }
350:            }
351:
352:            public long getStartRange() {
353:                try {
354:                    return _query.getStartRange();
355:                } catch (RuntimeException re) {
356:                    throw translate(re);
357:                }
358:            }
359:
360:            public long getEndRange() {
361:                try {
362:                    return _query.getEndRange();
363:                } catch (RuntimeException re) {
364:                    throw translate(re);
365:                }
366:            }
367:
368:            public void setRange(long start, long end) {
369:                try {
370:                    _query.setRange(start, end);
371:                } catch (RuntimeException re) {
372:                    throw translate(re);
373:                }
374:            }
375:
376:            public String getParameterDeclaration() {
377:                try {
378:                    return _query.getParameterDeclaration();
379:                } catch (RuntimeException re) {
380:                    throw translate(re);
381:                }
382:            }
383:
384:            public LinkedMap getParameterTypes() {
385:                try {
386:                    return _query.getParameterTypes();
387:                } catch (RuntimeException re) {
388:                    throw translate(re);
389:                }
390:            }
391:
392:            public Map getUpdates() {
393:                try {
394:                    return _query.getUpdates();
395:                } catch (RuntimeException re) {
396:                    throw translate(re);
397:                }
398:            }
399:
400:            public void declareParameters(String params) {
401:                try {
402:                    _query.declareParameters(params);
403:                } catch (RuntimeException re) {
404:                    throw translate(re);
405:                }
406:            }
407:
408:            public Number deleteInMemory(StoreQuery q, StoreQuery.Executor ex,
409:                    Object[] params) {
410:                try {
411:                    return _query.deleteInMemory(q, ex, params);
412:                } catch (RuntimeException re) {
413:                    throw translate(re);
414:                }
415:            }
416:
417:            public Number updateInMemory(StoreQuery q, StoreQuery.Executor ex,
418:                    Object[] params) {
419:                try {
420:                    return _query.updateInMemory(q, ex, params);
421:                } catch (RuntimeException re) {
422:                    throw translate(re);
423:                }
424:            }
425:
426:            public Class classForName(String name, String[] imports) {
427:                try {
428:                    return _query.classForName(name, imports);
429:                } catch (RuntimeException re) {
430:                    throw translate(re);
431:                }
432:            }
433:
434:            public void lock() {
435:                try {
436:                    _query.lock();
437:                } catch (RuntimeException re) {
438:                    throw translate(re);
439:                }
440:            }
441:
442:            public void unlock() {
443:                try {
444:                    _query.unlock();
445:                } catch (RuntimeException re) {
446:                    throw translate(re);
447:                }
448:            }
449:
450:            public void addFilterListener(FilterListener listener) {
451:                try {
452:                    _query.addFilterListener(listener);
453:                } catch (RuntimeException re) {
454:                    throw translate(re);
455:                }
456:            }
457:
458:            public void removeFilterListener(FilterListener listener) {
459:                try {
460:                    _query.removeFilterListener(listener);
461:                } catch (RuntimeException re) {
462:                    throw translate(re);
463:                }
464:            }
465:
466:            public void addAggregateListener(AggregateListener listener) {
467:                try {
468:                    _query.addAggregateListener(listener);
469:                } catch (RuntimeException re) {
470:                    throw translate(re);
471:                }
472:            }
473:
474:            public void removeAggregateListener(AggregateListener listener) {
475:                try {
476:                    _query.removeAggregateListener(listener);
477:                } catch (RuntimeException re) {
478:                    throw translate(re);
479:                }
480:            }
481:
482:            public Extent getCandidateExtent() {
483:                try {
484:                    return _query.getCandidateExtent();
485:                } catch (RuntimeException re) {
486:                    throw translate(re);
487:                }
488:            }
489:
490:            public void setCandidateExtent(Extent extent) {
491:                try {
492:                    _query.setCandidateExtent(extent);
493:                } catch (RuntimeException re) {
494:                    throw translate(re);
495:                }
496:            }
497:
498:            public void setCandidateCollection(Collection coll) {
499:                try {
500:                    _query.setCandidateCollection(coll);
501:                } catch (RuntimeException re) {
502:                    throw translate(re);
503:                }
504:            }
505:
506:            public void compile() {
507:                try {
508:                    _query.compile();
509:                } catch (RuntimeException re) {
510:                    throw translate(re);
511:                }
512:            }
513:
514:            public Object execute() {
515:                try {
516:                    return _query.execute();
517:                } catch (RuntimeException re) {
518:                    throw translate(re);
519:                }
520:            }
521:
522:            public Object execute(Map params) {
523:                try {
524:                    return _query.execute(params);
525:                } catch (RuntimeException re) {
526:                    throw translate(re);
527:                }
528:            }
529:
530:            public Object execute(Object[] params) {
531:                try {
532:                    return _query.execute(params);
533:                } catch (RuntimeException re) {
534:                    throw translate(re);
535:                }
536:            }
537:
538:            public long deleteAll() {
539:                try {
540:                    return _query.deleteAll();
541:                } catch (RuntimeException re) {
542:                    throw translate(re);
543:                }
544:            }
545:
546:            public long deleteAll(Object[] parameters) {
547:                try {
548:                    return _query.deleteAll(parameters);
549:                } catch (RuntimeException re) {
550:                    throw translate(re);
551:                }
552:            }
553:
554:            public long deleteAll(Map parameterMap) {
555:                try {
556:                    return _query.deleteAll(parameterMap);
557:                } catch (RuntimeException re) {
558:                    throw translate(re);
559:                }
560:            }
561:
562:            public long updateAll() {
563:                try {
564:                    return _query.updateAll();
565:                } catch (RuntimeException re) {
566:                    throw translate(re);
567:                }
568:            }
569:
570:            public long updateAll(Object[] parameters) {
571:                try {
572:                    return _query.updateAll(parameters);
573:                } catch (RuntimeException re) {
574:                    throw translate(re);
575:                }
576:            }
577:
578:            public long updateAll(Map parameterMap) {
579:                try {
580:                    return _query.updateAll(parameterMap);
581:                } catch (RuntimeException re) {
582:                    throw translate(re);
583:                }
584:            }
585:
586:            public void closeAll() {
587:                try {
588:                    _query.closeAll();
589:                } catch (RuntimeException re) {
590:                    throw translate(re);
591:                }
592:            }
593:
594:            public void closeResources() {
595:                try {
596:                    _query.closeResources();
597:                } catch (RuntimeException re) {
598:                    throw translate(re);
599:                }
600:            }
601:
602:            public String[] getDataStoreActions(Map params) {
603:                try {
604:                    return _query.getDataStoreActions(params);
605:                } catch (RuntimeException re) {
606:                    throw translate(re);
607:                }
608:            }
609:
610:            public boolean setQuery(Object query) {
611:                try {
612:                    return _query.setQuery(query);
613:                } catch (RuntimeException re) {
614:                    throw translate(re);
615:                }
616:            }
617:
618:            public void setIgnoreChanges(boolean ignore) {
619:                try {
620:                    _query.setIgnoreChanges(ignore);
621:                } catch (RuntimeException re) {
622:                    throw translate(re);
623:                }
624:            }
625:
626:            public void assertOpen() {
627:                try {
628:                    _query.assertOpen();
629:                } catch (RuntimeException re) {
630:                    throw translate(re);
631:                }
632:            }
633:
634:            public void assertNotReadOnly() {
635:                try {
636:                    _query.assertNotReadOnly();
637:                } catch (RuntimeException re) {
638:                    throw translate(re);
639:                }
640:            }
641:
642:            public void assertNotSerialized() {
643:                try {
644:                    _query.assertNotSerialized();
645:                } catch (RuntimeException re) {
646:                    throw translate(re);
647:                }
648:            }
649:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.