Source Code Cross Referenced for InstanceCallbackNonPersistFdsClass.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » pobjects » tck » 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 ORM » Speedo_1.4.5 » org.objectweb.speedo.pobjects.tck 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
003:         * Use is subject to license terms.
004:         *
005:         */
006:
007:        package org.objectweb.speedo.pobjects.tck;
008:
009:        import java.io.Serializable;
010:        import java.util.ArrayList;
011:        import java.util.Date;
012:        import java.util.HashSet;
013:        import java.util.Iterator;
014:
015:        import javax.jdo.Extent;
016:        import javax.jdo.InstanceCallbacks;
017:        import javax.jdo.PersistenceManager;
018:
019:        class InstanceCallbackNonPersistFdsClass implements  InstanceCallbacks {
020:            public int i; // non-managed
021:            public char c; // non-managed
022:            double d; // transactional
023:            short s; // transactional
024:            HashSet children; // non-managed
025:            Date loadTime; // non-managed
026:
027:            private int keyValue; // persistent--used as key field in application identity
028:            float floatValue; // persistent
029:            int intValue; // persistent  --primary key field
030:
031:            static private int nextKeyValue = 1;
032:
033:            static int savedIntValue;
034:            static float savedFloatValue;
035:
036:            static Date savedLoadTime;
037:            static String member1 = "one";
038:            static String member2 = "two";
039:            static String member3 = "three";
040:
041:            static boolean preClearCalled = false;
042:            static boolean preStoreCalled = false;
043:            static boolean preDeleteCalled = false;
044:            static boolean postloadCalled = false;
045:            static boolean postloadCalledMultipleTimes = false;
046:
047:            // used in CallingJdoPostload test
048:            static int beforeGetObjectById = 1;
049:            static int afterGetObjectById = 2;
050:            static int savedApplicationStep;
051:            static int applicationStep; // values are 0, beforeGetObjectById and afterGetObjectById 
052:
053:            // used in ModificationOfNontransactionalNonpersistentFields test
054:            static ArrayList exceptions = new ArrayList();
055:            static ArrayList callbackCalled = new ArrayList();
056:            static ArrayList attributeOpCausingExceptions = new ArrayList();
057:
058:            static void initializeStaticsForTest() {
059:                savedIntValue = 0;
060:                savedFloatValue = 0.0f;
061:                savedLoadTime = null;
062:                preClearCalled = false;
063:                preStoreCalled = false;
064:                preDeleteCalled = false;
065:                postloadCalled = false;
066:                postloadCalledMultipleTimes = false;
067:                savedApplicationStep = 0;
068:                applicationStep = 0;
069:
070:                exceptions = new ArrayList();
071:                callbackCalled = new ArrayList();
072:                attributeOpCausingExceptions = new ArrayList();
073:            }
074:
075:            static void removeAllInstances(PersistenceManager pm) {
076:                Extent e = pm
077:                        .getExtent(
078:                                org.objectweb.speedo.pobjects.tck.InstanceCallbackNonPersistFdsClass.class,
079:                                true);
080:                Iterator it = e.iterator();
081:                while (it.hasNext()) {
082:                    pm.deletePersistent(it.next());
083:                }
084:            }
085:
086:            InstanceCallbackNonPersistFdsClass() {
087:            }
088:
089:            InstanceCallbackNonPersistFdsClass(float floatValue, int intValue) {
090:                keyValue = nextKeyValue++;
091:                this .floatValue = floatValue;
092:                this .intValue = intValue;
093:            }
094:
095:            void setNonPersist(int i, char c, double d, short s) {
096:                this .i = i;
097:                this .c = c;
098:                this .d = d;
099:                this .s = s;
100:            }
101:
102:            void setNonManaged(int i, char c) {
103:                this .i = i;
104:                this .c = c;
105:            }
106:
107:            int calcIntValue() {
108:                return i * c;
109:            }
110:
111:            float calcFloatValue() {
112:                return (float) (d * s);
113:            }
114:
115:            void incrementIntValue() {
116:                intValue++;
117:            }
118:
119:            public void jdoPreStore() {
120:                preStoreCalled = true;
121:                intValue = calcIntValue();
122:                floatValue = calcFloatValue();
123:
124:                try {
125:                    i = -30;
126:                } catch (Exception e) {
127:                    callbackCalled.add("jdoPreStore ");
128:                    exceptions.add(e);
129:                    attributeOpCausingExceptions.add("i = -30;");
130:                }
131:                try {
132:                    c = '\u0000';
133:                } catch (Exception e) {
134:                    callbackCalled.add("jdoPreStore ");
135:                    exceptions.add(e);
136:                    attributeOpCausingExceptions.add("c = '\u0000';");
137:                }
138:                try {
139:                    d = 362.5;
140:                } catch (Exception e) {
141:                    callbackCalled.add("jdoPreStore ");
142:                    exceptions.add(e);
143:                    attributeOpCausingExceptions.add("d = 362.5;");
144:                }
145:                try {
146:                    s = 0;
147:                } catch (Exception e) {
148:                    callbackCalled.add("jdoPreStore ");
149:                    exceptions.add(e);
150:                    attributeOpCausingExceptions.add("s = 0;");
151:                }
152:                try {
153:                    loadTime = null;
154:                } catch (Exception e) {
155:                    callbackCalled.add("jdoPreStore ");
156:                    exceptions.add(e);
157:                    attributeOpCausingExceptions.add("loadTime = null;");
158:                }
159:                try {
160:                    children = null;
161:                } catch (Exception e) {
162:                    callbackCalled.add("jdoPreStore ");
163:                    exceptions.add(e);
164:                    attributeOpCausingExceptions.add("children = null;");
165:                }
166:            }
167:
168:            public void jdoPreDelete() {
169:                preDeleteCalled = true;
170:                try {
171:                    i = 0;
172:                } catch (Exception e) {
173:                    callbackCalled.add("jdoPreDelete ");
174:                    exceptions.add(e);
175:                    attributeOpCausingExceptions.add("i = 0;");
176:                }
177:                try {
178:                    c = 'x';
179:                } catch (Exception e) {
180:                    callbackCalled.add("jdoPreDelete ");
181:                    exceptions.add(e);
182:                    attributeOpCausingExceptions.add("c = 'x';");
183:                }
184:                try {
185:                    d = 0.0;
186:                } catch (Exception e) {
187:                    callbackCalled.add("jdoPreDelete ");
188:                    exceptions.add(e);
189:                    attributeOpCausingExceptions.add("d = 0.0;");
190:                }
191:                try {
192:                    s = -5;
193:                } catch (Exception e) {
194:                    callbackCalled.add("jdoPreDelete ");
195:                    exceptions.add(e);
196:                    attributeOpCausingExceptions.add("s = -5;");
197:                }
198:                try {
199:                    loadTime = null;
200:                } catch (Exception e) {
201:                    callbackCalled.add("jdoPreDelete ");
202:                    exceptions.add(e);
203:                    attributeOpCausingExceptions.add("loadTime = null;");
204:                }
205:                try {
206:                    children = null;
207:                } catch (Exception e) {
208:                    callbackCalled.add("jdoPreDelete ");
209:                    exceptions.add(e);
210:                    attributeOpCausingExceptions.add("children = null;");
211:                }
212:            }
213:
214:            public void jdoPostLoad() {
215:                postloadCalled = true;
216:                savedApplicationStep = applicationStep;
217:                i = -10;
218:                c = '2';
219:                d = 30.0;
220:                s = 40;
221:                savedIntValue = intValue;
222:                savedFloatValue = floatValue;
223:                loadTime = new Date();
224:                savedLoadTime = loadTime;
225:                children = new HashSet();
226:                children.add(member1);
227:                children.add(member2);
228:                children.add(member3);
229:            }
230:
231:            public void jdoPreClear() {
232:                preClearCalled = true;
233:                try {
234:                    i = 1;
235:                } catch (Exception e) {
236:                    callbackCalled.add("jdoPreClear ");
237:                    exceptions.add(e);
238:                    attributeOpCausingExceptions.add("i = 1;");
239:                }
240:                try {
241:                    c = '2';
242:                } catch (Exception e) {
243:                    callbackCalled.add("jdoPreClear ");
244:                    exceptions.add(e);
245:                    attributeOpCausingExceptions.add("c = '2';");
246:                }
247:                try {
248:                    d = 3.0;
249:                } catch (Exception e) {
250:                    callbackCalled.add("jdoPreClear ");
251:                    exceptions.add(e);
252:                    attributeOpCausingExceptions.add("d = 3.0;");
253:                }
254:                try {
255:                    s = 4;
256:                } catch (Exception e) {
257:                    callbackCalled.add("jdoPreClear ");
258:                    exceptions.add(e);
259:                    attributeOpCausingExceptions.add("s = 4;");
260:                }
261:                try {
262:                    loadTime = null;
263:                } catch (Exception e) {
264:                    callbackCalled.add("jdoPreClear ");
265:                    exceptions.add(e);
266:                    attributeOpCausingExceptions.add("loadTime = null;");
267:                }
268:                try {
269:                    children = null;
270:                } catch (Exception e) {
271:                    callbackCalled.add("jdoPreClear ");
272:                    exceptions.add(e);
273:                    attributeOpCausingExceptions.add("children = null;");
274:                }
275:            }
276:
277:            public static class KeyClass implements  Serializable {
278:                public int keyValue;
279:
280:                public KeyClass() {
281:                }
282:
283:                public KeyClass(String s) {
284:                    try {
285:                        keyValue = Integer.parseInt(s);
286:                    } catch (NumberFormatException e) {
287:                        keyValue = 0;
288:                    }
289:                }
290:
291:                public boolean equals(Object obj) {
292:                    if (obj == null || !this .getClass().equals(obj.getClass()))
293:                        return false;
294:                    else
295:                        return keyValue == ((KeyClass) obj).keyValue;
296:                }
297:
298:                public int hashCode() {
299:                    return keyValue;
300:                }
301:
302:                public String toString() {
303:                    return Integer.toString(keyValue);
304:                }
305:            }
306:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.