public abstract class PlayPlugin extends java.lang.Object implements java.lang.Comparable<PlayPlugin>
Modifier and Type | Class and Description |
---|---|
static class |
PlayPlugin.Filter<T>
Class that define a filter.
|
Modifier and Type | Field and Description |
---|---|
int |
index
Plugin priority (0 for highest priority)
|
Constructor and Description |
---|
PlayPlugin() |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
addMimeTypes()
Override to provide additional mime types from your plugin.
|
java.util.List<java.lang.String> |
addTemplateExtensions() |
void |
afterActionInvocation()
Called at the end of the action invocation.
|
void |
afterApplicationStart()
Called after the application start.
|
void |
afterFixtureLoad() |
void |
afterInvocation()
Called after an invocation.
|
void |
beforeActionInvocation(java.lang.reflect.Method actionMethod)
Called before an 'action' invocation, ie an HTTP request processing.
|
void |
beforeDetectingChanges() |
void |
beforeInvocation()
Called before a Play!
|
java.lang.Object |
bind(RootParamNode rootParamNode,
java.lang.String name,
java.lang.Class<?> clazz,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations)
Called when play need to bind a Java object from HTTP params.
|
java.lang.Object |
bind(java.lang.String name,
java.lang.Class clazz,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations,
java.util.Map<java.lang.String,java.lang.String[]> params)
Deprecated.
|
java.lang.Object |
bind(java.lang.String name,
java.lang.Object o,
java.util.Map<java.lang.String,java.lang.String[]> params)
Deprecated.
Use bindBean instead
|
java.lang.Object |
bindBean(RootParamNode rootParamNode,
java.lang.String name,
java.lang.Object bean)
Called when play need to bind an existing Java object from HTTP params.
|
int |
compareTo(PlayPlugin o) |
void |
compileAll(java.util.List<ApplicationClasses.ApplicationClass> classes)
Deprecated.
|
boolean |
compileSources() |
void |
detectChange()
It's time for the plugin to detect changes.
|
boolean |
detectClassesChange()
It's time for the plugin to detect changes.
|
void |
enhance(ApplicationClasses.ApplicationClass applicationClass)
Enhance this class
|
PlayPlugin.Filter |
getFilter()
Return the filter implementation for this plugin.
|
java.util.Collection<java.lang.Class> |
getFunctionalTests()
Implement to add some classes that should be considered functional tests but do not extend
FunctionalTest to tests that can be executed by test runner (will be visible in test UI). |
com.google.gson.JsonObject |
getJsonStatus()
Return the plugin status in JSON format
|
java.lang.String |
getMessage(java.lang.String locale,
java.lang.Object key,
java.lang.Object... args)
Translate the given key for the given locale and arguments.
|
java.lang.String |
getStatus()
Return the plugin status
|
java.util.Collection<java.lang.Class> |
getUnitTests()
Implement to add some classes that should be considered unit tests but do not extend
Assert to
tests that can be executed by test runner (will be visible in test UI). |
boolean |
hasFilter() |
void |
invocationFinally()
Called at the end of the invocation.
|
Template |
loadTemplate(VirtualFile file) |
Model.Factory |
modelFactory(java.lang.Class<? extends Model> modelClass) |
void |
onActionInvocationFinally()
Called at the end of the action invocation (either in case of success or any failure).
|
void |
onActionInvocationResult(Result result)
Called when the action method has thrown a result.
|
void |
onApplicationReady() |
void |
onApplicationStart()
Called at application start (and at each reloading) Time to start stateful things.
|
void |
onApplicationStop()
Called at application stop (and before each reloading) Time to shutdown stateful things.
|
java.util.List<ApplicationClasses.ApplicationClass> |
onClassesChange(java.util.List<ApplicationClasses.ApplicationClass> modified) |
void |
onConfigurationRead()
Called when the application.conf 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 occurred during the invocation.
|
void |
onInvocationSuccess() |
void |
onLoad()
Called at plugin loading
|
void |
onRequestRouting(Router.Route route)
Called when the request has been routed.
|
void |
onRoutesLoaded()
Called after routes loading.
|
void |
onTemplateCompilation(Template template)
Deprecated.
|
java.lang.String |
overrideTemplateSource(BaseTemplate template,
java.lang.String source) |
static void |
postEvent(java.lang.String message,
java.lang.Object context)
Inter-plugin communication.
|
boolean |
rawInvocation(Http.Request request,
Http.Response response)
Give a chance to this plugin to fully manage this request
|
void |
routeRequest(Http.Request request)
Let some plugins route themself
|
TestEngine.TestResults |
runTest(java.lang.Class<BaseTest> clazz)
Run a test class
|
boolean |
serveStatic(VirtualFile file,
Http.Request request,
Http.Response response)
Let a chance to this plugin to manage a static resource
|
java.util.Map<java.lang.String,java.lang.Object> |
unBind(java.lang.Object src,
java.lang.String name)
Unbind an object
|
java.lang.Object |
willBeValidated(java.lang.Object value) |
public void onLoad()
public boolean compileSources()
public TestEngine.TestResults runTest(java.lang.Class<BaseTest> clazz)
clazz
- the class to run@Deprecated public java.lang.Object bind(java.lang.String name, java.lang.Class clazz, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, java.util.Map<java.lang.String,java.lang.String[]> params)
bind(RootParamNode, String, Class, Type, Annotation[])
name
- the name of the objectclazz
- the class of the object to bindtype
- typeannotations
- annotation on the objectparams
- parameters to bindpublic java.lang.Object bind(RootParamNode rootParamNode, java.lang.String name, java.lang.Class<?> clazz, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations)
rootParamNode
- parameters to bindname
- the name of the objectclazz
- the class of the object to bindtype
- typeannotations
- annotation on the object@Deprecated public java.lang.Object bind(java.lang.String name, java.lang.Object o, java.util.Map<java.lang.String,java.lang.String[]> params)
name
- the name of the objecto
- object to bindparams
- parameters to bindpublic java.lang.Object bindBean(RootParamNode rootParamNode, java.lang.String name, java.lang.Object bean)
rootParamNode
- parameters to bindname
- the name of the objectbean
- object to bindpublic java.util.Map<java.lang.String,java.lang.Object> unBind(java.lang.Object src, java.lang.String name)
src
- object to unbindname
- the name of the objectpublic java.lang.String getMessage(java.lang.String locale, java.lang.Object key, java.lang.Object... args)
locale
- the locale we wantkey
- the message keyargs
- arguments of the messagespublic java.lang.String getStatus()
public com.google.gson.JsonObject getJsonStatus()
public void enhance(ApplicationClasses.ApplicationClass applicationClass) throws java.lang.Exception
applicationClass
- the class to enhancejava.lang.Exception
- if cannot enhance the class@Deprecated public void onTemplateCompilation(Template template)
template
- the template to compilepublic boolean rawInvocation(Http.Request request, Http.Response response) throws java.lang.Exception
request
- The Play requestresponse
- The Play responsejava.lang.Exception
- if cannot enhance the classpublic boolean serveStatic(VirtualFile file, Http.Request request, Http.Response response)
file
- The requested filerequest
- The Play requestresponse
- The Play responsepublic void beforeDetectingChanges()
public Template loadTemplate(VirtualFile file)
file
- the file of the template to loadpublic void detectChange()
public boolean detectClassesChange()
public void onApplicationStart()
public void afterApplicationStart()
public void onApplicationStop()
public void beforeInvocation()
public void afterInvocation()
public void onInvocationException(java.lang.Throwable e)
e
- The caught exception.public void invocationFinally()
public void beforeActionInvocation(java.lang.reflect.Method actionMethod)
actionMethod
- name of the methodpublic void onActionInvocationResult(Result result)
result
- The result object for the request.public void onInvocationSuccess()
public void onRequestRouting(Router.Route route)
route
- The route selected.public void afterActionInvocation()
public void onActionInvocationFinally()
public void onConfigurationRead()
public void onRoutesLoaded()
public void onEvent(java.lang.String message, java.lang.Object context)
message
- convention: pluginClassShortName.messagecontext
- depends on the pluginpublic java.util.List<ApplicationClasses.ApplicationClass> onClassesChange(java.util.List<ApplicationClasses.ApplicationClass> modified)
modified
- list of modified classpublic java.util.List<java.lang.String> addTemplateExtensions()
public java.util.Map<java.lang.String,java.lang.String> addMimeTypes()
@Deprecated public void compileAll(java.util.List<ApplicationClasses.ApplicationClass> classes)
classes
- list of class to compilepublic void routeRequest(Http.Request request)
request
- the current requestpublic Model.Factory modelFactory(java.lang.Class<? extends Model> modelClass)
modelClass
- class of the modelpublic void afterFixtureLoad()
public static void postEvent(java.lang.String message, java.lang.Object context)
message
- the message to postcontext
- an objectpublic void onApplicationReady()
public int compareTo(PlayPlugin o)
compareTo
in interface java.lang.Comparable<PlayPlugin>
public java.lang.String overrideTemplateSource(BaseTemplate template, java.lang.String source)
public java.lang.Object willBeValidated(java.lang.Object value)
public java.util.Collection<java.lang.Class> getUnitTests()
Assert
to
tests that can be executed by test runner (will be visible in test UI).
Note:You probably will also need to override runTest(java.lang.Class)
method
to handle unsupported tests execution properly.
Keep in mind that this method can only add tests to currently loaded ones. You cannot disable tests this way. You should also make sure you do not duplicate already loaded tests.
public java.util.Collection<java.lang.Class> getFunctionalTests()
FunctionalTest
to tests that can be executed by test runner (will be visible in test UI).
Note:You probably will also need to override runTest(java.lang.Class)
method
to handle unsupported tests execution properly.
Keep in mind that this method can only add tests to currently loaded ones. You cannot disable tests this way. You should also make sure you do not duplicate already loaded tests.
public final boolean hasFilter()
public PlayPlugin.Filter getFilter()
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly