public abstract class AbstractCommand extends Object implements Command
Command
classes.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
LOG |
Modifier | Constructor and Description |
---|---|
protected |
AbstractCommand(CommandBuilder builder,
com.typesafe.config.Config config,
Command parent,
Command child,
MorphlineContext context)
Using the given
builder , constructs a command rooted at the given morphline JSON
config . |
protected |
AbstractCommand(com.typesafe.config.Config config,
Command parent,
Command child,
MorphlineContext context)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected Command |
buildCommand(com.typesafe.config.Config cmdConfig,
Command currentParent,
Command finalChild)
Factory method to create a command rooted at the given cmdConfig.
|
protected List<Command> |
buildCommandChain(com.typesafe.config.Config rootConfig,
String configKey,
Command finalChild,
boolean ignoreNotifications)
Factory method to create the chain of commands rooted at the given rootConfig.
|
protected void |
doNotify(Record notification)
Processes the given notification on the control plane of the subtree rooted at this command.
|
protected boolean |
doProcess(Record record)
Processes the given record on the data plane of this command.
|
protected Command |
getChild()
Returns the child of this command.
|
protected com.typesafe.config.Config |
getConfig()
Returns the JSON configuration of this command.
|
protected Configs |
getConfigs()
Returns a helper for convenient access to the JSON configuration of this command.
|
protected MorphlineContext |
getContext()
Returns the context of this command.
|
protected com.codahale.metrics.Counter |
getCounter(String... names)
Returns a counter for maintaining main-memory metrics.
|
protected com.codahale.metrics.Histogram |
getHistogram(String... names)
Returns a histogram for maintaining main-memory metrics.
|
protected com.codahale.metrics.Meter |
getMeter(String... names)
Returns a meter for maintaining main-memory metrics.
|
Command |
getParent()
Returns the parent of this command.
|
protected com.codahale.metrics.Timer |
getTimer(String... names)
Returns a timer for maintaining main-memory metrics.
|
protected boolean |
isMeasuringMetrics()
Returns whether or not metrics should be measured.
|
void |
notify(Record notification)
Processes the given notification on the control plane of the subtree rooted at this command.
|
boolean |
process(Record record)
Processes the given record on the data plane of this command.
|
protected void |
validateArguments()
Helper that checks if the user provided configuration parameters are valid.
|
protected AbstractCommand(CommandBuilder builder, com.typesafe.config.Config config, Command parent, Command child, MorphlineContext context)
builder
, constructs a command rooted at the given morphline JSON
config
.
The command will feed records into child
. The command will have
parent
as it's parent. Additional parameters can be passed via the morphline
context
.@Deprecated protected AbstractCommand(com.typesafe.config.Config config, Command parent, Command child, MorphlineContext context)
public Command getParent()
Command
protected Command getChild()
protected com.typesafe.config.Config getConfig()
protected MorphlineContext getContext()
protected Configs getConfigs()
public final void notify(Record notification)
Command
protected void doNotify(Record notification)
public final boolean process(Record record)
Command
protected boolean doProcess(Record record)
protected void validateArguments()
protected com.codahale.metrics.Counter getCounter(String... names)
protected com.codahale.metrics.Histogram getHistogram(String... names)
protected com.codahale.metrics.Meter getMeter(String... names)
protected com.codahale.metrics.Timer getTimer(String... names)
protected final boolean isMeasuringMetrics()
protected List<Command> buildCommandChain(com.typesafe.config.Config rootConfig, String configKey, Command finalChild, boolean ignoreNotifications)
ignoreNotifications
- if true indicates don't forward notifications at the end of the chain of commands.
This is a feature that multi-branch commands like tryRules and ifThenElse need to
avoid sending a notification multiple times to finalChild, once from each branch.Copyright © 2013–2014. All rights reserved.