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 CommandsService_post_executeCommand

Called after the command completes (typical use case would be some sort of notification (email, sms, etc...)

java.lang.Object CommandsService_pre_executeCommand

Called when a command is about to be executed.

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 FileSystemCommandExecutionIOStorage_createInputStream

Called to create an input stream to read a command IO from the filesystem.

java.lang.Object FileSystemCommandExecutionIOStorage_createOutputStream

Called to create an output stream to write a command IO from the filesystem.

java.lang.Object PlannerService_post_computePlans

Called after computing the plans which allows you to tweak the plan or add some metadata

java.lang.Object PlannerService_pre_computePlans

Called before computing any plans which allows you to tweak the creation of the plan including the ability to create your own actions.

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_post_authorize

Called after user authorization.

java.lang.Object UserService_post_restAuthenticateAndAuthorize

Called after rest user authentication and authorization.

java.lang.Object UserService_pre_authenticate

Called when a user authenticate.

java.lang.Object UserService_pre_authorize

Called to authorize a user.

java.lang.Object UserService_pre_restAuthenticateAndAuthorize

This call is wrapping the entire rest authentication and authorization flow, thus allowing you to write your entire REST auth code.

 
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

CommandsService_post_executeCommand

java.lang.Object CommandsService_post_executeCommand
Called after the command completes (typical use case would be some sort of notification (email, sms, etc...)
Parameters:
args.serviceResult - the CommandExecution object with all the details about the execution
Returns:
null (the result is unused since executing a command is asynchronous)


CommandsService_pre_executeCommand

java.lang.Object CommandsService_pre_executeCommand
Called when a command is about to be executed. This closure allows you for example to add tighter control to who can execute what or to add some parameters to the command
Parameters:
args.fabric - the fabric the agent belongs to
args.agent - the agent on which the command will be executed
args.args - the arguments for the command (see Agent.executeShellCommand for details
args.onResultStreamAvailable - the closure that will be called when the results are available
Returns:
null (the result is unused... you can tweak args instead)


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)


FileSystemCommandExecutionIOStorage_createInputStream

java.lang.Object FileSystemCommandExecutionIOStorage_createInputStream
Called to create an input stream to read a command IO from the filesystem. This closure allows you to decrypt a previously encrypted file.
Parameters:
args.resource - the resource (org.linkedin.util.io.resource.Resource) from which to create an input stream.
Returns:
null if you don't want to do anything, otherwise an InputStream


FileSystemCommandExecutionIOStorage_createOutputStream

java.lang.Object FileSystemCommandExecutionIOStorage_createOutputStream
Called to create an output stream to write a command IO from the filesystem. This closure allows you to encrypt the stream for example.
Parameters:
args.resource - the resource (org.linkedin.util.io.resource.Resource) from which to create an output stream.
Returns:
null if you don't want to do anything, otherwise an OutputStream


PlannerService_post_computePlans

java.lang.Object PlannerService_post_computePlans
Called after computing the plans which allows you to tweak the plan or add some metadata
Parameters:
args.params.planType - the type of plan to create (ex: bounce, deploy, transition, etc...)
args.params.stepType - the type of steps to create (ex: sequential or parallel)
args.params.name - (optional) the name of the plan if provided
args.params.* - any other params needed by the plan creation (provided in the "plans" and "mountPointActions" configuration parameters)
args.metadata - metadata to use for the plan
args.serviceResult - the collection of plans
Returns:
a collection of plans (depending on args.params.stepType)


PlannerService_pre_computePlans

java.lang.Object PlannerService_pre_computePlans
Called before computing any plans which allows you to tweak the creation of the plan including the ability to create your own actions.
Parameters:
args.params.planType - the type of plan to create (ex: bounce, deploy, transition, etc...)
args.params.stepType - the type of steps to create (ex: sequential or parallel)
args.params.name - (optional) the name of the plan if provided
args.params.* - any other params needed by the plan creation (provided in the "plans" and "mountPointActions" configuration parameters)
args.metadata - metadata to use for the plan
Returns:
a collection of plans (depending on args.params.stepType)


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_post_authorize

java.lang.Object UserService_post_authorize
Called after user authorization.
Parameters:
args.filter - is a grails filter plugin object which gives you access to all methods and closures available from the filter (ex: filter.request, filter.response, filter.name, filter.accessControl {...}, etc...)
args.serviceResult - true or false depending on the filter result
args.serviceException - whenever there was an exception with authorization
Returns:
true to authorize the call, false to deny it, or null to let glu proceed with authorization


UserService_post_restAuthenticateAndAuthorize

java.lang.Object UserService_post_restAuthenticateAndAuthorize
Called after rest user authentication and authorization.
Parameters:
args.filter - is a grails filter plugin object which gives you access to all methods and closures available from the filter (ex: filter.request, filter.response, filter.name, filter.accessControl {...}, etc...)
args.serviceResult - true or false depending on the filter result
args.serviceException - whenever there was an exception with authorization
Returns:
true to authorize the call, false to deny it, or null to let glu proceed with authorization


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


UserService_pre_authorize

java.lang.Object UserService_pre_authorize
Called to authorize a user. This closure allows you for example to implement your entire authorization mechanism if you wish to! You may want to check the class org.linkedin.glu.console.filters.AuthFilters for an example of what you can do
Parameters:
args.filter - is a grails filter plugin object which gives you access to all methods and closures available from the filter (ex: filter.request, filter.response, filter.name, filter.accessControl {...}, etc...)
Returns:
true to authorize the call, false to deny it, or null to let glu proceed with authorization


UserService_pre_restAuthenticateAndAuthorize

java.lang.Object UserService_pre_restAuthenticateAndAuthorize
This call is wrapping the entire rest authentication and authorization flow, thus allowing you to write your entire REST auth code. Note that if you return a non null value, then the plugins UserService_pre_authenticate, UserService_post_authenticate, UserService_pre_authorize and UserService_post_authorize won't be called
Parameters:
args.filter - is a grails filter plugin object which gives you access to all methods and closures available from the filter (ex: filter.request, filter.response, filter.name, filter.accessControl {...}, etc...)
Returns:
true to authorize the call, false to deny it, or null to let glu proceed with authorization


 

Groovy Documentation