Groovy Documentation

com.ace.mws.plugins
[Java] Class AbstractPlugin

java.lang.Object
  com.ace.mws.plugins.AbstractPluginInfo
      com.ace.mws.plugins.AbstractPlugin

public abstract class AbstractPlugin
extends AbstractPluginInfo

Optional base class for all plugin types and therefore plugin instances which extends AbstractPluginInfo. Contains method definitions to facilitate creating new plugin types. Also contains a default implementation of the poll() method which uses getNodes(), getVirtualMachines(), and getJobs.

Authors:
bsaville


Field Summary
 
Fields inherited from class AbstractPluginInfo
id
 
Constructor Summary
AbstractPlugin()

 
Method Summary
void afterStart()

Hook to do any post-start logic.

void afterStop()

Hook to do any post-stop teardown of the plugin after it stops.

void beforeStart()

Hook to do any initialization needed before the plugin starts.

void beforeStop()

Hook to start any processes needed to teardown the plugin before it stops.

List getJobs()

Returns a list of job resources which will then be saved to the database.

List getJobs(IPluginJobFilter filter)

CURRENTLY UNSUPPORTED

Returns a list of job resources which will then be saved to the database.

org.slf4j.Logger getLogger()

Returns a log that can be used throughout the Plugin.

List getNodes()

Returns a list of node resources which will then be saved to the database.

List getNodes(IPluginNodeFilter filter)

CURRENTLY UNSUPPORTED

Returns a list of node resources which will then be saved to the database.

protected IPluginPersistenceService getPluginPersistenceService()

List getVirtualMachines()

Returns a list of virtual machine resources which will then be saved to the database.

List getVirtualMachines(IPluginVirtualMachineFilter filter)

CURRENTLY UNSUPPORTED

Returns a list of virtual machine resources which will then be saved to the database.

boolean jobCancel(List jobs)

Cancels the specified job(s).

boolean jobModify(List jobs, Map properties)

Modifies the specified job(s) with the properties given.

boolean jobRequeue(List jobs)

Requeues the specified job(s).

boolean jobResume(List jobs)

Resumes the specified job(s).

boolean jobStart(String jobId, String taskList, String username)

Starts the specified job with a tasklist and username.

boolean jobStart(String jobId, String taskList, String username, Map properties)

Starts the specified job with a tasklist, username, and other properties.

boolean jobSubmit(Map properties)

Submits a new job specified by the properties given.

boolean jobSuspend(List jobs)

Suspends the specified job.

boolean nodeModify(List nodes, Map properties)

Modifies the specified node(s) with the properties given.

boolean nodePower(List nodes, String state)

Changes the power state of the specified node(s).

void poll()

The poll event takes data from the plugin and calls the update methods on the IPluginPersistenceService, such as:

boolean resourceCreate(String type, String id, Map attributes)

Creates a resource with the specified arguments.

protected void setPluginPersistenceService(IPluginPersistenceService pluginPersistenceService)

void start()

Starts the Plugin, including polling if enabled.

void stop()

Stops the Plugin, including polling if started.

boolean systemModify(Map properties)

Modifies system properties as specified.

List systemQuery(List attributes)

Retrieves the specified system attribute(s).

void verifyConfiguration()

Verifies the configuration of the plugin and throws an exception containing error messages if not.

boolean virtualMachineMigrate(String vmId, String hypervisorId, String operationId)

Migrates a virtual machine with the specified ID to the specified hypervisor.

 
Methods inherited from class AbstractPluginInfo
getAutoStart, getConfig, getId, getPluginType, getPollInterval, getState, setId
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

AbstractPlugin

AbstractPlugin()


 
Method Detail

afterStart

public void afterStart()
Hook to do any post-start logic. Can be empty.


afterStop

public void afterStop()
Hook to do any post-stop teardown of the plugin after it stops. Can be empty.


beforeStart

public void beforeStart()
Hook to do any initialization needed before the plugin starts. Can be empty.


beforeStop

public void beforeStop()
Hook to start any processes needed to teardown the plugin before it stops. Can be empty.


getJobs

public List getJobs()
Returns a list of job resources which will then be saved to the database.
Returns:
List of current job resources


getJobs

public List getJobs(IPluginJobFilter filter)
CURRENTLY UNSUPPORTED

Returns a list of job resources which will then be saved to the database.
Filters the results based on the filter passed in.
Parameters:
filter - The filter for the results
Returns:
List of filtered current job resources


getLogger

public org.slf4j.Logger getLogger()
Returns a log that can be used throughout the Plugin.
Returns:
A logging instance


getNodes

public List getNodes()
Returns a list of node resources which will then be saved to the database.
Returns:
List of current node resources


getNodes

public List getNodes(IPluginNodeFilter filter)
CURRENTLY UNSUPPORTED

Returns a list of node resources which will then be saved to the database.
Filters the results based on the filter passed in.
Parameters:
filter - The filter for the results
Returns:
List of filtered current node resources


getPluginPersistenceService

protected IPluginPersistenceService getPluginPersistenceService()


getVirtualMachines

public List getVirtualMachines()
Returns a list of virtual machine resources which will then be saved to the database.
Returns:
List of current virtual machine resources


getVirtualMachines

public List getVirtualMachines(IPluginVirtualMachineFilter filter)
CURRENTLY UNSUPPORTED

Returns a list of virtual machine resources which will then be saved to the database.
Filters the results based on the filter passed in.
Parameters:
filter - The filter for the results
Returns:
List of filtered current virtual machine resources


jobCancel

public boolean jobCancel(List jobs)
Cancels the specified job(s).
Parameters:
jobs - The unique ID(s) of the job(s) to cancel
Returns:
True if successful, false if an error occurred


jobModify

public boolean jobModify(List jobs, Map properties)
Modifies the specified job(s) with the properties given.
Parameters:
properties - The properties to modify on the job(s)
jobs - The unique ID(s) of the job(s) to modify
Returns:
True if successful, false if an error occurred


jobRequeue

public boolean jobRequeue(List jobs)
Requeues the specified job(s).
Parameters:
jobs - The unique ID(s) of the job(s) to requeue
Returns:
True if successful, false if an error occurred


jobResume

public boolean jobResume(List jobs)
Resumes the specified job(s).
Parameters:
jobs - The unique ID(s) of the job(s) to resume
Returns:
True if successful, false if an error occurred


jobStart

public boolean jobStart(String jobId, String taskList, String username)
Starts the specified job with a tasklist and username.
Parameters:
jobId - The unique ID of the job to start
taskList - The tasklist of the job
username - The user starting the job
Returns:
True if successful, false if an error occurred


jobStart

public boolean jobStart(String jobId, String taskList, String username, Map properties)
Starts the specified job with a tasklist, username, and other properties.
Parameters:
jobId - The unique ID of the job to start
taskList - The tasklist of the job
username - The user starting the job
properties - The other properties to set when starting the job
Returns:
True if successful, false otherwise


jobSubmit

public boolean jobSubmit(Map properties)
Submits a new job specified by the properties given.
Parameters:
properties - The job's properties
Returns:
True if successful, false if an error occurred


jobSuspend

public boolean jobSuspend(List jobs)
Suspends the specified job.
Parameters:
jobs - The unique ID(s) of the job(s)
Returns:
True if successful, false if an error occurred


nodeModify

public boolean nodeModify(List nodes, Map properties)
Modifies the specified node(s) with the properties given.
Parameters:
properties - The properties to modify on the node(s)
nodes - The unique ID(s) of the node(s) to modify
Returns:
True if successful, false if an error occurred


nodePower

public boolean nodePower(List nodes, String state)
Changes the power state of the specified node(s).
Parameters:
state - The new requested power state of the node(s)
nodes - The unique ID(s) of the node(s) to modify
Returns:
True if successful, false if an error occurred


poll

public void poll()
The poll event takes data from the plugin and calls the update methods on the IPluginPersistenceService, such as: The default implementation calls getNodes(), getJobs, and getVirtualMachines and sends each result to the IPluginPersistenceService respective methods. It also correctly handles UnsupportedOperationExceptions when making these calls.


resourceCreate

public boolean resourceCreate(String type, String id, Map attributes)
Creates a resource with the specified arguments.
Parameters:
type - The type of the resource (ie vm)
id - The unique ID of the resource (ie hv1:vm1 for a VM)
attributes - The attributes used to create the resource
Returns:
True if successful, false if an error occurred


setPluginPersistenceService

protected void setPluginPersistenceService(IPluginPersistenceService pluginPersistenceService)


start

public void start()
Starts the Plugin, including polling if enabled.
throws:
PluginStartException If there is a problem while starting the Plugin


stop

public void stop()
Stops the Plugin, including polling if started.
throws:
PluginStopException If there is a problem while stopping the Plugin


systemModify

public boolean systemModify(Map properties)
Modifies system properties as specified.
Parameters:
properties - The system properties to modify
Returns:
True if successful, false if an error occurred


systemQuery

public List systemQuery(List attributes)
Retrieves the specified system attribute(s).
Parameters:
attributes - The attributes to query for
Returns:
A list of attribute values


verifyConfiguration

public void verifyConfiguration()
Verifies the configuration of the plugin and throws an exception containing error messages if not. This is called when the IPluginControlService.start method or the start() method is called, as well as any time the configuration of the Plugin is modified.
throws:
InvalidPluginConfigurationException Thrown when configuration is invalid. This exception should contain error messages.
See Also:
InvalidPluginConfigurationException.InvalidPluginConfigurationException
InvalidPluginConfigurationException.InvalidPluginConfigurationException


virtualMachineMigrate

public boolean virtualMachineMigrate(String vmId, String hypervisorId, String operationId)
Migrates a virtual machine with the specified ID to the specified hypervisor.
Parameters:
vmId The - ID of the virtual machine
hypervisorId The - ID of the new desired hypervisor for the VM
operationId - The ID of the operation
Returns:
True if successful, false if an error occurred


 

Groovy Documentation