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 classMainCommandLineSupport.OptionclassMainCommandLineSupport.ParameterOption
-
Field Summary
Fields Modifier and Type Field Description protected PropertiesargumentPropertiesprotected 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, helper, INITIAL_PROPERTIES_LOCATION, initialProperties, listeners, mainConfigurationProperties, OVERRIDE_PROPERTIES_LOCATION, overrideProperties, PROPERTY_PLACEHOLDER_LOCATION, propertyPlaceholderLocations, routesCollector, standalone, wildcardProperties
-
-
Constructor Summary
Constructors Constructor Description MainCommandLineSupport()MainCommandLineSupport(Class<org.apache.camel.CamelConfiguration>... configurationClasses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArgumentProperty(String key, String value)Adds a property (command line) for the properties component.protected voidaddInitialOptions()voidaddOption(MainCommandLineSupport.Option option)protected voidconfigurePropertiesService(org.apache.camel.CamelContext camelContext)PropertiesgetArgumentProperties()protected voidinitOptions()voidparseArguments(String[] arguments)Parses the command line arguments.intrun(String[] args)Parses the command line arguments then runs the program.voidsetArgumentProperties(Map<String,Object> initialProperties)Sets command line argument as properties for the properties component.voidsetArgumentProperties(Properties argumentProperties)Sets command line argument as properties for the properties component.voidshowOptions()Displays the command line options.voidshowOptionsHeader()Displays the header message for the command line options.-
Methods inherited from class org.apache.camel.main.MainSupport
afterStart, afterStop, autoconfigure, beforeStart, beforeStop, completed, configureLifecycle, createCamelContext, doInit, doStart, doStop, enableTrace, enableTraceStandby, findOrCreateCamelTemplate, getAppName, getCamelTemplate, getCompleteTask, getDuration, getDurationHitExitCode, getDurationIdle, getDurationMaxMessages, getExitCode, getShutdownStrategy, initCamelContext, internalBeforeStart, isTrace, registerMainBootstrap, run, setAppName, setDuration, setDurationHitExitCode, setDurationIdle, setDurationMaxMessages, setShutdownStrategy, waitUntilCompleted
-
Methods inherited from class org.apache.camel.main.BaseMainSupport
addInitialProperty, addMainListener, addOverrideProperty, addProperty, autoConfigurationFailFast, autoConfigurationFromProperties, autoConfigurationFromReloadedProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoConfigurationSingleOption, autowireWildcardProperties, configure, configurePackageScan, configureRoutes, configureRoutesLoader, configureStartupRecorder, configureVault, doAutoConfigurationFromProperties, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, loadConfigurations, modelineRoutes, postProcessCamelContext, removeMainListener, setDefaultPropertyPlaceholderLocation, setInitialProperties, setInitialProperties, setOverrideProperties, setOverrideProperties, setPropertyPlaceholderLocations, setRoutesCollector
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, 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
-
argumentProperties
protected Properties argumentProperties
-
-
Constructor Detail
-
MainCommandLineSupport
@SafeVarargs public MainCommandLineSupport(Class<org.apache.camel.CamelConfiguration>... configurationClasses)
-
MainCommandLineSupport
public MainCommandLineSupport()
-
-
Method Detail
-
getArgumentProperties
public Properties getArgumentProperties()
-
setArgumentProperties
public void setArgumentProperties(Properties argumentProperties)
Sets command line argument as properties for the properties component.
-
setArgumentProperties
public void setArgumentProperties(Map<String,Object> initialProperties)
Sets command line argument as properties for the properties component.
-
addArgumentProperty
public void addArgumentProperty(String key, String value)
Adds a property (command line) for the properties component.- Parameters:
key- the property keyvalue- the property value
-
initOptions
protected void initOptions()
-
addInitialOptions
protected void addInitialOptions()
-
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
-
configurePropertiesService
protected void configurePropertiesService(org.apache.camel.CamelContext camelContext) throws Exception- Overrides:
configurePropertiesServicein classBaseMainSupport- Throws:
Exception
-
showOptionsHeader
public void showOptionsHeader()
Displays the header message for the command line options.
-
-