001 /**
002 *
003 * Copyright 2004 Protique Ltd
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 **/
018
019 package org.activemq.transport.remote;
020 import java.net.URI;
021
022 import javax.jms.JMSException;
023
024 import org.activemq.io.WireFormat;
025 import org.activemq.transport.TransportChannel;
026 import org.activemq.transport.composite.CompositeTransportChannelFactory;
027
028 /**
029 * Creates a remote based transport.
030 *
031 * @see RemoteTransportChannel
032 * @version $Revision: 1.1.1.1 $
033 */
034 public class RemoteTransportChannelFactory extends CompositeTransportChannelFactory {
035 /**
036 * Create a Channel
037 *
038 * @param wireFormat
039 * @param remoteLocation
040 * @return the TransportChannel bound to the remote node
041 * @throws JMSException
042 */
043 public TransportChannel create(WireFormat wireFormat, URI remoteLocation) throws JMSException {
044 TransportChannel result = new RemoteTransportChannel(wireFormat, stripLeadingSlashes(remoteLocation.getSchemeSpecificPart()));
045 return populateProperties(result, remoteLocation);
046 }
047
048 /**
049 * Create a peer channel
050 * @param wireFormat
051 * @param remoteLocation
052 * @param localLocation
053 * @return
054 * @throws JMSException
055 *
056 */
057
058 public TransportChannel create(WireFormat wireFormat, URI remoteLocation, URI localLocation) throws JMSException {
059 RemoteTransportChannel result = new RemoteTransportChannel(wireFormat, remoteLocation.getSchemeSpecificPart());
060 result.setBrokerConnectorURI(localLocation.toString());
061 return populateProperties(result, remoteLocation);
062 }
063
064
065 /**
066 * Does this channel require an embedded broker to perform such as VM or multicast based transports
067 *
068 * @return true if an embedded broker is a requirement of using the channel
069 */
070 public boolean requiresEmbeddedBroker() {
071 return true;
072 }
073 }