Source Code Cross Referenced for ConnectionImpl.java in  » J2EE » JOnAS-4.8.6 » ersatz » resourceadapter » 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 » ersatz.resourceadapter 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Jul 10, 2003
003:         *
004:         * ConnectionImpl.java is used to test the J2EE Connector
005:         * as implemented by JOnAS. 
006:         *  
007:         */
008:        package ersatz.resourceadapter;
009:
010:        import javax.resource.ResourceException;
011:        import javax.resource.NotSupportedException;
012:        import javax.resource.cci.Connection;
013:        import javax.resource.cci.Interaction;
014:        import javax.resource.cci.ConnectionMetaData;
015:        import javax.resource.cci.LocalTransaction;
016:        import javax.resource.cci.ResultSetInfo;
017:        import javax.resource.spi.ManagedConnection;
018:        import javax.resource.spi.ConnectionEvent;
019:        import javax.resource.spi.ConnectionRequestInfo;
020:
021:        /**
022:         * @author Bob Kruse
023:         *
024:         * Ersatz Resource Adapter
025:         *
026:         * used to test the J2EE Connector as implemented by JOnAS.
027:         * 
028:         */
029:        public class ConnectionImpl implements  Connection {
030:            public String product = "Ersatz EIS"; // see J2eeConnectorTestBeanClient
031:            String version = "1.1";
032:            String UserName = "Ersatz"; //
033:            private ManagedConnectionImpl mc;
034:            public ConnectionRequestInfoImpl crii = null;
035:            public LocalTransactionImpl lt;
036:            boolean closed = false; // connection is closed
037:            String cName = "ConnectionImpl";
038:            private boolean autoCommitMode = false;
039:
040:            public ConnectionImpl(ManagedConnectionImpl mc) { // constructor for Connection
041:                Utility.log(cName + ".constructor");
042:                this .mc = mc;
043:            }
044:
045:            //
046:            // close connection handle
047:            //
048:            public void close() throws ResourceException {
049:                Utility.log(cName
050:                        + ".close with ConnectionEvent.CONNECTION_CLOSED="
051:                        + ConnectionEvent.CONNECTION_CLOSED);
052:                closed = true;
053:
054:                if (mc != null) {
055:                    try {
056:                        mc.sendEvent(ConnectionEvent.CONNECTION_CLOSED, null,
057:                                this );
058:                        mc = null;
059:                        Utility.log(cName
060:                                + ".close sendevent 'CONNECTION_CLOSED'");
061:                    } catch (ResourceException e) {
062:                        Utility.log(cName + ".close error: unable to close");
063:                        throw e;
064:                    }
065:                } else {
066:                    Utility.log(cName + ".close error: mc=null");
067:                }
068:                return;
069:            }
070:
071:            //
072:            // close physical connection
073:            //
074:            // The connectionErrorOccurred method indicates that the associated 
075:            // ManagedConnection instance is now invalid and unusable.
076:            // mc.sendEvent method makes the call to connectionErrorOccurred
077:            //
078:            public void close(int eType) throws ResourceException {
079:                Utility.log(cName + ".close(" + eType + ")");
080:                closed = true;
081:
082:                if (mc != null) {
083:                    try {
084:                        mc.sendEvent(eType, null, this );
085:                        mc = null;
086:                        Utility.log(cName + ".close(CONNECTION_ERROR_OCCURRED="
087:                                + ConnectionEvent.CONNECTION_ERROR_OCCURRED
088:                                + ") to " + "close physical connection");
089:                    } catch (ResourceException e) {
090:                        Utility
091:                                .log(cName
092:                                        + ".close error: unable to close physical connection"
093:                                        + " with 'CONNECTION_ERROR_OCCURRED'");
094:                        throw e;
095:                    }
096:                } else {
097:                    Utility.log(cName + ".close error: mc=null already");
098:                }
099:                return;
100:            }
101:
102:            public Interaction createInteraction() throws ResourceException {
103:                Utility.log(cName + ".createInteraction");
104:                InteractionImpl gi = new InteractionImpl(this , mc);
105:                // TODO Interaction gi = new Interaction(this, this.mc, lw);
106:                return gi;
107:            }
108:
109:            public ConnectionMetaData getMetaData() throws ResourceException {
110:                Utility.log(cName + ".getMetaData");
111:                ConnectionMetaDataImpl eisInfo = new ConnectionMetaDataImpl(
112:                        this , mc);
113:                return eisInfo;
114:            }
115:
116:            public LocalTransaction getLocalTransaction()
117:                    throws ResourceException {
118:                try {
119:                    lt = (LocalTransactionImpl) mc.getLocalTransaction(true);
120:                    Utility.log(cName + ".getLocalTransaction lt=" + lt);
121:                } catch (Exception e) {
122:                    Utility.log(cName + ".getLocalTransaction error: "
123:                            + e.getMessage() + " <<<<<<<<<<<<");
124:                }
125:                return (lt);
126:            }
127:
128:            public ResultSetInfo getResultSetInfo() throws ResourceException {
129:                Utility.log(cName + ".getResultSetInfo");
130:                NotSupportedException nse = new NotSupportedException(
131:                        "getResultSetInfo is not supported");
132:                throw nse;
133:            }
134:
135:            public void associateConnection(ManagedConnectionImpl mc)
136:                    throws IllegalStateException {
137:                Utility.log(cName + ".associateConnection");
138:                this .mc = mc;
139:            }
140:
141:            public ManagedConnectionImpl getMC() throws ResourceException {
142:                if (mc == null)
143:                    Utility.log(cName + ".getMC mc=" + this .mc);
144:                else
145:                    Utility.log(cName + ".getMC mc=" + this .mc + " mc.xar="
146:                            + mc.xar + ", mc.xari=" + mc.xari);
147:                return this .mc;
148:            }
149:
150:            public void setAutoCommit(boolean a) {
151:                autoCommitMode = a;
152:            }
153:
154:            public boolean getAutoCommit() {
155:                return autoCommitMode;
156:            }
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.