Source Code Cross Referenced for RmiIiopStatelessBean.java in  » J2EE » openejb3 » org » apache » openejb » test » stateless » 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.stateless 
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.stateless;
017:
018:        import java.rmi.RemoteException;
019:
020:        import javax.ejb.EJBException;
021:        import javax.ejb.EJBHome;
022:        import javax.ejb.EJBMetaData;
023:        import javax.ejb.EJBObject;
024:        import javax.ejb.Handle;
025:        import javax.ejb.SessionContext;
026:        import javax.naming.InitialContext;
027:
028:        import org.apache.openejb.test.object.ObjectGraph;
029:
030:        /**
031:         * 
032:         * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
033:         * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
034:         */
035:        public class RmiIiopStatelessBean implements  javax.ejb.SessionBean {
036:
037:            private String name;
038:            private SessionContext ejbContext;
039:
040:            //=============================
041:            // Home interface methods
042:            //    
043:            //    
044:            // Home interface methods
045:            //=============================
046:
047:            //=============================
048:            // Remote interface methods
049:            //    
050:            /*-------------------------------------------------*/
051:            /*  String                                         */
052:            /*-------------------------------------------------*/
053:
054:            public String returnStringObject(String data) {
055:                return data;
056:            }
057:
058:            public String[] returnStringObjectArray(String[] data) {
059:                return data;
060:            }
061:
062:            /*-------------------------------------------------*/
063:            /*  Character                                      */
064:            /*-------------------------------------------------*/
065:
066:            public Character returnCharacterObject(Character data) {
067:                return data;
068:            }
069:
070:            public char returnCharacterPrimitive(char data) {
071:                return data;
072:            }
073:
074:            public Character[] returnCharacterObjectArray(Character[] data) {
075:                return data;
076:            }
077:
078:            public char[] returnCharacterPrimitiveArray(char[] data) {
079:                return data;
080:            }
081:
082:            /*-------------------------------------------------*/
083:            /*  Boolean                                        */
084:            /*-------------------------------------------------*/
085:
086:            public Boolean returnBooleanObject(Boolean data) {
087:                return data;
088:            }
089:
090:            public boolean returnBooleanPrimitive(boolean data) {
091:                return data;
092:            }
093:
094:            public Boolean[] returnBooleanObjectArray(Boolean[] data) {
095:                return data;
096:            }
097:
098:            public boolean[] returnBooleanPrimitiveArray(boolean[] data) {
099:                return data;
100:            }
101:
102:            /*-------------------------------------------------*/
103:            /*  Byte                                           */
104:            /*-------------------------------------------------*/
105:
106:            public Byte returnByteObject(Byte data) {
107:                return data;
108:            }
109:
110:            public byte returnBytePrimitive(byte data) {
111:                return data;
112:            }
113:
114:            public Byte[] returnByteObjectArray(Byte[] data) {
115:                return data;
116:            }
117:
118:            public byte[] returnBytePrimitiveArray(byte[] data) {
119:                return data;
120:            }
121:
122:            /*-------------------------------------------------*/
123:            /*  Short                                          */
124:            /*-------------------------------------------------*/
125:
126:            public Short returnShortObject(Short data) {
127:                return data;
128:            }
129:
130:            public short returnShortPrimitive(short data) {
131:                return data;
132:            }
133:
134:            public Short[] returnShortObjectArray(Short[] data) {
135:                return data;
136:            }
137:
138:            public short[] returnShortPrimitiveArray(short[] data) {
139:                return data;
140:            }
141:
142:            /*-------------------------------------------------*/
143:            /*  Integer                                        */
144:            /*-------------------------------------------------*/
145:
146:            public Integer returnIntegerObject(Integer data) {
147:                return data;
148:            }
149:
150:            public int returnIntegerPrimitive(int data) {
151:                return data;
152:            }
153:
154:            public Integer[] returnIntegerObjectArray(Integer[] data) {
155:                return data;
156:            }
157:
158:            public int[] returnIntegerPrimitiveArray(int[] data) {
159:                return data;
160:            }
161:
162:            /*-------------------------------------------------*/
163:            /*  Long                                           */
164:            /*-------------------------------------------------*/
165:
166:            public Long returnLongObject(Long data) {
167:                return data;
168:            }
169:
170:            public long returnLongPrimitive(long data) {
171:                return data;
172:            }
173:
174:            public Long[] returnLongObjectArray(Long[] data) {
175:                return data;
176:            }
177:
178:            public long[] returnLongPrimitiveArray(long[] data) {
179:                return data;
180:            }
181:
182:            /*-------------------------------------------------*/
183:            /*  Float                                          */
184:            /*-------------------------------------------------*/
185:
186:            public Float returnFloatObject(Float data) {
187:                return data;
188:            }
189:
190:            public float returnFloatPrimitive(float data) {
191:                return data;
192:            }
193:
194:            public Float[] returnFloatObjectArray(Float[] data) {
195:                return data;
196:            }
197:
198:            public float[] returnFloatPrimitiveArray(float[] data) {
199:                return data;
200:            }
201:
202:            /*-------------------------------------------------*/
203:            /*  Double                                         */
204:            /*-------------------------------------------------*/
205:
206:            public Double returnDoubleObject(Double data) {
207:                return data;
208:            }
209:
210:            public double returnDoublePrimitive(double data) {
211:                return data;
212:            }
213:
214:            public Double[] returnDoubleObjectArray(Double[] data) {
215:                return data;
216:            }
217:
218:            public double[] returnDoublePrimitiveArray(double[] data) {
219:                return data;
220:            }
221:
222:            /*-------------------------------------------------*/
223:            /*  EJBHome                                         */
224:            /*-------------------------------------------------*/
225:
226:            public EJBHome returnEJBHome(EJBHome data) {
227:                return data;
228:            }
229:
230:            public EJBHome returnEJBHome() throws javax.ejb.EJBException {
231:                EJBHome data = null;
232:
233:                try {
234:                    InitialContext ctx = new InitialContext();
235:
236:                    data = (EJBHome) ctx
237:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
238:
239:                } catch (Exception e) {
240:                    e.printStackTrace();
241:                    throw new javax.ejb.EJBException(e);
242:                }
243:                return data;
244:            }
245:
246:            public ObjectGraph returnNestedEJBHome()
247:                    throws javax.ejb.EJBException {
248:                ObjectGraph data = null;
249:
250:                try {
251:                    InitialContext ctx = new InitialContext();
252:
253:                    Object object = ctx
254:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
255:                    data = new ObjectGraph(object);
256:
257:                } catch (Exception e) {
258:                    throw new javax.ejb.EJBException(e);
259:                }
260:                return data;
261:            }
262:
263:            public EJBHome[] returnEJBHomeArray(EJBHome[] data) {
264:                return data;
265:            }
266:
267:            /*-------------------------------------------------*/
268:            /*  EJBObject                                      */
269:            /*-------------------------------------------------*/
270:
271:            public EJBObject returnEJBObject(EJBObject data) {
272:                return data;
273:            }
274:
275:            public EJBObject returnEJBObject() throws javax.ejb.EJBException {
276:                EncStatelessObject data = null;
277:
278:                try {
279:                    InitialContext ctx = new InitialContext();
280:
281:                    EncStatelessHome home = (EncStatelessHome) ctx
282:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
283:                    data = home.create();
284:
285:                } catch (Exception e) {
286:                    throw new javax.ejb.EJBException(e);
287:                }
288:                return data;
289:            }
290:
291:            public ObjectGraph returnNestedEJBObject()
292:                    throws javax.ejb.EJBException {
293:                ObjectGraph data = null;
294:
295:                try {
296:                    InitialContext ctx = new InitialContext();
297:
298:                    EncStatelessHome home = (EncStatelessHome) ctx
299:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
300:                    EncStatelessObject object = home.create();
301:                    data = new ObjectGraph(object);
302:
303:                } catch (Exception e) {
304:                    throw new javax.ejb.EJBException(e);
305:                }
306:                return data;
307:            }
308:
309:            public EJBObject[] returnEJBObjectArray(EJBObject[] data) {
310:                return data;
311:            }
312:
313:            /*-------------------------------------------------*/
314:            /*  EJBMetaData                                         */
315:            /*-------------------------------------------------*/
316:
317:            public EJBMetaData returnEJBMetaData(EJBMetaData data) {
318:                return data;
319:            }
320:
321:            public EJBMetaData returnEJBMetaData()
322:                    throws javax.ejb.EJBException {
323:                EJBMetaData data = null;
324:
325:                try {
326:                    InitialContext ctx = new InitialContext();
327:
328:                    EncStatelessHome home = (EncStatelessHome) ctx
329:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
330:                    data = home.getEJBMetaData();
331:
332:                } catch (Exception e) {
333:                    throw new javax.ejb.EJBException(e);
334:                }
335:                return data;
336:            }
337:
338:            public ObjectGraph returnNestedEJBMetaData()
339:                    throws javax.ejb.EJBException {
340:                ObjectGraph data = null;
341:
342:                try {
343:                    InitialContext ctx = new InitialContext();
344:
345:                    EncStatelessHome home = (EncStatelessHome) ctx
346:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
347:                    EJBMetaData object = home.getEJBMetaData();
348:                    data = new ObjectGraph(object);
349:
350:                } catch (Exception e) {
351:                    throw new javax.ejb.EJBException(e);
352:                }
353:                return data;
354:            }
355:
356:            public EJBMetaData[] returnEJBMetaDataArray(EJBMetaData[] data) {
357:                return data;
358:            }
359:
360:            /*-------------------------------------------------*/
361:            /*  Handle                                         */
362:            /*-------------------------------------------------*/
363:
364:            public Handle returnHandle(Handle data) {
365:                return data;
366:            }
367:
368:            public Handle returnHandle() throws javax.ejb.EJBException {
369:                Handle data = null;
370:
371:                try {
372:                    InitialContext ctx = new InitialContext();
373:
374:                    EncStatelessHome home = (EncStatelessHome) ctx
375:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
376:                    EncStatelessObject object = home.create();
377:                    data = object.getHandle();
378:
379:                } catch (Exception e) {
380:                    throw new javax.ejb.EJBException(e);
381:                }
382:                return data;
383:            }
384:
385:            public ObjectGraph returnNestedHandle()
386:                    throws javax.ejb.EJBException {
387:                ObjectGraph data = null;
388:
389:                try {
390:                    InitialContext ctx = new InitialContext();
391:
392:                    EncStatelessHome home = (EncStatelessHome) ctx
393:                            .lookup("java:comp/env/stateless/rmi-iiop/home");
394:                    EncStatelessObject object = home.create();
395:                    data = new ObjectGraph(object.getHandle());
396:
397:                } catch (Exception e) {
398:                    throw new javax.ejb.EJBException(e);
399:                }
400:                return data;
401:            }
402:
403:            public Handle[] returnHandleArray(Handle[] data) {
404:                return data;
405:            }
406:
407:            /*-------------------------------------------------*/
408:            /*  ObjectGraph                                         */
409:            /*-------------------------------------------------*/
410:
411:            public ObjectGraph returnObjectGraph(ObjectGraph data) {
412:                return data;
413:            }
414:
415:            public ObjectGraph[] returnObjectGraphArray(ObjectGraph[] data) {
416:                return data;
417:            }
418:
419:            public String remove(String arg) {
420:                return arg;
421:            }
422:
423:            //    
424:            // Remote interface methods
425:            //=============================
426:
427:            //================================
428:            // SessionBean interface methods
429:            //    
430:            /**
431:             * Set the associated session context. The container calls this method
432:             * after the instance creation.
433:             */
434:            public void setSessionContext(SessionContext ctx)
435:                    throws EJBException, RemoteException {
436:                ejbContext = ctx;
437:            }
438:
439:            /**
440:             * 
441:             * @exception javax.ejb.CreateException
442:             */
443:            public void ejbCreate() throws javax.ejb.CreateException {
444:                this .name = "nameless automaton";
445:            }
446:
447:            /**
448:             * A container invokes this method before it ends the life of the session
449:             * object. This happens as a result of a client's invoking a remove
450:             * operation, or when a container decides to terminate the session object
451:             * after a timeout.
452:             */
453:            public void ejbRemove() throws EJBException, RemoteException {
454:            }
455:
456:            /**
457:             * The activate method is called when the instance is activated
458:             * from its "passive" state. The instance should acquire any resource
459:             * that it has released earlier in the ejbPassivate() method.
460:             */
461:            public void ejbActivate() throws EJBException, RemoteException {
462:                // Should never called.
463:            }
464:
465:            /**
466:             * The passivate method is called before the instance enters
467:             * the "passive" state. The instance should release any resources that
468:             * it can re-acquire later in the ejbActivate() method.
469:             */
470:            public void ejbPassivate() throws EJBException, RemoteException {
471:                // Should never called.
472:            }
473:
474:            //    
475:            // SessionBean interface methods
476:            //================================
477:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.