org.ow2.jonas.camel.component
Class RouteBuilderComponent

java.lang.Object
  extended by org.apache.camel.builder.BuilderSupport
      extended by org.apache.camel.builder.RouteBuilder
          extended by org.ow2.jonas.camel.component.RouteBuilderComponent
All Implemented Interfaces:
org.apache.camel.RoutesBuilder

public abstract class RouteBuilderComponent
extends org.apache.camel.builder.RouteBuilder

iPOJO component that creates a CAMEL context with:

In order to use it:


Field Summary
protected  org.osgi.framework.BundleContext bundleContext
          The OSGi bundle context.
protected  java.lang.String camelContextName
          The Camel context name.
protected  org.ow2.jonas.camel.service.api.ICamelService camelService
          The Camel service.
protected  java.util.Map<java.lang.String,java.lang.String> registryReplacements
          Replacements to do in the registry.
static java.lang.String TRACE_LOGGER_NAME
           
protected  java.lang.String traceDestination
          The external trace destination, might be null.
 
Constructor Summary
RouteBuilderComponent(org.osgi.framework.BundleContext bundleContext)
          Saves the bundle context and gets the JONAS_BASE/conf folder.
 
Method Summary
 void configure()
          Configures the Camel context with the tracer.
protected  void configureCamelComponents(org.apache.camel.CamelContext camelContext, java.util.List<java.lang.String> registryFilesContent)
          Configure CAMEL components, called just before registry injection.
 java.io.File getConfigurationFolder()
           
 java.io.File getFileEndpointFile(java.lang.String url)
           
 java.lang.String getRouteName()
           
 void setCamelService(org.ow2.jonas.camel.service.api.ICamelService camelService)
           
 void start()
          Start the Camel context.
 void stop()
          Stop the Camel context.
 
Methods inherited from class org.apache.camel.builder.RouteBuilder
addRoutes, addRoutesToCamelContext, checkInitialized, configureRoute, configureRoutes, createContainer, errorHandler, from, from, from, from, fromF, getContext, getRouteCollection, includeRoutes, intercept, interceptFrom, interceptFrom, interceptSendToEndpoint, onCompletion, onException, onException, populateRoutes, setErrorHandlerBuilder, setRouteCollection, toString
 
Methods inherited from class org.apache.camel.builder.BuilderSupport
bean, bean, bean, bean, body, body, constant, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, endpoints, endpoints, exceptionMessage, faultBody, faultBodyAs, getErrorHandlerBuilder, header, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, noErrorHandler, outBody, outBody, property, regexReplaceAll, regexReplaceAll, sendTo, setContext, systemProperty, systemProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRACE_LOGGER_NAME

public static final java.lang.String TRACE_LOGGER_NAME
See Also:
Constant Field Values

bundleContext

protected org.osgi.framework.BundleContext bundleContext
The OSGi bundle context. Obtained via constructor.


camelService

protected org.ow2.jonas.camel.service.api.ICamelService camelService
The Camel service. Injected by the container.


registryReplacements

protected java.util.Map<java.lang.String,java.lang.String> registryReplacements
Replacements to do in the registry.


camelContextName

protected java.lang.String camelContextName
The Camel context name.


traceDestination

protected java.lang.String traceDestination
The external trace destination, might be null.

Constructor Detail

RouteBuilderComponent

public RouteBuilderComponent(org.osgi.framework.BundleContext bundleContext)
Saves the bundle context and gets the JONAS_BASE/conf folder.

Method Detail

start

public void start()
           throws java.lang.Throwable
Start the Camel context.

Throws:
java.lang.Throwable

stop

public void stop()
          throws java.lang.Throwable
Stop the Camel context.

Throws:
java.lang.Throwable

configureCamelComponents

protected void configureCamelComponents(org.apache.camel.CamelContext camelContext,
                                        java.util.List<java.lang.String> registryFilesContent)
                                 throws java.lang.Exception
Configure CAMEL components, called just before registry injection.

By default, the jms component is configured to use the JCF connection factory on JNDI.

You can override this method to configure other components, for example jdbc.

Parameters:
camelContext - CAMEL context.
registryFilesContent - Actual contents of the CAMEL registry files (with all variables replaced).
Throws:
java.lang.Exception

configure

public void configure()
               throws java.lang.Exception
Configures the Camel context with the tracer.

Specified by:
configure in class org.apache.camel.builder.RouteBuilder
Throws:
java.lang.Exception

setCamelService

public void setCamelService(org.ow2.jonas.camel.service.api.ICamelService camelService)
Parameters:
camelService - Camel service to inject.

getConfigurationFolder

public final java.io.File getConfigurationFolder()
Returns:
The JONAS_BASE/conf folder.

getRouteName

public final java.lang.String getRouteName()
Returns:
The route bundle's symbolic name.

getFileEndpointFile

public java.io.File getFileEndpointFile(java.lang.String url)
Returns:
The File object (source or target) of a Camel endpoint of type "file".


Copyright © 2010 OW2 Consortium. All Rights Reserved.