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.AbstractLifecycleBeanApplication bootstrap bean that is able to execute one or more native executable statements upon startup and shutdown.- Author:
- Derek Hulley
-
-
Constructor Summary
Constructors Constructor Description RuntimeExecBootstrapBean()Initializes the bean failOnError = true killProcessesOnShutdown = true enabled = true
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidonBootstrap(org.springframework.context.ApplicationEvent event)protected voidonShutdown(org.springframework.context.ApplicationEvent event)Handle the shutdown of a subsystem but not the entire VMvoidsetDisabledAtStartUp(String disabledAtStartUp)Deprecated.UsesetEnabled(java.lang.String)instead, remembering that the boolean property should be inverted.voidsetEnabled(String enabled)Set whether or not the process should be enabled at ApplicationContext bootstrap.voidsetEnabledFromBean(BooleanBean enabled)voidsetFailOnError(boolean failOnError)Set whether a process failure generates an error or not.voidsetKillProcessesOnShutdown(boolean killProcessesOnShutdown)Set whether or not to force a shutdown of successfully started processes.voidsetStartupCommands(List<RuntimeExec> startupCommands)Set the commands to execute, in sequence, when the application context is initialized.
-
-
-
Method Detail
-
setStartupCommands
public void setStartupCommands(List<RuntimeExec> startupCommands)
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
public void setDisabledAtStartUp(String disabledAtStartUp)
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 isfalseby 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
public void setEnabled(String enabled)
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 istrueby default.- Parameters:
enabled- any String which does notequalsIgnoreCase("true")will prevent the command from being executed.- Since:
- 3.3
-
setEnabledFromBean
public void setEnabledFromBean(BooleanBean enabled)
-
onBootstrap
protected void onBootstrap(org.springframework.context.ApplicationEvent event)
- Specified by:
onBootstrapin 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:
onShutdownin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
-