org.apache.camel.impl
Class ServiceSupport

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
All Implemented Interfaces:
Service
Direct Known Subclasses:
ActivityMonitorEngine, ActivityRules, BatchProcessor, BeanProcessor, ChoiceProcessor, ConsumerCache, DefaultCamelContext, DefaultChannel, DefaultComponent, DefaultConsumer, DefaultInflightRepository, DefaultManagementAgent, DefaultProducer, DefaultProducerTemplate, DefaultRoute, DefaultServicePool, DefaultShutdownStrategy, DefaultTypeConverter, DelegateProcessor, Enricher, ErrorHandlerSupport, EventNotifierSupport, IdempotentConsumer, LoadBalancerSupport, MainSupport, MulticastProcessor, OnCompletionProcessor, PollEnricher, PollingConsumerSupport, ProcessRules, ProducerCache, RecipientList, Requestor, RoutePolicySupport, RouteService, RoutingSlip, SedaConsumer, SendProcessor, StreamResequencer, TemporalRule, TryProcessor

public abstract class ServiceSupport
extends Object
implements Service

A useful base class which ensures that a service is only initialized once and provides some helper methods for enquiring of its status

Version:
$Revision: 17329 $

Constructor Summary
ServiceSupport()
           
 
Method Summary
protected  void addChildService(Object childService)
           
protected abstract  void doStart()
           
protected abstract  void doStop()
           
 ServiceStatus getStatus()
          Returns the current status
 String getVersion()
          Returns the version of this service
 boolean isRunAllowed()
          Helper methods so the service knows if it should keep running.
 boolean isStarted()
           
 boolean isStarting()
           
 boolean isStopped()
           
 boolean isStopping()
           
protected  boolean removeChildService(Object childService)
           
 void start()
          Starts the service
 void stop()
          Stops the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceSupport

public ServiceSupport()
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Service
Starts the service

Specified by:
start in interface Service
Throws:
Exception - is thrown if starting failed

stop

public void stop()
          throws Exception
Description copied from interface: Service
Stops the service

Specified by:
stop in interface Service
Throws:
Exception - is thrown if stopping failed

getStatus

public ServiceStatus getStatus()
Returns the current status


isStarted

public boolean isStarted()
Returns:
true if this service has been started

isStarting

public boolean isStarting()
Returns:
true if this service is

isStopping

public boolean isStopping()
Returns:
true if this service is in the process of closing

isStopped

public boolean isStopped()
Returns:
true if this service is closed

isRunAllowed

public boolean isRunAllowed()
Helper methods so the service knows if it should keep running. Returns false if the service is being stopped or is stopped.

Returns:
true if the service should continue to run.

doStart

protected abstract void doStart()
                         throws Exception
Throws:
Exception

doStop

protected abstract void doStop()
                        throws Exception
Throws:
Exception

addChildService

protected void addChildService(Object childService)

removeChildService

protected boolean removeChildService(Object childService)

getVersion

public String getVersion()
Returns the version of this service



Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.