org.ow2.jonas.samples.camel.wrapper
Class CamelWrapper

java.lang.Object
  extended by org.ow2.jonas.samples.camel.wrapper.CamelWrapper
All Implemented Interfaces:
ICamelWrapper

public class CamelWrapper
extends java.lang.Object
implements ICamelWrapper

Camel wrapper. A camel context is wrapped here.

Author:
Guillaume Renault

Constructor Summary
CamelWrapper(org.apache.camel.osgi.CamelContextFactory factory)
          Constructor.
 
Method Summary
 void addComponent(java.lang.String componentName, org.apache.camel.Component component)
          Add a component on the given camel context.
 void addRoutes(org.apache.camel.builder.RouteBuilder builder)
          Add a route.
 void addToTheRegistry(java.io.InputStream inputStream)
          Add values to the registy.
 java.lang.String getCamelContextName()
          Gets the camel context name.
 java.lang.String getName()
          Get the name of the camel context.
 org.apache.camel.ProducerTemplate getProducerTemplate()
          Get a producer template for the camel context.
 java.util.List<org.apache.camel.model.RouteDefinition> getRoutes()
           
 void removeFromTheRegistry(java.io.InputStream inputStream)
          Remove values from the registy.
 void run()
          Main method.
 void setName(java.lang.String name)
          Set the name of the camel context.
 void stopContext()
          Stop the camel context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamelWrapper

public CamelWrapper(org.apache.camel.osgi.CamelContextFactory factory)
Constructor. Create a new Camel Context. The bundle context has to be set.

Parameters:
bundleContext - the OSGi bundle context.
Method Detail

getCamelContextName

public java.lang.String getCamelContextName()
Gets the camel context name.

Returns:
the camel context name.

run

public void run()
         throws java.lang.Exception
Main method.

Throws:
java.lang.Exception

stopContext

public void stopContext()
                 throws java.lang.Exception
Stop the camel context.

Specified by:
stopContext in interface ICamelWrapper
Throws:
java.lang.Exception - If stopping fails.

addRoutes

public void addRoutes(org.apache.camel.builder.RouteBuilder builder)
               throws java.lang.Exception
Add a route.

Specified by:
addRoutes in interface ICamelWrapper
Parameters:
builder - the route to add.
Throws:
java.lang.Exception - If adding routes fails.

getRoutes

public java.util.List<org.apache.camel.model.RouteDefinition> getRoutes()
Specified by:
getRoutes in interface ICamelWrapper
Returns:
the list of deployed routes on the camel context.

addToTheRegistry

public void addToTheRegistry(java.io.InputStream inputStream)
                      throws java.lang.Exception
Add values to the registy.

Specified by:
addToTheRegistry in interface ICamelWrapper
Parameters:
inputStream - the input stream containing the entire xml file that defines the entries to add.
Throws:
java.lang.Exception

removeFromTheRegistry

public void removeFromTheRegistry(java.io.InputStream inputStream)
Remove values from the registy.

Specified by:
removeFromTheRegistry in interface ICamelWrapper
Parameters:
inputStream - the input stream containing the entire xml file that defines the entries to remove.

getProducerTemplate

public org.apache.camel.ProducerTemplate getProducerTemplate()
Get a producer template for the camel context.

Specified by:
getProducerTemplate in interface ICamelWrapper
Returns:
a producer for the camel context.

addComponent

public void addComponent(java.lang.String componentName,
                         org.apache.camel.Component component)
Add a component on the given camel context.

Specified by:
addComponent in interface ICamelWrapper
Parameters:
componentName - the component name.
component - the component.

getName

public java.lang.String getName()
Get the name of the camel context.

Returns:
the name of the camel context.

setName

public void setName(java.lang.String name)
Set the name of the camel context.

Parameters:
name - the name of the camel context.


Copyright © 2009 OW2 Consortium. All Rights Reserved.