Source Code Cross Referenced for DbCompat.java in  » JMX » je » com » sleepycat » compat » 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 » JMX » je » com.sleepycat.compat 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*-
002:         * See the file LICENSE for redistribution information.
003:         *
004:         * Copyright (c) 2000,2008 Oracle.  All rights reserved.
005:         *
006:         * $Id: DbCompat.java,v 1.21.2.3 2008/01/07 15:14:07 cwl Exp $
007:         */
008:
009:        package com.sleepycat.compat;
010:
011:        import java.io.FileNotFoundException;
012:        import java.util.Comparator;
013:
014:        import com.sleepycat.je.Cursor;
015:        import com.sleepycat.je.CursorConfig;
016:        import com.sleepycat.je.Database;
017:        import com.sleepycat.je.DatabaseConfig;
018:        import com.sleepycat.je.DatabaseEntry;
019:        import com.sleepycat.je.DatabaseException;
020:        import com.sleepycat.je.DbInternal;
021:        import com.sleepycat.je.Environment;
022:        import com.sleepycat.je.EnvironmentConfig;
023:        import com.sleepycat.je.LockMode;
024:        import com.sleepycat.je.OperationStatus;
025:        import com.sleepycat.je.SecondaryConfig;
026:        import com.sleepycat.je.SecondaryCursor;
027:        import com.sleepycat.je.SecondaryDatabase;
028:        import com.sleepycat.je.Transaction;
029:        import com.sleepycat.je.TransactionConfig;
030:
031:        /**
032:         * A minimal set of DB-JE compatibility methods for internal use only.
033:         * Two versions are maintained in parallel in the DB and JE source trees.
034:         * Used by the collections package.
035:         */
036:        public class DbCompat {
037:
038:            /* Capabilities */
039:
040:            public static final boolean CDB = false;
041:            public static final boolean JOIN = true;
042:            public static final boolean NESTED_TRANSACTIONS = false;
043:            public static final boolean INSERTION_ORDERED_DUPLICATES = false;
044:            public static final boolean SEPARATE_DATABASE_FILES = false;
045:            public static final boolean MEMORY_SUBSYSTEM = false;
046:            public static final boolean LOCK_SUBSYSTEM = false;
047:            public static final boolean HASH_METHOD = false;
048:            public static final boolean RECNO_METHOD = false;
049:            public static final boolean QUEUE_METHOD = false;
050:            public static final boolean BTREE_RECNUM_METHOD = false;
051:            public static final boolean OPTIONAL_READ_UNCOMMITTED = false;
052:            public static final boolean SECONDARIES = true;
053:            public static boolean TRANSACTION_RUNNER_PRINT_STACK_TRACES = true;
054:            public static final boolean DATABASE_COUNT = true;
055:
056:            /* Methods used by the collections package. */
057:
058:            public static boolean getInitializeLocking(EnvironmentConfig config) {
059:                return config.getLocking();
060:            }
061:
062:            public static boolean getInitializeCDB(EnvironmentConfig config) {
063:                return false;
064:            }
065:
066:            public static boolean isTypeBtree(DatabaseConfig dbConfig) {
067:                return true;
068:            }
069:
070:            public static boolean isTypeHash(DatabaseConfig dbConfig) {
071:                return false;
072:            }
073:
074:            public static boolean isTypeQueue(DatabaseConfig dbConfig) {
075:                return false;
076:            }
077:
078:            public static boolean isTypeRecno(DatabaseConfig dbConfig) {
079:                return false;
080:            }
081:
082:            public static boolean getBtreeRecordNumbers(DatabaseConfig dbConfig) {
083:                return false;
084:            }
085:
086:            public static boolean getReadUncommitted(DatabaseConfig dbConfig) {
087:                return true;
088:            }
089:
090:            public static boolean getRenumbering(DatabaseConfig dbConfig) {
091:                return false;
092:            }
093:
094:            public static boolean getSortedDuplicates(DatabaseConfig dbConfig) {
095:                return dbConfig.getSortedDuplicates();
096:            }
097:
098:            public static boolean getUnsortedDuplicates(DatabaseConfig dbConfig) {
099:                return false;
100:            }
101:
102:            public static boolean getDeferredWrite(DatabaseConfig dbConfig) {
103:                return dbConfig.getDeferredWrite();
104:            }
105:
106:            // XXX Remove this when DB and JE support CursorConfig.cloneConfig
107:            public static CursorConfig cloneCursorConfig(CursorConfig config) {
108:                CursorConfig newConfig = new CursorConfig();
109:                newConfig.setReadCommitted(config.getReadCommitted());
110:                newConfig.setReadUncommitted(config.getReadUncommitted());
111:                return newConfig;
112:            }
113:
114:            public static boolean getWriteCursor(CursorConfig config) {
115:                return false;
116:            }
117:
118:            public static void setWriteCursor(CursorConfig config, boolean write) {
119:                if (write) {
120:                    throw new UnsupportedOperationException();
121:                }
122:            }
123:
124:            public static void setRecordNumber(DatabaseEntry entry, int recNum) {
125:                throw new UnsupportedOperationException();
126:            }
127:
128:            public static int getRecordNumber(DatabaseEntry entry) {
129:                throw new UnsupportedOperationException();
130:            }
131:
132:            public static String getDatabaseFile(Database db)
133:                    throws DatabaseException {
134:
135:                return null;
136:            }
137:
138:            public static long getDatabaseCount(Database db)
139:                    throws DatabaseException {
140:
141:                return db.count();
142:            }
143:
144:            public static void syncDeferredWrite(Database db, boolean flushLog)
145:                    throws DatabaseException {
146:
147:                DbInternal.dbGetDatabaseImpl(db).sync(flushLog);
148:            }
149:
150:            public static OperationStatus getCurrentRecordNumber(Cursor cursor,
151:                    DatabaseEntry key, LockMode lockMode)
152:                    throws DatabaseException {
153:
154:                throw new UnsupportedOperationException();
155:            }
156:
157:            public static OperationStatus getSearchRecordNumber(Cursor cursor,
158:                    DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
159:                    throws DatabaseException {
160:
161:                throw new UnsupportedOperationException();
162:            }
163:
164:            public static OperationStatus getSearchRecordNumber(
165:                    SecondaryCursor cursor, DatabaseEntry key,
166:                    DatabaseEntry pKey, DatabaseEntry data, LockMode lockMode)
167:                    throws DatabaseException {
168:
169:                throw new UnsupportedOperationException();
170:            }
171:
172:            public static OperationStatus putAfter(Cursor cursor,
173:                    DatabaseEntry key, DatabaseEntry data)
174:                    throws DatabaseException {
175:
176:                throw new UnsupportedOperationException();
177:            }
178:
179:            public static OperationStatus putBefore(Cursor cursor,
180:                    DatabaseEntry key, DatabaseEntry data)
181:                    throws DatabaseException {
182:
183:                throw new UnsupportedOperationException();
184:            }
185:
186:            public static OperationStatus append(Database db, Transaction txn,
187:                    DatabaseEntry key, DatabaseEntry data)
188:                    throws DatabaseException {
189:
190:                throw new UnsupportedOperationException();
191:            }
192:
193:            public static Transaction getThreadTransaction(Environment env)
194:                    throws DatabaseException {
195:
196:                return env.getThreadTransaction();
197:            }
198:
199:            /* Methods used by the collections tests. */
200:
201:            public static void setInitializeCache(EnvironmentConfig config,
202:                    boolean val) {
203:                if (!val) {
204:                    throw new UnsupportedOperationException();
205:                }
206:            }
207:
208:            public static void setInitializeLocking(EnvironmentConfig config,
209:                    boolean val) {
210:                if (!val) {
211:                    throw new UnsupportedOperationException();
212:                }
213:            }
214:
215:            public static void setInitializeCDB(EnvironmentConfig config,
216:                    boolean val) {
217:                if (val) {
218:                    throw new UnsupportedOperationException();
219:                }
220:            }
221:
222:            public static void setLockDetectModeOldest(EnvironmentConfig config) {
223:                /* JE does this by default, since it uses timeouts. */
224:            }
225:
226:            public static void setSerializableIsolation(
227:                    TransactionConfig config, boolean val) {
228:                config.setSerializableIsolation(val);
229:            }
230:
231:            public static void setBtreeComparator(DatabaseConfig dbConfig,
232:                    Comparator comparator) {
233:                dbConfig.setBtreeComparator(comparator.getClass());
234:            }
235:
236:            public static void setTypeBtree(DatabaseConfig dbConfig) {
237:            }
238:
239:            public static void setTypeHash(DatabaseConfig dbConfig) {
240:                throw new UnsupportedOperationException();
241:            }
242:
243:            public static void setTypeRecno(DatabaseConfig dbConfig) {
244:                throw new UnsupportedOperationException();
245:            }
246:
247:            public static void setTypeQueue(DatabaseConfig dbConfig) {
248:                throw new UnsupportedOperationException();
249:            }
250:
251:            public static void setBtreeRecordNumbers(DatabaseConfig dbConfig,
252:                    boolean val) {
253:                throw new UnsupportedOperationException();
254:            }
255:
256:            public static void setReadUncommitted(DatabaseConfig dbConfig,
257:                    boolean val) {
258:            }
259:
260:            public static void setRenumbering(DatabaseConfig dbConfig,
261:                    boolean val) {
262:                throw new UnsupportedOperationException();
263:            }
264:
265:            public static void setSortedDuplicates(DatabaseConfig dbConfig,
266:                    boolean val) {
267:                dbConfig.setSortedDuplicates(val);
268:            }
269:
270:            public static void setUnsortedDuplicates(DatabaseConfig dbConfig,
271:                    boolean val) {
272:                if (val) {
273:                    throw new UnsupportedOperationException();
274:                }
275:            }
276:
277:            public static void setDeferredWrite(DatabaseConfig dbConfig,
278:                    boolean val) {
279:                dbConfig.setDeferredWrite(val);
280:            }
281:
282:            public static void setRecordLength(DatabaseConfig dbConfig, int val) {
283:                if (val != 0) {
284:                    throw new UnsupportedOperationException();
285:                }
286:            }
287:
288:            public static void setRecordPad(DatabaseConfig dbConfig, int val) {
289:                throw new UnsupportedOperationException();
290:            }
291:
292:            public static Database openDatabase(Environment env,
293:                    Transaction txn, String file, String name,
294:                    DatabaseConfig config) throws DatabaseException,
295:                    FileNotFoundException {
296:
297:                return env.openDatabase(txn, makeDbName(file, name), config);
298:            }
299:
300:            public static SecondaryDatabase openSecondaryDatabase(
301:                    Environment env, Transaction txn, String file, String name,
302:                    Database primary, SecondaryConfig config)
303:                    throws DatabaseException, FileNotFoundException {
304:
305:                return env.openSecondaryDatabase(txn, makeDbName(file, name),
306:                        primary, config);
307:            }
308:
309:            private static String makeDbName(String file, String name) {
310:                if (file == null) {
311:                    return name;
312:                } else {
313:                    if (name != null) {
314:                        return file + '.' + name;
315:                    } else {
316:                        return file;
317:                    }
318:                }
319:            }
320:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.