play
Class PlayPlugin

java.lang.Object
  extended by play.PlayPlugin
All Implemented Interfaces:
java.lang.Comparable<PlayPlugin>
Direct Known Subclasses:
CorePlugin, DBPlugin, JobsPlugin, JPAPlugin, MessagesPlugin, TempFilePlugin, ValidationPlugin, WS

public abstract class PlayPlugin
extends java.lang.Object
implements java.lang.Comparable<PlayPlugin>

A framework plugin


Field Summary
 int index
          Plugin priority (0 for highest priority)
 
Constructor Summary
PlayPlugin()
           
 
Method Summary
 void afterActionInvocation()
          Called at the end of the action invocation.
 void afterApplicationStart()
          Called after the application start.
 void afterInvocation()
          Called after an invocation.
 void beforeActionInvocation(java.lang.reflect.Method actionMethod)
          Called before an 'action' invocation, ie an HTTP request processing.
 void beforeInvocation()
          Called before a Play! invocation.
 java.lang.Object bind(java.lang.String name, java.lang.Class clazz, java.lang.reflect.Type type, java.util.Map<java.lang.String,java.lang.String[]> params)
          Called when play need to bind a Java object from HTTP params
 int compareTo(PlayPlugin o)
           
 void compileAll(java.util.List<ApplicationClasses.ApplicationClass> classes)
          Let a chance to the plugin to compile it owns classes.
 void detectChange()
          It's time for the plugin to detect changes.
 void enhance(ApplicationClasses.ApplicationClass applicationClass)
          Enhance this class
 java.lang.String getStatus()
          Retun the plugin status
 void invocationFinally()
          Called at the end of the invocation.
 void onActionInvocationResult(Result result)
          Called when the action method has thrown a result.
 void onApplicationStart()
          Called at application start (and at each reloading) Time to start statefull things.
 void onApplicationStop()
          Called at application stop (and before each reloading) Time to shutdown statefull things.
 void onConfigurationRead()
          Called when the application.cond has been read.
 void onEvent(java.lang.String message, java.lang.Object context)
          Event may be sent by plugins or other components
 void onInvocationException(java.lang.Throwable e)
          Called if an exception occured during the invocation.
 void onLoad()
          Called at plugin loading
 void onRoutesLoaded()
          Called after routes loading.
static void postEvent(java.lang.String message, java.lang.Object context)
          Inter-plugin communication.
 boolean rawInvocation(Http.Request request, Http.Response response)
          Let a chance to this plugin to fully manage this request
 void routeRequest(Http.Request request)
          Let some plugins route themself
 boolean serveStatic(VirtualFile file, Http.Request request, Http.Response response)
          Let a chance to this plugin to manage a static ressource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

public int index
Plugin priority (0 for highest priority)

Constructor Detail

PlayPlugin

public PlayPlugin()
Method Detail

onLoad

public void onLoad()
Called at plugin loading


bind

public java.lang.Object bind(java.lang.String name,
                             java.lang.Class clazz,
                             java.lang.reflect.Type type,
                             java.util.Map<java.lang.String,java.lang.String[]> params)
Called when play need to bind a Java object from HTTP params


getStatus

public java.lang.String getStatus()
Retun the plugin status


enhance

public void enhance(ApplicationClasses.ApplicationClass applicationClass)
             throws java.lang.Exception
Enhance this class

Parameters:
applicationClass -
Throws:
java.lang.Exception

rawInvocation

public boolean rawInvocation(Http.Request request,
                             Http.Response response)
                      throws java.lang.Exception
Let a chance to this plugin to fully manage this request

Parameters:
request - The Play request
response - The Play response
Returns:
true if this plugin has managed this request
Throws:
java.lang.Exception

serveStatic

public boolean serveStatic(VirtualFile file,
                           Http.Request request,
                           Http.Response response)
Let a chance to this plugin to manage a static ressource

Parameters:
request - The Play request
response - The Play response
Returns:
true if this plugin has managed this request

detectChange

public void detectChange()
It's time for the plugin to detect changes. Throw an exception is the application must be reloaded.


onApplicationStart

public void onApplicationStart()
Called at application start (and at each reloading) Time to start statefull things.


afterApplicationStart

public void afterApplicationStart()
Called after the application start.


onApplicationStop

public void onApplicationStop()
Called at application stop (and before each reloading) Time to shutdown statefull things.


beforeInvocation

public void beforeInvocation()
Called before a Play! invocation. Time to prepare request specific things.


afterInvocation

public void afterInvocation()
Called after an invocation. (unless an excetion has been thrown). Time to close request specific things.


onInvocationException

public void onInvocationException(java.lang.Throwable e)
Called if an exception occured during the invocation.

Parameters:
e - The catched exception.

invocationFinally

public void invocationFinally()
Called at the end of the invocation. (even if an exception occured). Time to close request specific things.


beforeActionInvocation

public void beforeActionInvocation(java.lang.reflect.Method actionMethod)
Called before an 'action' invocation, ie an HTTP request processing.


onActionInvocationResult

public void onActionInvocationResult(Result result)
Called when the action method has thrown a result.

Parameters:
result - The result object for the request.

afterActionInvocation

public void afterActionInvocation()
Called at the end of the action invocation.


onConfigurationRead

public void onConfigurationRead()
Called when the application.cond has been read.


onRoutesLoaded

public void onRoutesLoaded()
Called after routes loading.


onEvent

public void onEvent(java.lang.String message,
                    java.lang.Object context)
Event may be sent by plugins or other components

Parameters:
message - convention: pluginClassShortName.message
context - depends on the plugin

compileAll

public void compileAll(java.util.List<ApplicationClasses.ApplicationClass> classes)
Let a chance to the plugin to compile it owns classes. Must be added to the mutable list.


routeRequest

public void routeRequest(Http.Request request)
Let some plugins route themself

Parameters:
request -

postEvent

public static void postEvent(java.lang.String message,
                             java.lang.Object context)
Inter-plugin communication.


compareTo

public int compareTo(PlayPlugin o)
Specified by:
compareTo in interface java.lang.Comparable<PlayPlugin>


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly