Source Code Cross Referenced for ResourceAdapterConfig.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » jca » cfg » 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 resin 3.1.5 » resin » com.caucho.jca.cfg 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *
023:         *   Free Software Foundation, Inc.
024:         *   59 Temple Place, Suite 330
025:         *   Boston, MA 02111-1307  USA
026:         *
027:         * @author Scott Ferguson
028:         */
029:
030:        package com.caucho.jca.cfg;
031:
032:        import com.caucho.config.ConfigException;
033:        import com.caucho.log.Log;
034:        import com.caucho.util.L10N;
035:
036:        import java.util.ArrayList;
037:        import java.util.logging.Logger;
038:
039:        /**
040:         * Configuration for a connector.
041:         */
042:        public class ResourceAdapterConfig extends ObjectConfig {
043:            private static final L10N L = new L10N(ResourceAdapterConfig.class);
044:            private static final Logger log = Log
045:                    .open(ResourceAdapterConfig.class);
046:
047:            private Class _adapterClass;
048:
049:            private ArrayList<ConnectionDefinition> _outboundConnections = new ArrayList<ConnectionDefinition>();
050:
051:            private ArrayList<MessageListenerConfig> _inboundConnections = new ArrayList<MessageListenerConfig>();
052:
053:            private ArrayList<AdminObjectConfig> _resources = new ArrayList<AdminObjectConfig>();
054:
055:            private ConnectionDefinition _connectionDefinition;
056:
057:            private String _transactionSupport;
058:
059:            public ResourceAdapterConfig() {
060:            }
061:
062:            /**
063:             * Sets the resource adapter class
064:             */
065:            public void setResourceadapterClass(Class cl)
066:                    throws ConfigException {
067:                _adapterClass = cl;
068:
069:                setType(cl);
070:            }
071:
072:            /**
073:             * Gets the resource adapter class
074:             */
075:            public Class getResourceadapterClass() {
076:                return _adapterClass;
077:            }
078:
079:            /**
080:             * Adds an admin object.
081:             */
082:            public void addAdminobject(AdminObjectConfig adminObject) {
083:                _resources.add(adminObject);
084:            }
085:
086:            /**
087:             * Sets the ManagedConnectionFactory class.
088:             */
089:            public void setManagedconnectionfactoryClass(Class cl)
090:                    throws ConfigException {
091:                getConnectionDefinition().setManagedconnectionfactoryClass(cl);
092:            }
093:
094:            /**
095:             * Sets the ConnectionFactory interface
096:             */
097:            public void setConnectionfactoryInterface(String cl) {
098:            }
099:
100:            /**
101:             * Sets the ConnectionFactory impl class
102:             */
103:            public void setConnectionfactoryImplClass(String cl) {
104:            }
105:
106:            /**
107:             * Sets the Connection interface
108:             */
109:            public void setConnectionInterface(String cl) {
110:            }
111:
112:            /**
113:             * Sets the Connection impl class
114:             */
115:            public void setConnectionImplClass(String cl) {
116:            }
117:
118:            /**
119:             * Returns the top connection definition (for backward compatibility).
120:             */
121:            private ConnectionDefinition getConnectionDefinition()
122:                    throws ConfigException {
123:                if (_connectionDefinition == null) {
124:                    _connectionDefinition = new ConnectionDefinition();
125:                    _outboundConnections.add(_connectionDefinition);
126:                }
127:
128:                return _connectionDefinition;
129:            }
130:
131:            /**
132:             * Adds a new connection definitin.
133:             */
134:            void addConnectionDefinition(ConnectionDefinition conn)
135:                    throws ConfigException {
136:                if (getConnectionDefinition(conn
137:                        .getConnectionFactoryInterface().getName()) != null)
138:                    throw new ConfigException(
139:                            L
140:                                    .l(
141:                                            "'{0}' is a duplicate connection-definition.  The <connectionfactory-interface> must be unique.",
142:                                            conn
143:                                                    .getConnectionFactoryInterface()
144:                                                    .getName()));
145:
146:                _outboundConnections.add(conn);
147:            }
148:
149:            /**
150:             * Gets the connection definition for the named class.
151:             */
152:            public ConnectionDefinition getConnectionDefinition(String type) {
153:                if (type == null && _outboundConnections.size() == 1)
154:                    return _outboundConnections.get(0);
155:                else if (type == null)
156:                    return null;
157:
158:                for (int i = 0; i < _outboundConnections.size(); i++) {
159:                    ConnectionDefinition cfg = _outboundConnections.get(i);
160:
161:                    Class cl = cfg.getManagedConnectionFactoryClass();
162:
163:                    if (cl != null && cl.getName().equals(type))
164:                        return cfg;
165:
166:                    cl = cfg.getConnectionFactoryInterface();
167:
168:                    if (cl != null && cl.getName().equals(type))
169:                        return cfg;
170:
171:                    cl = cfg.getConnectionFactoryImpl();
172:
173:                    if (cl != null && cl.getName().equals(type))
174:                        return cfg;
175:                }
176:
177:                return null;
178:            }
179:
180:            /**
181:             * Adds a new connection definitin.
182:             */
183:            void addMessageListener(MessageListenerConfig cfg)
184:                    throws ConfigException {
185:                if (getMessageListener(cfg.getMessageListenerType().getName()) != null)
186:                    throw new ConfigException(
187:                            L
188:                                    .l(
189:                                            "'{0}' is a duplicate messagelistener-type.  The <messagelistener-type> must be unique.",
190:                                            cfg.getMessageListenerType()
191:                                                    .getName()));
192:
193:                _inboundConnections.add(cfg);
194:            }
195:
196:            /**
197:             * Gets the resource adapter class
198:             */
199:            public MessageListenerConfig getMessageListener(String type) {
200:                if (type == null && _inboundConnections.size() == 1)
201:                    return _inboundConnections.get(0);
202:                else if (type == null)
203:                    return null;
204:
205:                for (int i = 0; i < _inboundConnections.size(); i++) {
206:                    MessageListenerConfig cfg = _inboundConnections.get(i);
207:
208:                    //Class cl = cfg.getMessageListenerType();
209:                    Class cl = cfg.getActivationSpecClass();
210:
211:                    if (cl != null && cl.getName().equals(type))
212:                        return cfg;
213:                }
214:
215:                return null;
216:            }
217:
218:            /**
219:             * Adds a new resource
220:             */
221:            void addResource(AdminObjectConfig cfg) {
222:                _resources.add(cfg);
223:            }
224:
225:            /**
226:             * Gets the resource adapter class
227:             */
228:            public AdminObjectConfig getAdminObject(String type) {
229:                for (int i = 0; i < _resources.size(); i++) {
230:                    AdminObjectConfig cfg = _resources.get(i);
231:
232:                    Class cl = cfg.getAdminObjectClass();
233:
234:                    if (cl != null && cl.getName().equals(type))
235:                        return cfg;
236:
237:                    cl = cfg.getAdminObjectInterface();
238:
239:                    if (cl != null && cl.getName().equals(type))
240:                        return cfg;
241:                }
242:
243:                return null;
244:            }
245:
246:            /**
247:             * Sets the transaction support.
248:             */
249:            public void setTransactionSupport(String xa) {
250:                _transactionSupport = xa;
251:            }
252:
253:            /**
254:             * Gets the transaction support.
255:             */
256:            public String getTransactionSupport() {
257:                return _transactionSupport;
258:            }
259:
260:            /**
261:             * Sets the reauthentication support.
262:             */
263:            public void setReauthenticationSupport(boolean support) {
264:            }
265:
266:            /**
267:             * Creates an authentication mechanism
268:             */
269:            public AuthenticationMechanism createAuthenticationMechanism() {
270:                return new AuthenticationMechanism();
271:            }
272:
273:            /**
274:             * Creates a security permission
275:             */
276:            public SecurityPermission createSecurityPermission() {
277:                return new SecurityPermission();
278:            }
279:
280:            /**
281:             * Adds an outbound resource adapter.
282:             */
283:            public OutboundResourceAdapterConfig createOutboundResourceadapter()
284:                    throws ConfigException {
285:                return new OutboundResourceAdapterConfig(this );
286:            }
287:
288:            /**
289:             * Adds an inbound resource adapter.
290:             */
291:            public InboundResourceAdapterConfig createInboundResourceadapter()
292:                    throws ConfigException {
293:                return new InboundResourceAdapterConfig(this );
294:            }
295:
296:            public static class AuthenticationMechanism {
297:                public void setDescription(String description) {
298:                }
299:
300:                public void setAuthenticationMechanismType(String type) {
301:                }
302:
303:                public void setCredentialInterface(String type) {
304:                }
305:            }
306:
307:            public static class SecurityPermission {
308:                public void setDescription(String description) {
309:                }
310:
311:                public void setSecurityPermissionSpec(String spec) {
312:                }
313:            }
314:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.