org.apache.flume.source
Class BasicSourceSemantics

java.lang.Object
  extended by org.apache.flume.source.BasicSourceSemantics
All Implemented Interfaces:
Configurable, LifecycleAware, NamedComponent, Source
Direct Known Subclasses:
AbstractEventDrivenSource, AbstractPollableSource

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract class BasicSourceSemantics
extends Object
implements Source, Configurable

Alternative to AbstractSource, which:

  1. Ensure configure cannot be called while started
  2. Exceptions thrown during configure, start, stop put source in ERROR state
  3. Exceptions thrown during start, stop will be logged but not re-thrown.
  4. Exception in configure disables starting


Constructor Summary
BasicSourceSemantics()
           
 
Method Summary
 void configure(Context context)
           Request the implementing class to (re)configure itself.
protected abstract  void doConfigure(Context context)
           
protected abstract  void doStart()
           
protected abstract  void doStop()
           
 ChannelProcessor getChannelProcessor()
          Returns the channel processor that will handle this source's events.
 LifecycleState getLifecycleState()
           Return the current state of the service or component.
 String getName()
           
protected  Exception getStartException()
           
protected  boolean isStarted()
           
 void setChannelProcessor(ChannelProcessor cp)
          Specifies which channel processor will handle this source's events.
protected  void setLifecycleState(LifecycleState lifecycleState)
           
 void setName(String name)
           
 void start()
           Starts a service or component.
 void stop()
           Stops a service or component.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicSourceSemantics

public BasicSourceSemantics()
Method Detail

configure

public void configure(Context context)
Description copied from interface: Configurable

Request the implementing class to (re)configure itself.

When configuration parameters are changed, they must be reflected by the component asap.

There are no thread safety guarrantees on when configure might be called.

Specified by:
configure in interface Configurable

start

public void start()
Description copied from interface: LifecycleAware

Starts a service or component.

Implementations should determine the result of any start logic and effect the return value of LifecycleAware.getLifecycleState() accordingly.

Specified by:
start in interface LifecycleAware

stop

public void stop()
Description copied from interface: LifecycleAware

Stops a service or component.

Implementations should determine the result of any stop logic and effect the return value of LifecycleAware.getLifecycleState() accordingly.

Specified by:
stop in interface LifecycleAware

setChannelProcessor

public void setChannelProcessor(ChannelProcessor cp)
Description copied from interface: Source
Specifies which channel processor will handle this source's events.

Specified by:
setChannelProcessor in interface Source

getChannelProcessor

public ChannelProcessor getChannelProcessor()
Description copied from interface: Source
Returns the channel processor that will handle this source's events.

Specified by:
getChannelProcessor in interface Source

setName

public void setName(String name)
Specified by:
setName in interface NamedComponent

getName

public String getName()
Specified by:
getName in interface NamedComponent

getLifecycleState

public LifecycleState getLifecycleState()
Description copied from interface: LifecycleAware

Return the current state of the service or component.

Specified by:
getLifecycleState in interface LifecycleAware

toString

public String toString()
Overrides:
toString in class Object

isStarted

protected boolean isStarted()

getStartException

protected Exception getStartException()
Returns:
Exception thrown during configure() or start()

setLifecycleState

protected void setLifecycleState(LifecycleState lifecycleState)

doConfigure

protected abstract void doConfigure(Context context)
                             throws FlumeException
Throws:
FlumeException

doStart

protected abstract void doStart()
                         throws FlumeException
Throws:
FlumeException

doStop

protected abstract void doStop()
                        throws FlumeException
Throws:
FlumeException


Copyright © 2009-2013 Apache Software Foundation. All Rights Reserved.