Package play
Class Play
- java.lang.Object
-
- play.Play
-
public class Play extends java.lang.Object
Main framework class
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Play.Mode
2 modes
-
Field Summary
Fields Modifier and Type Field Description static java.io.File
applicationPath
The application rootstatic ApplicationClasses
classes
All loaded application classesstatic ApplicationClassloader
classloader
The application classLoaderstatic java.util.Properties
configuration
The app configuration (already resolved from the framework id)static java.util.Set<VirtualFile>
confs
The loaded configuration filesstatic java.lang.String
ctxPath
Context path (when several application are deployed on the same host)static java.lang.String
defaultWebEncoding
This is used as default encoding everywhere related to the web: request, response, WSstatic boolean
forceProd
static java.io.File
frameworkPath
The framework rootstatic java.lang.String
id
The framework IDstatic boolean
initialized
Is the application initializedstatic java.util.List<VirtualFile>
javaPath
All paths to search for Java filesstatic java.util.List<java.lang.String>
langs
The list of supported localesstatic boolean
lazyLoadTemplates
Lazy load the templates on demandstatic Play.Mode
mode
The application modestatic java.util.Map<java.lang.String,VirtualFile>
modules
Modulesstatic java.util.Map<java.lang.String,VirtualFile>
modulesRoutes
Plugin routes filesstatic PluginCollection
pluginCollection
pluginCollection that holds all loaded plugins and all enabled plugins..static java.util.List<PlayPlugin>
plugins
Deprecated.static boolean
readOnlyTmp
tmp dir is readOnlystatic java.util.List<VirtualFile>
roots
All paths to search for filesstatic VirtualFile
routes
Main routes filestatic java.lang.String
secretKey
The very secret keystatic boolean
standalonePlayServer
This flag indicates if the app is running in a standalone Play server or as a WAR in an applicationServerstatic boolean
started
Is the application startedstatic long
startedAt
The last time than the application has startedstatic java.util.List<VirtualFile>
templatesPath
All paths to search for templates filesstatic java.io.File
tmpDir
tmp dirstatic boolean
usePrecompiled
static java.lang.String
version
Framework version
-
Constructor Summary
Constructors Constructor Description Play()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addModule(java.lang.String name, java.io.File path)
Add a play application (as plugin)static void
addModule(VirtualFile appRoot, java.lang.String name, java.io.File path)
Add a play application (as plugin)static void
detectChanges()
Detect sources modificationsstatic void
fatalServerErrorOccurred()
Call this method when there has been a fatal error that Play cannot recover fromstatic java.io.File
getFile(java.lang.String path)
Search a File in the current applicationstatic VirtualFile
getVirtualFile(java.lang.String path)
Search a VirtualFile in all loaded applications and pluginsstatic void
guessFrameworkPath()
static void
init(java.io.File root, java.lang.String id)
Init the frameworkstatic void
initStaticStuff()
Allow some code to run very early in Play - Use with caution !static void
loadModules()
Load all modules.static void
loadModules(VirtualFile appRoot)
Load all modules.static <T extends PlayPlugin>
Tplugin(java.lang.Class<T> clazz)
static void
readConfiguration()
Read application.conf and resolve overridden key using the play id mechanism.static boolean
runningInTestMode()
Returns true if application is running in test-mode.static void
start()
Start the application.static void
stop()
Stop the applicationstatic boolean
useDefaultMockMailSystem()
-
-
-
Field Detail
-
initialized
public static boolean initialized
Is the application initialized
-
started
public static boolean started
Is the application started
-
id
public static java.lang.String id
The framework ID
-
mode
public static Play.Mode mode
The application mode
-
applicationPath
public static java.io.File applicationPath
The application root
-
tmpDir
public static java.io.File tmpDir
tmp dir
-
readOnlyTmp
public static boolean readOnlyTmp
tmp dir is readOnly
-
frameworkPath
public static java.io.File frameworkPath
The framework root
-
classes
public static ApplicationClasses classes
All loaded application classes
-
classloader
public static ApplicationClassloader classloader
The application classLoader
-
roots
public static java.util.List<VirtualFile> roots
All paths to search for files
-
javaPath
public static java.util.List<VirtualFile> javaPath
All paths to search for Java files
-
templatesPath
public static java.util.List<VirtualFile> templatesPath
All paths to search for templates files
-
routes
public static VirtualFile routes
Main routes file
-
modulesRoutes
public static java.util.Map<java.lang.String,VirtualFile> modulesRoutes
Plugin routes files
-
confs
public static java.util.Set<VirtualFile> confs
The loaded configuration files
-
configuration
public static java.util.Properties configuration
The app configuration (already resolved from the framework id)
-
startedAt
public static long startedAt
The last time than the application has started
-
langs
public static java.util.List<java.lang.String> langs
The list of supported locales
-
secretKey
public static java.lang.String secretKey
The very secret key
-
pluginCollection
public static PluginCollection pluginCollection
pluginCollection that holds all loaded plugins and all enabled plugins..
-
plugins
@Deprecated public static java.util.List<PlayPlugin> plugins
Deprecated.Readonly list containing currently enabled plugins. This list is updated from pluginCollection when pluginCollection is modified Play plugins Use pluginCollection instead.
-
modules
public static java.util.Map<java.lang.String,VirtualFile> modules
Modules
-
version
public static java.lang.String version
Framework version
-
ctxPath
public static java.lang.String ctxPath
Context path (when several application are deployed on the same host)
-
usePrecompiled
public static boolean usePrecompiled
-
forceProd
public static boolean forceProd
-
lazyLoadTemplates
public static boolean lazyLoadTemplates
Lazy load the templates on demand
-
defaultWebEncoding
public static java.lang.String defaultWebEncoding
This is used as default encoding everywhere related to the web: request, response, WS
-
standalonePlayServer
public static boolean standalonePlayServer
This flag indicates if the app is running in a standalone Play server or as a WAR in an applicationServer
-
-
Method Detail
-
init
public static void init(java.io.File root, java.lang.String id)
Init the framework- Parameters:
root
- The application pathid
- The framework id to use
-
guessFrameworkPath
public static void guessFrameworkPath()
-
readConfiguration
public static void readConfiguration()
Read application.conf and resolve overridden key using the play id mechanism.
-
start
public static void start()
Start the application. Recall to restart !
-
stop
public static void stop()
Stop the application
-
detectChanges
public static void detectChanges()
Detect sources modifications
-
plugin
public static <T extends PlayPlugin> T plugin(java.lang.Class<T> clazz)
-
initStaticStuff
public static void initStaticStuff()
Allow some code to run very early in Play - Use with caution !
-
loadModules
public static void loadModules()
Load all modules. You can even specify the list using the MODULES environment variable.
-
loadModules
public static void loadModules(VirtualFile appRoot)
Load all modules. You can even specify the list using the MODULES environment variable.- Parameters:
appRoot
- the application path virtual file
-
addModule
public static void addModule(java.lang.String name, java.io.File path)
Add a play application (as plugin)- Parameters:
name
- the module namepath
- The application path
-
addModule
public static void addModule(VirtualFile appRoot, java.lang.String name, java.io.File path)
Add a play application (as plugin)- Parameters:
appRoot
- the application path virtual filename
- the module namepath
- The application path
-
getVirtualFile
public static VirtualFile getVirtualFile(java.lang.String path)
Search a VirtualFile in all loaded applications and plugins- Parameters:
path
- Relative path from the applications root- Returns:
- The virtualFile or null
-
getFile
public static java.io.File getFile(java.lang.String path)
Search a File in the current application- Parameters:
path
- Relative path from the application root- Returns:
- The file even if it doesn't exist
-
runningInTestMode
public static boolean runningInTestMode()
Returns true if application is running in test-mode. Test-mode is resolved from the framework id. Your app is running in test-mode if the framework id (Play.id) is 'test' or 'test-?.*'- Returns:
- true if test mode
-
fatalServerErrorOccurred
public static void fatalServerErrorOccurred()
Call this method when there has been a fatal error that Play cannot recover from
-
useDefaultMockMailSystem
public static boolean useDefaultMockMailSystem()
-
-