Source Code Cross Referenced for AEC2.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jtests » beans » relation » oob » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.jtests.beans.relation.oob 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library 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 GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: AEC2.java 5995 2004-12-17 15:08:36Z joaninh $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.jtests.beans.relation.oob;
027:
028:        import javax.ejb.CreateException;
029:        import javax.ejb.DuplicateKeyException;
030:        import javax.ejb.EJBException;
031:        import javax.ejb.EntityContext;
032:        import javax.ejb.FinderException;
033:        import javax.ejb.RemoveException;
034:        import javax.naming.Context;
035:        import javax.naming.InitialContext;
036:        import javax.naming.NamingException;
037:        import javax.rmi.PortableRemoteObject;
038:
039:        import org.objectweb.jonas.common.Log;
040:        import org.objectweb.util.monolog.api.BasicLevel;
041:        import org.objectweb.util.monolog.api.Logger;
042:
043:        /**
044:         * @author S.Chassande-Barrioz
045:         */
046:        public abstract class AEC2 implements  javax.ejb.EntityBean {
047:
048:            private BHomeLocal bhl = null;
049:
050:            public void m1() {
051:            }
052:
053:            public void assignB(String c) throws FinderException {
054:                logger.log(BasicLevel.DEBUG, "param=" + c);
055:                if (c != null) {
056:                    BLocal bl = null;
057:                    bl = bhl.findByPrimaryKey(c);
058:                    setB(bl);
059:                } else
060:                    setB(null);
061:            }
062:
063:            public void assignBInNewTx(String c) throws FinderException {
064:                assignB(c);
065:            }
066:
067:            public String retrieveB() {
068:                BLocal lejbB = getB();
069:                if (lejbB == null) {
070:                    logger.log(BasicLevel.DEBUG, "return null");
071:                    return null;
072:                } else {
073:                    logger.log(BasicLevel.DEBUG, "return " + lejbB.getId());
074:                    return lejbB.getId();
075:                }
076:            }
077:
078:            public String retrieveBInNewTx() {
079:                return retrieveB();
080:            }
081:
082:            // ------------------------------------------------------------------
083:            // Get and Set accessor methods of the bean's abstract schema
084:            // ------------------------------------------------------------------
085:            public abstract String getId();
086:
087:            public abstract void setId(String id);
088:
089:            public abstract BLocal getB();
090:
091:            public abstract void setB(BLocal bl);
092:
093:            public abstract BLocal getBBis();
094:
095:            public abstract void setBBis(BLocal bl);
096:
097:            // ------------------------------------------------------------------
098:            // EntityBean implementation
099:            // ------------------------------------------------------------------
100:
101:            static protected Logger logger = null;
102:            EntityContext ejbContext;
103:
104:            /**
105:             * The Entity bean can define 0 or more ejbCreate methods.
106:             *
107:             * @throws CreateException Failure to create an entity EJB object.
108:             * @throws DuplicateKeyException An object with the same key already exists.
109:             */
110:            public String ejbCreate(String id) throws CreateException,
111:                    DuplicateKeyException {
112:                logger.log(BasicLevel.DEBUG, "");
113:
114:                // Init here the bean fields
115:                setId(id);
116:
117:                // In CMP, should return null.
118:                return null;
119:            }
120:
121:            /**
122:             * Set the associated entity context. The container invokes this method
123:             * on an instance after the instance has been created.
124:             * This method is called in an unspecified transaction context.
125:             *
126:             * @param ctx - An EntityContext interface for the instance. The instance
127:             * should store the reference to the context in an instance variable.
128:             * @throws EJBException Thrown by the method to indicate a failure caused by a
129:             * system-level error.
130:             */
131:            public void setEntityContext(EntityContext ctx) {
132:                if (logger == null)
133:                    logger = Log.getLogger(Log.JONAS_TESTS_PREFIX);
134:                logger.log(BasicLevel.DEBUG, "");
135:                ejbContext = ctx;
136:                try {
137:                    Context ictx = new InitialContext();
138:                    bhl = (BHomeLocal) ictx.lookup("java:comp/env/ejb/b");
139:                } catch (NamingException e) {
140:                    throw new EJBException("Impossible to fetch the ", e);
141:                }
142:            }
143:
144:            /**
145:             * Unset the associated entity context. The container calls this method
146:             * before removing the instance.
147:             * This is the last method that the container invokes on the instance.
148:             * The Java garbage collector will eventually invoke the finalize() method
149:             * on the instance.
150:             * This method is called in an unspecified transaction context.
151:             *
152:             * @throws EJBException Thrown by the method to indicate a failure caused by a
153:             * system-level error.
154:             */
155:            public void unsetEntityContext() {
156:                logger.log(BasicLevel.DEBUG, "");
157:                ejbContext = null;
158:            }
159:
160:            /**
161:             * A container invokes this method before it removes the EJB object
162:             * that is currently associated with the instance. This method is
163:             * invoked when a client invokes a remove operation on the enterprise Bean's
164:             * home interface or the EJB object's remote interface. This method
165:             * transitions the instance from the ready state to the pool of available
166:             * instances.
167:             *
168:             * This method is called in the transaction context of the remove operation.
169:             * @throws RemoveException  The enterprise Bean does not allow destruction of the object.
170:             * @throws EJBException - Thrown by the method to indicate a failure caused by a system-level
171:             * error.
172:             */
173:            public void ejbRemove() throws RemoveException {
174:                logger.log(BasicLevel.DEBUG, "");
175:            }
176:
177:            /**
178:             * A container invokes this method to instruct the instance to synchronize
179:             * its state by loading it state from the underlying database.
180:             * This method always executes in the proper transaction context.
181:             *
182:             * @throws EJBException Thrown by the method to indicate a failure caused by
183:             * a system-level error.
184:             */
185:            public void ejbLoad() {
186:                logger.log(BasicLevel.DEBUG, "");
187:            }
188:
189:            /**
190:             * A container invokes this method to instruct the instance to synchronize
191:             * its state by storing it to the underlying database.
192:             * This method always executes in the proper transaction context.
193:             *
194:             * @throws EJBException Thrown by the method to indicate a failure caused by
195:             * a system-level error.
196:             */
197:            public void ejbStore() {
198:                logger.log(BasicLevel.DEBUG, "");
199:            }
200:
201:            /**
202:             * There must be an ejbPostCreate par ejbCreate method
203:             *
204:             * @throws CreateException Failure to create an entity EJB object.
205:             */
206:            public void ejbPostCreate(String id) throws CreateException {
207:                logger.log(BasicLevel.DEBUG, "id=" + id);
208:            }
209:
210:            /**
211:             * A container invokes this method on an instance before the instance
212:             * becomes disassociated with a specific EJB object.
213:             */
214:            public void ejbPassivate() {
215:                logger.log(BasicLevel.DEBUG, "");
216:            }
217:
218:            /**
219:             * A container invokes this method when the instance is taken out of
220:             * the pool of available instances to become associated with a specific
221:             * EJB object.
222:             */
223:            public void ejbActivate() {
224:                logger.log(BasicLevel.DEBUG, "");
225:            }
226:
227:        }
w___w__w.___ja___v_a_2___s__._c___o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.