activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject [04/14] git commit: Pass the connector object to the createProtocolHandler method so that a protocol can use config details to control the creation the protocol handler instance.
Date Fri, 11 Oct 2013 19:14:08 GMT
Pass the connector object to the createProtocolHandler method so that a protocol can use config
details to control the creation the protocol handler instance.

git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-apollo/trunk@1508923 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/activemq-apollo/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-apollo/commit/c96242e9
Tree: http://git-wip-us.apache.org/repos/asf/activemq-apollo/tree/c96242e9
Diff: http://git-wip-us.apache.org/repos/asf/activemq-apollo/diff/c96242e9

Branch: refs/heads/trunk
Commit: c96242e99ec6f6d8ca517806e07eb0a8f305ed9b
Parents: bfd24ee
Author: Hiram R. Chirino <chirino@apache.org>
Authored: Wed Jul 31 15:30:51 2013 +0000
Committer: Hiram R. Chirino <chirino@apache.org>
Committed: Wed Jul 31 15:30:51 2013 +0000

----------------------------------------------------------------------
 .../scala/org/apache/activemq/apollo/amqp/AmqpProtocol.scala    | 2 +-
 .../scala/org/apache/activemq/apollo/broker/Connector.scala     | 2 +-
 .../apache/activemq/apollo/broker/protocol/AnyProtocol.scala    | 4 ++--
 .../org/apache/activemq/apollo/broker/protocol/Protocol.scala   | 5 +++--
 .../apache/activemq/apollo/broker/protocol/SslProtocol.scala    | 2 +-
 .../apache/activemq/apollo/broker/protocol/UdpProtocol.scala    | 2 +-
 .../main/java/org/apache/activemq/apollo/mqtt/MqttProtocol.java | 3 ++-
 .../activemq/apollo/openwire/OpenwireProtocolFactory.scala      | 2 +-
 .../scala/org/apache/activemq/apollo/stomp/StompProtocol.scala  | 2 +-
 .../org/apache/activemq/apollo/stomp/StompUdpProtocol.scala     | 2 +-
 10 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-amqp/src/main/scala/org/apache/activemq/apollo/amqp/AmqpProtocol.scala
----------------------------------------------------------------------
diff --git a/apollo-amqp/src/main/scala/org/apache/activemq/apollo/amqp/AmqpProtocol.scala
b/apollo-amqp/src/main/scala/org/apache/activemq/apollo/amqp/AmqpProtocol.scala
index 54cf75b..265f1ca 100644
--- a/apollo-amqp/src/main/scala/org/apache/activemq/apollo/amqp/AmqpProtocol.scala
+++ b/apollo-amqp/src/main/scala/org/apache/activemq/apollo/amqp/AmqpProtocol.scala
@@ -44,7 +44,7 @@ object AmqpProtocol extends Protocol {
     }
   }
 
-  def createProtocolHandler = new AmqpProtocolHandler
+  def createProtocolHandler(connector:Connector) = new AmqpProtocolHandler
 }
 
 //object AmqpMessageCodecFactory extends MessageCodecFactory.Provider {

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
----------------------------------------------------------------------
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
index 0979812..868ba90 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
@@ -184,7 +184,7 @@ class AcceptingConnector(val broker:Broker, val id:String) extends Connector
{
       connected.incrementAndGet()
       var connection = new BrokerConnection(AcceptingConnector.this, broker.connection_id_counter.incrementAndGet)
       connection.dispatch_queue.setLabel("connection %d to %s".format(connection.id, transport.getRemoteAddress))
-      connection.protocol_handler = protocol.createProtocolHandler
+      connection.protocol_handler = protocol.createProtocolHandler(AcceptingConnector.this)
       connection.transport = transport
 
       broker.connections.put(connection.id, connection)

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
----------------------------------------------------------------------
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
index 9b1ae6a..8af0dff 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
@@ -40,7 +40,7 @@ object AnyProtocol extends BaseProtocol {
 
   def createProtocolCodec(connector:Connector) = new AnyProtocolCodec(connector)
 
-  def createProtocolHandler = new AnyProtocolHandler
+  def createProtocolHandler(connector:Connector) = new AnyProtocolHandler
 
   def change_protocol_codec(transport:Transport, codec:ProtocolCodec) = {
     var current = transport.getProtocolCodec
@@ -148,7 +148,7 @@ class AnyProtocolHandler extends ProtocolHandler {
 
     var protocol: ProtocolDetected = command.asInstanceOf[ProtocolDetected];
     val protocol_handler = ProtocolFactory.get(protocol.id) match {
-      case Some(x) => x.createProtocolHandler
+      case Some(x) => x.createProtocolHandler(connection.connector)
       case None =>
         throw new ProtocolException("No protocol handler available for protocol: " + protocol.id);
     }

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala
----------------------------------------------------------------------
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala
b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala
index 7f6ecef..91a0834 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala
@@ -20,13 +20,14 @@ import java.io.IOException
 import org.apache.activemq.apollo.broker.store.MessageRecord
 import org.fusesource.hawtdispatch._
 import org.apache.activemq.apollo.util.{Log, ClassFinder}
-import org.apache.activemq.apollo.broker.{Broker, Message, BrokerConnection}
+import org.apache.activemq.apollo.broker.{Connector, Broker, Message, BrokerConnection}
 import org.apache.activemq.apollo.dto.{SimpleProtocolFilterDTO, ProtocolFilterDTO, ConnectionStatusDTO}
 import org.fusesource.hawtbuf.Buffer
 import scala.collection.mutable.ListBuffer
+import org.fusesource.hawtdispatch.transport.ProtocolCodec
 
 trait Protocol extends ProtocolCodecFactory.Provider {
-  def createProtocolHandler:ProtocolHandler
+  def createProtocolHandler(connector: Connector):ProtocolHandler
 }
 
 abstract class BaseProtocol extends Protocol {

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/SslProtocol.scala
----------------------------------------------------------------------
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/SslProtocol.scala
b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/SslProtocol.scala
index 0f5ca65..1f18e6c 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/SslProtocol.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/SslProtocol.scala
@@ -88,5 +88,5 @@ class SslProtocol extends Protocol {
     rc
   }
 
-  def createProtocolHandler = new AnyProtocolHandler
+  def createProtocolHandler(connector:Connector) = new AnyProtocolHandler
 }

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/UdpProtocol.scala
----------------------------------------------------------------------
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/UdpProtocol.scala
b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/UdpProtocol.scala
index b5253c5..8d38ed0 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/UdpProtocol.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/UdpProtocol.scala
@@ -294,7 +294,7 @@ class UdpProtocol extends BaseProtocol {
   def id = "udp"
   def createProtocolCodec(connector:Connector):ProtocolCodec = new UdpProtocolCodec()
 
-  def createProtocolHandler:ProtocolHandler = new UdpProtocolHandler {
+  def createProtocolHandler(connector:Connector):ProtocolHandler = new UdpProtocolHandler
{
     type ConfigTypeDTO = UdpDTO
     def configClass = classOf[ConfigTypeDTO]
 

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-mqtt/src/main/java/org/apache/activemq/apollo/mqtt/MqttProtocol.java
----------------------------------------------------------------------
diff --git a/apollo-mqtt/src/main/java/org/apache/activemq/apollo/mqtt/MqttProtocol.java b/apollo-mqtt/src/main/java/org/apache/activemq/apollo/mqtt/MqttProtocol.java
index a22e520..56d253e 100644
--- a/apollo-mqtt/src/main/java/org/apache/activemq/apollo/mqtt/MqttProtocol.java
+++ b/apollo-mqtt/src/main/java/org/apache/activemq/apollo/mqtt/MqttProtocol.java
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.apollo.mqtt;
 
+import org.apache.activemq.apollo.broker.Connector;
 import org.apache.activemq.apollo.broker.DestinationParser;
 import org.apache.activemq.apollo.broker.protocol.Protocol;
 import org.apache.activemq.apollo.broker.protocol.ProtocolHandler;
@@ -45,7 +46,7 @@ public class MqttProtocol extends MqttProtocolCodecFactory implements Protocol
{
 
 
     @Override
-    public ProtocolHandler createProtocolHandler() {
+    public ProtocolHandler createProtocolHandler(Connector connector) {
         return new MqttProtocolHandler();
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
----------------------------------------------------------------------
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
index d82bbb6..dea6fb8 100644
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
@@ -31,7 +31,7 @@ import org.apache.activemq.apollo.util.Log
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
 object OpenwireProtocol extends OpenwireProtocolCodecFactory with Protocol with Log {
-  def createProtocolHandler = new OpenwireProtocolHandler
+  def createProtocolHandler(connector:Connector) = new OpenwireProtocolHandler
 }
 
 object OpenwireMessageCodecFactory extends MessageCodecFactory.Provider {

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
----------------------------------------------------------------------
diff --git a/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
b/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
index 70ef657..5db872a 100644
--- a/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
+++ b/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
@@ -53,7 +53,7 @@ class StompProtocolCodecFactory extends ProtocolCodecFactory.Provider {
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
 object StompProtocol extends StompProtocolCodecFactory with Protocol {
-  def createProtocolHandler = new StompProtocolHandler
+  def createProtocolHandler(connector:Connector) = new StompProtocolHandler
 }
 
 object StompMessageCodecFactory extends MessageCodecFactory.Provider {

http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/c96242e9/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompUdpProtocol.scala
----------------------------------------------------------------------
diff --git a/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompUdpProtocol.scala
b/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompUdpProtocol.scala
index 12bf382..a992221 100644
--- a/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompUdpProtocol.scala
+++ b/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompUdpProtocol.scala
@@ -33,7 +33,7 @@ class StompUdpProtocol extends UdpProtocol {
 
   override def id = "stomp-udp"
 
-  override def createProtocolHandler = new UdpProtocolHandler {
+  override def createProtocolHandler(connector:Connector) = new UdpProtocolHandler {
 
     type ConfigTypeDTO = StompDTO
     def configClass = classOf[ConfigTypeDTO]


Mime
View raw message