Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/transport/peer/PeerTransportChannelFactory.java


1   /** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  
19  package org.activemq.transport.peer;
20  import java.net.URI;
21  import javax.jms.JMSException;
22  import org.activemq.io.WireFormat;
23  import org.activemq.transport.TransportChannel;
24  import org.activemq.transport.TransportChannelFactorySupport;
25  
26  /**
27   * Creates peer based transport. A PeerTransportChannel creates an embedded broker, and uses discovery and/or defined
28   * list of urls to create a p-2-p interconnected network.
29   * 
30   * @see PeerTransportChannel
31   * @version $Revision: 1.1.1.1 $
32   */
33  public class PeerTransportChannelFactory extends TransportChannelFactorySupport {
34      /**
35       * Create a Channel
36       * 
37       * @param wireFormat
38       * @param remoteLocation
39       * @return the TransportChannel bound to the remote node
40       * @throws JMSException
41       */
42      public TransportChannel create(WireFormat wireFormat, URI remoteLocation) throws JMSException {
43          TransportChannel result = new PeerTransportChannel(wireFormat, remoteLocation.getHost());
44          return populateProperties(result, remoteLocation);
45      }
46      
47      /**
48       * Create a peer channel
49       * @param wireFormat
50       * @param remoteLocation
51       * @param localLocation
52       * @return
53       * @throws JMSException
54       * 
55       */
56      
57      public TransportChannel create(WireFormat wireFormat, URI remoteLocation, URI localLocation) throws JMSException {
58          PeerTransportChannel result = new PeerTransportChannel(wireFormat, remoteLocation.getHost());
59          result.setBrokerConnectorURI(localLocation.toString());
60          return populateProperties(result, remoteLocation);
61      }
62  
63      /**
64       * Does this channel require an embedded broker to perform such as VM or multicast based transports
65       * 
66       * @return true if an embedded broker is a requirement of using the channel
67       */
68      public boolean requiresEmbeddedBroker() {
69          return true;
70      }
71  }