Source Code Cross Referenced for RmiIiopCmp2Bean.java in  » J2EE » openejb3 » org » apache » openejb » test » entity » cmp » 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 » openejb3 » org.apache.openejb.test.entity.cmp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */package org.apache.openejb.test.entity.cmp;
017:
018:        import java.util.StringTokenizer;
019:        import javax.ejb.CreateException;
020:        import javax.ejb.EJBException;
021:        import javax.ejb.EJBHome;
022:        import javax.ejb.EJBMetaData;
023:        import javax.ejb.EJBObject;
024:        import javax.ejb.EntityBean;
025:        import javax.ejb.EntityContext;
026:        import javax.ejb.Handle;
027:        import javax.naming.InitialContext;
028:
029:        import org.apache.openejb.test.object.ObjectGraph;
030:
031:        public abstract class RmiIiopCmp2Bean implements  EntityBean {
032:            private static int nextId;
033:
034:            public EntityContext ejbContext;
035:
036:            public abstract Integer getId();
037:
038:            public abstract void setId(Integer primaryKey);
039:
040:            public abstract String getFirstName();
041:
042:            public abstract void setFirstName(String firstName);
043:
044:            public abstract String getLastName();
045:
046:            public abstract void setLastName(String lastName);
047:
048:            //=============================
049:            // Home interface methods
050:            //
051:
052:            /**
053:             * Maps to RmiIiopCmpHome.create
054:             */
055:            public Integer ejbCreate(String name) throws CreateException {
056:                setId(nextId++);
057:                StringTokenizer st = new StringTokenizer(name, " ");
058:                setFirstName(st.nextToken());
059:                setLastName(st.nextToken());
060:                return null;
061:            }
062:
063:            public void ejbPostCreate(String name) {
064:            }
065:
066:            //
067:            // Home interface methods
068:            //=============================
069:
070:            //=============================
071:            // Remote interface methods
072:            //
073:            /*-------------------------------------------------*/
074:            /*  String                                         */
075:            /*-------------------------------------------------*/
076:
077:            public String returnStringObject(String data) {
078:                return data;
079:            }
080:
081:            public String[] returnStringObjectArray(String[] data) {
082:                return data;
083:            }
084:
085:            /*-------------------------------------------------*/
086:            /*  Character                                      */
087:            /*-------------------------------------------------*/
088:
089:            public Character returnCharacterObject(Character data) {
090:                return data;
091:            }
092:
093:            public char returnCharacterPrimitive(char data) {
094:                return data;
095:            }
096:
097:            public Character[] returnCharacterObjectArray(Character[] data) {
098:                return data;
099:            }
100:
101:            public char[] returnCharacterPrimitiveArray(char[] data) {
102:                return data;
103:            }
104:
105:            /*-------------------------------------------------*/
106:            /*  Boolean                                        */
107:            /*-------------------------------------------------*/
108:
109:            public Boolean returnBooleanObject(Boolean data) {
110:                return data;
111:            }
112:
113:            public boolean returnBooleanPrimitive(boolean data) {
114:                return data;
115:            }
116:
117:            public Boolean[] returnBooleanObjectArray(Boolean[] data) {
118:                return data;
119:            }
120:
121:            public boolean[] returnBooleanPrimitiveArray(boolean[] data) {
122:                return data;
123:            }
124:
125:            /*-------------------------------------------------*/
126:            /*  Byte                                           */
127:            /*-------------------------------------------------*/
128:
129:            public Byte returnByteObject(Byte data) {
130:                return data;
131:            }
132:
133:            public byte returnBytePrimitive(byte data) {
134:                return data;
135:            }
136:
137:            public Byte[] returnByteObjectArray(Byte[] data) {
138:                return data;
139:            }
140:
141:            public byte[] returnBytePrimitiveArray(byte[] data) {
142:                return data;
143:            }
144:
145:            /*-------------------------------------------------*/
146:            /*  Short                                          */
147:            /*-------------------------------------------------*/
148:
149:            public Short returnShortObject(Short data) {
150:                return data;
151:            }
152:
153:            public short returnShortPrimitive(short data) {
154:                return data;
155:            }
156:
157:            public Short[] returnShortObjectArray(Short[] data) {
158:                return data;
159:            }
160:
161:            public short[] returnShortPrimitiveArray(short[] data) {
162:                return data;
163:            }
164:
165:            /*-------------------------------------------------*/
166:            /*  Integer                                        */
167:            /*-------------------------------------------------*/
168:
169:            public Integer returnIntegerObject(Integer data) {
170:                return data;
171:            }
172:
173:            public int returnIntegerPrimitive(int data) {
174:                return data;
175:            }
176:
177:            public Integer[] returnIntegerObjectArray(Integer[] data) {
178:                return data;
179:            }
180:
181:            public int[] returnIntegerPrimitiveArray(int[] data) {
182:                return data;
183:            }
184:
185:            /*-------------------------------------------------*/
186:            /*  Long                                           */
187:            /*-------------------------------------------------*/
188:
189:            public Long returnLongObject(Long data) {
190:                return data;
191:            }
192:
193:            public long returnLongPrimitive(long data) {
194:                return data;
195:            }
196:
197:            public Long[] returnLongObjectArray(Long[] data) {
198:                return data;
199:            }
200:
201:            public long[] returnLongPrimitiveArray(long[] data) {
202:                return data;
203:            }
204:
205:            /*-------------------------------------------------*/
206:            /*  Float                                          */
207:            /*-------------------------------------------------*/
208:
209:            public Float returnFloatObject(Float data) {
210:                return data;
211:            }
212:
213:            public float returnFloatPrimitive(float data) {
214:                return data;
215:            }
216:
217:            public Float[] returnFloatObjectArray(Float[] data) {
218:                return data;
219:            }
220:
221:            public float[] returnFloatPrimitiveArray(float[] data) {
222:                return data;
223:            }
224:
225:            /*-------------------------------------------------*/
226:            /*  Double                                         */
227:            /*-------------------------------------------------*/
228:
229:            public Double returnDoubleObject(Double data) {
230:                return data;
231:            }
232:
233:            public double returnDoublePrimitive(double data) {
234:                return data;
235:            }
236:
237:            public Double[] returnDoubleObjectArray(Double[] data) {
238:                return data;
239:            }
240:
241:            public double[] returnDoublePrimitiveArray(double[] data) {
242:                return data;
243:            }
244:
245:            /*-------------------------------------------------*/
246:            /*  EJBHome                                         */
247:            /*-------------------------------------------------*/
248:
249:            public EJBHome returnEJBHome(EJBHome data) {
250:                return data;
251:            }
252:
253:            public EJBHome returnEJBHome() {
254:                EJBHome data = null;
255:
256:                try {
257:                    InitialContext ctx = new InitialContext();
258:
259:                    data = (EJBHome) ctx
260:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
261:
262:                } catch (Exception e) {
263:                    e.printStackTrace();
264:                    throw new EJBException(e);
265:                }
266:                return data;
267:            }
268:
269:            public ObjectGraph returnNestedEJBHome() {
270:                ObjectGraph data = null;
271:
272:                try {
273:                    InitialContext ctx = new InitialContext();
274:
275:                    Object object = ctx
276:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
277:                    data = new ObjectGraph(object);
278:
279:                } catch (Exception e) {
280:                    throw new EJBException(e);
281:                }
282:                return data;
283:            }
284:
285:            public EJBHome[] returnEJBHomeArray(EJBHome[] data) {
286:                return data;
287:            }
288:
289:            /*-------------------------------------------------*/
290:            /*  EJBObject                                      */
291:            /*-------------------------------------------------*/
292:
293:            public EJBObject returnEJBObject(EJBObject data) {
294:                return data;
295:            }
296:
297:            public EJBObject returnEJBObject() {
298:                EncCmpObject data = null;
299:
300:                try {
301:                    InitialContext ctx = new InitialContext();
302:
303:                    EncCmpHome home = (EncCmpHome) ctx
304:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
305:                    data = home.create("Test01 CmpBean");
306:
307:                } catch (Exception e) {
308:                    throw new EJBException(e);
309:                }
310:                return data;
311:            }
312:
313:            public ObjectGraph returnNestedEJBObject() {
314:                ObjectGraph data = null;
315:
316:                try {
317:                    InitialContext ctx = new InitialContext();
318:
319:                    EncCmpHome home = (EncCmpHome) ctx
320:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
321:                    EncCmpObject object = home.create("Test02 CmpBean");
322:                    data = new ObjectGraph(object);
323:
324:                } catch (Exception e) {
325:                    throw new EJBException(e);
326:                }
327:                return data;
328:            }
329:
330:            public EJBObject[] returnEJBObjectArray(EJBObject[] data) {
331:                return data;
332:            }
333:
334:            /*-------------------------------------------------*/
335:            /*  EJBMetaData                                         */
336:            /*-------------------------------------------------*/
337:
338:            public EJBMetaData returnEJBMetaData(EJBMetaData data) {
339:                return data;
340:            }
341:
342:            public EJBMetaData returnEJBMetaData() {
343:                EJBMetaData data = null;
344:
345:                try {
346:                    InitialContext ctx = new InitialContext();
347:
348:                    EncCmpHome home = (EncCmpHome) ctx
349:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
350:                    data = home.getEJBMetaData();
351:
352:                } catch (Exception e) {
353:                    throw new EJBException(e);
354:                }
355:                return data;
356:            }
357:
358:            public ObjectGraph returnNestedEJBMetaData() {
359:                ObjectGraph data = null;
360:
361:                try {
362:                    InitialContext ctx = new InitialContext();
363:
364:                    EncCmpHome home = (EncCmpHome) ctx
365:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
366:                    EJBMetaData object = home.getEJBMetaData();
367:                    data = new ObjectGraph(object);
368:
369:                } catch (Exception e) {
370:                    throw new EJBException(e);
371:                }
372:                return data;
373:            }
374:
375:            public EJBMetaData[] returnEJBMetaDataArray(EJBMetaData[] data) {
376:                return data;
377:            }
378:
379:            /*-------------------------------------------------*/
380:            /*  Handle                                         */
381:            /*-------------------------------------------------*/
382:
383:            public Handle returnHandle(Handle data) {
384:                return data;
385:            }
386:
387:            public Handle returnHandle() {
388:                Handle data = null;
389:
390:                try {
391:                    InitialContext ctx = new InitialContext();
392:
393:                    EncCmpHome home = (EncCmpHome) ctx
394:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
395:                    EncCmpObject object = home.create("Test03 CmpBean");
396:                    data = object.getHandle();
397:
398:                } catch (Exception e) {
399:                    throw new EJBException(e);
400:                }
401:                return data;
402:            }
403:
404:            public ObjectGraph returnNestedHandle() {
405:                ObjectGraph data = null;
406:
407:                try {
408:                    InitialContext ctx = new InitialContext();
409:
410:                    EncCmpHome home = (EncCmpHome) ctx
411:                            .lookup("java:comp/env/cmp/rmi-iiop/home");
412:                    EncCmpObject object = home.create("Test04 CmpBean");
413:                    data = new ObjectGraph(object.getHandle());
414:
415:                } catch (Exception e) {
416:                    throw new EJBException(e);
417:                }
418:                return data;
419:            }
420:
421:            public Handle[] returnHandleArray(Handle[] data) {
422:                return data;
423:            }
424:
425:            /*-------------------------------------------------*/
426:            /*  ObjectGraph                                         */
427:            /*-------------------------------------------------*/
428:
429:            public ObjectGraph returnObjectGraph(ObjectGraph data) {
430:                return data;
431:            }
432:
433:            public ObjectGraph[] returnObjectGraphArray(ObjectGraph[] data) {
434:                return data;
435:            }
436:
437:            //
438:            // Remote interface methods
439:            //=============================
440:
441:            //================================
442:            // EntityBean interface methods
443:            //
444:
445:            /**
446:             * A container invokes this method to instruct the
447:             * instance to synchronize its state by loading it state from the
448:             * underlying database.
449:             */
450:            public void ejbLoad() {
451:            }
452:
453:            /**
454:             * Set the associated entity context. The container invokes this method
455:             * on an instance after the instance has been created.
456:             */
457:            public void setEntityContext(EntityContext ctx) {
458:                ejbContext = ctx;
459:            }
460:
461:            /**
462:             * Unset the associated entity context. The container calls this method
463:             * before removing the instance.
464:             */
465:            public void unsetEntityContext() {
466:            }
467:
468:            /**
469:             * A container invokes this method to instruct the
470:             * instance to synchronize its state by storing it to the underlying
471:             * database.
472:             */
473:            public void ejbStore() {
474:            }
475:
476:            /**
477:             * A container invokes this method before it removes the EJB object
478:             * that is currently associated with the instance. This method
479:             * is invoked when a client invokes a remove operation on the
480:             * enterprise Bean's home interface or the EJB object's remote interface.
481:             * This method transitions the instance from the ready state to the pool
482:             * of available instances.
483:             */
484:            public void ejbRemove() {
485:            }
486:
487:            /**
488:             * A container invokes this method when the instance
489:             * is taken out of the pool of available instances to become associated
490:             * with a specific EJB object. This method transitions the instance to
491:             * the ready state.
492:             */
493:            public void ejbActivate() {
494:            }
495:
496:            /**
497:             * A container invokes this method on an instance before the instance
498:             * becomes disassociated with a specific EJB object. After this method
499:             * completes, the container will place the instance into the pool of
500:             * available instances.
501:             */
502:            public void ejbPassivate() {
503:            }
504:
505:            //
506:            // EntityBean interface methods
507:            //================================
508:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.