Groovy Documentation

org.linkedin.glu.orchestration.engine.plugins.builtin
[Groovy] Class DocumentationPlugin

java.lang.Object
  org.linkedin.glu.orchestration.engine.plugins.builtin.DocumentationPlugin

class DocumentationPlugin

This class is not a useful plugin per se, and is meant as documentation to describe each plugin hooks.

A plugin is simply a class with (groovy) closures, each of them defining a specific hook. You can define as many or as little of those closures as you want and you can 'spread' them accross different classes (for example, you can have a plugin class handling only the 'deployment' related plugin hooks, and another handling the hooks for a different part of the system). If a closure is missing, then it will simply not be called.

To make your plugin available to glu, you must add its class name in the configuration file:

     orchestration.engine.plugins = [
     'org.linkedin.glu.orchestration.engine.plugins.builtin.StreamFileContentPlugin',
     'org.acme.MyPlugin',
     etc...
   ]
 

Make sure that the jar file(s) containing your plugin (and its dependencies) is available to glu. If you are using the (console) server to deploy the glu webapp, then you can follow the steps that explain how to use the MySql driver in the documentation (http://linkedin.github.com/glu/docs/latest/html/console.html#example-for-a-different-database-mysql): you would copy your jar file(s) in the same location.

A closure receives arguments provided by the caller which depend on the hook (see individual documentation below). The arguments received is a map.

In a "post" hook (which means a hook that is being called after a given call), one of these arguments is always provided:

Every hook should return null if you do not want to override the value that the original caller returns, otherwise return your own value!

In a "pre" plugin, you can generally modify the arguments provided in the map:

   def xxx_pre_yyy = { args ->
     args.description = "${args.description} / foo"
     return null
   }
 
Authors:
yan@pongasoft.com


Field Summary
static java.lang.String MODULE

static Logger log

 
Property Summary
java.lang.Object DeploymentService_onStart_executeDeploymentPlan

Called when the plan has started executing.

java.lang.Object DeploymentService_post_executeDeploymentPlan

Called when the deployment ends to allow you to do any kind of post deployment action (typical use case would be some sort of notification (email, sms, etc...)

java.lang.Object DeploymentService_pre_executeDeploymentPlan

Called before executing a deployment plan to allow you to either tweak the plan or prevent entirely its execution (you can throw a java.security.AccessControlException).

java.lang.Object PluginService_initialize

This closure is called once when the application boots up to give a chance to the plugin to initialize itself.

java.lang.Object SystemService_post_parseSystemModel

Called after parsing the system model to give you a chance to tweak the model built by glu.

java.lang.Object SystemService_pre_parseSystemModel

Called before parsing the system model to give you a chance to preprocess it or process it entirely

java.lang.Object UserService_post_authenticate

Called after user authentication.

java.lang.Object UserService_pre_authenticate

Called when a user authenticate.

 
Method Summary
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

MODULE

public static final java.lang.String MODULE


log

public static final Logger log


 
Property Detail

DeploymentService_onStart_executeDeploymentPlan

java.lang.Object DeploymentService_onStart_executeDeploymentPlan
Called when the plan has started executing. The difference between this hook and the "pre" hook is that the plan has actually started, hence a deployment id is available. At this stage of the process you cannot modify the arguments because the deployment is already in process.
Parameters:
args.model - the SystemModel object used to generate the plan (note that the model may be filtered, and you can call unfilter() on it to get the full model)
args.plan - the Plan object representing the plan that will be executed
args.description - the description to use for this plan
args.deploymentId - the id of the deployment (the key to be able to query the progress of the deployment)
Returns:
null (the result is unused since executing a plan is asynchronous)


DeploymentService_post_executeDeploymentPlan

java.lang.Object DeploymentService_post_executeDeploymentPlan
Called when the deployment ends to allow you to do any kind of post deployment action (typical use case would be some sort of notification (email, sms, etc...)
Parameters:
args.model - the SystemModel object used to generate the plan (note that the model may be filtered, and you can call unfilter() on it to get the full model)
args.plan - the Plan object representing the plan
args.description - the description to use for this plan
args.deploymentId - the id of the deployment (same as onStart hook)
args.serviceResult - the IPlanExecution object with all the details about the execution
Returns:
null (the result is unused since executing a plan is asynchronous)


DeploymentService_pre_executeDeploymentPlan

java.lang.Object DeploymentService_pre_executeDeploymentPlan
Called before executing a deployment plan to allow you to either tweak the plan or prevent entirely its execution (you can throw a java.security.AccessControlException). Note that as with any "pre" hook, you can change and/or replace any of the arguments and the caller will use the new ones.
throws:
java.security.AccessControlException to prevent deployment
Parameters:
args.model - the SystemModel object used to generate the plan (note that the model may be filtered, and you can call unfilter() on it to get the full model)
args.plan - the Plan object representing the plan that will be executed
args.description - the description to use for this plan
Returns:
null (the result is unused since executing a plan is asynchronous)


PluginService_initialize

java.lang.Object PluginService_initialize
This closure is called once when the application boots up to give a chance to the plugin to initialize itself.
Parameters:
args.applicationContext - the (spring) application context used to start the (grails) application: all beans created are available in this call
args.config - is a groovy.util.ConfigObject and contains all the values defined in the configuration file
Returns:
for this closure, the returned value is ignored


SystemService_post_parseSystemModel

java.lang.Object SystemService_post_parseSystemModel
Called after parsing the system model to give you a chance to tweak the model built by glu.
Parameters:
args.source - same value passed in the "pre" hook
args.serviceResult - the SystemModel object
args.serviceException - if there is an exception (most likely while parsing the model)
Returns:
you can replace the model built by glu entirely by returning your own, or simply tweak the one provided in args.serviceResult and returning null


SystemService_pre_parseSystemModel

java.lang.Object SystemService_pre_parseSystemModel
Called before parsing the system model to give you a chance to preprocess it or process it entirely
Parameters:
args.source - can be a String, an InputStream or anything that can be turned into a URI. You can modify this attribute and the caller will pick it up
Returns:
if you want to do all the processing yourself, then simply return a fully built SystemModel object, otherwise return null


UserService_post_authenticate

java.lang.Object UserService_post_authenticate
Called after user authentication.
Parameters:
args.authToken - is a shiro authentication token object (username/password)
args.serviceResult - the username (when authentication worked)
args.serviceException - whenever authentication failed
Returns:
the username or null to let the caller return its value


UserService_pre_authenticate

java.lang.Object UserService_pre_authenticate
Called when a user authenticate. This closure allows you for example to implement your entire login mechanism if you wish to! Please be very careful in what you return as a non null value will bypass the authentication entirely!
Parameters:
args.authToken - is a shiro authentication token object (username/password)
Returns:
the username if you want to bypass the glu authentication system entirely because you did the check yourself, or null to let glu proceed with authentication


 

Groovy Documentation