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


001:        /*-
002:         * See the file LICENSE for redistribution information.
003:         *
004:         * Copyright (c) 2002,2008 Oracle.  All rights reserved.
005:         *
006:         * $Id: NameLN.java,v 1.19.2.3 2008/01/07 15:14:16 cwl Exp $
007:         */
008:
009:        package com.sleepycat.je.tree;
010:
011:        import java.nio.ByteBuffer;
012:
013:        import com.sleepycat.je.dbi.DatabaseId;
014:        import com.sleepycat.je.log.LogEntryType;
015:        import com.sleepycat.je.log.LogException;
016:        import com.sleepycat.je.log.LogUtils;
017:
018:        /**
019:         * A NameLN represents a Leaf Node in the name->database id mapping tree.
020:         */
021:        public final class NameLN extends LN {
022:
023:            private static final String BEGIN_TAG = "<nameLN>";
024:            private static final String END_TAG = "</nameLN>";
025:
026:            private DatabaseId id;
027:            private boolean deleted;
028:
029:            /**
030:             * In the ideal world, we'd have a base LN class so that this NameLN
031:             * doesn't have a superfluous data field, but we want to optimize the LN
032:             * class for size and speed right now.
033:             */
034:            public NameLN(DatabaseId id) {
035:                super (new byte[0]);
036:                this .id = id;
037:                deleted = false;
038:            }
039:
040:            /**
041:             * Create an empty NameLN, to be filled in from the log.
042:             */
043:            public NameLN() {
044:                super ();
045:                id = new DatabaseId();
046:            }
047:
048:            public boolean isDeleted() {
049:                return deleted;
050:            }
051:
052:            void makeDeleted() {
053:                deleted = true;
054:            }
055:
056:            public DatabaseId getId() {
057:                return id;
058:            }
059:
060:            public void setId(DatabaseId id) {
061:                this .id = id;
062:            }
063:
064:            /*
065:             * Dumping
066:             */
067:
068:            public String toString() {
069:                return dumpString(0, true);
070:            }
071:
072:            public String beginTag() {
073:                return BEGIN_TAG;
074:            }
075:
076:            public String endTag() {
077:                return END_TAG;
078:            }
079:
080:            public String dumpString(int nSpaces, boolean dumpTags) {
081:                StringBuffer sb = new StringBuffer();
082:                sb.append(super .dumpString(nSpaces, dumpTags));
083:                sb.append('\n');
084:                sb.append(TreeUtils.indent(nSpaces));
085:                sb.append("<deleted val=\"").append(Boolean.toString(deleted));
086:                sb.append("\">");
087:                sb.append('\n');
088:                sb.append(TreeUtils.indent(nSpaces));
089:                sb.append("<id val=\"").append(id);
090:                sb.append("\">");
091:                sb.append('\n');
092:                return sb.toString();
093:            }
094:
095:            /*
096:             * Logging
097:             */
098:
099:            /**
100:             * Log type for transactional entries.
101:             */
102:            protected LogEntryType getTransactionalLogType() {
103:                return LogEntryType.LOG_NAMELN_TRANSACTIONAL;
104:            }
105:
106:            /**
107:             * @see Node#getLogType
108:             */
109:            public LogEntryType getLogType() {
110:                return LogEntryType.LOG_NAMELN;
111:            }
112:
113:            /**
114:             * @see LN#getLogSize
115:             */
116:            public int getLogSize() {
117:                return super .getLogSize() + // superclass
118:                        id.getLogSize() + // id
119:                        LogUtils.getBooleanLogSize(); // deleted flag
120:            }
121:
122:            /**
123:             * @see LN#writeToLog
124:             */
125:            public void writeToLog(ByteBuffer logBuffer) {
126:                /* Ask ancestors to write to log. */
127:                super .writeToLog(logBuffer); // super class
128:                id.writeToLog(logBuffer); // id
129:                LogUtils.writeBoolean(logBuffer, deleted); // deleted flag
130:            }
131:
132:            /**
133:             * @see LN#readFromLog
134:             */
135:            public void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion)
136:                    throws LogException {
137:
138:                super .readFromLog(itemBuffer, entryTypeVersion); // super class
139:                id.readFromLog(itemBuffer, entryTypeVersion); // id
140:                deleted = LogUtils.readBoolean(itemBuffer); // deleted flag
141:            }
142:
143:            /**
144:             * Dump additional fields. Done this way so the additional info can be
145:             * within the XML tags defining the dumped log entry.
146:             */
147:            protected void dumpLogAdditional(StringBuffer sb, boolean verbose) {
148:                id.dumpLog(sb, true);
149:            }
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.