activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r519989 - in /activemq/camel/trunk/camel-core/src/main: java/org/apache/camel/ java/org/apache/camel/builder/ java/org/apache/camel/impl/ java/org/apache/camel/seda/ java/org/apache/camel/util/ resources/ resources/META-INF/ resources/META-...
Date Mon, 19 Mar 2007 16:13:49 GMT
Author: chirino
Date: Mon Mar 19 09:13:48 2007
New Revision: 519989

URL: http://svn.apache.org/viewvc?view=rev&rev=519989
Log:
Updated DefaultEndpointResolver so that it uses a FactoryFinder to delegate to plugable EndpointResolver
implementations

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/seda/SedaEndpointResolver.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
  (with props)
    activemq/camel/trunk/camel-core/src/main/resources/
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/EndpointResolver/
    activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/EndpointResolver/seda
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContainer.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointResolver.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContainer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContainer.java?view=diff&rev=519989&r1=519988&r2=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContainer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContainer.java Mon
Mar 19 09:13:48 2007
@@ -54,7 +54,7 @@
     // Implementation methods
     //-----------------------------------------------------------------------
     protected EndpointResolver<E> createEndpointResolver() {
-        return new DefaultEndpointResolver<E>(this);
+        return new DefaultEndpointResolver<E>();
     }
 
     /**

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java?view=diff&rev=519989&r1=519988&r2=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java Mon
Mar 19 09:13:48 2007
@@ -26,5 +26,5 @@
     /**
      * Resolves the given uri or returns null if no endpoint could be found
      */
-    public Endpoint<E> resolve(String uri);
+    public Endpoint<E> resolve(CamelContainer container, String uri);
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?view=diff&rev=519989&r1=519988&r2=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
Mon Mar 19 09:13:48 2007
@@ -16,21 +16,20 @@
  */
 package org.apache.camel.builder;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.camel.CamelContainer;
 import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointResolver;
 import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
-import org.apache.camel.CamelContainer;
-import org.apache.camel.impl.DefaultEndpointResolver;
 import org.apache.camel.util.ObjectHelper;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
 /**
  * A builder of destinationBuilders using a typesafe Java DLS.
  *
@@ -51,7 +50,9 @@
      * Resolves the given URI to an endpoint
      */
     public Endpoint<E> endpoint(String uri) {
-        return getContainer().getEndpointResolver().resolve(uri);
+         CamelContainer<E> c = getContainer();
+         EndpointResolver<E> er = c.getEndpointResolver();
+         return er.resolve(c, uri);
     }
 
     public DestinationBuilder<E> from(String uri) {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointResolver.java?view=diff&rev=519989&r1=519988&r2=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointResolver.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointResolver.java
Mon Mar 19 09:13:48 2007
@@ -16,11 +16,11 @@
  */
 package org.apache.camel.impl;
 
-import org.apache.camel.EndpointResolver;
-import org.apache.camel.Endpoint;
-import org.apache.camel.ExchangeConverter;
 import org.apache.camel.CamelContainer;
-import org.apache.camel.seda.SedaEndpoint;
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointResolver;
+import org.apache.camel.util.FactoryFinder;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * A default implementation of {@link org.apache.camel.EndpointResolver}
@@ -28,16 +28,23 @@
  * @version $Revision$
  */
 public class DefaultEndpointResolver<E> implements EndpointResolver<E> {
-    private final CamelContainer container;
+    static final private FactoryFinder endpointResolverFactory = new FactoryFinder("META-INF/services/org/apache/camel/EndpointResolver/");
+    
+    public Endpoint<E> resolve(CamelContainer container, String uri) {
+    	String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":");
+    	if( splitURI == null )
+    		throw new IllegalArgumentException("Invalid URI, it did not contain a scheme: "+uri);
+    	EndpointResolver resolver;
+		try {
+			resolver = (EndpointResolver) endpointResolverFactory.newInstance(splitURI[0]);
+		} catch (Throwable e) {
+			throw new IllegalArgumentException("Invalid URI, no EndpointResolver registered for scheme
: "+splitURI[0], e);
+		}
 
-    public DefaultEndpointResolver(CamelContainer container) {
-        this.container = container;
+		return resolver.resolve(container, uri);
+		
+		// EndpointResolvers could be more recusive in nature if we resolved the reset of the of
the URI 
+		//return resolver.resolve(container, splitURI[1]);
     }
-
-    public Endpoint<E> resolve(String uri) {
-        // TODO we may want to cache them?
-        return new SedaEndpoint<E>(uri, container);
-    }
-
 
 }

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/seda/SedaEndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/seda/SedaEndpointResolver.java?view=auto&rev=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/seda/SedaEndpointResolver.java
(added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/seda/SedaEndpointResolver.java
Mon Mar 19 09:13:48 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.seda;
+
+import org.apache.camel.CamelContainer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointResolver;
+import org.apache.camel.util.ObjectHelper;
+
+/**
+ * A default implementation of {@link org.apache.camel.EndpointResolver}
+ *
+ * @version $Revision: 519901 $
+ */
+public class SedaEndpointResolver<E> implements EndpointResolver<E> {
+	
+    public Endpoint<E> resolve(CamelContainer container, String uri) {
+		return new SedaEndpoint<E>(uri, container);
+    }
+
+}

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java?view=auto&rev=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
(added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
Mon Mar 19 09:13:48 2007
@@ -0,0 +1,108 @@
+/**
+ *
+ * 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.util;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+
+public class FactoryFinder {
+
+    private final String path;
+    private final ConcurrentHashMap classMap = new ConcurrentHashMap();
+
+    public FactoryFinder(String path) {
+        this.path = path;
+    }
+
+    /**
+     * Creates a new instance of the given key
+     *
+     * @param key is the key to add to the path to find a text file
+     *            containing the factory name
+     * @return a newly created instance
+     */
+    public Object newInstance(String key)
+            throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException
+    {
+        return newInstance(key, null);
+    }
+
+    public Object newInstance(String key, String propertyPrefix)
+            throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException
+    {
+        if (propertyPrefix == null)
+            propertyPrefix = "";
+
+        Class clazz = (Class) classMap.get(propertyPrefix + key);
+        if (clazz == null) {
+            clazz = newInstance(doFindFactoryProperies(key), propertyPrefix);
+            classMap.put(propertyPrefix + key, clazz);
+        }
+        return clazz.newInstance();
+    }
+
+    private Class newInstance(Properties properties, String propertyPrefix) throws ClassNotFoundException,
IOException {
+
+        String className = properties.getProperty(propertyPrefix + "class");
+        if (className == null) {
+            throw new IOException("Expected property is missing: " + propertyPrefix + "class");
+        }
+        Class clazz;
+        try {
+            clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+        } catch (ClassNotFoundException e) {
+            clazz = FactoryFinder.class.getClassLoader().loadClass(className);
+        }
+
+        return clazz;
+    }
+
+    private Properties doFindFactoryProperies(String key) throws IOException {
+        String uri = path + key;
+
+        // lets try the thread context class loader first
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        if (classLoader == null) classLoader = getClass().getClassLoader();
+        InputStream in = classLoader.getResourceAsStream(uri);
+        if (in == null) {
+            in = FactoryFinder.class.getClassLoader().getResourceAsStream(uri);
+            if (in == null) {
+                throw new IOException("Could not find factory class for resource: " + uri);
+            }
+        }
+
+        // lets load the file
+        BufferedInputStream reader = null;
+        try {
+            reader = new BufferedInputStream(in);
+            Properties properties = new Properties();
+            properties.load(reader);
+            return properties;
+        } finally {
+            try {
+                reader.close();
+            } catch (Exception e) {
+            }
+        }
+    }
+}

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?view=auto&rev=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
(added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
Mon Mar 19 09:13:48 2007
@@ -0,0 +1,292 @@
+/**
+ *
+ * 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.util;
+
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+public class IntrospectionSupport {
+        
+	
+    static public boolean getProperties(Object target, Map props, String optionPrefix) {
+    	
+        boolean rc = false;
+        if( target == null )
+            throw new IllegalArgumentException("target was null.");
+        if( props == null )
+            throw new IllegalArgumentException("props was null.");
+        
+        if( optionPrefix == null )
+        	optionPrefix="";
+        
+        Class clazz = target.getClass();
+        Method[] methods = clazz.getMethods();
+        for (int i = 0; i < methods.length; i++) {
+            Method method = methods[i];
+            String name = method.getName();
+            Class type = method.getReturnType();
+            Class params[] = method.getParameterTypes();
+            if( name.startsWith("get") && params.length==0 && 
+            		type!=null && isSettableType(type)) {
+
+            	try {
+            		
+            		Object value = method.invoke(target, new Object[]{});
+            		if( value == null )
+            			continue;
+            		
+            		String strValue = convertToString(value, type);
+            		if( strValue ==null )
+            			continue;
+            		
+                    name = name.substring(3,4).toLowerCase()+name.substring(4);
+                    props.put(optionPrefix+name, strValue);
+                    rc = true;
+                    
+            	} catch ( Throwable ignore) {
+            	}
+            	
+            }
+        }
+        
+        return rc;
+    }
+	
+	
+	
+    static public boolean setProperties(Object target, Map props, String optionPrefix) {
+        boolean rc = false;
+        if( target == null )
+            throw new IllegalArgumentException("target was null.");
+        if( props == null )
+            throw new IllegalArgumentException("props was null.");
+        
+        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
+            String name = (String) iter.next();
+            if( name.startsWith(optionPrefix) ) {
+                Object value = props.get(name);
+                name = name.substring(optionPrefix.length());
+                if( setProperty(target, name, value) ) {
+                    iter.remove();
+                    rc = true;
+                }
+            }
+        }
+        return rc;
+    }
+    
+    public static Map extractProperties(Map props, String optionPrefix) {
+        if( props == null )
+            throw new IllegalArgumentException("props was null.");
+
+        HashMap rc = new HashMap(props.size());
+        
+        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
+            String name = (String) iter.next();
+            if( name.startsWith(optionPrefix) ) {
+                Object value = props.get(name);
+                name = name.substring(optionPrefix.length());
+                rc.put(name, value);
+                iter.remove();
+            }
+        }
+        
+        return rc;
+    }
+          
+    public static boolean setProperties(Object target, Map props) {
+    	boolean rc = false;
+    	
+        if( target == null )
+            throw new IllegalArgumentException("target was null.");
+        if( props == null )
+            throw new IllegalArgumentException("props was null.");
+        
+        for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) {
+            Map.Entry entry = (Entry) iter.next();
+            if( setProperty(target, (String) entry.getKey(), entry.getValue()) ) {
+                iter.remove();
+                rc=true;
+            }
+        }
+        
+        return rc;
+    }
+
+    public static boolean setProperty(Object target, String name, Object value) {
+        try {
+            Class clazz = target.getClass();
+            Method setter = findSetterMethod(clazz, name);
+            if( setter == null )
+                return false;
+            
+            // If the type is null or it matches the needed type, just use the value directly
+            if( value == null || value.getClass()==setter.getParameterTypes()[0] ) {
+                setter.invoke(target, new Object[]{value});
+            } else {
+                // We need to convert it
+                setter.invoke(target, new Object[]{ convert(value, setter.getParameterTypes()[0])
});
+            }
+            return true;
+        } catch (Throwable ignore) {
+            return false;
+        }
+    }
+
+    private static Object convert(Object value, Class type) throws URISyntaxException {
+        PropertyEditor editor = PropertyEditorManager.findEditor(type);
+        if( editor != null ) { 
+            editor.setAsText(value.toString());
+            return editor.getValue();
+        }
+        if( type == URI.class ) {
+            return new URI(value.toString());
+        }
+        return null;
+    }
+
+    private static String convertToString(Object value, Class type) throws URISyntaxException
{
+        PropertyEditor editor = PropertyEditorManager.findEditor(type);
+        if( editor != null ) { 
+            editor.setValue(value);
+            return editor.getAsText();
+        }
+        if( type == URI.class ) {
+            return ((URI)value).toString();
+        }
+        return null;
+    }
+
+    private static Method findSetterMethod(Class clazz, String name) {
+        // Build the method name.
+        name = "set"+name.substring(0,1).toUpperCase()+name.substring(1);
+        Method[] methods = clazz.getMethods();
+        for (int i = 0; i < methods.length; i++) {
+            Method method = methods[i];
+            Class params[] = method.getParameterTypes();
+            if( method.getName().equals(name) 
+                    && params.length==1
+                    && isSettableType(params[0])) {
+                return method;
+            }
+        }
+        return null;
+    }
+
+    private static boolean isSettableType(Class clazz) {
+        if( PropertyEditorManager.findEditor(clazz)!=null )
+            return true;
+        if( clazz == URI.class )
+            return true;
+        if( clazz == Boolean.class )
+            return true;
+        return false;
+    }
+
+    static public String toString(Object target) {
+        return toString(target, Object.class);
+    }
+
+    static public String toString(Object target, Class stopClass) {
+        LinkedHashMap map = new LinkedHashMap();
+        addFields(target, target.getClass(), stopClass, map);
+        StringBuffer buffer = new StringBuffer(simpleName(target.getClass()));
+        buffer.append(" {");
+        Set entrySet = map.entrySet();
+        boolean first = true;
+        for (Iterator iter = entrySet.iterator(); iter.hasNext();) {
+            Map.Entry entry = (Map.Entry) iter.next();
+            if (first) {
+                first = false;
+            }
+            else {
+                buffer.append(", ");
+            }
+            buffer.append(entry.getKey());
+            buffer.append(" = ");
+            appendToString(buffer, entry.getValue());
+        }
+        buffer.append("}");
+        return buffer.toString();
+    }
+
+    protected static void appendToString(StringBuffer buffer, Object value) {
+//        if (value instanceof ActiveMQDestination) {
+//            ActiveMQDestination destination = (ActiveMQDestination) value;
+//            buffer.append(destination.getQualifiedName());
+//        }
+//        else {
+            buffer.append(value);
+//        }
+    }
+
+    static public String simpleName(Class clazz) {
+        String name = clazz.getName();
+        int p = name.lastIndexOf(".");
+        if( p >= 0 ) {
+            name = name.substring(p+1);
+        }
+        return name;
+    }
+    
+
+    static private void addFields(Object target, Class startClass, Class stopClass, LinkedHashMap
map) {
+        
+        if( startClass!=stopClass ) 
+            addFields( target, startClass.getSuperclass(), stopClass, map );
+        
+        Field[] fields = startClass.getDeclaredFields();
+        for (int i = 0; i < fields.length; i++) {
+            Field field = fields[i];
+            if( Modifier.isStatic(field.getModifiers()) || 
+                Modifier.isTransient(field.getModifiers()) ||
+                Modifier.isPrivate(field.getModifiers())  ) {
+                continue;
+            }
+            
+            try {
+                field.setAccessible(true);
+                Object o = field.get(target);
+                if( o!=null && o.getClass().isArray() ) {
+                    try {
+                        o = Arrays.asList((Object[]) o);
+                    } catch (Throwable e) {
+                    }
+                }
+                map.put(field.getName(), o);
+            } catch (Throwable e) {
+                e.printStackTrace();
+            }
+        }
+        
+    }
+
+    
+}

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?view=diff&rev=519989&r1=519988&r2=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
Mon Mar 19 09:13:48 2007
@@ -32,4 +32,13 @@
             throw new NullPointerException("No " + name + " specified");
         }
     }
+    
+    public static String[] splitOnCharacter(String value, String needle) {
+		int i = value.indexOf(needle);
+		if( i < 0 ) {
+			return null;
+		}		
+		return new String[] {value.substring(0, i), value.substring(i+1)};
+	}
+
 }

Added: activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/EndpointResolver/seda
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/EndpointResolver/seda?view=auto&rev=519989
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/EndpointResolver/seda
(added)
+++ activemq/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/EndpointResolver/seda
Mon Mar 19 09:13:48 2007
@@ -0,0 +1 @@
+class=org.apache.camel.seda.SedaEndpointResolver



Mime
View raw message