/** 
 * 
 * Copyright 2004 Protique Ltd
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 * 
 **/

package org.codehaus.activemq.transport.remote;
import javax.jms.JMSException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.activemq.broker.BrokerContainer;
import org.codehaus.activemq.io.WireFormat;
import org.codehaus.activemq.transport.NetworkConnector;
import org.codehaus.activemq.transport.RemoteNetworkConnector;
import org.codehaus.activemq.transport.peer.PeerTransportChannel;
import org.codehaus.activemq.util.IdGenerator;

/**
 * A <CODE>RemoteTransportChannel</CODE> creates an embedded broker that creates a remote connection to
 * another broker. This connection type is designed for reliable connections, that can use the storage
 * mechansims of an embedded broker to be decoupled from the remote broker - i.e. for connections that 
 * need to be reliable, don't block but maybe using a transport across an unreliable network connection
 * <P>
 
 * <P>
 * An example of the expected format is: <CODE>remote://tcp://remotebroker:5060</CODE> 
 * <P>
 * 
 * @version $Revision: 1.1 $
 */
public class RemoteTransportChannel extends PeerTransportChannel {
    private static final Log log = LogFactory.getLog(RemoteTransportChannel.class);
    
  
    /**
     * Construct a RemoteTransportChannel
     * 
     * @param wireFormat
     * @param peerURIs
     * @throws JMSException
     */
    protected RemoteTransportChannel(WireFormat wireFormat, String peerURIs) throws JMSException{
        super(wireFormat,new IdGenerator().generateId());
        setPeerURIs(peerURIs);
        setDoDiscovery(false);
        setRemote(true);
    }
    
    /**
     * Create a NetworkConnector
     * @param container
     * @return the NetworkConnector
     */
    protected NetworkConnector createNetworkConnector(BrokerContainer container){
        return new RemoteNetworkConnector(container);
    }

}