org.apache.camel.util
Class EndpointHelper

java.lang.Object
  extended by org.apache.camel.util.EndpointHelper

public final class EndpointHelper
extends Object

Some helper methods for working with Endpoint instances

Version:
$Revision: 795369 $

Method Summary
static boolean isReferenceParameter(String parameter)
          Is the given parameter a reference parameter (starting with a # char)
static boolean matchEndpoint(String uri, String pattern)
          Matches the endpoint with the given pattern.
static void pollEndpoint(Endpoint endpoint, Processor processor)
          Creates a PollingConsumer and polls all pending messages on the endpoint and invokes the given Processor to process each Exchange and then closes down the consumer and throws any exceptions thrown.
static void pollEndpoint(Endpoint endpoint, Processor processor, long timeout)
          Creates a PollingConsumer and polls all pending messages on the endpoint and invokes the given Processor to process each Exchange and then closes down the consumer and throws any exceptions thrown.
static void setProperties(CamelContext context, Object bean, Map parameters)
          Sets the regular properties on the given bean
static void setReferenceProperties(CamelContext context, Object bean, Map parameters)
          Sets the reference properties on the given bean

This is convention over configuration, setting all reference parameters (using isReferenceParameter(String) by looking it up in registry and setting it on the bean if possible.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

pollEndpoint

public static void pollEndpoint(Endpoint endpoint,
                                Processor processor,
                                long timeout)
                         throws Exception
Creates a PollingConsumer and polls all pending messages on the endpoint and invokes the given Processor to process each Exchange and then closes down the consumer and throws any exceptions thrown.

Throws:
Exception

pollEndpoint

public static void pollEndpoint(Endpoint endpoint,
                                Processor processor)
                         throws Exception
Creates a PollingConsumer and polls all pending messages on the endpoint and invokes the given Processor to process each Exchange and then closes down the consumer and throws any exceptions thrown.

Throws:
Exception

matchEndpoint

public static boolean matchEndpoint(String uri,
                                    String pattern)
Matches the endpoint with the given pattern.

The match rules are applied in this order:

Parameters:
uri - the endpoint uri
pattern - a pattern to match
Returns:
true if match, false otherwise.

setProperties

public static void setProperties(CamelContext context,
                                 Object bean,
                                 Map parameters)
                          throws Exception
Sets the regular properties on the given bean

Parameters:
context - the camel context
bean - the bean
parameters - parameters
Throws:
Exception - is thrown if setting property fails

setReferenceProperties

public static void setReferenceProperties(CamelContext context,
                                          Object bean,
                                          Map parameters)
                                   throws Exception
Sets the reference properties on the given bean

This is convention over configuration, setting all reference parameters (using isReferenceParameter(String) by looking it up in registry and setting it on the bean if possible.

Parameters:
context - the camel context
bean - the bean
parameters - parameters
Throws:
Exception - is thrown if setting property fails

isReferenceParameter

public static boolean isReferenceParameter(String parameter)
Is the given parameter a reference parameter (starting with a # char)

Parameters:
parameter - the parameter
Returns:
true if its a reference parameter


Apache CAMEL