Source Code Cross Referenced for IDTable.java in  » Database-DBMS » Ozone-1.1 » org » ozoneDB » core » wizardStore » 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 » Ozone 1.1 » org.ozoneDB.core.wizardStore 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // You can redistribute this software and/or modify it under the terms of
002:        // the Ozone Library License version 1 published by ozone-db.org.
003:        //
004:        // The original code and portions created by SMB are
005:        // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
006:        //
007:        // $Id: IDTable.java,v 1.3 2002/06/08 00:49:39 mediumnet Exp $
008:
009:        package org.ozoneDB.core.wizardStore;
010:
011:        import java.io.*;
012:        import org.ozoneDB.DxLib.*;
013:        import org.ozoneDB.core.*;
014:        import org.ozoneDB.util.LogWriter;
015:
016:        /**
017:         * @author <a href="http://www.softwarebuero.de/">SMB</a>
018:         * @version $Revision: 1.3 $Date: 2002/06/08 00:49:39 $
019:         */
020:        public final class IDTable extends DxDiskHashMap {
021:
022:            final static long serialVersionUID = 1L;
023:
024:            public final static int MAX_CACHE_SIZE = 2000;
025:
026:            //    protected DxDeque		leafCache;
027:            //
028:            //    protected DxDeque		branchCache;
029:            //
030:            //    protected DxDeque		keyDataCache;
031:
032:            public IDTable(String _baseFileName, int _maxBufferSize,
033:                    int _cacheBits, int _tableBitSize) {
034:                super (_baseFileName, _maxBufferSize, _cacheBits, _tableBitSize);
035:                //        leafCache = new DxArrayDeque (MAX_CACHE_SIZE);
036:                //        branchCache = new DxArrayDeque (MAX_CACHE_SIZE);
037:                //        keyDataCache = new DxArrayDeque (MAX_CACHE_SIZE);
038:            }
039:
040:            public synchronized void close() throws Exception {
041:                writeDirtyTables();
042:                setReusable(true);
043:            }
044:
045:            public synchronized void writeDirtyTables() throws IOException {
046:                DxIterator it = buffer.iterator();
047:                DxDiskSubTable table = null;
048:                while ((table = (DxDiskSubTable) it.next()) != null) {
049:                    if (table.isDirty()) {
050:                        if (false) {
051:                            Env.currentEnv().logWriter.newEntry(this ,
052:                                    "write dirty table: " + table.getFile(),
053:                                    LogWriter.DEBUG);
054:                        }
055:                        table.writeTable();
056:                    }
057:                }
058:            }
059:
060:            public boolean isDirtyTable(DxDiskSubTable table) {
061:                boolean result = table.isDirty();
062:                if (false) {
063:                    Env.currentEnv().logWriter.newEntry(this ,
064:                            "isDirtyTable(): name=" + table.getFile()
065:                                    + ", dirty=" + result, LogWriter.DEBUG);
066:                }
067:                return result;
068:            }
069:
070:            public void printStatistics() {
071:                Env.currentEnv().logWriter.newEntry(this , "Statistics:",
072:                        LogWriter.INFO);
073:                Env.currentEnv().logWriter
074:                        .newEntry(this , "    sub-table accesses: "
075:                                + bufferAccesses + "  hits: " + bufferHits
076:                                + " loads: " + (bufferAccesses - bufferHits),
077:                                LogWriter.INFO);
078:                Env.currentEnv().logWriter.newEntry(this ,
079:                        "    cache accesses: " + cacheAccesses + "  hits: "
080:                                + cacheHits, LogWriter.INFO);
081:            }
082:
083:            public DxDiskHashNodeLeaf newNodeLeaf() {
084:                return new IDTableNodeLeaf(this );
085:
086:                //        System.out.print ("newNodeLeaf()... ");
087:                //        if (leafCache.isEmpty()) {
088:                //            System.out.println ("new");
089:                //            return new IDTableNodeLeaf (this);
090:                //            }
091:                //        else {
092:                //            System.out.println ("cache");
093:                //            return (DxDiskHashNodeLeaf)leafCache.popTop();
094:                //            }
095:            }
096:
097:            public DxDiskHashNodeBranch newNodeBranch() {
098:                return new IDTableNodeBranch(this );
099:
100:                //        System.out.print ("newNodeBranch()... ");
101:                //        if (branchCache.isEmpty()) {
102:                //            System.out.println ("new");
103:                //            return new IDTableNodeBranch();
104:                //            }
105:                //        else {
106:                //            System.out.println ("cache");
107:                //            return (DxDiskHashNodeBranch)branchCache.popTop();
108:                //            }
109:            }
110:
111:            public DxKeyData newKeyData() {
112:                return new DxKeyData();
113:
114:                //        System.out.print ("newKeyData()... ");
115:                //        if (keyDataCache.isEmpty()) {
116:                //            System.out.println ("new");
117:                //            return new DxKeyData();
118:                //            }
119:                //        else {
120:                //            System.out.println ("cache");
121:                //            return (DxKeyData)keyDataCache.popTop();
122:                //            }
123:            }
124:
125:            public ObjectID newObjectID() {
126:                //        System.out.println ("newObjectID()");
127:                return new ObjectID();
128:            }
129:
130:            public ClusterID newClusterID() {
131:                //        System.out.println ("newClusterID()");
132:                return new ClusterID();
133:            }
134:
135:            /**
136:             * The specified sub-table was deleted from the tree. So we have
137:             * to delete it from the table buffer too.
138:             */
139:            public synchronized void deleteRequest(DxDiskSubTable subTable) {
140:                //        System.out.println ("deleteRequest()");
141:                //
142:                //        DxDiskHashNode[] table = subTable.table();
143:                //        for (int i=0; i<table.length; i++) {
144:                //            if (table[i] instanceof IDTableNodeLeaf) {
145:                //                DxKeyData element = ((IDTableNodeLeaf)table[i]).element();
146:                //                while (element != null) {
147:                //                    if (keyDataCache.count() < MAX_CACHE_SIZE) {
148:                //                        System.out.print ("keydata cached");
149:                //                        keyDataCache.pushTop (element);
150:                //                        element = element.next;
151:                //                        }
152:                //                    else
153:                //                        System.out.print ("keydata cache full");
154:                //                    }
155:                //
156:                //                if (leafCache.count() < MAX_CACHE_SIZE) {
157:                //                    System.out.print ("leaf cached");
158:                //                    leafCache.pushTop (table[i]);
159:                //                    table[i].empty();
160:                //                    table[i] = null;
161:                //                    }
162:                //                else
163:                //                    System.out.print ("leaf cache full");
164:                //                }
165:                //            else  if (table[i] instanceof IDTableNodeBranch){
166:                //                if (branchCache.count() < MAX_CACHE_SIZE) {
167:                //                    System.out.print ("branch cached");
168:                //                    branchCache.pushTop (table[i]);
169:                //                    table[i].empty();
170:                //                    table[i] = null;
171:                //                    }
172:                //                else
173:                //                    System.out.print ("branch cache full");
174:                //                }
175:                //            else {
176:                //                throw new RuntimeException ("Unknown node type.");
177:                //                }
178:                //            }
179:
180:                super.deleteRequest(subTable);
181:            }
182:
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.