Source Code Cross Referenced for BasicManagedQueryFactory.java in  » Database-ORM » ODAL » com » completex » objective » components » persistency » 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 » ODAL » com.completex.objective.components.persistency 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Objective Database Abstraction Layer (ODAL)
003:         *  Copyright (c) 2004, The ODAL Development Group
004:         *  All rights reserved.
005:         *  For definition of the ODAL Development Group please refer to LICENCE.txt file
006:         *
007:         *  Distributable under LGPL license.
008:         *  See terms of license at gnu.org.
009:         */package com.completex.objective.components.persistency;
010:
011:        /**
012:         * Represents concrete query factory. It uses QueryFactoryBase delegate class as as supporting
013:         * "engine" to perform new BasicQuery object instatiation.
014:         * 
015:         * @author Gennady Krizhevsky
016:         */
017:        public interface BasicManagedQueryFactory extends QueryFactoryBase {
018:
019:            /**
020:             * One of the SupportedDelegates static fields
021:             * 
022:             * @return delegate factory class
023:             */
024:            Class getDelegateType();
025:
026:            /**
027:             * Sets delegate factory
028:             * 
029:             * @param queryFactory delegate factory
030:             */
031:            void setDelegate(QueryFactoryBase queryFactory);
032:
033:            /**
034:             * Sets default parameters that will be set when query is instantiated
035:             * 
036:             * @param parameters default parameters that will be set when query is instantiated
037:             */
038:            void setDefaultParameters(Parameter[] parameters);
039:
040:            /**
041:             * Contains supported QueryFactoryBase delegate class validations.
042:             */
043:            static final class SupportedDelegates {
044:                public static final Class CALL_FACTORY = CallFactory.class;
045:                public static final Class QUERY_FACTORY = QueryFactory.class;
046:
047:                private static Class[] SUPPORTED = new Class[] { CALL_FACTORY,
048:                        QUERY_FACTORY, };
049:
050:                /**
051:                 * Checks if factoryClass is a valid delegate. 
052:                 * 
053:                 * @param factoryDelegateClass
054:                 * @throws OdalRuntimePersistencyException if factoryClass is not a valid delegate
055:                 */
056:                public static void validate(Class factoryDelegateClass) {
057:                    boolean found = false;
058:                    for (int i = 0; i < SUPPORTED.length; i++) {
059:                        Class aClass = SUPPORTED[i];
060:                        if (aClass.isAssignableFrom(factoryDelegateClass)) {
061:                            found = true;
062:                            break;
063:                        }
064:                    }
065:                    if (!found) {
066:                        invalidateFactoryClass(factoryDelegateClass);
067:                    }
068:                }
069:
070:                private static void invalidateFactoryClass(
071:                        Class factoryDelegateClass) {
072:                    throw new OdalRuntimePersistencyException(
073:                            "Unsupported delegate factory: "
074:                                    + factoryDelegateClass + "; supported: "
075:                                    + SUPPORTED);
076:                }
077:
078:                /**
079:                 * Returns true if factory delegate class is of CallFactory type
080:                 * 
081:                 * @param factoryDelegateClass
082:                 * @return true if factory delegate class is of CallFactory type
083:                 */
084:                public static boolean isCall(Class factoryDelegateClass) {
085:                    return CALL_FACTORY.isAssignableFrom(factoryDelegateClass);
086:                }
087:
088:                /**
089:                 * Returns true if factory delegate class is of QueryFactory type
090:                 * 
091:                 * @param factoryDelegateClass
092:                 * @return true if factory delegate class is of QueryFactory type
093:                 */
094:                public static boolean isQuery(Class factoryDelegateClass) {
095:                    return QUERY_FACTORY.isAssignableFrom(factoryDelegateClass);
096:                }
097:
098:                /**
099:                 * Returns appropriate QueryFactoryBase delegate from Persistency2 based on concrete factory type 
100:                 * 
101:                 * @param factory
102:                 * @param persistency
103:                 * @return appropriate QueryFactoryBase delegate from Persistency2 based on concrete factory type
104:                 */
105:                public static QueryFactoryBase selectDelegate(
106:                        BasicManagedQueryFactory factory,
107:                        Persistency2 persistency) {
108:                    if (factory == null) {
109:                        throw new NullPointerException("factory == null");
110:                    }
111:                    QueryFactoryBase delegateFactory = null;
112:                    if (isCall(factory.getDelegateType())) {
113:                        delegateFactory = persistency.getCallFactory();
114:                    } else if (isQuery(factory.getDelegateType())) {
115:                        delegateFactory = persistency.getQueryFactory();
116:                    } else {
117:                        invalidateFactoryClass(factory.getDelegateType());
118:                    }
119:                    return delegateFactory;
120:                }
121:            }
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.