| 1 | // Copyright 2004-2007 Jean-Francois Poilpret |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package net.sourceforge.hivetranse.transaction.ibatis; |
| 16 | |
| 17 | import java.sql.Connection; |
| 18 | |
| 19 | import org.apache.hivemind.Resource; |
| 20 | import org.apache.hivemind.impl.BaseLocatable; |
| 21 | import org.apache.hivemind.util.ToStringBuilder; |
| 22 | |
| 23 | /** |
| 24 | * Represents a configuration parameter to the <code>SqlMapClientFactory</code> |
| 25 | * configured for building a <code>SqlMapClient</code> service. |
| 26 | * Each instance defines a iBATIS SqlMaps configuration file and a |
| 27 | * <code>Connection</code> service reference (must be built by |
| 28 | * <code>hivetranse.jdbc.ConnectionFactory</code>). |
| 29 | * |
| 30 | * @author Jean-Francois Poilpret |
| 31 | */ |
| 32 | public class SqlMapClientFactoryContribution extends BaseLocatable |
| 33 | { |
| 34 | public void setConfig(Resource config) |
| 35 | { |
| 36 | _config = config; |
| 37 | } |
| 38 | public Resource getConfig() |
| 39 | { |
| 40 | return _config; |
| 41 | } |
| 42 | |
| 43 | public void setConnection(Connection connection) |
| 44 | { |
| 45 | _connection = connection; |
| 46 | } |
| 47 | public Connection getConnection() |
| 48 | { |
| 49 | return _connection; |
| 50 | } |
| 51 | |
| 52 | public String toString() |
| 53 | { |
| 54 | ToStringBuilder builder = new ToStringBuilder(this); |
| 55 | builder.append("config", _config); |
| 56 | builder.append("connection", _connection); |
| 57 | return builder.toString(); |
| 58 | } |
| 59 | |
| 60 | private Resource _config; |
| 61 | private Connection _connection; |
| 62 | } |