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: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.jca.cfg;
030:
031: import com.caucho.config.Config;
032: import com.caucho.config.ConfigException;
033: import com.caucho.util.L10N;
034:
035: import javax.resource.spi.ManagedConnectionFactory;
036:
037: /**
038: * Configuration for a connector.
039: */
040: public class ConnectionDefinition extends ObjectConfig {
041: private static final L10N L = new L10N(ConnectionDefinition.class);
042:
043: private Class _managedConnectionFactoryClass;
044: private Class _connectionFactoryInterface;
045: private Class _connectionFactoryImplClass;
046: private Class _connectionInterface;
047: private String _connectionImplClass;
048:
049: public void setManagedconnectionfactoryClass(Class cl)
050: throws ConfigException {
051: Config.checkCanInstantiate(cl);
052:
053: if (!ManagedConnectionFactory.class.isAssignableFrom(cl))
054: throw new ConfigException(
055: L
056: .l("`{0}' must implement ManagedConnectionFactory. managedconnectionfactory-class must implement javax.resource.spi.ManagedConnectionFactory."));
057:
058: _managedConnectionFactoryClass = cl;
059:
060: setType(cl);
061: }
062:
063: public Class getManagedConnectionFactoryClass() {
064: return _managedConnectionFactoryClass;
065: }
066:
067: /**
068: * Sets the application-view for the connection factory.
069: */
070: public void setConnectionfactoryInterface(Class cl)
071: throws ConfigException {
072: _connectionFactoryInterface = cl;
073: }
074:
075: /**
076: * Returns the application-view for the connection factory.
077: */
078: public Class getConnectionFactoryInterface() {
079: return _connectionFactoryInterface;
080: }
081:
082: /**
083: * Sets the connection factory implementation class.
084: */
085: public void setConnectionfactoryImplClass(Class cl)
086: throws ConfigException {
087: _connectionFactoryImplClass = cl;
088: }
089:
090: /**
091: * Returns the application-view for the connection factory.
092: */
093: public Class getConnectionFactoryImpl() {
094: return _connectionFactoryImplClass;
095: }
096:
097: /**
098: * Sets the application-view for the connection
099: */
100: public void setConnectionInterface(Class cl) throws ConfigException {
101: _connectionInterface = cl;
102: }
103:
104: /**
105: * Returns the application-view for the connection
106: */
107: public Class getConnectionInterface() {
108: return _connectionInterface;
109: }
110:
111: /**
112: * Sets the connection implementation class.
113: */
114: public void setConnectionImplClass(String cl)
115: throws ConfigException {
116: _connectionImplClass = cl;
117: }
118: }
|