Package org.alfresco.util.exec
Class RuntimeExecBootstrapBean
java.lang.Object
org.springframework.extensions.surf.util.AbstractLifecycleBean
org.alfresco.util.exec.RuntimeExecBootstrapBean
- All Implemented Interfaces:
EventListener
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
,org.springframework.context.ApplicationListener
public class RuntimeExecBootstrapBean
extends org.springframework.extensions.surf.util.AbstractLifecycleBean
Application bootstrap bean that is able to execute one or more
native executable statements upon startup and shutdown.
- Author:
- Derek Hulley
-
Field Summary
Fields inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
log
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes the bean failOnError = true killProcessesOnShutdown = true enabled = true -
Method Summary
Modifier and TypeMethodDescriptionprotected void
onBootstrap
(org.springframework.context.ApplicationEvent event) protected void
onShutdown
(org.springframework.context.ApplicationEvent event) Handle the shutdown of a subsystem but not the entire VMvoid
setDisabledAtStartUp
(String disabledAtStartUp) Deprecated.void
setEnabled
(String enabled) Set whether or not the process should be enabled at ApplicationContext bootstrap.void
setEnabledFromBean
(BooleanBean enabled) void
setFailOnError
(boolean failOnError) Set whether a process failure generates an error or not.void
setKillProcessesOnShutdown
(boolean killProcessesOnShutdown) Set whether or not to force a shutdown of successfully started processes.void
setStartupCommands
(List<RuntimeExec> startupCommands) Set the commands to execute, in sequence, when the application context is initialized.Methods inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
getApplicationContext, onApplicationEvent, setApplicationContext
-
Constructor Details
-
RuntimeExecBootstrapBean
public RuntimeExecBootstrapBean()Initializes the bean- failOnError = true
- killProcessesOnShutdown = true
- enabled = true
-
-
Method Details
-
setStartupCommands
Set the commands to execute, in sequence, when the application context is initialized.- Parameters:
startupCommands
- list of commands
-
setFailOnError
public void setFailOnError(boolean failOnError) Set whether a process failure generates an error or not. Deviation from the default is useful if use as part of a process where the command or the codes generated by the execution may be ignored or avoided by the system.- Parameters:
failOnError
- true (default) to issue an error message and throw an exception if the process fails to execute or generates an error return value.- Since:
- 2.1
-
setKillProcessesOnShutdown
public void setKillProcessesOnShutdown(boolean killProcessesOnShutdown) Set whether or not to force a shutdown of successfully started processes. As most bootstrap processes are kicked off in order to provide the server with some or other service, this is true by default.- Parameters:
killProcessesOnShutdown
- true to force any successfully executed commands' processes to be forcibly killed when the server shuts down.- Since:
- 2.1.0
-
setDisabledAtStartUp
Deprecated.UsesetEnabled(java.lang.String)
instead, remembering that the boolean property should be inverted.Set whether or not the process should be disabled at ApplicationContext bootstrap. If a RuntimeExecBootstrapBean is disabled, then the command will not be executed. This property is not required and isfalse
by default. This method has been deprecated in favour of a clearer name introduced in 3.3. SeesetEnabled(java.lang.String)
.- Parameters:
disabledAtStartUp
- any String whichequalsIgnoreCase("true")
to prevent the command from being executed.- Since:
- 3.2.1
-
setEnabled
Set whether or not the process should be enabled at ApplicationContext bootstrap. If a RuntimeExecBootstrapBean is not enabled, then the command will not be executed. This property is not required and istrue
by default.- Parameters:
enabled
- any String which does notequalsIgnoreCase("true")
will prevent the command from being executed.- Since:
- 3.3
-
setEnabledFromBean
-
onBootstrap
protected void onBootstrap(org.springframework.context.ApplicationEvent event) - Specified by:
onBootstrap
in classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
onShutdown
protected void onShutdown(org.springframework.context.ApplicationEvent event) Handle the shutdown of a subsystem but not the entire VM- Specified by:
onShutdown
in classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
setEnabled(java.lang.String)
instead, remembering that the boolean property should be inverted.