Source Code Cross Referenced for PersistenceCapableImpl.java in  » Database-ORM » XORM » org » xorm » 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 » XORM » org.xorm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          $Header: /cvsroot/xorm/xorm/src/org/xorm/PersistenceCapableImpl.java,v 1.5 2003/09/25 18:21:23 wbiggs Exp $
003:
004:          This file is part of XORM.
005:
006:          XORM is free software; you can redistribute it and/or modify
007:          it under the terms of the GNU General Public License as published by
008:          the Free Software Foundation; either version 2 of the License, or
009:          (at your option) any later version.
010:
011:          XORM is distributed in the hope that it will be useful,
012:          but WITHOUT ANY WARRANTY; without even the implied warranty of
013:          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:          GNU General Public License for more details.
015:
016:          You should have received a copy of the GNU General Public License
017:          along with XORM; if not, write to the Free Software
018:          Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:        package org.xorm;
021:
022:        import javax.jdo.PersistenceManager;
023:        import javax.jdo.spi.PersistenceCapable;
024:        import javax.jdo.spi.StateManager;
025:
026:        /**
027:         * This class is used to implement "lookalike" PersistenceCapable
028:         * functionality in Enhancer-generated classes.  It is separated from
029:         * InterfaceInvocationHandler primarily to enforce a separation of 
030:         * concerns.
031:         *
032:         * These methods are typically not called on Enhancer-generated objects
033:         * unless JDOHelper methods are used to interrogate the item.
034:         * Methods that are only relevant to the interaction between an instance
035:         * and a JDO StateManager throw UnsupportedOperationException.  That
036:         * means it is not possible for other JDO implementations to manage
037:         * XORM objects at this time.
038:         */
039:        class PersistenceCapableImpl implements  PersistenceCapable {
040:            // 20.20.1 Generated fields
041:            protected InterfaceInvocationHandler handler;
042:
043:            PersistenceCapableImpl(InterfaceInvocationHandler handler) {
044:                this .handler = handler;
045:            }
046:
047:            // 20.20.3 Generated interrogatives
048:            public final boolean jdoIsPersistent() {
049:                return handler.isPersistent();
050:            }
051:
052:            public final boolean jdoIsTransactional() {
053:                return handler.isTransactional();
054:            }
055:
056:            public final boolean jdoIsNew() {
057:                return handler.isNew();
058:            }
059:
060:            public final boolean jdoIsDirty() {
061:                return handler.isDirty() || handler.isNew()
062:                        || handler.isDeleted();
063:            }
064:
065:            public final boolean jdoIsDeleted() {
066:                return handler.isDeleted();
067:            }
068:
069:            public final void jdoMakeDirty(String fieldName) {
070:                // TODO do this on a field basis
071:                handler.makeDirty();
072:            }
073:
074:            public final PersistenceManager jdoGetPersistenceManager() {
075:                return (handler.getStatus() == ObjectState.STATUS_TRANSIENT) ? null
076:                        : handler.getInterfaceManager();
077:            }
078:
079:            public final Object jdoGetObjectId() {
080:                Object oid = handler.getObjectId();
081:                return (!handler.isPersistent() && (oid instanceof  TransientKey)) ? null
082:                        : new ObjectId(handler.getClassMapping()
083:                                .getMappedClass(), oid);
084:            }
085:
086:            public final Object jdoGetTransactionalObjectId() {
087:                return jdoGetObjectId();
088:            }
089:
090:            // 20.20.4 Generated jdoReplaceStateManager
091:            public final synchronized void jdoReplaceStateManager(
092:                    StateManager stateManager) {
093:                throw new UnsupportedOperationException();
094:            }
095:
096:            // 20.20.5 Generated jdoReplaceFlags
097:            public final void jdoReplaceFlags() {
098:                throw new UnsupportedOperationException();
099:            }
100:
101:            // 20.20.6 Generated jdoNewInstance helpers
102:            public PersistenceCapable jdoNewInstance(StateManager stateManager) {
103:                return (PersistenceCapable) XORM.newInstance(handler
104:                        .getFactory(), handler.getClassMapping()
105:                        .getMappedClass());
106:            }
107:
108:            public PersistenceCapable jdoNewInstance(StateManager stateManager,
109:                    Object oid) {
110:                // Because only datastore identity is supported, this method
111:                // is functionally the same as the one-argument version.
112:                return jdoNewInstance(stateManager);
113:            }
114:
115:            public Object jdoNewObjectIdInstance() {
116:                throw new UnsupportedOperationException();
117:            }
118:
119:            public Object jdoNewObjectIdInstance(String arg) {
120:                return new ObjectId(arg);
121:            }
122:
123:            // 20.20.10 Generated jdoReplaceField and jdoReplaceFields
124:            public void jdoReplaceField(int fieldNumber) {
125:                throw new UnsupportedOperationException();
126:            }
127:
128:            public void jdoReplaceFields(int[] fieldNumbers) {
129:                throw new UnsupportedOperationException();
130:            }
131:
132:            // 20.20.11 Generated jdoProvideField and jdoProvideFields
133:            public void jdoProvideField(int fieldNumber) {
134:                throw new UnsupportedOperationException();
135:            }
136:
137:            public void jdoProvideFields(int[] fieldNumbers) {
138:                throw new UnsupportedOperationException();
139:            }
140:
141:            // 20.20.12 Generated jdoCopyField and jdoCopyFields
142:            public void jdoCopyFields(Object pc, int[] fieldNumbers) {
143:                throw new UnsupportedOperationException();
144:            }
145:
146:            // 20.20.16
147:            public void jdoCopyKeyFieldsToObjectId(
148:                    PersistenceCapable.ObjectIdFieldSupplier supplier,
149:                    Object oid) {
150:                throw new UnsupportedOperationException();
151:            }
152:
153:            public void jdoCopyKeyFieldsToObjectId(Object oid) {
154:                throw new UnsupportedOperationException();
155:            }
156:
157:            // 20.20.17
158:            public void jdoCopyKeyFieldsFromObjectId(
159:                    PersistenceCapable.ObjectIdFieldConsumer consumer,
160:                    Object oid) {
161:                throw new UnsupportedOperationException();
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.