Source Code Cross Referenced for Platform.java in  » Database-ORM » db-ojb » org » apache » ojb » broker » platforms » 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 » db ojb » org.apache.ojb.broker.platforms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.ojb.broker.platforms;
002:
003:        /* Copyright 2002-2005 The Apache Software Foundation
004:         *
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
019:        import org.apache.ojb.broker.query.LikeCriteria;
020:
021:        import java.sql.CallableStatement;
022:        import java.sql.Connection;
023:        import java.sql.PreparedStatement;
024:        import java.sql.ResultSet;
025:        import java.sql.SQLException;
026:        import java.sql.Statement;
027:        import java.util.Properties;
028:
029:        /**
030:         * This interface provides callbacks that allow to perform
031:         * RDBMS Platform specific operations wherever neccessary.
032:         * The Platform implementation is selected by the platform attribute for
033:         * each jdbc-connection-descriptor entry in the repository file.
034:         *
035:         * @version $Id: Platform.java,v 1.24.2.6 2005/12/18 16:43:19 tomdz Exp $
036:         * @author	 Thomas Mahler
037:         */
038:        public interface Platform {
039:
040:            /**
041:             * Called after a statement has been created.
042:             */
043:            void afterStatementCreate(Statement stmt) throws PlatformException;
044:
045:            /**
046:             * Called by {@link org.apache.ojb.broker.accesslayer.StatementManagerIF} implementation
047:             * before invoking <tt>stmt.close()</tt> method.
048:             */
049:            void beforeStatementClose(Statement stmt, ResultSet rs)
050:                    throws PlatformException;
051:
052:            /**
053:             * Called by {@link org.apache.ojb.broker.accesslayer.StatementManagerIF} implementation
054:             * after invoking <tt>stmt.close()</tt> method.
055:             */
056:            void afterStatementClose(Statement stmt, ResultSet rs)
057:                    throws PlatformException;
058:
059:            /**
060:             * Called before batching operations on a statement.
061:             * @param stmt the statement you want to batch on
062:             * @throws PlatformException
063:             */
064:            void beforeBatch(PreparedStatement stmt) throws PlatformException;
065:
066:            /**
067:             * Called when adding statements to current batch.
068:             * @param stmt the statement you are adding to the batch
069:             * @throws PlatformException
070:             */
071:            void addBatch(PreparedStatement stmt) throws PlatformException;
072:
073:            /**
074:             * Executes current batch.
075:             * @param stmt the statement you want to execute the batch on
076:             * @throws PlatformException
077:             */
078:            int[] executeBatch(PreparedStatement stmt) throws PlatformException;
079:
080:            /**
081:             * Called immediately after a JDBC connection has been created by a
082:             * ConnectionFactory implementation (not used for DataSource connections).
083:             * @param conn the Connection to be initialized
084:             */
085:            void initializeJdbcConnection(JdbcConnectionDescriptor jcd,
086:                    Connection conn) throws PlatformException;
087:
088:            /**
089:             * Used to do a temporary change of the m_connection autoCommit state.
090:             * When using this method ensure to reset the original state before
091:             * m_connection was returned to pool or closed.
092:             * Only when
093:             * {@link org.apache.ojb.broker.metadata.JdbcConnectionDescriptor#getUseAutoCommit()} was set to
094:             * {@link org.apache.ojb.broker.metadata.JdbcConnectionDescriptor#AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE}
095:             * the change of the autoCommit state take effect.
096:             */
097:            void changeAutoCommitState(JdbcConnectionDescriptor jcd,
098:                    Connection con, boolean newState);
099:
100:            /**
101:             * Called to let the Platform implementation perform any JDBC type-specific operations
102:             * needed by the driver when binding positional parameters for a PreparedStatement.
103:             */
104:            void setObjectForStatement(PreparedStatement ps, int index,
105:                    Object value, int sqlType) throws SQLException;
106:
107:            /**
108:             * Called to let the Platform implementation perform any JDBC type-specific operations
109:             * needed by the driver when binding null parameters for a PreparedStatement.
110:             */
111:            void setNullForStatement(PreparedStatement ps, int index,
112:                    int sqlType) throws SQLException;
113:
114:            /**
115:             * Get join syntax type for this RDBMS - one of the constants from JoinSyntaxTypes interface.
116:             * @see org.apache.ojb.broker.accesslayer.JoinSyntaxTypes#SQL92_JOIN_SYNTAX
117:             * @see org.apache.ojb.broker.accesslayer.JoinSyntaxTypes#SQL92_NOPAREN_JOIN_SYNTAX
118:             * @see org.apache.ojb.broker.accesslayer.JoinSyntaxTypes#ORACLE_JOIN_SYNTAX
119:             * @see org.apache.ojb.broker.accesslayer.JoinSyntaxTypes#SYBASE_JOIN_SYNTAX
120:             */
121:            byte getJoinSyntaxType();
122:
123:            /**
124:             * Override default ResultSet size determination (rs.last();rs.getRow())
125:             * with select count(*) operation.
126:             */
127:            boolean useCountForResultsetSize();
128:
129:            /**
130:             * If this platform supports the batch operations jdbc 2.0 feature. This is
131:             * by driver, so we check the driver's metadata once and set something in
132:             * the platform.
133:             * @return true if the platform supports batch, false otherwise.
134:             */
135:            boolean supportsBatchOperations();
136:
137:            // arminw: think we can handle this internally
138:            //    /**
139:            //     * Sets platform information for if the jdbc driver/db combo support
140:            //     * batch operations. Will only be checked once, then have same batch
141:            //     * support setting for the entire session.
142:            //     * @param conn
143:            //     */
144:            //    void checkForBatchSupport(Connection conn);
145:
146:            /**
147:             * Returns a query to create a sequence entry.
148:             *
149:             * @param sequenceName The name of the sequence to create.
150:             * @param prop The database specific sequence properties.
151:             * @return a sql string to create a sequence
152:             */
153:            String createSequenceQuery(String sequenceName, Properties prop);
154:
155:            /**
156:             * Returns a query to create a sequence entry.
157:             *
158:             * @param sequenceName The name of the sequence to create.
159:             * @return a sql string to create a sequence
160:             * @deprecated use {@link #createSequenceQuery(String)} instead.
161:             */
162:            String createSequenceQuery(String sequenceName);
163:
164:            /**
165:             * Returns a query to obtain the next sequence key.
166:             * @return a sql string to get next sequence value
167:             */
168:            String nextSequenceQuery(String sequenceName);
169:
170:            /**
171:             * Returns a query to drop a sequence entry.
172:             * @return a sql string to drop a sequence
173:             */
174:            String dropSequenceQuery(String sequenceName);
175:
176:            /**
177:             * Create stored procedure call for a special sequence manager implementation
178:             * {@link org.apache.ojb.broker.util.sequence.SequenceManagerStoredProcedureImpl},
179:             * because it seems that jdbc-driver differ in handling of CallableStatement.
180:             * <br/>
181:             * Note: The out-parameter of the stored procedure must be registered at
182:             * first position, because lookup for new long id in the implementation:
183:             * <br/>
184:             * <pre>
185:             * Connection con = broker.serviceConnectionManager().getConnection();
186:             * cs = getPlatform().prepareNextValProcedureStatement(con, PROCEDURE_NAME, sequenceName);
187:             * cs.executeUpdate();
188:             * return cs.getLong(1);
189:             * </pre>
190:             */
191:            CallableStatement prepareNextValProcedureStatement(Connection con,
192:                    String procedureName, String sequenceName)
193:                    throws PlatformException;
194:
195:            /**
196:             * If database supports native key generation via identity column, this
197:             * method should return the sql-query to obtain the last generated id.
198:             */
199:            String getLastInsertIdentityQuery(String tableName);
200:
201:            /**
202:             * Answer true if LIMIT or equivalent is supported
203:             * <b> SQL-Paging is not yet supported </b>
204:             */
205:            boolean supportsPaging();
206:
207:            /**
208:             * Add the LIMIT or equivalent to the SQL 
209:             * <b> SQL-Paging is not yet supported </b>
210:             */
211:            void addPagingSql(StringBuffer anSqlString);
212:
213:            /**
214:             * Answer true if the LIMIT parameters are bound before the query parameters
215:             * <b> SQL-Paging is not yet supported </b>
216:             */
217:            boolean bindPagingParametersFirst();
218:
219:            /**
220:             * Bind the Paging Parameters
221:             * <b> SQL-Paging is not yet supported </b>
222:             * @param ps
223:             * @param index parameter index
224:             * @param startAt
225:             * @param endAt
226:             */
227:            int bindPagingParameters(PreparedStatement ps, int index,
228:                    int startAt, int endAt) throws SQLException;
229:
230:            /**
231:             * Whether the platform supports a COUNT DISTINCT across multiple columns.
232:             * 
233:             * @return <code>true</code> if it is supported
234:             */
235:            boolean supportsMultiColumnCountDistinct();
236:
237:            /**
238:             * Concatenate the columns </br>
239:             * ie: col1 || col2 || col3 (ANSI)</br>
240:             * ie: col1 + col2 + col3 (MS SQL-Server)</br>
241:             * ie: concat(col1, col2, col3) (MySql)
242:             * 
243:             * @param theColumns
244:             * @return the concatenated String 
245:             */
246:            String concatenate(String[] theColumns);
247:
248:            /**
249:             * Answer the Clause used Escape wildcards in LIKE 
250:             * @param aCriteria
251:             */
252:            String getEscapeClause(LikeCriteria aCriteria);
253:
254:            // arminw: Check is not necessary any longer
255:            //    /**
256:            //     * Determines whether statement is {@link CallableStatement} or not.
257:            //     *
258:            //     * @param stmt the statement
259:            //     * @return true if statement is {@link CallableStatement}.
260:            //     */
261:            //    boolean isCallableStatement(PreparedStatement stmt);
262:
263:            /**
264:             * Registers call argument at <code>position</code> as returning
265:             * a {@link ResultSet} value.
266:             *
267:             * @param stmt     the statement
268:             * @param position argument position
269:             */
270:            void registerOutResultSet(CallableStatement stmt, int position)
271:                    throws SQLException;
272:
273:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.