public class ApplicationContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Date |
INIT_TIME
The class load time (system initialization time).
|
static Path |
PATH_CONFIG
The path to the global configuration.
|
static java.util.Date |
START_TIME
The context start (or reset) time.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
destroy()
Destroys the application context and frees all resources used.
|
java.lang.Object |
execute(java.lang.String name,
java.lang.Object[] args,
java.lang.String source,
java.lang.StringBuffer trace)
Executes a procedure within this context.
|
void |
executeAsync(java.lang.String name,
java.lang.Object[] args,
java.lang.String source)
Executes a procedure asynchronously within this context.
|
CallContext |
findContext(int threadId)
Finds the currently active call context for a thread id.
|
CallContext |
findContext(java.lang.Thread thread)
Finds the currently active call context for a thread.
|
java.io.File |
getBaseDir()
Returns the application base directory.
|
java.lang.ClassLoader |
getClassLoader()
Returns the plug-in class loader.
|
Dict |
getConfig()
Returns the application configuration.
|
Environment |
getEnvironment()
Returns the environment used.
|
static ApplicationContext |
getInstance()
Returns the singleton application context instance.
|
Library |
getLibrary()
Returns the procedure library used.
|
Storage |
getStorage()
Returns the application data storage.
|
WebMatcher[] |
getWebMatchers()
Returns the array of cached web matchers (from the web services).
|
protected static ApplicationContext |
init(java.io.File baseDir,
java.io.File localDir,
boolean start)
Creates and initializes the application context.
|
java.lang.String |
installPlugin(java.io.File file)
Installs a plug-in from the specified file.
|
boolean |
isPluginLoaded(java.lang.String pluginId)
Checks if the specified plug-in is currently loaded.
|
void |
loadPlugin(java.lang.String pluginId)
Loads a plug-in.
|
Dict |
pluginConfig(java.lang.String pluginId)
Returns the specified plug-in configuration dictionary.
|
void |
reset()
Resets this context and reloads all resources.
|
void |
unloadPlugin(java.lang.String pluginId)
Unloads a plug-in.
|
public static final Path PATH_CONFIG
public static final java.util.Date INIT_TIME
public static java.util.Date START_TIME
protected static ApplicationContext init(java.io.File baseDir, java.io.File localDir, boolean start)
baseDir
- the base application directorylocalDir
- the local add-on directorystart
- the initialize plug-ins flagprotected static void destroy()
public static ApplicationContext getInstance()
public void reset()
public Dict getConfig()
public Storage getStorage()
public Environment getEnvironment()
public WebMatcher[] getWebMatchers()
reset()
public Library getLibrary()
public java.io.File getBaseDir()
public java.lang.ClassLoader getClassLoader()
public boolean isPluginLoaded(java.lang.String pluginId)
pluginId
- the unique plug-in idpublic Dict pluginConfig(java.lang.String pluginId)
pluginId
- the unique plug-in idpublic java.lang.String installPlugin(java.io.File file) throws PluginException
file
- the plug-in ZIP filePluginException
- if the plug-in couldn't be installed
correctlypublic void loadPlugin(java.lang.String pluginId) throws PluginException
pluginId
- the unique plug-in idPluginException
- if no plug-in instance could be created
or if the plug-in initialization failedpublic void unloadPlugin(java.lang.String pluginId) throws PluginException
pluginId
- the unique plug-in idPluginException
- if the plug-in deinitialization failedpublic java.lang.Object execute(java.lang.String name, java.lang.Object[] args, java.lang.String source, java.lang.StringBuffer trace) throws ProcedureException
name
- the procedure nameargs
- the procedure argumentssource
- the call source informationtrace
- the trace buffer or null for noneProcedureException
- if the procedure execution failedpublic void executeAsync(java.lang.String name, java.lang.Object[] args, java.lang.String source)
name
- the procedure nameargs
- the procedure argumentssource
- the call source informationpublic CallContext findContext(java.lang.Thread thread)
thread
- the thread to search forpublic CallContext findContext(int threadId)
threadId
- the thread id to search for