Package org.apache.camel.main
Class MainCommandLineSupport
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.main.BaseMainSupport
-
- org.apache.camel.main.MainSupport
-
- org.apache.camel.main.MainCommandLineSupport
-
- Direct Known Subclasses:
Main
public abstract class MainCommandLineSupport extends MainSupport
Support for command line arguments to Camel main.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
MainCommandLineSupport.Option
class
MainCommandLineSupport.ParameterOption
-
Field Summary
Fields Modifier and Type Field Description protected List<MainCommandLineSupport.Option>
options
-
Fields inherited from class org.apache.camel.main.MainSupport
camelTemplate, DEFAULT_EXIT_CODE, exitCode, LOG, shutdownStrategy, UNINITIALIZED_EXIT_CODE
-
Fields inherited from class org.apache.camel.main.BaseMainSupport
camelContext, DEFAULT_PROPERTY_PLACEHOLDER_LOCATION, defaultPropertyPlaceholderLocation, INITIAL_PROPERTIES_LOCATION, initialProperties, listeners, mainConfigurationProperties, OVERRIDE_PROPERTIES_LOCATION, overrideProperties, PROPERTY_PLACEHOLDER_LOCATION, propertyPlaceholderLocations, routesCollector, wildcardProperties
-
-
Constructor Summary
Constructors Constructor Description MainCommandLineSupport()
MainCommandLineSupport(Class... configurationClasses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOption(MainCommandLineSupport.Option option)
protected void
initOptions()
void
parseArguments(String[] arguments)
Parses the command line arguments.int
run(String[] args)
Parses the command line arguments then runs the program.void
showOptions()
Displays the command line options.void
showOptionsHeader()
Displays the header message for the command line options.-
Methods inherited from class org.apache.camel.main.MainSupport
afterStart, afterStop, beforeStart, beforeStop, completed, configureLifecycle, createCamelContext, doStart, doStop, enableTrace, findOrCreateCamelTemplate, getCamelTemplate, getCompleteTask, getDuration, getDurationHitExitCode, getDurationIdle, getDurationMaxMessages, getExitCode, getShutdownStrategy, initCamelContext, isTrace, run, setDuration, setDurationHitExitCode, setDurationIdle, setDurationMaxMessages, setShutdownStrategy, waitUntilCompleted
-
Methods inherited from class org.apache.camel.main.BaseMainSupport
addInitialProperty, addMainListener, addOverrideProperty, addProperty, autoConfigurationFailFast, autoConfigurationFromProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoconfigure, autowireWildcardProperties, configure, configurePropertiesService, configureRoutes, configureStartupRecorder, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, isAutoConfigurationEnabled, loadConfigurations, postProcessCamelContext, removeMainListener, setAutoConfigurationEnabled, setDefaultPropertyPlaceholderLocation, setInitialProperties, setInitialProperties, setOverrideProperties, setOverrideProperties, setPropertyPlaceholderLocations, setRoutesCollector
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
-
-
-
Field Detail
-
options
protected final List<MainCommandLineSupport.Option> options
-
-
Constructor Detail
-
MainCommandLineSupport
public MainCommandLineSupport(Class... configurationClasses)
-
MainCommandLineSupport
public MainCommandLineSupport()
-
-
Method Detail
-
initOptions
protected void initOptions()
-
showOptions
public void showOptions()
Displays the command line options.
-
parseArguments
public void parseArguments(String[] arguments)
Parses the command line arguments.
-
addOption
public void addOption(MainCommandLineSupport.Option option)
-
run
public int run(String[] args) throws Exception
Parses the command line arguments then runs the program. The run method will keep blocking until the program is stopped.- Returns:
- the exit code, usually 0 for normal termination.
- Throws:
Exception
-
showOptionsHeader
public void showOptionsHeader()
Displays the header message for the command line options.
-
-