Source Code Cross Referenced for MockManagedConnectionFactory.java in  » EJB-Server-geronimo » plugins » org » apache » geronimo » connector » mock » 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 » EJB Server geronimo » plugins » org.apache.geronimo.connector.mock 
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.geronimo.connector.mock;
017:
018:        import java.io.PrintWriter;
019:        import java.util.HashSet;
020:        import java.util.Iterator;
021:        import java.util.Set;
022:        import java.util.Collections;
023:
024:        import javax.resource.ResourceException;
025:        import javax.resource.spi.ConnectionManager;
026:        import javax.resource.spi.ConnectionRequestInfo;
027:        import javax.resource.spi.ManagedConnection;
028:        import javax.resource.spi.ManagedConnectionFactory;
029:        import javax.resource.spi.ResourceAdapter;
030:        import javax.security.auth.Subject;
031:
032:        /**
033:         *
034:         *
035:         * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
036:         *
037:         * */
038:        public class MockManagedConnectionFactory implements 
039:                ManagedConnectionFactory {
040:
041:            private MockResourceAdapter resourceAdapter;
042:            private PrintWriter logWriter;
043:
044:            private final Set managedConnections = Collections
045:                    .synchronizedSet(new HashSet());
046:
047:            private boolean reauthentication;
048:
049:            public String getOutboundStringProperty1() {
050:                return outboundStringProperty1;
051:            }
052:
053:            public void setOutboundStringProperty1(
054:                    String outboundStringProperty1) {
055:                this .outboundStringProperty1 = outboundStringProperty1;
056:            }
057:
058:            public String getOutboundStringProperty2() {
059:                return outboundStringProperty2;
060:            }
061:
062:            public void setOutboundStringProperty2(
063:                    String outboundStringProperty2) {
064:                this .outboundStringProperty2 = outboundStringProperty2;
065:            }
066:
067:            public String getOutboundStringProperty3() {
068:                return outboundStringProperty3;
069:            }
070:
071:            public void setOutboundStringProperty3(
072:                    String outboundStringProperty3) {
073:                this .outboundStringProperty3 = outboundStringProperty3;
074:            }
075:
076:            public String getOutboundStringProperty4() {
077:                return outboundStringProperty4;
078:            }
079:
080:            public void setOutboundStringProperty4(
081:                    String outboundStringProperty4) {
082:                this .outboundStringProperty4 = outboundStringProperty4;
083:            }
084:
085:            private String outboundStringProperty1;
086:            private String outboundStringProperty2;
087:            private String outboundStringProperty3;
088:            private String outboundStringProperty4;
089:
090:            public void setResourceAdapter(ResourceAdapter resourceAdapter)
091:                    throws ResourceException {
092:                assert this .resourceAdapter == null : "Setting ResourceAdapter twice";
093:                assert resourceAdapter != null : "trying to set resourceAdapter to null";
094:                this .resourceAdapter = (MockResourceAdapter) resourceAdapter;
095:            }
096:
097:            public ResourceAdapter getResourceAdapter() {
098:                return resourceAdapter;
099:            }
100:
101:            public Object createConnectionFactory(
102:                    ConnectionManager connectionManager)
103:                    throws ResourceException {
104:                return new MockConnectionFactory(this , connectionManager);
105:            }
106:
107:            public Object createConnectionFactory() throws ResourceException {
108:                return null;
109:            }
110:
111:            public ManagedConnection createManagedConnection(Subject subject,
112:                    ConnectionRequestInfo connectionRequestInfo)
113:                    throws ResourceException {
114:                MockManagedConnection managedConnection = new MockManagedConnection(
115:                        this , subject,
116:                        (MockConnectionRequestInfo) connectionRequestInfo);
117:                managedConnections.add(managedConnection);
118:                return managedConnection;
119:            }
120:
121:            public ManagedConnection matchManagedConnections(Set connectionSet,
122:                    Subject subject, ConnectionRequestInfo cxRequestInfo)
123:                    throws ResourceException {
124:                if (reauthentication) {
125:                    for (Iterator iterator = connectionSet.iterator(); iterator
126:                            .hasNext();) {
127:                        ManagedConnection managedConnection = (ManagedConnection) iterator
128:                                .next();
129:                        if (managedConnections.contains(managedConnection)) {
130:                            return managedConnection;
131:                        }
132:                    }
133:                } else {
134:                    for (Iterator iterator = connectionSet.iterator(); iterator
135:                            .hasNext();) {
136:                        ManagedConnection managedConnection = (ManagedConnection) iterator
137:                                .next();
138:                        //                return managedConnection;
139:                        if (managedConnections.contains(managedConnection)) {
140:                            MockManagedConnection mockManagedConnection = (MockManagedConnection) managedConnection;
141:                            if ((subject == null ? mockManagedConnection
142:                                    .getSubject() == null
143:                                    : subject.equals(mockManagedConnection
144:                                            .getSubject())
145:                                            && (cxRequestInfo == null ? mockManagedConnection
146:                                                    .getConnectionRequestInfo() == null
147:                                                    : cxRequestInfo
148:                                                            .equals(mockManagedConnection
149:                                                                    .getConnectionRequestInfo())))) {
150:                                return mockManagedConnection;
151:                            }
152:                        }
153:                    }
154:                }
155:                return null;
156:            }
157:
158:            public void setLogWriter(PrintWriter logWriter)
159:                    throws ResourceException {
160:                this .logWriter = logWriter;
161:            }
162:
163:            public PrintWriter getLogWriter() throws ResourceException {
164:                return logWriter;
165:            }
166:
167:            public boolean isReauthentication() {
168:                return reauthentication;
169:            }
170:
171:            public void setReauthentication(boolean reauthentication) {
172:                this .reauthentication = reauthentication;
173:            }
174:
175:            public Set getManagedConnections() {
176:                return managedConnections;
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.