Source Code Cross Referenced for MemoryDataStoreResponseMessage.java in  » Net » Terracotta » com » tc » memorydatastore » message » 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 » Net » Terracotta » com.tc.memorydatastore.message 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice.  All rights reserved.
003:         */
004:        package com.tc.memorydatastore.message;
005:
006:        import com.tc.bytes.TCByteBuffer;
007:        import com.tc.io.TCByteBufferOutput;
008:        import com.tc.net.protocol.tcm.MessageChannel;
009:        import com.tc.net.protocol.tcm.MessageMonitor;
010:        import com.tc.net.protocol.tcm.TCMessageHeader;
011:        import com.tc.net.protocol.tcm.TCMessageType;
012:        import com.tc.object.lockmanager.api.ThreadID;
013:        import com.tc.object.msg.DSOMessageBase;
014:        import com.tc.object.session.SessionID;
015:
016:        import java.io.IOException;
017:        import java.util.Collection;
018:
019:        public class MemoryDataStoreResponseMessage extends DSOMessageBase {
020:            private static final byte TYPE = 1;
021:            private static final byte THREAD_ID = 2;
022:            private static final byte REQUEST_COMPLETED_FLAG = 3;
023:            private static final byte VALUE = 4;
024:            private static final byte NUM_OF_REMOVE = 5;
025:
026:            public static final int PUT_RESPONSE = 4;
027:            public static final int GET_RESPONSE = 5;
028:            public static final int GET_ALL_RESPONSE = 6;
029:            public static final int REMOVE_RESPONSE = 7;
030:            public static final int REMOVE_ALL_RESPONSE = 8;
031:
032:            private int type;
033:            private int numOfRemove;
034:            private boolean requestCompletedFlag;
035:            private ThreadID threadID;
036:            private TCMemoryDataStoreMessageData value;
037:
038:            public MemoryDataStoreResponseMessage(SessionID sessionID,
039:                    MessageMonitor monitor, TCByteBufferOutput out,
040:                    MessageChannel channel, TCMessageType type) {
041:                super (sessionID, monitor, out, channel, type);
042:            }
043:
044:            public MemoryDataStoreResponseMessage(SessionID sessionID,
045:                    MessageMonitor monitor, MessageChannel channel,
046:                    TCMessageHeader header, TCByteBuffer[] data) {
047:                super (sessionID, monitor, channel, header, data);
048:            }
049:
050:            protected void dehydrateValues() {
051:                putNVPair(TYPE, this .type);
052:                putNVPair(THREAD_ID, threadID.toLong());
053:                putNVPair(REQUEST_COMPLETED_FLAG, this .requestCompletedFlag);
054:                if (isGetResponse() || isGetAllResponse() || isRemoveResponse()) {
055:                    putNVPair(VALUE, value);
056:                }
057:                if (isRemoveAllResponse()) {
058:                    putNVPair(NUM_OF_REMOVE, this .numOfRemove);
059:                }
060:            }
061:
062:            protected String describePayload() {
063:                StringBuffer rv = new StringBuffer();
064:                rv.append("Type : ");
065:
066:                if (isPutResponse()) {
067:                    rv.append("PUT RESPONSE \n");
068:                } else if (isGetResponse()) {
069:                    rv.append("GET RESPONSE \n");
070:                } else if (isRemoveResponse()) {
071:                    rv.append("REMOVE RESPONSE \n");
072:                } else {
073:                    rv.append("UNKNOWN \n");
074:                }
075:                rv.append("Request Completed Flag: ");
076:                rv.append(this .requestCompletedFlag);
077:                rv.append(" \n");
078:
079:                rv.append(value).append('\n');
080:
081:                return rv.toString();
082:            }
083:
084:            protected boolean hydrateValue(byte name) throws IOException {
085:                switch (name) {
086:                case TYPE:
087:                    this .type = getIntValue();
088:                    return true;
089:                case THREAD_ID:
090:                    this .threadID = new ThreadID(getLongValue());
091:                    return true;
092:                case REQUEST_COMPLETED_FLAG:
093:                    this .requestCompletedFlag = getBooleanValue();
094:                    return true;
095:                case VALUE:
096:                    value = new TCMemoryDataStoreMessageData(type);
097:                    getObject(value);
098:                    return true;
099:                case NUM_OF_REMOVE:
100:                    this .numOfRemove = getIntValue();
101:                    return true;
102:                default:
103:                    return false;
104:                }
105:            }
106:
107:            public void initializePutResponse(ThreadID threadID,
108:                    boolean requestCompletedFlag) {
109:                this .type = PUT_RESPONSE;
110:                this .threadID = threadID;
111:                this .requestCompletedFlag = requestCompletedFlag;
112:            }
113:
114:            public void initializeGetResponse(ThreadID threadID, byte[] value,
115:                    boolean requestCompletedFlag) {
116:                this .type = GET_RESPONSE;
117:                this .threadID = threadID;
118:                this .requestCompletedFlag = requestCompletedFlag;
119:                this .value = new TCMemoryDataStoreMessageData(type, null, value);
120:            }
121:
122:            public void initializeGetAllResponse(ThreadID threadID,
123:                    Collection values, boolean requestCompletedFlag) {
124:                this .type = GET_ALL_RESPONSE;
125:                this .threadID = threadID;
126:                this .requestCompletedFlag = requestCompletedFlag;
127:                this .value = new TCMemoryDataStoreMessageData(type, null,
128:                        values);
129:            }
130:
131:            public void initializeRemoveResponse(ThreadID threadID,
132:                    byte[] value, boolean requestCompletedFlag) {
133:                this .type = REMOVE_RESPONSE;
134:                this .threadID = threadID;
135:                this .requestCompletedFlag = requestCompletedFlag;
136:                this .value = new TCMemoryDataStoreMessageData(type, null, value);
137:            }
138:
139:            public void initializeRemoveAllResponse(ThreadID threadID,
140:                    int numOfRemove, boolean requestCompletedFlag) {
141:                this .type = REMOVE_ALL_RESPONSE;
142:                this .threadID = threadID;
143:                this .numOfRemove = numOfRemove;
144:                this .requestCompletedFlag = requestCompletedFlag;
145:            }
146:
147:            public boolean isRequestCompletedFlag() {
148:                return requestCompletedFlag;
149:            }
150:
151:            public byte[] getValue() {
152:                return this .value.getValue();
153:            }
154:
155:            public Collection getValues() {
156:                return this .value.getValues();
157:            }
158:
159:            public ThreadID getThreadID() {
160:                return this .threadID;
161:            }
162:
163:            public int getType() {
164:                return this .type;
165:            }
166:
167:            public int getNumOfRemove() {
168:                return numOfRemove;
169:            }
170:
171:            public boolean isGetResponse() {
172:                return this .type == GET_RESPONSE
173:                        || this .type == GET_ALL_RESPONSE;
174:            }
175:
176:            private boolean isPutResponse() {
177:                return this .type == PUT_RESPONSE;
178:            }
179:
180:            private boolean isGetAllResponse() {
181:                return this .type == GET_ALL_RESPONSE;
182:            }
183:
184:            private boolean isRemoveResponse() {
185:                return this .type == REMOVE_RESPONSE;
186:            }
187:
188:            private boolean isRemoveAllResponse() {
189:                return this.type == REMOVE_ALL_RESPONSE;
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.