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
Support for command line arguments to Camel main.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classclass -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Propertiesprotected final List<MainCommandLineSupport.Option> Fields inherited from class org.apache.camel.main.MainSupport
camelTemplate, DEFAULT_EXIT_CODE, exitCode, LOG, shutdownStrategy, UNINITIALIZED_EXIT_CODEFields inherited from class org.apache.camel.main.BaseMainSupport
camelContext, defaultPropertyPlaceholderLocation, helper, initialProperties, listeners, mainConfigurationProperties, overrideProperties, propertyPlaceholderLocations, routesCollector, standalone, wildcardPropertiesFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionMainCommandLineSupport(Class<org.apache.camel.CamelConfiguration>... configurationClasses) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArgumentProperty(String key, String value) Adds a property (command line) for the properties component.protected voidvoidprotected voidconfigurePropertiesService(org.apache.camel.CamelContext camelContext) protected voidvoidparseArguments(String[] arguments) Parses the command line arguments.intParses 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.voidDisplays the command line options.voidDisplays 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, getExitCode, getShutdownStrategy, initCamelContext, internalBeforeStart, isTrace, registerMainBootstrap, run, setAppName, setShutdownStrategy, waitUntilCompletedMethods inherited from class org.apache.camel.main.BaseMainSupport
addInitialProperty, addMainListener, addOverrideProperty, addProperty, autoConfigurationFailFast, autoConfigurationFromProperties, autoConfigurationFromReloadedProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoConfigurationSingleOption, autowireWildcardProperties, configure, configureMainListener, configurePackageScan, configureRoutes, configureRoutesLoader, configureStartupRecorder, createLifecycleStrategy, detectCamelDebugJar, doAutoConfigurationFromProperties, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, loadConfigurations, loadCustomBeans, modelineRoutes, postProcessCamelContext, postProcessCamelRegistry, preProcessCamelRegistry, removeMainListener, setDefaultPropertyPlaceholderLocation, setInitialProperties, setInitialProperties, setOverrideProperties, setOverrideProperties, setPropertyPlaceholderLocations, setRoutesCollectorMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Field Details
-
options
-
argumentProperties
-
-
Constructor Details
-
MainCommandLineSupport
@SafeVarargs public MainCommandLineSupport(Class<org.apache.camel.CamelConfiguration>... configurationClasses) -
MainCommandLineSupport
public MainCommandLineSupport()
-
-
Method Details
-
getArgumentProperties
-
setArgumentProperties
Sets command line argument as properties for the properties component. -
setArgumentProperties
Sets command line argument as properties for the properties component. -
addArgumentProperty
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
Parses the command line arguments. -
addOption
-
run
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.
-