You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/07/19 00:57:36 UTC
svn commit: r965312 - in /activemq/sandbox/activemq-apollo-actor: ./
apollo-transport/src/main/java/org/apache/activemq/apollo/transport/
apollo-util/src/main/scala/org/apache/activemq/apollo/util/
Author: chirino
Date: Sun Jul 18 22:57:36 2010
New Revision: 965312
URL: http://svn.apache.org/viewvc?rev=965312&view=rev
Log:
remove the factory finder class.. upgrade the cascal version
Removed:
activemq/sandbox/activemq-apollo-actor/apollo-util/src/main/scala/org/apache/activemq/apollo/util/FactoryFinder.java
Modified:
activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/DiscoveryAgentFactory.java
activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactorySupport.java
activemq/sandbox/activemq-apollo-actor/pom.xml
Modified: activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/DiscoveryAgentFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/DiscoveryAgentFactory.java?rev=965312&r1=965311&r2=965312&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/DiscoveryAgentFactory.java (original)
+++ activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/DiscoveryAgentFactory.java Sun Jul 18 22:57:36 2010
@@ -16,64 +16,34 @@
*/
package org.apache.activemq.apollo.transport;
-import java.io.IOException;
-import java.net.URI;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.activemq.apollo.util.JavaClassFinder;
-import org.apache.activemq.apollo.util.FactoryFinder;
-import org.apache.activemq.apollo.util.IOExceptionSupport;
+import java.util.List;
-public abstract class DiscoveryAgentFactory {
+public class DiscoveryAgentFactory {
- private static final FactoryFinder DISCOVERY_AGENT_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/transport/discoveryagent/");
- private static final ConcurrentHashMap<String, DiscoveryAgentFactory> DISCOVERY_AGENT_FACTORYS = new ConcurrentHashMap<String, DiscoveryAgentFactory>();
+ public interface Provider {
+ public DiscoveryAgent create(String uri) throws Exception;
+ }
+
+ static public List<Provider> providers;
+
+ static {
+ JavaClassFinder<Provider> finder = new JavaClassFinder<Provider>("META-INF/services/org.apache.activemq.apollo/discovery-agent-factory.index");
+ providers = finder.new_instances();
+ }
/**
- * @param uri
- * @return
- * @throws IOException
+ * Creates a DiscoveryAgent
*/
- private static DiscoveryAgentFactory findDiscoveryAgentFactory(URI uri) throws IOException {
- String scheme = uri.getScheme();
- if (scheme == null) {
- throw new IOException("DiscoveryAgent scheme not specified: [" + uri + "]");
+ public static DiscoveryAgent create(String uri) throws Exception {
+ for( Provider provider : providers) {
+ DiscoveryAgent rc = provider.create(uri);
+ if( rc!=null ) {
+ return rc;
+ }
}
- DiscoveryAgentFactory daf = DISCOVERY_AGENT_FACTORYS.get(scheme);
- if (daf == null) {
- // Try to load if from a META-INF property.
- try {
- daf = (DiscoveryAgentFactory)DISCOVERY_AGENT_FINDER.newInstance(scheme);
- DISCOVERY_AGENT_FACTORYS.put(scheme, daf);
- } catch (Throwable e) {
- throw IOExceptionSupport.create("DiscoveryAgent scheme NOT recognized: [" + scheme + "]", e);
- }
- }
- return daf;
- }
-
- public static DiscoveryAgent createDiscoveryAgent(URI uri) throws IOException {
- DiscoveryAgentFactory tf = findDiscoveryAgentFactory(uri);
- return tf.doCreateDiscoveryAgent(uri);
-
+ throw new IllegalArgumentException("Unknown discovery agent uri: "+uri);
}
- protected abstract DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException;
- // {
- // try {
- // String type = ( uri.getScheme() == null ) ? uri.getPath() :
- // uri.getScheme();
- // DiscoveryAgent rc = (DiscoveryAgent)
- // discoveryAgentFinder.newInstance(type);
- // Map options = URISupport.parseParamters(uri);
- // IntrospectionSupport.setProperties(rc, options);
- // if( rc.getClass() == SimpleDiscoveryAgent.class ) {
- // CompositeData data = URISupport.parseComposite(uri);
- // ((SimpleDiscoveryAgent)rc).setServices(data.getComponents());
- // }
- // return rc;
- // } catch (Throwable e) {
- // throw IOExceptionSupport.create("Could not create discovery agent: "+uri,
- // e);
- // }
- // }
}
Modified: activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactorySupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactorySupport.java?rev=965312&r1=965311&r2=965312&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactorySupport.java (original)
+++ activemq/sandbox/activemq-apollo-actor/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/TransportFactorySupport.java Sun Jul 18 22:57:36 2010
@@ -16,7 +16,6 @@
*/
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.IntrospectionSupport;
import org.apache.activemq.apollo.util.URISupport;
@@ -97,4 +96,8 @@ public class TransportFactorySupport {
return "stomp";
}
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return super.clone(); //To change body of overridden methods use File | Settings | File Templates.
+ }
}
Modified: activemq/sandbox/activemq-apollo-actor/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/pom.xml?rev=965312&r1=965311&r2=965312&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/pom.xml (original)
+++ activemq/sandbox/activemq-apollo-actor/pom.xml Sun Jul 18 22:57:36 2010
@@ -45,7 +45,7 @@
<!-- dependencies that track scala version changes -->
<scala-version>2.8.0</scala-version>
<scalatest-version>1.2-for-scala-2.8.0.final-SNAPSHOT</scalatest-version>
- <cascal-version>1.2-Scala.2.8.0-SNAPSHOT</cascal-version>
+ <cascal-version>1.3-SNAPSHOT</cascal-version>
<servicemix.kernel.version>1.1.0</servicemix.kernel.version>
<spring-version>2.5.5</spring-version>