camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r754494 - in /camel/trunk/components/camel-osgi/src: main/java/org/apache/camel/osgi/ test/java/org/apache/camel/osgi/
Date Sat, 14 Mar 2009 17:10:36 GMT
Author: davsclaus
Date: Sat Mar 14 17:10:35 2009
New Revision: 754494

URL: http://svn.apache.org/viewvc?rev=754494&view=rev
Log:
CAMEL-1458: FactoryFinder as SPI

Added:
    camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinderResolver.java
  (with props)
Modified:
    camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
    camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
    camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
    camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/osgi/OsgiFactoryFinderTest.java

Modified: camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java?rev=754494&r1=754493&r2=754494&view=diff
==============================================================================
--- camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
(original)
+++ camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
Sat Mar 14 17:10:35 2009
@@ -53,7 +53,7 @@
             context.setComponentResolver(new OsgiComponentResolver());
             context.setLanguageResolver(new OsgiLanguageResolver());
             addOsgiAnnotationTypeConverterLoader(context, bundleContext);
-            context.setFactoryFinderResolver(new OsgiFactoryFinder());
+            context.setFactoryFinderResolver(new OsgiFactoryFinderResolver());
         }
         
         return context;

Modified: camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java?rev=754494&r1=754493&r2=754494&view=diff
==============================================================================
--- camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
(original)
+++ camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java
Sat Mar 14 17:10:35 2009
@@ -50,7 +50,7 @@
             context.setPackageScanClassResolver(new OsgiPackageScanClassResolver(bundleContext));
             context.setComponentResolver(new OsgiComponentResolver());
             context.setLanguageResolver(new OsgiLanguageResolver());
-            context.setFactoryFinderResolver(new OsgiFactoryFinder());
+            context.setFactoryFinderResolver(new OsgiFactoryFinderResolver());
             addOsgiAnnotationTypeConverterLoader(context);
         }
         

Modified: camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java?rev=754494&r1=754493&r2=754494&view=diff
==============================================================================
--- camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
(original)
+++ camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinder.java
Sat Mar 14 17:10:35 2009
@@ -25,33 +25,20 @@
 import org.apache.camel.NoFactoryAvailableException;
 import org.apache.camel.impl.DefaultFactoryFinder;
 import org.apache.camel.spi.FactoryFinder;
+import org.apache.camel.spi.ClassResolver;
 import org.apache.camel.util.ObjectHelper;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 
 public class OsgiFactoryFinder extends DefaultFactoryFinder {
-    
-    private class BundleEntry {
-        URL url;
-        Bundle bundle;
-    }
-
-    public OsgiFactoryFinder() {
-        super();
-    }
 
-    public OsgiFactoryFinder(String path) {
-        super(path);
+    public OsgiFactoryFinder(ClassResolver classResolver, String resourcePath) {
+        super(classResolver, resourcePath);
     }
 
-    @Override
-    public FactoryFinder resolveDefaultFactoryFinder() {
-        return new OsgiFactoryFinder();
-    }
-
-    @Override
-    public FactoryFinder resolveFactoryFinder(String path) {
-        return new OsgiFactoryFinder(path);
+    private class BundleEntry {
+        URL url;
+        Bundle bundle;
     }
 
     @Override

Added: camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinderResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinderResolver.java?rev=754494&view=auto
==============================================================================
--- camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinderResolver.java
(added)
+++ camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinderResolver.java
Sat Mar 14 17:10:35 2009
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+package org.apache.camel.osgi;
+
+import org.apache.camel.spi.FactoryFinderResolver;
+import org.apache.camel.spi.FactoryFinder;
+import org.apache.camel.spi.ClassResolver;
+
+/**
+ * @version $Revision$
+ */
+public class OsgiFactoryFinderResolver implements FactoryFinderResolver {
+
+    public FactoryFinder resolveDefaultFactoryFinder(ClassResolver classResolver) {
+        return resolveFactoryFinder(classResolver, "META-INF/services/org/apache/camel/");
+    }
+
+    public FactoryFinder resolveFactoryFinder(ClassResolver classResolver, String resourcePath)
{
+        return new OsgiFactoryFinder(classResolver, resourcePath);
+    }
+
+}

Propchange: camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinderResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiFactoryFinderResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/osgi/OsgiFactoryFinderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/osgi/OsgiFactoryFinderTest.java?rev=754494&r1=754493&r2=754494&view=diff
==============================================================================
--- camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/osgi/OsgiFactoryFinderTest.java
(original)
+++ camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/osgi/OsgiFactoryFinderTest.java
Sat Mar 14 17:10:35 2009
@@ -19,10 +19,11 @@
 import java.io.IOException;
 
 import org.apache.camel.NoFactoryAvailableException;
+import org.apache.camel.impl.DefaultClassResolver;
 
 public class OsgiFactoryFinderTest extends CamelOsgiTestSupport {
     public void testFindClass() throws Exception {
-        OsgiFactoryFinder finder = new OsgiFactoryFinder("META-INF/services/org/apache/camel/component/");
+        OsgiFactoryFinder finder = new OsgiFactoryFinder(new DefaultClassResolver(), "META-INF/services/org/apache/camel/component/");
         Class clazz = finder.findClass("file_test", "strategy.factory.");
         assertNotNull("We should get the file strategy factory here", clazz);
         



Mime
View raw message