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


001:        // InboundCASLR.java
002:        // Stateless Session bean
003:
004:        package org.objectweb.jonas.jtests.beans.jca15;
005:
006:        import java.rmi.RemoteException;
007:        import javax.ejb.CreateException;
008:        import javax.ejb.EJBException;
009:        import javax.ejb.RemoveException;
010:        import javax.ejb.EJBObject;
011:        import javax.ejb.SessionBean;
012:        import javax.ejb.SessionContext;
013:        import javax.naming.Context;
014:        import javax.naming.InitialContext;
015:        import javax.naming.NamingException;
016:        import javax.resource.cci.Connection;
017:        import javax.resource.spi.ManagedConnection;
018:        import javax.resource.spi.ConnectionEvent;
019:        import javax.resource.spi.ResourceAdapter;
020:        import ersatz.resourceadapter.ManagedConnectionFactoryImpl;
021:        import ersatz.resourceadapter.ConnectionImpl;
022:        import ersatz.resourceadapter.ConnectionFactoryImpl;
023:        import ersatz.resourceadapter.ResourceAdapterImpl;
024:
025:        /**
026:         *
027:         */
028:        public class InboundCASLR implements  SessionBean {
029:
030:            SessionContext ejbContext;
031:            private ConnectionFactoryImpl cccf = null; //Common Client Connection Factory
032:            private ManagedConnectionFactoryImpl mcf = null;
033:            private ConnectionImpl conn = null;
034:            InitialContext ic = null;
035:            String cName = "InboundCASLR";
036:
037:            // ------------------------------------------------------------------
038:            // SessionBean implementation
039:            // ------------------------------------------------------------------
040:
041:            public void setSessionContext(SessionContext ctx) {
042:                Utility.log(cName + "setSessionContext");
043:                ejbContext = ctx;
044:            }
045:
046:            public void ejbRemove() {
047:                Utility.log("");
048:            }
049:
050:            public void ejbCreate() throws CreateException {
051:                Utility.log("");
052:            }
053:
054:            public void ejbPassivate() {
055:                Utility.log("");
056:            }
057:
058:            public void ejbActivate() {
059:                Utility.log("");
060:            }
061:
062:            // ------------------------------------------------------------------
063:            // InboundCA implementation
064:            // ------------------------------------------------------------------
065:
066:            /**
067:             * method1
068:             */
069:            public void method1(String rar_jndi_name, String testName)
070:                    throws Exception {
071:                Utility.log("============================ " + testName);
072:                try {
073:                    ic = new InitialContext();
074:                } catch (Exception e1) {
075:                    Utility
076:                            .log(cName
077:                                    + ".method1 error: InitialContext failed");
078:                    throw e1;
079:                }
080:                try {
081:                    cccf = (ConnectionFactoryImpl) ic.lookup(rar_jndi_name);
082:                    Utility.log(cName + ".method1 : found " + rar_jndi_name);
083:                } catch (Exception e2) {
084:                    Utility.log(cName + ".method1 error: lookup failed for "
085:                            + rar_jndi_name);
086:                    throw e2;
087:                }
088:
089:                try {
090:                    conn = (ConnectionImpl) cccf.getConnection();
091:                    Utility
092:                            .log(cName + ".method1 : getConnection conn="
093:                                    + conn);
094:                    if (conn == null) {
095:                        Utility
096:                                .log(cName
097:                                        + ".method1 error: getConnection returned null connection.");
098:                        throw new Exception("");
099:                    }
100:                } catch (Exception e3) {
101:                    Utility.log(cName + ".method1 error: getConnection failed "
102:                            + e3.toString());
103:                    throw e3;
104:                }
105:
106:            }
107:
108:            /**
109:             * closeUp
110:             */
111:            public void closeUp(int w) {
112:                try {
113:                    if (w > 0) {
114:                        // The CONNECTION_ERROR_OCCURRED indicates that the associated 
115:                        // ManagedConnection instance is now invalid and unusable.
116:                        conn.close(ConnectionEvent.CONNECTION_ERROR_OCCURRED);
117:                        Utility.log(cName
118:                                + ".closeUp : closed physical connection");
119:                    } else {
120:                        // The CONNECTION_CLOSED indicates that connection handle
121:                        // is closed, but physical connection still exists
122:                        conn.close();
123:                        Utility.log(cName + ".closeUp : closed connection");
124:                    }
125:                } catch (Exception e) {
126:                    Utility
127:                            .log(cName
128:                                    + ".closeUp error: close handle/physical connection failed");
129:                }
130:            }
131:
132:            /**
133:             * JUnit tests
134:             */
135:
136:            /**
137:             *  ra.xml contains value, used by Application Server to set EIS_URL in ra
138:             */
139:            public String getEIS_URL() throws Exception {
140:                Utility.log(cName + ".getEIS_URL");
141:                mcf = (ManagedConnectionFactoryImpl) cccf.getMcf();
142:                ResourceAdapterImpl ra = (ResourceAdapterImpl) mcf
143:                        .getResourceAdapter();
144:
145:                String cp1 = "none";
146:                if (ra == null)
147:                    return cp1;
148:                try {
149:                    cp1 = ra.getEIS_URL();
150:                } catch (Exception e) {
151:                    Utility
152:                            .log(cName
153:                                    + ".getEIS_URL get <configuration-property> error: failed");
154:                    throw e;
155:                }
156:                return cp1;
157:            }
158:
159:            public boolean deliverMsg(String msg) throws Exception {
160:                boolean success;
161:
162:                Utility.log(cName + ".deliverMsg to resource adapter");
163:                mcf = (ManagedConnectionFactoryImpl) cccf.getMcf();
164:                ResourceAdapterImpl ra = (ResourceAdapterImpl) mcf
165:                        .getResourceAdapter();
166:                try {
167:                    success = ra.deliverMsg(msg);
168:                    Utility.log(cName + ".deliverMsg o.k. msg=" + msg);
169:                } catch (Exception e) {
170:                    Utility.log(cName + ".deliverMsg error: e=" + e.toString());
171:                    success = false;
172:                }
173:                return success;
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.