Source Code Cross Referenced for DatabaseRoot.java in  » Database-DBMS » Quadcap-Embeddable-Database » com » quadcap » sql » 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 » Quadcap Embeddable Database » com.quadcap.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.quadcap.sql;
002:
003:        /* Copyright 1999 - 2003 Quadcap Software.  All rights reserved.
004:         *
005:         * This software is distributed under the Quadcap Free Software License.
006:         * This software may be used or modified for any purpose, personal or
007:         * commercial.  Open Source redistributions are permitted.  Commercial
008:         * redistribution of larger works derived from, or works which bundle
009:         * this software requires a "Commercial Redistribution License"; see
010:         * http://www.quadcap.com/purchase.
011:         *
012:         * Redistributions qualify as "Open Source" under  one of the following terms:
013:         *   
014:         *    Redistributions are made at no charge beyond the reasonable cost of
015:         *    materials and delivery.
016:         *
017:         *    Redistributions are accompanied by a copy of the Source Code or by an
018:         *    irrevocable offer to provide a copy of the Source Code for up to three
019:         *    years at the cost of materials and delivery.  Such redistributions
020:         *    must allow further use, modification, and redistribution of the Source
021:         *    Code under substantially the same terms as this license.
022:         *
023:         * Redistributions of source code must retain the copyright notices as they
024:         * appear in each source code file, these license terms, and the
025:         * disclaimer/limitation of liability set forth as paragraph 6 below.
026:         *
027:         * Redistributions in binary form must reproduce this Copyright Notice,
028:         * these license terms, and the disclaimer/limitation of liability set
029:         * forth as paragraph 6 below, in the documentation and/or other materials
030:         * provided with the distribution.
031:         *
032:         * The Software is provided on an "AS IS" basis.  No warranty is
033:         * provided that the Software is free of defects, or fit for a
034:         * particular purpose.  
035:         *
036:         * Limitation of Liability. Quadcap Software shall not be liable
037:         * for any damages suffered by the Licensee or any third party resulting
038:         * from use of the Software.
039:         */
040:
041:        import java.io.Externalizable;
042:        import java.io.File;
043:        import java.io.IOException;
044:        import java.io.ObjectInput;
045:        import java.io.ObjectOutput;
046:
047:        import java.util.Properties;
048:
049:        import com.quadcap.sql.file.DatafileRoot;
050:
051:        /**
052:         * The persistent root block of the database.
053:         *
054:         * @author Stan Bailes
055:         */
056:        public class DatabaseRoot implements  Externalizable, DatafileRoot {
057:            int buildNumber = -1;
058:            long tableIndexNode = -1;
059:            long indexIndexNode = -1;
060:            long forwardDepsNode = -1;
061:            long reverseDepsNode = -1;
062:            long blobRefCountRoot = -1;
063:            long nextTransId = 1;
064:            String dbFileName = null;
065:            String unused1 = null;
066:            String unused2 = null;
067:            String backupDir = null;
068:
069:            /** Backups roll; Number of backups to keep. */
070:            int backupCount = 1;
071:
072:            /** bitmap SUN=1 - SAT=7 */
073:            int backupDays = 0;
074:
075:            /** minutes after midnight */
076:            int backupTime = 0;
077:
078:            /** Julian day of previous backup. */
079:            int backupLastDay = -1;
080:
081:            String backupFormat = "xml.gz";
082:
083:            Database db;
084:
085:            /**
086:             * Default constructor
087:             */
088:            public DatabaseRoot() {
089:            }
090:
091:            /**
092:             * Explicit constuctor for database creation
093:             */
094:            public DatabaseRoot(Database db, String dbFileName, Properties props)
095:                    throws IOException {
096:                this .dbFileName = dbFileName;
097:                this .unused2 = "";
098:                this .unused1 = "";
099:                this .buildNumber = Version.buildNumber;
100:                tableIndexNode = db.getFile().newPage();
101:                indexIndexNode = db.getFile().newPage();
102:                forwardDepsNode = db.getFile().newPage();
103:                reverseDepsNode = db.getFile().newPage();
104:                blobRefCountRoot = db.getFile().newPage();
105:                backupDir = props.getProperty("backup-directory");
106:            }
107:
108:            /**
109:             * Set the database which owns this root
110:             */
111:            public void setDatabase(Database db) {
112:                this .db = db;
113:            }
114:
115:            /**
116:             * Return the build number
117:             */
118:            public int getBuildNumber() {
119:                return buildNumber;
120:            }
121:
122:            /**
123:             * Return the root block of the relation index
124:             */
125:            public long getRelationIndexNode() {
126:                return tableIndexNode;
127:            }
128:
129:            /**
130:             * Return the root block of the index index
131:             */
132:            public long getIndexIndexNode() {
133:                return indexIndexNode;
134:            }
135:
136:            /**
137:             * Return the root block of the forward dependencies graph
138:             */
139:            public long getForwardDepsNode() {
140:                return forwardDepsNode;
141:            }
142:
143:            /**
144:             * Return the root block of the reverse dependencies graph
145:             */
146:            public long getReverseDepsNode() {
147:                return reverseDepsNode;
148:            }
149:
150:            /**
151:             * Return the root block of the blob ref count index
152:             */
153:            public long getBlobRefCountRoot() {
154:                return blobRefCountRoot;
155:            }
156:
157:            /**
158:             * Return the next transaction id
159:             */
160:            public long getNextTransId() {
161:                return nextTransId++;
162:            }
163:
164:            /**
165:             * Return the backup directory name
166:             */
167:            public String getBackupDir() {
168:                return backupDir;
169:            }
170:
171:            /**
172:             * Return the backup count
173:             */
174:            public int getBackupCount() {
175:                return backupCount;
176:            }
177:
178:            /**
179:             * Return the backup days
180:             */
181:            public int getBackupDays() {
182:                return backupDays;
183:            }
184:
185:            /**
186:             * Return the backup last day
187:             */
188:            public int getBackupLastDay() {
189:                return backupLastDay;
190:            }
191:
192:            /**
193:             * Return the backup time
194:             */
195:            public int getBackupTime() {
196:                return backupTime;
197:            }
198:
199:            /**
200:             * Return the backup format
201:             */
202:            public String getBackupFormat() {
203:                return backupFormat;
204:            }
205:
206:            /**
207:             * Set the backup directory
208:             */
209:            public void setBackupDir(String dir) {
210:                backupDir = dir;
211:            }
212:
213:            /**
214:             * Set the backup count
215:             */
216:            public void setBackupCount(int count) {
217:                backupCount = count;
218:            }
219:
220:            /**
221:             * Set the backup days
222:             */
223:            public void setBackupDays(int days) {
224:                backupDays = days;
225:            }
226:
227:            /**
228:             * Set the backup last day
229:             */
230:            public void setBackupLastDay(int day) {
231:                backupLastDay = day;
232:            }
233:
234:            /**
235:             * Set the backup time
236:             */
237:            public void setBackupTime(int time) {
238:                backupTime = time;
239:            }
240:
241:            /**
242:             * Set the backup format
243:             */
244:            public void setBackupFormat(String fmt) {
245:                backupFormat = fmt;
246:            }
247:
248:            /**
249:             * Set the backup directory
250:             */
251:            public void setNextTransId(long id) {
252:                nextTransId = id;
253:            }
254:
255:            /**
256:             * Read me from a stream
257:             */
258:            public void readExternal(ObjectInput in) throws IOException,
259:                    ClassNotFoundException {
260:                buildNumber = in.readInt();
261:                tableIndexNode = in.readLong();
262:                indexIndexNode = in.readLong();
263:                forwardDepsNode = in.readLong();
264:                reverseDepsNode = in.readLong();
265:                blobRefCountRoot = in.readLong();
266:                nextTransId = in.readLong();
267:                dbFileName = (String) in.readObject();
268:                unused2 = (String) in.readObject();
269:                unused1 = (String) in.readObject();
270:                backupDir = (String) in.readObject();
271:                backupCount = in.readInt();
272:                backupDays = in.readInt();
273:                backupLastDay = in.readInt();
274:                backupTime = in.readInt();
275:                backupFormat = (String) in.readObject();
276:            }
277:
278:            /**
279:             * Write me to a stream
280:             */
281:            public void writeExternal(ObjectOutput out) throws IOException {
282:                out.writeInt(buildNumber);
283:                out.writeLong(tableIndexNode);
284:                out.writeLong(indexIndexNode);
285:                out.writeLong(forwardDepsNode);
286:                out.writeLong(reverseDepsNode);
287:                out.writeLong(blobRefCountRoot);
288:                out.writeLong(nextTransId);
289:                out.writeObject(dbFileName);
290:                out.writeObject(unused2);
291:                out.writeObject(unused1);
292:                out.writeObject(backupDir);
293:                out.writeInt(backupCount);
294:                out.writeInt(backupDays);
295:                out.writeInt(backupLastDay);
296:                out.writeInt(backupTime);
297:                out.writeObject(backupFormat);
298:            }
299:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.