Author: davsclaus
Date: Wed Sep 23 07:07:04 2009
New Revision: 817984
URL: http://svn.apache.org/viewvc?rev=817984&view=rev
Log:
CAMEL-2036: AntPathMatch is now OSGi friendly.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java?rev=817984&r1=817983&r2=817984&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
Wed Sep 23 07:07:04 2009
@@ -18,6 +18,8 @@
import java.lang.reflect.Method;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
import org.apache.camel.util.ObjectHelper;
import static
org.apache.camel.util.CollectionHelper.collectionAsCommaDelimitedString;
@@ -26,9 +28,11 @@
* <p/>
* Exclude take precedence over includes. If a file match both exclude and
include it will be regarded as excluded.
*/
-public class AntPathMatcherGenericFileFilter implements GenericFileFilter {
+public class AntPathMatcherGenericFileFilter implements GenericFileFilter,
CamelContextAware {
private static final String ANTPATHMATCHER_CLASSNAME =
"org.apache.camel.spring.util.SpringAntPathMatcherFileFilter";
+ private CamelContext context;
+
private String[] excludes;
private String[] includes;
@@ -63,8 +67,9 @@
@SuppressWarnings("unchecked")
private void init() throws NoSuchMethodException {
// we must use reflection to invoke the AntPathMatcherFileFilter that
reside in camel-spring.jar
- // and we don't want camel-cone to have runtime dependency on
camel-spring.jar
- Class clazz = ObjectHelper.loadClass(ANTPATHMATCHER_CLASSNAME);
+ // and we don't want camel-core to have runtime dependency on
camel-spring.jar
+ // use class resolver from CamelContext to ensure it works with OSGi
as well
+ Class clazz =
context.getClassResolver().resolveClass(ANTPATHMATCHER_CLASSNAME);
ObjectHelper.notNull(clazz, ANTPATHMATCHER_CLASSNAME + " not found in
classpath. camel-spring.jar is required in the classpath.");
filter = ObjectHelper.newInstance(clazz);
@@ -104,4 +109,12 @@
setIncludes(includes.split(","));
}
+ public void setCamelContext(CamelContext camelContext) {
+ this.context = camelContext;
+ }
+
+ public CamelContext getCamelContext() {
+ return context;
+ }
+
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java?rev=817984&r1=817983&r2=817984&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
Wed Sep 23 07:07:04 2009
@@ -177,7 +177,7 @@
boolean hit =
IntrospectionSupport.setProperty(context.getTypeConverter(), bean, name, ref);
if (hit) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Configued property: " + name + " on
bean: " + bean + " with value: " + ref);
+ LOG.debug("Configured property: " + name + " on
bean: " + bean + " with value: " + ref);
}
// must remove as its a valid option and we could
configure it
it.remove();
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=817984&r1=817983&r2=817984&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
Wed Sep 23 07:07:04 2009
@@ -65,7 +65,7 @@
try {
return setProperties(target, properties, optionPrefix);
} catch (Exception e) {
- LOG.debug("Can not copy properties to target: " + target, e);
+ LOG.debug("Cannot copy properties to target: " + target, e);
return false;
}
}