activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r961224 - in /activemq/sandbox/activemq-apollo-actor: activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/ activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/ activemq-brok...
Date Wed, 07 Jul 2010 04:29:46 GMT
Author: chirino
Date: Wed Jul  7 04:29:44 2010
New Revision: 961224

URL: http://svn.apache.org/viewvc?rev=961224&view=rev
Log:
following the .index convention set by jaxb for class discovery.
transport factories more consistent now too.

Added:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/broker-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/brokers
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/vm
    activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores
    activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreFactory.scala
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreSPI.scala
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pool-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pools
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolFactory.scala
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolSPI.scala
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreFactory.scala
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreSPI.scala
    activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols
    activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/
    activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/tcp
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/resources/META-INF/services/org.apache.activem.apollo/
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/resources/META-INF/services/org.apache.activem.apollo/transport-factory.index
      - copied, changed from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/ssl
Removed:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/brokers
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/ssl
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/tcp
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/vm
    activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores
    activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreSPI.scala
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pools
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolSPI.scala
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreSPI.scala
    activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols
    activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/resources/META-INF/services/org/apache/activemq/broker/store/memory
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/resources/META-INF/services/org/apache/activemq/transport/pipe
Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/jaxb/XmlBrokerFactory.scala
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/transport/vm/VMTransport.scala
    activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
    activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/StoreFactory.scala
    activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportFactory.java
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactory.java
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportFactory.java
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/DirectBufferPoolFactory.scala

Copied: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/broker-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/brokers)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/broker-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/broker-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/brokers&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Copied: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Copied: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/vm)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/vm&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
Wed Jul  7 04:29:44 2010
@@ -39,27 +39,24 @@ import ReporterLevel._
  */
 object BrokerFactory {
 
-  val finder = ClassFinder[SPI]("META-INF/services/org.apache.activemq.apollo/brokers")
-  var spis = List[SPI]()
-
-  trait SPI {
+  trait Provider {
     def createBroker(brokerURI:String):Broker
   }
 
-  finder.find.foreach{ clazz =>
-    try {
-      spis ::= clazz.newInstance.asInstanceOf[SPI]
-    } catch {
-      case e:Throwable => e.printStackTrace
-    }
+  def discover = {
+    val finder = new ClassFinder[Provider]("META-INF/services/org.apache.activemq.apollo/broker-factory.index")
+    finder.new_instances
   }
 
+  var providers = discover
+
+
   def createBroker(uri:String, start:Boolean=false):Broker = {
     if( uri == null ) {
       return null
     }
-    spis.foreach { spi=>
-      val broker = spi.createBroker(uri)
+    providers.foreach { provider=>
+      val broker = provider.createBroker(uri)
       if( broker!=null ) {
         if (start) {
           broker.start();

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/jaxb/XmlBrokerFactory.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/jaxb/XmlBrokerFactory.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/jaxb/XmlBrokerFactory.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/jaxb/XmlBrokerFactory.scala
Wed Jul  7 04:29:44 2010
@@ -25,7 +25,7 @@ import java.lang.String
 import XmlEncoderDecoder._
 import org.apache.activemq.apollo.util._
 
-class XmlBrokerFactory extends BrokerFactory.SPI {
+class XmlBrokerFactory extends BrokerFactory.Provider {
 
   def createBroker(value: String): Broker = {
     try {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
Wed Jul  7 04:29:44 2010
@@ -31,9 +31,9 @@ import java.lang.String
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class MultiProtocolFactorySPI extends ProtocolFactory.SPI {
+class MultiProtocolFactory extends ProtocolFactory.Provider {
 
-  def all_protocols: Array[Protocol] = ((ProtocolFactory.spis.map(_.create())).filter(_.isIdentifiable)).toArray
+  def all_protocols: Array[Protocol] = ((ProtocolFactory.providers.map(_.create())).filter(_.isIdentifiable)).toArray
 
   def create() = {
     new MultiProtocol(()=>all_protocols)

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala
Wed Jul  7 04:29:44 2010
@@ -31,25 +31,21 @@ import org.apache.activemq.apollo.transp
  */
 object ProtocolFactory {
 
-  trait SPI {
+  trait Provider {
     def create():Protocol
     def create(config:String):Protocol
   }
 
-  val finder =  ClassFinder[SPI]("META-INF/services/org.apache.activemq.apollo/protocols")
-  var spis = List[SPI]()
-
-  finder.find.foreach{ clazz =>
-    try {
-      spis ::= clazz.newInstance.asInstanceOf[SPI]
-    } catch {
-      case e:Throwable => e.printStackTrace
-    }
+  def discover = {
+    val finder = new ClassFinder[Provider]("META-INF/services/org.apache.activemq.apollo/protocol-factory.index")
+    finder.new_instances
   }
 
+  var providers = discover
+
   def get(name:String):Option[Protocol] = {
-    spis.foreach { spi=>
-      val rc = spi.create(name)
+    providers.foreach { provider=>
+      val rc = provider.create(name)
       if( rc!=null ) {
         return Some(rc)
       }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/transport/vm/VMTransport.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/transport/vm/VMTransport.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/transport/vm/VMTransport.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/transport/vm/VMTransport.scala
Wed Jul  7 04:29:44 2010
@@ -92,6 +92,10 @@ class VMTransportFactory extends PipeTra
   }
 
   override def connect(location: String): Transport = {
+    if( !location.startsWith("vm:") ) {
+        return null;
+    }
+
     try {
       var uri = new URI(location)
       var brokerURI: String = null;

Copied: activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Copied: activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreFactory.scala
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreSPI.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreFactory.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreFactory.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreSPI.scala&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreSPI.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStoreFactory.scala
Wed Jul  7 04:29:44 2010
@@ -33,7 +33,7 @@ import ReporterLevel._
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class CassandraStoreSPI extends StoreFactory.SPI {
+class CassandraStoreFactory extends StoreFactory.SPI {
 
   def create(config: StoreDTO) = {
     if( config.isInstanceOf[CassandraStoreDTO]) {

Copied: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pool-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pools)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pool-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pool-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/direct-buffer-pools&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Copied: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/stores&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Copied: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolFactory.scala
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolSPI.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolFactory.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolFactory.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolSPI.scala&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolSPI.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBDirectBufferPoolFactory.scala
Wed Jul  7 04:29:44 2010
@@ -31,7 +31,7 @@ import org.apache.activemq.apollo.util.D
  * 
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class HawtDBDirectBufferPoolSPI extends DirectBufferPoolFactory.SPI {
+class HawtDBDirectBufferPoolFactory extends DirectBufferPoolFactory.SPI {
 
   val prefix: String = "hawtdb:"
 

Copied: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreFactory.scala
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreSPI.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreFactory.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreFactory.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreSPI.scala&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreSPI.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStoreFactory.scala
Wed Jul  7 04:29:44 2010
@@ -33,7 +33,7 @@ import ReporterLevel._
  * 
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class HawtDBStoreSPI extends StoreFactory.SPI {
+class HawtDBStoreFactory extends StoreFactory.SPI {
 
   def create(config: StoreDTO) = {
     if( config.isInstanceOf[HawtDBStoreDTO]) {

Copied: activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocols&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Modified: activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
Wed Jul  7 04:29:44 2010
@@ -81,7 +81,7 @@ class StompProtocolCodecFactory extends 
   }
 }
 
-class StompProtocolFactorySPI extends ProtocolFactory.SPI {
+class StompProtocolFactory extends ProtocolFactory.Provider {
 
   def create() = StompProtocol
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/StoreFactory.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/StoreFactory.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/StoreFactory.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/StoreFactory.scala
Wed Jul  7 04:29:44 2010
@@ -36,30 +36,24 @@ class StoreFactory
  */
 object StoreFactory {
 
-  val finder =  ClassFinder[SPI]("META-INF/services/org.apache.activemq.apollo/stores")
-  var storesSPI = List[SPI]()
-
-  trait SPI {
+  trait Provider {
     def create(config:StoreDTO):Store
     def validate(config: StoreDTO, reporter:Reporter):ReporterLevel
   }
 
-  finder.find.foreach{ clazz =>
-    try {
-      val SPI = clazz.newInstance.asInstanceOf[SPI]
-      storesSPI ::= SPI
-    } catch {
-      case e:Throwable =>
-        e.printStackTrace
-    }
+  def discover = {
+    val finder = new ClassFinder[Provider]("META-INF/services/org.apache.activemq.apollo/store-factory.index")
+    finder.new_instances
   }
 
+  var providers = discover
+
   def create(config:StoreDTO):Store = {
     if( config == null ) {
       return null
     }
-    storesSPI.foreach { spi=>
-      val rc = spi.create(config)
+    providers.foreach { provider=>
+      val rc = provider.create(config)
       if( rc!=null ) {
         return rc
       }
@@ -72,8 +66,8 @@ object StoreFactory {
     if( config == null ) {
       return INFO
     } else {
-      storesSPI.foreach { spi=>
-        val rc = spi.validate(config, reporter)
+      providers.foreach { provider=>
+        val rc = provider.validate(config, reporter)
         if( rc!=null ) {
           return rc
         }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportFactory.java?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportFactory.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportFactory.java
Wed Jul  7 04:29:44 2010
@@ -38,10 +38,14 @@ import static org.apache.activemq.apollo
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  * @author David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com (logging improvement
modifications)
  */
-public class TcpTransportFactory implements TransportFactory.TransportFactorySPI {
+public class TcpTransportFactory implements TransportFactory.Provider {
     private static final Log LOG = LogFactory.getLog(TcpTransportFactory.class);
 
     public TransportServer bind(String location) throws Exception {
+        if( !location.startsWith("tcp:") ) {
+            return null;
+        }
+
         URI uri = new URI(location);
         Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(uri));
         TcpTransportServer server = createTcpTransportServer(uri);
@@ -61,6 +65,10 @@ public class TcpTransportFactory impleme
 
 
     public Transport connect(String location) throws Exception {
+        if( !location.startsWith("tcp:") ) {
+            return null;
+        }
+
         URI uri = new URI(location);
         Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(uri));
         URI localLocation = getLocalLocation(uri);

Copied: activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/tcp)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/transport-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/tcp&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
    (empty)

Modified: activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactory.java?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactory.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactory.java
Wed Jul  7 04:29:44 2010
@@ -16,11 +16,9 @@
  */
 package org.apache.activemq.apollo.transport;
 
-import org.apache.activemq.apollo.util.FactoryFinder;
-import org.apache.activemq.apollo.util.IOExceptionSupport;
+import org.apache.activemq.apollo.util.ClassFinder;
 
-import java.io.IOException;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.ArrayList;
 
 /**
  *
@@ -28,57 +26,50 @@ import java.util.concurrent.ConcurrentHa
  */
 public class TransportFactory {
 
-    private static final FactoryFinder TRANSPORT_FACTORY_FINDER = new FactoryFinder("META-INF/services/org.apache.activemq.apollo/transports/");
-    private static final ConcurrentHashMap<String, TransportFactorySPI> TRANSPORT_FACTORYS
= new ConcurrentHashMap<String, TransportFactorySPI>();
-
-    public interface TransportFactorySPI {
+    public interface Provider {
         public TransportServer bind(String location) throws Exception;
         public Transport connect(String location) throws Exception;
     }
-    
-    /**
-     */
-    private static TransportFactorySPI factory(String location) throws IOException {
-        String scheme = FactoryFinder.getScheme(location);
-        if (scheme == null) {
-            throw new IOException("Transport not scheme specified: [" + location + "]");
-        }
-        TransportFactorySPI tf = TRANSPORT_FACTORYS.get(scheme);
-        if (tf == null) {
-            // Try to load if from a META-INF property.
+
+    static public ArrayList<Provider> providers;
+
+    static {
+        ClassFinder<Provider> finder = new ClassFinder<Provider>("META-INF/services/org.apache.activemq.apollo/transport-factory.index");
+        ArrayList<Provider> t = new ArrayList<Provider>();
+        for( Class<Provider> clazz: finder.findArray() ) {
             try {
-                tf = (TransportFactorySPI)TRANSPORT_FACTORY_FINDER.newInstance(scheme);
-                TRANSPORT_FACTORYS.put(scheme, tf);
-            } catch (Throwable e) {
-                throw IOExceptionSupport.create("Transport scheme NOT recognized: [" + scheme
+ "]", e);
+              t.add( clazz.newInstance() );
+            } catch(Throwable e) {
+              e.printStackTrace();
             }
         }
-        return tf;
-    }
-
-
-     /**
-      * Allow registration of a transport factory without wiring via META-INF classes
-     * @param scheme
-     * @param tf
-     */
-    public static void registerTransportFactory(String scheme, TransportFactorySPI tf) {
-        TRANSPORT_FACTORYS.put(scheme, tf);
+        providers = t;
     }
 
     /**
      * Creates a client transport.
      */
     public static Transport connect(String location) throws Exception {
-        return factory(location).connect(location);
+        for( Provider provider : providers) {
+          Transport rc = provider.connect(location);
+          if( rc!=null ) {
+            return rc;
+          }
+        }
+        throw new IllegalArgumentException("Unknown transport connect uri: "+location);
     }
 
     /**
      * Creates a transport server.
      */
     public static TransportServer bind(String location) throws Exception {
-        return factory(location).bind(location);
+        for( Provider spi : providers) {
+          TransportServer rc = spi.bind(location);
+          if( rc!=null ) {
+            return rc;
+          }
+        }
+        throw new IllegalArgumentException("Unknown transport bind uri: "+location);
     }
 
-
 }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportFactory.java?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportFactory.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/apollo/transport/pipe/PipeTransportFactory.java
Wed Jul  7 04:29:44 2010
@@ -34,11 +34,15 @@ import org.apache.activemq.apollo.util.I
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-public class PipeTransportFactory implements TransportFactory.TransportFactorySPI {
+public class PipeTransportFactory implements TransportFactory.Provider {
 
     public static final HashMap<String, PipeTransportServer> servers = new HashMap<String,
PipeTransportServer>();
 
     public TransportServer bind(String location) throws URISyntaxException, IOException {
+        if( !location.startsWith("pipe:") ) {
+            return null;
+        }
+
         URI uri = new URI(location);
         Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(uri));
         String node = uri.getHost();
@@ -61,6 +65,10 @@ public class PipeTransportFactory implem
     }
 
     public Transport connect(String location) throws IOException, URISyntaxException {
+        if( !location.startsWith("pipe:") ) {
+            return null;
+        }
+
         URI uri = new URI(location);
         String name = uri.getHost();
         synchronized(servers) {

Copied: activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/resources/META-INF/services/org.apache.activem.apollo/transport-factory.index
(from r961223, activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/ssl)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/resources/META-INF/services/org.apache.activem.apollo/transport-factory.index?p2=activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/resources/META-INF/services/org.apache.activem.apollo/transport-factory.index&p1=activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/ssl&r1=961223&r2=961224&rev=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/transports/ssl
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/resources/META-INF/services/org.apache.activem.apollo/transport-factory.index
Wed Jul  7 04:29:44 2010
@@ -1,17 +1,17 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You 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.
-## ---------------------------------------------------------------------------
-class=org.apache.activemq.transport.tcp.SslTransportFactory
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You 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.
+## ---------------------------------------------------------------------------
+org.apache.activemq.transport.pipe.PipeTransportFactory

Modified: activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala
Wed Jul  7 04:29:44 2010
@@ -18,6 +18,7 @@ package org.apache.activemq.apollo.util
 
 import java.io.InputStream
 import java.util.Properties
+import scala.collection.mutable.ListBuffer
 
 /**
  * <p>
@@ -26,7 +27,11 @@ import java.util.Properties
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-case class ClassFinder[T](path:String, loaders:Seq[ClassLoader]=Thread.currentThread.getContextClassLoader::Nil)
{
+class ClassFinder[T](val path:String, val loaders:Array[ClassLoader]) {
+
+  def this(path:String) = this(path, Array(Thread.currentThread.getContextClassLoader))
+
+  def findArray(): Array[Class[T]] = find.toArray
 
   def find(): List[Class[T]] = {
     var classes = List[Class[T]]()
@@ -53,6 +58,18 @@ case class ClassFinder[T](path:String, l
     return classes.distinct
   }
 
+  def new_instances() = {
+    val t = ListBuffer[T]()
+    find.foreach {clazz =>
+      try {
+        t += clazz.newInstance.asInstanceOf[T]
+      } catch {
+        case e: Throwable => e.printStackTrace
+      }
+    }
+    t.toList
+  }
+
   private def loadProperties(is:InputStream):Properties = {
     if( is==null ) {
       return null;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/DirectBufferPoolFactory.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/DirectBufferPoolFactory.scala?rev=961224&r1=961223&r2=961224&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/DirectBufferPoolFactory.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/apollo/util/DirectBufferPoolFactory.scala
Wed Jul  7 04:29:44 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.apollo.util
 
+import scala.collection.mutable.ListBuffer
+
 /**
  * <p>
  * </p>
@@ -24,28 +26,24 @@ package org.apache.activemq.apollo.util
  */
 object DirectBufferPoolFactory {
 
-  val finder = ClassFinder[SPI]("META-INF/services/org.apache.activemq.apollo/direct-buffer-pools")
-  var spis = List[SPI]()
-
-  trait SPI {
+  trait Provider {
     def create(config:String):DirectBufferPool
     def validate(config: String):Boolean
   }
 
-  finder.find.foreach{ clazz =>
-    try {
-      spis ::= clazz.newInstance.asInstanceOf[SPI]
-    } catch {
-      case e:Throwable => e.printStackTrace
-    }
+  def discover = {
+    val finder = new ClassFinder[Provider]("META-INF/services/org.apache.activemq.apollo/direct-buffer-pool-factory.index")
+    finder.new_instances
   }
 
+  var providers = discover
+
   def create(config:String):DirectBufferPool = {
     if( config == null ) {
       return null
     }
-    spis.foreach { spi=>
-      val rc = spi.create(config)
+    providers.foreach { provider=>
+      val rc = provider.create(config)
       if( rc!=null ) {
         return rc
       }
@@ -58,8 +56,8 @@ object DirectBufferPoolFactory {
     if( config == null ) {
       return true
     } else {
-      spis.foreach { spi=>
-        if( spi.validate(config) ) {
+      providers.foreach { provider=>
+        if( provider.validate(config) ) {
           return true
         }
       }



Mime
View raw message