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


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.store.raw.data.LoggableActions
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.data;
023:
024:        import org.apache.derby.impl.store.raw.data.PageActions;
025:        import org.apache.derby.impl.store.raw.data.BasePage;
026:
027:        import org.apache.derby.iapi.services.io.FormatIdUtil;
028:
029:        import org.apache.derby.iapi.store.access.conglomerate.LogicalUndo;
030:
031:        import org.apache.derby.iapi.store.raw.xact.RawTransaction;
032:        import org.apache.derby.iapi.store.raw.RecordHandle;
033:        import org.apache.derby.iapi.store.raw.Loggable;
034:        import org.apache.derby.iapi.store.raw.log.LogInstant;
035:
036:        import org.apache.derby.iapi.error.StandardException;
037:        import org.apache.derby.iapi.types.DataValueDescriptor;
038:
039:        import org.apache.derby.iapi.services.sanity.SanityManager;
040:        import org.apache.derby.iapi.services.io.FormatableBitSet;
041:        import org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream;
042:        import org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream;
043:
044:        import java.io.IOException;
045:
046:        public class LoggableActions implements  PageActions {
047:
048:            public void actionDelete(RawTransaction t, BasePage page, int slot,
049:                    int recordId, boolean delete, LogicalUndo undo)
050:                    throws StandardException {
051:
052:                DeleteOperation lop = new DeleteOperation(t, page, slot,
053:                        recordId, delete, undo);
054:
055:                doAction(t, page, lop);
056:            }
057:
058:            public int actionUpdate(RawTransaction t, BasePage page, int slot,
059:                    int recordId, Object[] row, FormatableBitSet validColumns,
060:                    int realStartColumn,
061:                    DynamicByteArrayOutputStream logBuffer,
062:                    int realSpaceOnPage, RecordHandle headRowHandle)
063:                    throws StandardException {
064:                UpdateOperation lop = new UpdateOperation(t, page, slot,
065:                        recordId, row, validColumns, realStartColumn,
066:                        logBuffer, realSpaceOnPage, headRowHandle);
067:
068:                doAction(t, page, lop);
069:
070:                return lop.getNextStartColumn();
071:            }
072:
073:            public void actionPurge(RawTransaction t, BasePage page, int slot,
074:                    int num_rows, int[] recordIds, boolean logData)
075:                    throws StandardException {
076:                PurgeOperation lop = new PurgeOperation(t, page, slot,
077:                        num_rows, recordIds, logData);
078:
079:                doAction(t, page, lop);
080:            }
081:
082:            public void actionUpdateField(RawTransaction t, BasePage page,
083:                    int slot, int recordId, int fieldId, Object newValue,
084:                    LogicalUndo undo) throws StandardException {
085:                UpdateFieldOperation lop = new UpdateFieldOperation(t, page,
086:                        slot, recordId, fieldId, newValue, undo);
087:
088:                doAction(t, page, lop);
089:            }
090:
091:            public int actionInsert(RawTransaction t, BasePage page, int slot,
092:                    int recordId, Object[] row, FormatableBitSet validColumns,
093:                    LogicalUndo undo, byte insertFlag, int startColumn,
094:                    boolean isLongColumn, int realStartColumn,
095:                    DynamicByteArrayOutputStream logBuffer,
096:                    int realSpaceOnPage, int overflowThreshold)
097:                    throws StandardException {
098:                InsertOperation lop = new InsertOperation(t, page, slot,
099:                        recordId, row, validColumns, undo, insertFlag,
100:                        startColumn, isLongColumn, realStartColumn, logBuffer,
101:                        realSpaceOnPage, overflowThreshold);
102:
103:                doAction(t, page, lop);
104:                return (lop.getNextStartColumn());
105:
106:            }
107:
108:            public void actionCopyRows(RawTransaction t, BasePage destPage,
109:                    BasePage srcPage, int srcSlot, int numRows, int destSlot,
110:                    int[] recordIds) throws StandardException {
111:
112:                CopyRowsOperation lop = new CopyRowsOperation(t, destPage,
113:                        srcPage, srcSlot, numRows, destSlot, recordIds);
114:
115:                doAction(t, destPage, lop);
116:            }
117:
118:            public void actionInvalidatePage(RawTransaction t, BasePage page)
119:                    throws StandardException {
120:
121:                InvalidatePageOperation lop = new InvalidatePageOperation(page);
122:                doAction(t, page, lop);
123:            }
124:
125:            public void actionInitPage(RawTransaction t, BasePage page,
126:                    int initFlag, int pageFormatId, long pageOffset)
127:                    throws StandardException {
128:                InitPageOperation lop = new InitPageOperation(page, initFlag,
129:                        pageFormatId, pageOffset);
130:
131:                doAction(t, page, lop);
132:            }
133:
134:            public void actionShrinkReservedSpace(RawTransaction t,
135:                    BasePage page, int slot, int recordId, int newValue,
136:                    int oldValue) throws StandardException {
137:
138:                SetReservedSpaceOperation lop = new SetReservedSpaceOperation(
139:                        page, slot, recordId, newValue, oldValue);
140:
141:                doAction(t, page, lop);
142:            }
143:
144:            private void doAction(RawTransaction t, BasePage page, Loggable lop)
145:                    throws StandardException {
146:                long oldversion = 0; // sanity check
147:                LogInstant oldLogInstant = null; // sanity check
148:                if (SanityManager.DEBUG) {
149:                    oldLogInstant = page.getLastLogInstant();
150:                    oldversion = page.getPageVersion();
151:                }
152:
153:                // mark the page as pre-dirtied so that if a checkpoint happens after
154:                // the log record is sent to the log stream, the cache cleaning will
155:                // wait for this change.
156:                page.preDirty();
157:
158:                t.logAndDo(lop);
159:
160:                if (SanityManager.DEBUG) {
161:                    // log instant may not supported by underlying log factory, in that
162:                    // case, it is expected to stay null
163:                    if (oldLogInstant != null
164:                            && page.getLastLogInstant() != null
165:                            && !oldLogInstant
166:                                    .lessThan(page.getLastLogInstant()))
167:                        SanityManager.THROWASSERT("old log instant = "
168:                                + oldLogInstant + " lastlog = "
169:                                + page.getLastLogInstant());
170:
171:                    SanityManager
172:                            .ASSERT(oldversion == ((PageBasicOperation) lop)
173:                                    .getPageVersion());
174:                    SanityManager.ASSERT(page.getPageVersion() > oldversion);
175:                }
176:
177:            }
178:
179:        }
w__w_w__._j__av_a2_s_.___c___o_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.