(Quick Reference)

Plugin Control Service

The control service allows lifecycle management operations to be performed on plugins. It also provides methods to create and retrieve plugins. Note that the plugin control service may be used by other plugins, allowing one plugin to dynamically create, retrieve, start, or stop plugins.

The pluginControlService property will be injected with a class of type IPluginControlService in all plugin types.

Examples

Create plugin with default configuration
try {
	if (pluginControlService.createPlugin("myPlugin", "Native"))
		log.info "myPlugin was created successfully!"
	else
		log.warn "There was an error creating myPlugin"
} catch(PluginStartException e) {
	log.warn "There was a problem starting the new plugin: ${e.message}"
} catch(InvalidPluginConfigurationException e) {
	log.warn "There were errors with the plugin's configuration: ${e.errors}"
}

Create plugin with custom configuration
if (pluginControlService.createPlugin("myPlugin", "Native", [autoStart:false, pollInterval:600]))
	log.info "myPlugin was created successfully!"
else
	log.warn "There was an error creating myPlugin"

Start Plugin
try {
	pluginControlService.start("myPlugin")
} catch(PluginStartException e) {
	log.warn "There was a problem starting the plugin: ${e.message}"
} catch(InvalidPluginException) {
	log.warn "The plugin 'myPlugin' is invalid"
} catch(InvalidPluginConfigurationException e) {
	log.warn "The plugin has an invalid configuration: ${e.errors}"
}

Stop Plugin
try {
	pluginControlService.stop("myPlugin")
} catch(PluginStopException e) {
	log.warn "There was a problem stopping the plugin: ${e.message}"
} catch(InvalidPluginException) {
	log.warn "The plugin 'myPlugin' is invalid"
}

Configure plugin
try {
	pluginControlService.configure("myPlugin")
} catch(InvalidPluginException) {
	log.warn "The plugin 'myPlugin' is invalid"
} catch(InvalidPluginConfigurationException e) {
	log.warn "The plugin has an invalid configuration: ${e.errors}"
}