org.ow2.jonas.camel.service.impl
Class CamelService

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.ow2.jonas.lib.reconfig.ReconfigEmitter
          extended by org.ow2.jonas.lib.service.AbsServiceImpl
              extended by org.ow2.jonas.camel.service.impl.CamelService
All Implemented Interfaces:
javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ICamelService, CamelServiceMBean, org.ow2.jonas.service.Service

public class CamelService
extends org.ow2.jonas.lib.service.AbsServiceImpl
implements ICamelService, CamelServiceMBean

Camel service.

Author:
Guillaume Renault

Field Summary
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
CamelService(org.osgi.framework.BundleContext context)
          Constructor, needed to get the bundle context.
 
Method Summary
 void addComponent(java.lang.String componentName, org.apache.camel.Component component, java.lang.String camelContextName)
          Add a component on the given camel context.
 void addRegistry(java.io.InputStream input, java.lang.String camelContextName)
          Add values to the registry component.
 void addRoutes(org.apache.camel.builder.RouteBuilder builder, java.lang.String camelContextName)
           
protected  void doStart()
          Initializes the service.
protected  void doStop()
          Stops all Camel contexts.
static javax.management.ObjectName getObjectName(java.lang.String domainName)
           
 org.apache.camel.ProducerTemplate getProducerTemplate(java.lang.String camelContextName)
          Get a producer template for the given camel context.
 java.util.List<org.apache.camel.model.RouteDefinition> getRoutes(java.lang.String camelContextName)
          Get the list of existing routes.
 void removeRegistry(java.io.InputStream input, java.lang.String camelContextName)
          Remove entries from the registry component.
 void setJmxService(org.ow2.jonas.jmx.JmxService jmxService)
           
 java.lang.String startNewContext()
          Start a new camel context.
 void stop(java.lang.String name)
          Stop an instance of Camel.
 
Methods inherited from class org.ow2.jonas.lib.service.AbsServiceImpl
convertToList, doInit, getDomainName, getJonasServerName, getName, getServerProperties, init, isStarted, setName, setServerProperties, start, stop, throwRequirementException, toString
 
Methods inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CamelService

public CamelService(org.osgi.framework.BundleContext context)
Constructor, needed to get the bundle context.

Parameters:
context - the bundle context.
Method Detail

setJmxService

public void setJmxService(org.ow2.jonas.jmx.JmxService jmxService)
Parameters:
jmxService - JMX service to set.

doStart

protected void doStart()
Initializes the service.

Specified by:
doStart in class org.ow2.jonas.lib.service.AbsServiceImpl

doStop

protected void doStop()
Stops all Camel contexts.

Specified by:
doStop in class org.ow2.jonas.lib.service.AbsServiceImpl

startNewContext

public java.lang.String startNewContext()
                                 throws java.lang.Exception
Start a new camel context.

Specified by:
startNewContext in interface ICamelService
Returns:
the name of the camel context.
Throws:
java.lang.Exception - If starting the context fails.

stop

public void stop(java.lang.String name)
          throws java.lang.Exception
Stop an instance of Camel.

Specified by:
stop in interface ICamelService
Parameters:
name - the camel context name to stop.
Throws:
java.lang.Exception - If stopping any CAMEL console fails.

addRoutes

public void addRoutes(org.apache.camel.builder.RouteBuilder builder,
                      java.lang.String camelContextName)
               throws java.lang.Exception
Specified by:
addRoutes in interface ICamelService
Parameters:
builder - the route to add.
camelContextName - the camel context name on which the route has to be set.
Throws:
java.lang.Exception - If adding route fails.

getRoutes

public java.util.List<org.apache.camel.model.RouteDefinition> getRoutes(java.lang.String camelContextName)
Get the list of existing routes.

Specified by:
getRoutes in interface ICamelService
Parameters:
camelContextName - the identifier of the camel context to check.
Returns:
the list of existing routes for the given camel context..

getProducerTemplate

public org.apache.camel.ProducerTemplate getProducerTemplate(java.lang.String camelContextName)
Get a producer template for the given camel context.

Specified by:
getProducerTemplate in interface ICamelService
Parameters:
camelContextName - the camel context name on which the producer has to be taken.
Returns:
the producer template.

addRegistry

public void addRegistry(java.io.InputStream input,
                        java.lang.String camelContextName)
                 throws java.lang.Exception
Add values to the registry component.

Specified by:
addRegistry in interface ICamelService
Parameters:
input - the stream that contains the entries to add.
camelContextName - the camel context name that contains the registry to update.
Throws:
java.lang.Exception

removeRegistry

public void removeRegistry(java.io.InputStream input,
                           java.lang.String camelContextName)
Remove entries from the registry component.

Specified by:
removeRegistry in interface ICamelService
Parameters:
input - the input stream that contains all the entries to remove
camelContextName - the camel context name to remove the entries on.

addComponent

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

Specified by:
addComponent in interface ICamelService
Parameters:
componentName - the component name.
component - the component.
camelContextName - the camel name context.

getObjectName

public static javax.management.ObjectName getObjectName(java.lang.String domainName)
Parameters:
domainName - Server's domain name.
Returns:
JMX name of the versioning service management bean.


Copyright © 2009 OW2 Consortium. All Rights Reserved.