Source Code Cross Referenced for MockTCObject.java in  » Net » Terracotta » com » tc » object » 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.object 
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
003:         * notice. All rights reserved.
004:         */
005:        package com.tc.object;
006:
007:        import com.tc.exception.ImplementMe;
008:        import com.tc.object.dna.api.DNA;
009:        import com.tc.object.dna.api.DNAException;
010:        import com.tc.object.dna.api.DNAWriter;
011:
012:        import gnu.trove.TLinkable;
013:
014:        import java.util.LinkedList;
015:        import java.util.List;
016:
017:        /**
018:         * Mock implementation of TCObject for testing.
019:         */
020:        public class MockTCObject implements  TCObject {
021:            private ObjectID id;
022:            private Object peer;
023:            private List history = new LinkedList();
024:            private final Object resolveLock = new Object();
025:            private long version = 0;
026:            private TCClass tcClazz;
027:            private boolean accessed = false;
028:
029:            private boolean dehydrateReturnValue = true;
030:
031:            public MockTCObject(final ObjectID id, final Object obj) {
032:                this (id, obj, false, false);
033:            }
034:
035:            public MockTCObject(final ObjectID id, final Object obj,
036:                    boolean isIndexed, boolean isLogical) {
037:                this .peer = obj;
038:                this .id = id;
039:                this .tcClazz = new MockTCClass(isIndexed, isLogical);
040:            }
041:
042:            public void setDehydrateReturnValue(boolean dehydrateReturnValue) {
043:                this .dehydrateReturnValue = dehydrateReturnValue;
044:            }
045:
046:            public List getHistory() {
047:                return history;
048:            }
049:
050:            public ObjectID getObjectID() {
051:                return this .id;
052:            }
053:
054:            public Object getPeerObject() {
055:                return this .peer;
056:            }
057:
058:            public TCClass getTCClass() {
059:                return this .tcClazz;
060:            }
061:
062:            public void booleanFieldChanged(String classname, String fieldname,
063:                    boolean newValue, int index) {
064:                if ("java.lang.reflect.AccessibleObject.override"
065:                        .equals(fieldname)) {
066:                    // do nothing since the support for AccessibleObject looks up the
067:                    // TCObject instance in the currently active ClientObjectManager, which causes
068:                    // and exception to be thrown during the tests since their accessible status is
069:                    // always set to 'true' before execution
070:                } else {
071:                    throw new ImplementMe();
072:                }
073:            }
074:
075:            public void byteFieldChanged(String classname, String fieldname,
076:                    byte newValue, int index) {
077:                throw new ImplementMe();
078:            }
079:
080:            public void charFieldChanged(String classname, String fieldname,
081:                    char newValue, int index) {
082:                throw new ImplementMe();
083:            }
084:
085:            public void doubleFieldChanged(String classname, String fieldname,
086:                    double newValue, int index) {
087:                throw new ImplementMe();
088:            }
089:
090:            public void floatFieldChanged(String classname, String fieldname,
091:                    float newValue, int index) {
092:                throw new ImplementMe();
093:            }
094:
095:            public void intFieldChanged(String classname, String fieldname,
096:                    int newValue, int index) {
097:                throw new ImplementMe();
098:            }
099:
100:            public void longFieldChanged(String classname, String fieldname,
101:                    long newValue, int index) {
102:                throw new ImplementMe();
103:            }
104:
105:            public void shortFieldChanged(String classname, String fieldname,
106:                    short newValue, int index) {
107:                throw new ImplementMe();
108:            }
109:
110:            public void hydrate(DNA from, boolean force) throws DNAException {
111:                // do nothing
112:            }
113:
114:            public void resolveReference(String fieldName) {
115:                throw new ImplementMe();
116:            }
117:
118:            public void resolveArrayReference(int index) {
119:                return;
120:            }
121:
122:            public boolean dehydrateIfNew(DNAWriter writer) throws DNAException {
123:                return dehydrateReturnValue;
124:            }
125:
126:            public void objectFieldChanged(String classname, String fieldname,
127:                    Object newValue, int index) {
128:                return;
129:            }
130:
131:            public boolean isPhysical() {
132:                return true;
133:            }
134:
135:            public boolean isLogical() {
136:                return false;
137:            }
138:
139:            public static class MethodCall {
140:                public int method;
141:                public Object[] parameters;
142:
143:                public MethodCall(int method, Object[] parameters) {
144:                    this .method = method;
145:                    this .parameters = parameters;
146:                }
147:
148:                public String toString() {
149:                    StringBuffer sb = new StringBuffer();
150:                    sb.append(method);
151:                    sb.append("(");
152:                    for (int i = 0; i < parameters.length; i++) {
153:                        sb.append(parameters[i].toString());
154:                        if (i + 1 < parameters.length) {
155:                            sb.append(',');
156:                        }
157:                    }
158:                    sb.append(")");
159:                    return sb.toString();
160:                }
161:            }
162:
163:            public ObjectID setReference(String fieldName, ObjectID id) {
164:                throw new ImplementMe();
165:            }
166:
167:            public void setArrayReference(int index, ObjectID id) {
168:                throw new ImplementMe();
169:            }
170:
171:            public void setValue(String fieldName, Object obj) {
172:                throw new ImplementMe();
173:            }
174:
175:            public long getVersion() {
176:                return version;
177:            }
178:
179:            public void setVersion(long version) {
180:                this .version = version;
181:            }
182:
183:            public int clearReferences(int toClear) {
184:                return 0;
185:            }
186:
187:            public Object getResolveLock() {
188:                return resolveLock;
189:            }
190:
191:            public void setNext(TLinkable link) {
192:                throw new ImplementMe();
193:            }
194:
195:            public void setPrevious(TLinkable link) {
196:                throw new ImplementMe();
197:            }
198:
199:            public TLinkable getNext() {
200:                return null;
201:            }
202:
203:            public TLinkable getPrevious() {
204:                return null;
205:            }
206:
207:            public ClassLoader getClassLoader() {
208:                return null;
209:            }
210:
211:            public void markAccessed() {
212:                this .accessed = true;
213:            }
214:
215:            public void clearAccessed() {
216:                this .accessed = false;
217:            }
218:
219:            public boolean recentlyAccessed() {
220:                return this .accessed;
221:            }
222:
223:            public int accessCount(int factor) {
224:                throw new ImplementMe();
225:            }
226:
227:            public void clearReference(String fieldName) {
228:                throw new ImplementMe();
229:            }
230:
231:            public void resolveAllReferences() {
232:                //
233:            }
234:
235:            public void setIsNew() {
236:                //
237:            }
238:
239:            public boolean isNew() {
240:                return false;
241:            }
242:
243:            public boolean isShared() {
244:                return true;
245:            }
246:
247:            public void objectFieldChangedByOffset(String classname,
248:                    long fieldOffset, Object newValue, int index) {
249:                return;
250:            }
251:
252:            public void logicalInvoke(int method, String methodSignature,
253:                    Object[] params) {
254:                history.add(new MethodCall(method, params));
255:            }
256:
257:            public String getFieldNameByOffset(long fieldOffset) {
258:                throw new ImplementMe();
259:            }
260:
261:            public void disableAutoLocking() {
262:                throw new ImplementMe();
263:            }
264:
265:            public boolean autoLockingDisabled() {
266:                return false;
267:            }
268:
269:            public boolean canEvict() {
270:                throw new ImplementMe();
271:            }
272:
273:            public void objectArrayChanged(int startPos, Object[] array,
274:                    int length) {
275:                throw new ImplementMe();
276:            }
277:
278:            public void primitiveArrayChanged(int startPos, Object array,
279:                    int length) {
280:                throw new ImplementMe();
281:            }
282:
283:            public void literalValueChanged(Object newValue, Object oldValue) {
284:                throw new ImplementMe();
285:            }
286:
287:            public void setLiteralValue(Object newValue) {
288:                throw new ImplementMe();
289:            }
290:
291:            public ArrayIndexOutOfBoundsException checkArrayIndex(int index) {
292:                throw new ImplementMe();
293:            }
294:
295:            public boolean isFieldPortableByOffset(long fieldOffset) {
296:                throw new ImplementMe();
297:            }
298:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.