Source Code Cross Referenced for QEntityContext.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » ejb » entity » 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 » EJB Server resin 3.1.5 » resin » com.caucho.ejb.entity 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *   Free SoftwareFoundation, Inc.
023:         *   59 Temple Place, Suite 330
024:         *   Boston, MA 02111-1307  USA
025:         *
026:         * @author Scott Ferguson
027:         */
028:
029:        package com.caucho.ejb.entity;
030:
031:        import com.caucho.amber.entity.EntityItem;
032:        import com.caucho.ejb.AbstractContext;
033:        import com.caucho.ejb.AbstractServer;
034:        import com.caucho.ejb.xa.EjbTransactionManager;
035:
036:        import javax.ejb.*;
037:        import javax.transaction.UserTransaction;
038:        import java.util.logging.Level;
039:        import java.util.logging.Logger;
040:
041:        /**
042:         * Abstract base class for an EntityHome.
043:         */
044:        public abstract class QEntityContext extends AbstractContext implements 
045:                EntityContext {
046:            private static final Logger log = Logger
047:                    .getLogger(QEntityContext.class.getName());
048:
049:            protected final EntityServer _server;
050:            public Object _primaryKey;
051:
052:            private Object _remoteView;
053:            private EJBObject _remote;
054:
055:            protected QEntityContext(EntityServer server) {
056:                _server = server;
057:            }
058:
059:            /**
060:             * Returns the owning server.
061:             */
062:            public AbstractServer getServer() {
063:                return _server;
064:            }
065:
066:            /**
067:             * Returns the owning server.
068:             */
069:            public EntityServer getEntityServer() {
070:                return _server;
071:            }
072:
073:            /**
074:             * Returns the transaction manager.
075:             */
076:            public EjbTransactionManager getTransactionManager() {
077:                return getEntityServer().getTransactionManager();
078:            }
079:
080:            /**
081:             * Returns the home handle for the home bean.
082:             */
083:            public HomeHandle getHomeHandle() {
084:                return getServer().getHomeHandle();
085:            }
086:
087:            /**
088:             * Returns the home interface
089:             */
090:            public EJBHome getEJBHome() {
091:                return getServer().getEJBHome();
092:            }
093:
094:            public void setPrimaryKey(Object key) {
095:                _primaryKey = key;
096:            }
097:
098:            /**
099:             * Returns null, since primary key isn't available to the home.
100:             */
101:            public Object getPrimaryKey() throws IllegalStateException {
102:                if (_primaryKey == null) {
103:                    throw new IllegalStateException(
104:                            "Can't get primary key.  The context may belong to a home instance or it may be called before ejbActivate or ejbCreate.");
105:                } else
106:                    return _primaryKey;
107:            }
108:
109:            /**
110:             * Returns null, since primary key isn't available to the home.
111:             */
112:            public Object _caucho_getPrimaryKey() {
113:                return _primaryKey;
114:            }
115:
116:            /**
117:             * Returns the current UserTransaction.  Only Session beans with
118:             * bean-managed transactions may use this.
119:             */
120:            public UserTransaction getUserTransaction()
121:                    throws IllegalStateException {
122:                throw new IllegalStateException(
123:                        "Entity beans may not call getUserTransaction()");
124:            }
125:
126:            /**
127:             * Returns the object's handle.
128:             */
129:            public Handle getHandle() {
130:                return getEntityServer().createHandle(_primaryKey);
131:            }
132:
133:            /**
134:             * Returns null, since the ejb object isn't available to the home.
135:             */
136:            public EJBObject getEJBObject() throws IllegalStateException {
137:                /*
138:                if (_remote == null)
139:                  _remote = getEntityServer().createEJBObject(getPrimaryKey());
140:                
141:                return _remote;
142:                 */
143:                return getRemoteView();
144:            }
145:
146:            /**
147:             * Finish any caching for the entity.
148:             */
149:            public void postCreate(Object primaryKey) {
150:                _primaryKey = primaryKey;
151:
152:                getEntityServer().postCreate(primaryKey, this );
153:            }
154:
155:            /**
156:             * Remove the object specified by the handle.
157:             */
158:            public void remove(Handle handle) {
159:                getServer().remove(handle);
160:            }
161:
162:            /**
163:             * Remove the object specified by the primary key.
164:             */
165:            public void remove(Object primaryKey) {
166:                getServer().remove(primaryKey);
167:            }
168:
169:            public void _caucho_remove_callback(Class listenClass,
170:                    Object primaryKey) throws RemoveException {
171:            }
172:
173:            /**
174:             * Invalidate the cache the entity server.
175:             */
176:            public void invalidateHomeCache() {
177:                getServer().invalidateCache();
178:            }
179:
180:            /**
181:             * Update the context.
182:             */
183:            public void update() {
184:            }
185:
186:            /**
187:             * Sets the Amber entity item.
188:             */
189:            protected void __caucho_setAmber(EntityItem item) {
190:            }
191:
192:            public abstract void _caucho_load() throws FinderException;
193:
194:            /**
195:             * Callback when removed from the cache.
196:             */
197:            public void removeEvent() {
198:                try {
199:                    destroy();
200:                } catch (Exception e) {
201:                    log.log(Level.WARNING, e.toString(), e);
202:                }
203:            }
204:
205:            /**
206:             * Destroy the context.
207:             */
208:            public void destroy() throws Exception {
209:                super.destroy();
210:
211:                _remote = null;
212:                _remoteView = null;
213:            }
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.