public final class CamelContextHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_BASE |
static String |
COMPONENT_DESCRIPTOR |
static String |
COMPONENT_DOCUMENTATION_PREFIX |
static String |
MODEL_DESCRIPTOR |
static String |
MODEL_DOCUMENTATION_PREFIX |
Modifier and Type | Method and Description |
---|---|
static <T> T |
convertTo(CamelContext context,
Class<T> type,
Object value)
Converts the given value to the requested type
|
static <T> T |
findByType(CamelContext camelContext,
Class<T> type)
Look up a bean of the give type in the
Registry on the
CamelContext returning an instance if only one bean is present, |
static SortedMap<String,Properties> |
findComponents(CamelContext camelContext)
Finds all possible Components on the classpath, already registered in
CamelContext ,
and from the Registry . |
static SortedMap<String,Properties> |
findComponents(CamelContext camelContext,
Enumeration<URL> componentDescriptionIter) |
static SortedMap<String,Properties> |
findEips(CamelContext camelContext)
Find information about all the EIPs from camel-core.
|
static Endpoint |
getEndpointInjection(CamelContext camelContext,
String uri,
String ref,
String injectionPointName,
boolean mandatory)
Evaluates the @EndpointInject annotation using the given context
|
static Endpoint |
getMandatoryEndpoint(CamelContext camelContext,
String uri)
Returns the mandatory endpoint for the given URI or the
NoSuchEndpointException is thrown |
static <T extends Endpoint> |
getMandatoryEndpoint(CamelContext camelContext,
String uri,
Class<T> type)
Returns the mandatory endpoint for the given URI and type or the
NoSuchEndpointException is thrown |
static int |
getMaximumCachePoolSize(CamelContext camelContext)
Gets the maximum cache pool size.
|
static int |
getMaximumEndpointCacheSize(CamelContext camelContext)
Gets the maximum endpoint cache size.
|
static int |
getMaximumTransformerCacheSize(CamelContext camelContext)
Gets the maximum transformer cache size.
|
static int |
getMaximumValidatorCacheSize(CamelContext camelContext)
Gets the maximum validator cache size.
|
static int |
getRouteStartupOrder(CamelContext camelContext,
String routeId)
Gets the route startup order for the given route id
|
static boolean |
isEipInUse(CamelContext camelContext,
String name)
Checks if any of the Camel routes is using an EIP with the given name
|
static Object |
lookup(CamelContext context,
String name)
Look up the given named bean in the
Registry on the
CamelContext |
static <T> T |
lookup(CamelContext context,
String name,
Class<T> beanType)
Look up the given named bean of the given type in the
Registry on the
CamelContext |
static Component |
lookupPropertiesComponent(CamelContext camelContext,
boolean autoCreate)
Lookup the
PropertiesComponent from the CamelContext . |
static <T> T |
mandatoryConvertTo(CamelContext context,
Class<T> type,
Object value)
Converts the given value to the specified type throwing an
IllegalArgumentException
if the value could not be converted to a non null value |
static Object |
mandatoryLookup(CamelContext context,
String name)
Look up the given named bean in the
Registry on the
CamelContext or throws NoSuchBeanException if not found. |
static <T> T |
mandatoryLookup(CamelContext context,
String name,
Class<T> beanType)
Look up the given named bean of the given type in the
Registry on the
CamelContext or throws NoSuchBeanException if not found. |
static <T> T |
newInstance(CamelContext context,
Class<T> beanType)
Creates a new instance of the given type using the
Injector on the given
CamelContext |
static Boolean |
parseBoolean(CamelContext camelContext,
String text)
Parses the given text and converts it to an Boolean and handling property placeholders as well
|
static Double |
parseDouble(CamelContext camelContext,
String text)
Parses the given text and converts it to a Double and handling property placeholders as well
|
static Integer |
parseInteger(CamelContext camelContext,
String text)
Parses the given text and converts it to an Integer and handling property placeholders as well
|
static Long |
parseLong(CamelContext camelContext,
String text)
Parses the given text and converts it to an Long and handling property placeholders as well
|
static String |
parseText(CamelContext camelContext,
String text)
Parses the given text and handling property placeholders as well
|
static void |
resolvePropertyPlaceholders(CamelContext camelContext,
Object target)
Inspects the given object and resolves any property placeholders from its properties.
|
public static final String COMPONENT_BASE
public static final String COMPONENT_DESCRIPTOR
public static final String COMPONENT_DOCUMENTATION_PREFIX
public static final String MODEL_DESCRIPTOR
public static final String MODEL_DOCUMENTATION_PREFIX
public static Endpoint getMandatoryEndpoint(CamelContext camelContext, String uri) throws NoSuchEndpointException
NoSuchEndpointException
is thrownNoSuchEndpointException
public static <T extends Endpoint> T getMandatoryEndpoint(CamelContext camelContext, String uri, Class<T> type)
NoSuchEndpointException
is thrownpublic static <T> T convertTo(CamelContext context, Class<T> type, Object value)
public static <T> T mandatoryConvertTo(CamelContext context, Class<T> type, Object value)
IllegalArgumentException
if the value could not be converted to a non null valuepublic static <T> T newInstance(CamelContext context, Class<T> beanType)
Injector
on the given
CamelContext
public static Object lookup(CamelContext context, String name)
Registry
on the
CamelContext
public static <T> T lookup(CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
public static <T> T findByType(CamelContext camelContext, Class<T> type)
Registry
on the
CamelContext
returning an instance if only one bean is present,public static Object mandatoryLookup(CamelContext context, String name)
Registry
on the
CamelContext
or throws NoSuchBeanException
if not found.public static <T> T mandatoryLookup(CamelContext context, String name, Class<T> beanType)
Registry
on the
CamelContext
or throws NoSuchBeanException if not found.public static Endpoint getEndpointInjection(CamelContext camelContext, String uri, String ref, String injectionPointName, boolean mandatory)
public static int getMaximumCachePoolSize(CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_CACHE_POOL_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static int getMaximumEndpointCacheSize(CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_ENDPOINT_CACHE_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static int getMaximumTransformerCacheSize(CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_TRANSFORMER_CACHE_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static int getMaximumValidatorCacheSize(CamelContext camelContext) throws IllegalArgumentException
Exchange.MAXIMUM_VALIDATOR_CACHE_SIZE
.
If no property has been set, then it will fallback to return a size of 1000.camelContext
- the camel contextIllegalArgumentException
- is thrown if the property is illegalpublic static String parseText(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argumentpublic static Integer parseInteger(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static Long parseLong(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static Double parseDouble(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static Boolean parseBoolean(CamelContext camelContext, String text) throws Exception
camelContext
- the camel contexttext
- the textException
- is thrown if illegal argument or type conversion not possiblepublic static SortedMap<String,Properties> findComponents(CamelContext camelContext) throws LoadPropertiesException
CamelContext
,
and from the Registry
.LoadPropertiesException
public static SortedMap<String,Properties> findComponents(CamelContext camelContext, Enumeration<URL> componentDescriptionIter) throws LoadPropertiesException
LoadPropertiesException
public static SortedMap<String,Properties> findEips(CamelContext camelContext) throws LoadPropertiesException
LoadPropertiesException
public static int getRouteStartupOrder(CamelContext camelContext, String routeId)
camelContext
- the camel contextrouteId
- the id of the routepublic static Component lookupPropertiesComponent(CamelContext camelContext, boolean autoCreate)
PropertiesComponent
from the CamelContext
.
camelContext
- the camel contextautoCreate
- whether to automatic create a new default PropertiesComponent
if no custom component
has been configured.public static boolean isEipInUse(CamelContext camelContext, String name)
camelContext
- the Camel contextname
- the name of the EIPpublic static void resolvePropertyPlaceholders(CamelContext camelContext, Object target) throws Exception
camelContext
- the Camel contexttarget
- the object that should have the properties (eg getter/setter) resolvedException
- is thrown if property placeholders was used and there was an error resolving themCamelContext.resolvePropertyPlaceholders(String)
,
PropertiesComponent
Apache Camel