Moab Web Services > Plugins > Plugin Services

Plugin Services

To use the built-in services, declare a variable with the correct name as a property in the plugin class.

The convention for each service name is to remove the leading "I" and lower case the resulting first letter. For example, the property to use the IMoabRestService would be called moabRestService. The following is an example of using the IPluginControlService in this manner.

Using the IPluginControlService
------------------------------------

package example;
import com.adaptc.mws.plugins.*;

class ExamplePlugin {
	IPluginControlService pluginControlService;

	public poll() {
		// Use service…
		pluginControlService.stop("pluginId");
	}
}

Use of the Groovy anonymous type "def" may also be used. For example, the service definition above would use def pluginControlService instead of IPluginControlService pluginControlService.

Do not attempt to create a new instance of the services before use, such as in a constructor. The services will be automatically injected before any methods are called on the plugin.

API documentation

The com.adaptc.mws.plugins package contains interfaces for all bundled services available to plugin types. These may be used as discussed above. All services begin with "I" and end with "Service", as in IMoabRestService (Moab REST Service).

Related Topics 

© 2015 Adaptive Computing