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


001:        /*
002:         * Derby - class org.apache.derby.impl.drda.Pkgnamcsn
003:         *
004:         * Licensed to the Apache Software Foundation (ASF) under one or more
005:         * contributor license agreements.  See the NOTICE file distributed with
006:         * this work for additional information regarding copyright ownership.
007:         * The ASF licenses this file to You under the Apache License, Version 2.0
008:         * (the "License"); you may not use this file except in compliance with
009:         * the License.  You may obtain a copy of the License at
010:         *
011:         *   http://www.apache.org/licenses/LICENSE-2.0
012:         *
013:         * Unless required by applicable law or agreed to in writing, software
014:         * distributed under the License is distributed on an "AS IS" BASIS,
015:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
016:         * implied. See the License for the specific language governing
017:         * permissions and limitations under the License.
018:         *
019:         */
020:
021:        package org.apache.derby.impl.drda;
022:
023:        /**
024:         * Class representing a PKGNAMCSN object (RDB Package Name,
025:         * Consistency Token, and Section Number).
026:         */
027:        final class Pkgnamcsn {
028:            /** Database name. */
029:            private final String rdbnam;
030:            /** RDB Package Collection Identifier. */
031:            private final String rdbcolid;
032:            /** RDB Package Identifier. */
033:            private final String pkgid;
034:            /** RDB Package Section Number. */
035:            private final int pkgsn;
036:            /** RDB Package Consistency Token. */
037:            private final ConsistencyToken pkgcnstkn;
038:
039:            /** Object which can be used for hashing when the consistency
040:             * token can be ignored. */
041:            private Object statementKey = null;
042:
043:            /**
044:             * Create a new <code>Pkgnamcsn</code> instance.
045:             *
046:             * @param rdbnam database name
047:             * @param rdbcolid RDB Package Collection Identifier
048:             * @param pkgid RDB Package Identifier
049:             * @param pkgsn RDB Package Section Number
050:             * @param pkgcnstkn RDB Package Consistency Token
051:             */
052:            Pkgnamcsn(String rdbnam, String rdbcolid, String pkgid, int pkgsn,
053:                    ConsistencyToken pkgcnstkn) {
054:                this .rdbnam = rdbnam;
055:                this .rdbcolid = rdbcolid;
056:                this .pkgid = pkgid;
057:                this .pkgsn = pkgsn;
058:                this .pkgcnstkn = pkgcnstkn;
059:            }
060:
061:            /**
062:             * Get RDBNAM.
063:             *
064:             * @return database name
065:             */
066:            public String getRdbnam() {
067:                return rdbnam;
068:            }
069:
070:            /**
071:             * Get RDBCOLID.
072:             *
073:             * @return RDB Package Collection Identifier
074:             */
075:            public String getRdbcolid() {
076:                return rdbcolid;
077:            }
078:
079:            /**
080:             * Get PKGID.
081:             *
082:             * @return RDB Package Identifier
083:             */
084:            public String getPkgid() {
085:                return pkgid;
086:            }
087:
088:            /**
089:             * Get PKGSN.
090:             *
091:             * @return RDB Package Section Number
092:             */
093:            public int getPkgsn() {
094:                return pkgsn;
095:            }
096:
097:            /**
098:             * Get PKGCNSTKN.
099:             *
100:             * @return RDB Package Consistency Token
101:             */
102:            public ConsistencyToken getPkgcnstkn() {
103:                return pkgcnstkn;
104:            }
105:
106:            /**
107:             * Return string representation.
108:             *
109:             * @return a <code>String</code> value
110:             */
111:            public String toString() {
112:                return super .toString() + "(\"" + rdbnam + "\", \"" + rdbcolid
113:                        + "\", \"" + pkgid + "\", " + pkgsn + ", " + pkgcnstkn
114:                        + ")";
115:            }
116:
117:            /**
118:             * Return an object which can be used as a key in a hash table
119:             * when the value of the consistency token can be ignored. The
120:             * object has <code>equals()</code> and <code>hashCode()</code>
121:             * methods which consider other objects returned from
122:             * <code>getStatementKey()</code> equal if RDBNAM, RDBCOLID, PKGID
123:             * and PKGSN are equal.
124:             *
125:             * @return an <code>Object</code> value
126:             * @see Database#getDRDAStatement(Pkgnamcsn)
127:             * @see Database#storeStatement(DRDAStatement)
128:             * @see Database#removeStatement(DRDAStatement)
129:             */
130:            public Object getStatementKey() {
131:                if (statementKey == null) {
132:                    statementKey = new StatementKey();
133:                }
134:                return statementKey;
135:            }
136:
137:            /**
138:             * Class for objects used as keys in the hash table
139:             * <code>stmtTable</code> found in the <code>Database</code>
140:             * class. The <code>equals()</code> and <code>hashCode()</code>
141:             * methods consider other <code>StatementKey</code> objects equal
142:             * to this object if they are associated with a
143:             * <code>Pkgnamcsn</code> object with the same values for RDBNAM,
144:             * RDBCOLID, PKGID and PKGSN.
145:             *
146:             * @see Database
147:             */
148:            private final class StatementKey {
149:                /** Cached hash code. */
150:                private int hash = 0;
151:
152:                /**
153:                 * Check whether RDBNAM, RDBCOLID, PKGID and PKGSN of another
154:                 * <code>StatementKey</code> object matches this object.
155:                 *
156:                 * @param obj another object
157:                 * @return true if the objects are equal
158:                 */
159:                public boolean equals(Object obj) {
160:                    if (StatementKey.this  == obj) {
161:                        return true;
162:                    } else if (obj instanceof  StatementKey) {
163:                        return ((StatementKey) obj).isKeyFor(Pkgnamcsn.this );
164:                    } else {
165:                        return false;
166:                    }
167:                }
168:
169:                /**
170:                 * Calculate hash code.
171:                 *
172:                 * @return hash code
173:                 */
174:                public int hashCode() {
175:                    if (hash == 0) {
176:                        hash = rdbnam.hashCode() ^ rdbcolid.hashCode()
177:                                ^ pkgid.hashCode() ^ pkgsn;
178:                    }
179:                    return hash;
180:                }
181:
182:                /**
183:                 * Check whether this object can be used as a key for a
184:                 * <code>Pkgnamcsn</code> object.
185:                 *
186:                 * @param p a <code>Pkgnamcsn</code> value
187:                 * @return true if this object can be key for the
188:                 * <code>Pkgnamcsn</code> object
189:                 */
190:                private boolean isKeyFor(Pkgnamcsn p) {
191:                    return rdbnam.equals(p.rdbnam)
192:                            && rdbcolid.equals(p.rdbcolid)
193:                            && pkgid.equals(p.pkgid) && pkgsn == p.pkgsn;
194:                }
195:            }
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.