public abstract class PlayPlugin extends Object implements 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 |
---|---|
Map<String,String> |
addMimeTypes()
Override to provide additional mime types from your plugin.
|
List<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(Method actionMethod)
Called before an 'action' invocation,
ie an HTTP request processing.
|
void |
beforeDetectingChanges() |
void |
beforeInvocation()
Called before a Play!
|
Object |
bind(RootParamNode rootParamNode,
String name,
Class<?> clazz,
Type type,
Annotation[] annotations)
Called when play need to bind a Java object from HTTP params.
|
Object |
bind(String name,
Class clazz,
Type type,
Annotation[] annotations,
Map<String,String[]> params)
Deprecated.
|
Object |
bind(String name,
Object o,
Map<String,String[]> params)
Deprecated.
|
Object |
bindBean(RootParamNode rootParamNode,
String name,
Object bean)
Called when play need to bind an existing Java object from HTTP params.
|
int |
compareTo(PlayPlugin o) |
void |
compileAll(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.
|
Collection<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
|
String |
getMessage(String locale,
Object key,
Object... args)
Translate the given key for the given locale and arguments.
|
String |
getStatus()
Return the plugin status
|
Collection<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(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.
|
List<ApplicationClasses.ApplicationClass> |
onClassesChange(List<ApplicationClasses.ApplicationClass> modified) |
void |
onConfigurationRead()
Called when the application.conf has been read.
|
void |
onEvent(String message,
Object context)
Event may be sent by plugins or other components
|
void |
onInvocationException(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.
|
String |
overrideTemplateSource(BaseTemplate template,
String source) |
static void |
postEvent(String message,
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(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
|
Map<String,Object> |
unBind(Object src,
String name) |
Object |
willBeValidated(Object value) |
public void onLoad()
public boolean compileSources()
public TestEngine.TestResults runTest(Class<BaseTest> clazz)
@Deprecated public Object bind(String name, Class clazz, Type type, Annotation[] annotations, Map<String,String[]> params)
public Object bind(RootParamNode rootParamNode, String name, Class<?> clazz, Type type, Annotation[] annotations)
@Deprecated public Object bind(String name, Object o, Map<String,String[]> params)
public Object bindBean(RootParamNode rootParamNode, String name, Object bean)
public String getMessage(String locale, Object key, Object... args)
public String getStatus()
public com.google.gson.JsonObject getJsonStatus()
public void enhance(ApplicationClasses.ApplicationClass applicationClass) throws Exception
applicationClass
- Exception
@Deprecated public void onTemplateCompilation(Template template)
template
- public boolean rawInvocation(Http.Request request, Http.Response response) throws Exception
request
- The Play requestresponse
- The Play responseException
public boolean serveStatic(VirtualFile file, Http.Request request, Http.Response response)
request
- The Play requestresponse
- The Play responsepublic void beforeDetectingChanges()
public Template loadTemplate(VirtualFile file)
public void detectChange()
public boolean detectClassesChange()
public void onApplicationStart()
public void afterApplicationStart()
public void onApplicationStop()
public void beforeInvocation()
public void afterInvocation()
public void onInvocationException(Throwable e)
e
- The caught exception.public void invocationFinally()
public void beforeActionInvocation(Method actionMethod)
public 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(String message, Object context)
message
- convention: pluginClassShortName.messagecontext
- depends on the pluginpublic List<ApplicationClasses.ApplicationClass> onClassesChange(List<ApplicationClasses.ApplicationClass> modified)
public Map<String,String> addMimeTypes()
@Deprecated public void compileAll(List<ApplicationClasses.ApplicationClass> classes)
public void routeRequest(Http.Request request)
request
- public Model.Factory modelFactory(Class<? extends Model> modelClass)
public void afterFixtureLoad()
public void onApplicationReady()
public int compareTo(PlayPlugin o)
compareTo
in interface Comparable<PlayPlugin>
public String overrideTemplateSource(BaseTemplate template, String source)
public Collection<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 Collection<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