001    /**
002     * Copyright 2008 Mike Kroutikov.
003     *
004     * This program is free software; you can redistribute it and/or modify
005     *   it under the terms of the Lesser GNU General Public License as 
006     *   published by the Free Software Foundation; either version 3 of
007     *   the License, or (at your option) any later version.
008     *
009     *   This program is distributed in the hope that it will be useful,
010     *   but WITHOUT ANY WARRANTY; without even the implied warranty of
011     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012     *   Lesser GNU General Public License for more details.
013     *
014     *   You should have received a copy of the Lesser GNU General Public License
015     *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
016     */
017    package org.otfeed.support.alt;
018    
019    import org.otfeed.IConnectionFactory;
020    import org.otfeed.OTConnectionSpec;
021    
022    import org.otfeed.OTException;
023    import org.otfeed.support.alt.IOutboundConnection;
024    import org.otfeed.support.alt.IOutboundConnectionFactory;
025    
026    public class OutboundConnectionFactoryAdapter implements IOutboundConnectionFactory {
027            
028            private final IConnectionFactory factory;
029            
030            public OutboundConnectionFactoryAdapter(IConnectionFactory f) {
031                    factory = f;
032            }
033    
034            public IOutboundConnection getConnection(OTConnectionSpec spec) throws OTException {
035                    return new OutboundConnectionAdapter(factory.connect(spec, null));
036            }
037    }