Source Code Cross Referenced for ReadOnly.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » raw » log » 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 DBMS » db derby 10.2 » org.apache.derby.impl.store.raw.log 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.store.raw.log.ReadOnly
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.store.raw.log;
023:
024:        import org.apache.derby.iapi.reference.SQLState;
025:
026:        import org.apache.derby.iapi.services.monitor.ModuleControl;
027:        import org.apache.derby.iapi.services.monitor.ModuleSupportable;
028:        import org.apache.derby.iapi.services.sanity.SanityManager;
029:        import org.apache.derby.iapi.services.io.Formatable;
030:
031:        import org.apache.derby.iapi.services.property.PersistentSet;
032:        import org.apache.derby.iapi.store.raw.Compensation;
033:        import org.apache.derby.iapi.store.raw.Loggable;
034:        import org.apache.derby.iapi.store.raw.RawStoreFactory;
035:        import org.apache.derby.iapi.store.raw.ScanHandle;
036:        import org.apache.derby.iapi.store.raw.log.LogFactory;
037:        import org.apache.derby.iapi.store.raw.log.LogInstant;
038:        import org.apache.derby.iapi.store.raw.log.Logger;
039:        import org.apache.derby.iapi.store.raw.log.LogScan;
040:
041:        import org.apache.derby.iapi.store.raw.data.DataFactory;
042:        import org.apache.derby.iapi.store.raw.xact.TransactionFactory;
043:        import org.apache.derby.iapi.store.raw.xact.RawTransaction;
044:        import org.apache.derby.iapi.store.raw.xact.TransactionId;
045:
046:        import org.apache.derby.iapi.error.StandardException;
047:
048:        import org.apache.derby.io.StorageFile;
049:        import org.apache.derby.iapi.store.access.DatabaseInstant;
050:        import org.apache.derby.catalog.UUID;
051:
052:        import java.util.Properties;
053:        import java.io.File;
054:
055:        /**
056:         A read-only version of the log factory.
057:         It doesn't do anything, it doesn't check that
058:         the database needs recovery or not.
059:         <P>
060:         It doesn't handle undo.  No recovery.
061:
062:         <P>Multithreading considerations:<BR>
063:         This class must be MT-safe.
064:         */
065:
066:        public class ReadOnly implements  LogFactory, ModuleSupportable {
067:
068:            private String logArchiveDirectory = null;
069:
070:            /* 
071:             ** Methods of Log Factory
072:             */
073:
074:            public Logger getLogger() {
075:                return null;
076:            }
077:
078:            /**
079:              MT - not needed, no work is done
080:              @exception StandardException Cloudscape Standard Error Policy
081:             */
082:            public void recover(RawStoreFactory rawStoreFactory,
083:                    DataFactory dataFactory,
084:                    TransactionFactory transactionFactory)
085:                    throws StandardException {
086:                if (transactionFactory != null)
087:                    transactionFactory.useTransactionTable((Formatable) null);
088:            }
089:
090:            /**
091:              MT - not needed, no work is done
092:             */
093:            public boolean checkpoint(RawStoreFactory rawStoreFactory,
094:                    DataFactory dataFactory,
095:                    TransactionFactory transactionFactory, boolean wait) {
096:                return true;
097:            }
098:
099:            public StandardException markCorrupt(StandardException originalError) {
100:                return originalError;
101:            }
102:
103:            public void flush(LogInstant where) throws StandardException {
104:            }
105:
106:            /*
107:             ** Methods of ModuleControl
108:             */
109:
110:            public boolean canSupport(Properties startParams) {
111:
112:                String runtimeLogAttributes = startParams
113:                        .getProperty(LogFactory.RUNTIME_ATTRIBUTES);
114:                if (runtimeLogAttributes == null)
115:                    return false;
116:
117:                return runtimeLogAttributes.equals(LogFactory.RT_READONLY);
118:            }
119:
120:            /*
121:             * truncation point support (not supported)
122:             */
123:
124:            public LogInstant setTruncationLWM(UUID name, LogInstant instant,
125:                    RawStoreFactory rawStoreFactory,
126:                    TransactionFactory transFactory) throws StandardException {
127:                if (SanityManager.DEBUG)
128:                    SanityManager.THROWASSERT("functionality not implemented");
129:
130:                throw StandardException
131:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
132:
133:            }
134:
135:            /**
136:              @exception StandardException functionality not implmented
137:             */
138:            public void setTruncationLWM(UUID name, LogInstant instant)
139:                    throws StandardException {
140:                if (SanityManager.DEBUG)
141:                    SanityManager.THROWASSERT("functionality not implemented");
142:
143:                throw StandardException
144:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
145:            }
146:
147:            /**
148:              @exception StandardException functionality not implmented
149:             */
150:            public void removeTruncationLWM(UUID name,
151:                    RawStoreFactory rawStoreFactory,
152:                    TransactionFactory transFactory) throws StandardException {
153:                if (SanityManager.DEBUG)
154:                    SanityManager.THROWASSERT("functionality not implemented");
155:
156:                throw StandardException
157:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
158:            }
159:
160:            /**
161:              @exception StandardException functionality not implmented
162:             */
163:            public LogInstant getTruncationLWM(UUID name)
164:                    throws StandardException {
165:                if (SanityManager.DEBUG)
166:                    SanityManager.THROWASSERT("functionality not implemented");
167:
168:                throw StandardException
169:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
170:            }
171:
172:            /**
173:              @exception StandardException functionality not implmented
174:             */
175:            public void removeTruncationLWM(UUID name) throws StandardException {
176:                if (SanityManager.DEBUG)
177:                    SanityManager.THROWASSERT("functionality not implemented");
178:
179:                throw StandardException
180:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
181:            }
182:
183:            /**
184:              @exception StandardException functionality not implmented
185:             */
186:            public ScanHandle openFlushedScan(DatabaseInstant i, int groupsIWant)
187:                    throws StandardException {
188:                if (SanityManager.DEBUG)
189:                    SanityManager.THROWASSERT("functionality not implemented");
190:
191:                throw StandardException
192:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
193:            }
194:
195:            /**
196:              @exception StandardException functionality not implmented
197:             */
198:            public LogScan openForwardsScan(LogInstant startAt,
199:                    LogInstant stopAt) throws StandardException {
200:                if (SanityManager.DEBUG)
201:                    SanityManager.THROWASSERT("functionality not implemented");
202:
203:                throw StandardException
204:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
205:            }
206:
207:            /**
208:             */
209:            public LogInstant getFirstUnflushedInstant() {
210:                if (SanityManager.DEBUG)
211:                    SanityManager.THROWASSERT("functionality not implemented");
212:
213:                return null;
214:            }
215:
216:            /**
217:              @exception StandardException functionality not implmented
218:             */
219:            public LogScan openForwardsFlushedScan(LogInstant startAt)
220:                    throws StandardException {
221:                if (SanityManager.DEBUG)
222:                    SanityManager.THROWASSERT("functionality not implemented");
223:
224:                throw StandardException
225:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
226:            }
227:
228:            /**
229:             * Backup restore - stop sending log record to the log stream
230:             * @exception StandardException Standard Cloudscape error policy
231:             */
232:            public void freezePersistentStore() throws StandardException {
233:                // read only, do nothing
234:            }
235:
236:            /**
237:             * Backup restore - start sending log record to the log stream
238:             * @exception StandardException Standard Cloudscape error policy
239:             */
240:            public void unfreezePersistentStore() throws StandardException {
241:                // read only, do nothing
242:            }
243:
244:            /**
245:             * Backup restore - is the log being archived to some directory?
246:             * if RawStore.LOG_ARCHIVAL_DIRECTORY is set to some value, that means the
247:             * log is meant to be archived.  Else, log not archived.
248:             */
249:            public boolean logArchived() {
250:                return (logArchiveDirectory != null);
251:            }
252:
253:            /**
254:            	Get JBMS properties relavent to the log factory
255:             */
256:            public void getLogFactoryProperties(PersistentSet set) {
257:                // do nothing
258:            }
259:
260:            public StorageFile getLogDirectory() {
261:                return null;
262:            }
263:
264:            public String getCanonicalLogPath() {
265:                return null;
266:            }
267:
268:            //roll-forward recovery support routines
269:            //Nothing to be done for read only databases
270:            public void enableLogArchiveMode() {
271:                //do nothing
272:            }
273:
274:            public void disableLogArchiveMode() {
275:                //do nothing
276:            }
277:
278:            //this function is suppose to delete all the logs 
279:            //before this call that are not active logs.
280:            public void deleteOnlineArchivedLogFiles() {
281:                //do nothing
282:            }
283:
284:            //Is the transaction in rollforward recovery
285:            public boolean inRFR() {
286:                return false;
287:            }
288:
289:            /**	
290:            	perform a  checkpoint during rollforward recovery
291:             */
292:            public void checkpointInRFR(LogInstant cinstant, long redoLWM,
293:                    DataFactory df) throws StandardException {
294:                //do nothing
295:            }
296:
297:            /*
298:             * There are no log files to backup for  read  only databases, nothing to be
299:             * done here. 
300:             * @param toDir - location where the log files should be copied to.
301:             * @exception StandardException Standard Derby error policy
302:             */
303:            public void startLogBackup(File toDir) throws StandardException {
304:                // nothing to do for read only databases.
305:            }
306:
307:            /* 
308:             * There are no log files to backup for read only databases, 
309:             * nothing to be done here. 
310:             *
311:             * @param toDir - location where the log files should be copied to.
312:             * @exception StandardException Standard Derby error policy
313:             */
314:            public void endLogBackup(File toDir) throws StandardException {
315:                // nothing to do for read only databases.
316:            }
317:
318:            /*
319:             * Log backup is not started for for read only databases, no work to do
320:             * here.
321:             **/
322:            public void abortLogBackup() {
323:                // nothing to do for read only databases.
324:            }
325:
326:            /*
327:             * Set that the database is encrypted. Read-only database can not 
328:             * be reencrypted, nothing to do in this case. 
329:             */
330:            public void setDatabaseEncrypted(boolean flushLog) {
331:                // nothing to do for a read-only database.
332:            }
333:
334:            /*
335:             * set up a new log file to start writing 
336:             * the log records into the new log file 
337:             * after this call.
338:             *
339:             * <P>MT - synchronization provided by caller - RawStore boot,
340:             * This method is called while re-encrypting the database 
341:             * at databse boot time. 
342:             *
343:             * Read-only database can not be reencrypted, 
344:             * nothing to do in this case. 
345:             */
346:            public void startNewLogFile() throws StandardException {
347:                // nothing to do for a read-only database. 
348:            }
349:
350:            /*
351:             * find if the checkpoint is in the last log file. 
352:             *
353:             * <P>MT - synchronization provided by caller - RawStore boot,
354:             * This method is called only if a crash occured while 
355:             * re-encrypting the database at boot time. 
356:
357:             * Read-only database can not be re-encrypted, 
358:             * nothing to do in this case. 
359:             */
360:            public boolean isCheckpointInLastLogFile() throws StandardException {
361:                // nothing to do for a read-only database. 
362:                return false;
363:            }
364:
365:            /*
366:             * delete the log file after the checkpoint. 
367:             *
368:             * <P>MT - synchronization provided by caller - RawStore boot,
369:             * This method is called only if a crash occured while 
370:             * re-encrypting the database at boot time. 
371:             *
372:             * Read-only database can not be re-encrypted, 
373:             * nothing to do in this case. 
374:             */
375:            public void deleteLogFileAfterCheckpointLogFile()
376:                    throws StandardException {
377:                // nothing to do for a read-only database. 
378:            }
379:
380:            /**
381:             *  Check to see if a database has been upgraded to the required
382:             *  level in order to use a store feature.
383:             *
384:             * This method is generally used to prevent writes to 
385:             * data/log file by a particular store feature until the 
386:             * database is upgraded to the required version. 
387:             * In read-only database writes are not allowed, so nothing to do
388:             * for this method in this implementation of the log factory.
389:             *
390:             * @param requiredMajorVersion  required database Engine major version
391:             * @param requiredMinorVersion  required database Engine minor version
392:             * @param feature Non-null to throw an exception, null to return the 
393:             *                state of the version match.
394:             *
395:             * @exception  StandardException 
396:             *             not implemented exception is thrown
397:             */
398:            public boolean checkVersion(int requiredMajorVersion,
399:                    int requiredMinorVersion, String feature)
400:                    throws StandardException {
401:                // nothing to do for read only databases; 
402:                throw StandardException
403:                        .newException(SQLState.STORE_FEATURE_NOT_IMPLEMENTED);
404:            }
405:        }
w_w__w__.__j_av__a__2__s__._c_om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.