|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.root.RootObject
com.neeve.server.app.SrvAppManager
public final class SrvAppManager
Manages the lifecycle of platform managed applications.
Method Summary | |
---|---|
static SrvAppManager |
create(SrvConfigDescriptor configDescriptor,
com.neeve.server.thread.SrvThreadManager threadManager,
ISrvAppWatcher appWatcher,
ISrvAppServerStopper serverStopper)
Create an application manager. |
void |
dispatchEventToApp(String name,
Object event)
Dispatch an event to an application. |
SrvAppLoader |
getAppLoader(String name)
Get an application loader. |
MessageBusBinding |
getAppServerBusBinding(String appName,
String busName)
Get an application's 'server' bus binding |
void |
installApp(String name,
File dir)
Install/upgrade an application. |
boolean |
isAppLoaded(String name)
Check if an application is loaded. |
boolean |
isStarted()
Check if the application manager is started. |
String |
issueAppCommand(String name,
String command,
String[] args)
Issue a command to an application. |
void |
issueAppCommand(String name,
String command,
String[] args,
SrvMonInvokeCommandResponse response)
Issue a command to an application. |
SrvMonListCommandsResponse |
issueGetCommands(SrvMonListCommandsRequest request)
Issue a request to get an apps commands. |
List<String> |
listApps()
List the set of loaded apps |
void |
loadApp(String name)
Load an application. |
void |
reloadApp(String name)
Reload an application. |
void |
scheduleAppEvent(String name,
Object event)
Schedule an application event. |
void |
scheduleAppReload(String name)
Schedule an application reload. |
void |
scheduleAppUnload(String name)
Schedule an application unload. |
void |
setAppMessageHandlingPolicy(String name,
AepEngine.MessageHandlingPolicy policy)
Set an application's message handling policy. |
void |
setAppVersion(String name,
int version)
Set an application's current version. |
void |
start()
Start an application manager. |
void |
startApp(String name,
boolean async)
Start an application. |
void |
stop()
Stop the application manager. |
void |
stopApp(String name)
Stop an application. |
void |
unloadApp(String name)
Unload an application. |
Methods inherited from class com.neeve.root.RootObject |
---|
getChecked, getThreaded, getTracer, setChecked, setTracer |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final SrvAppManager create(SrvConfigDescriptor configDescriptor, com.neeve.server.thread.SrvThreadManager threadManager, ISrvAppWatcher appWatcher, ISrvAppServerStopper serverStopper)
configDescriptor
- The server's configuration descriptor.threadManager
- The server's thread manager.appWatcher
- The interface through which app status is communicated.
public final void start() throws ESrvAppException
IllegalStateException
- Thrown if the application manager has
already been started (or started and stopped).
ESrvAppException
public final List<String> listApps() throws Exception
Exception
- Thrown if an error was encountered while preparing
the list of loaded apps.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.public final void installApp(String name, File dir) throws Exception
name
- The name of the application to be installed/upgraded.dir
- The name of the directory where the new application's files
(jar files etc) are located.
Exception
- Thrown if an error was encountered while installing
the application.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method installs/upgrades an application. The method copies the application's files into the application specific repository and increments the application's latest version.
public final void setAppVersion(String name, int version) throws Exception
name
- The application whose current version is to be set.version
- The version to set.
Exception
- Thrown in case an error is encountered during setting
the application's current version.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method updates the current version setting for an application. Specifying a version of 0 will set the current version to the latest installed version.
public final void loadApp(String name) throws Exception
name
- The name of the application to load.
Exception
- Thrown in case an error is encountered during loading
of the application.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method loads an application. It looks up the application of the supplied name, loads an instance of and starts the application.
public final SrvAppLoader getAppLoader(String name)
name
- The name of the application whose loader to retrieve.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method returns an application's loader. A null value is returned if there is no application loaded with the supplied name.
public final boolean isStarted()
public final boolean isAppLoaded(String name)
name
- The name of the application to check for.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.public final String issueAppCommand(String name, String command, String[] args) throws Exception
name
- The application to issue the command to.command
- The command to issueargs
- The command arguments
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
Exception
public final void issueAppCommand(String name, String command, String[] args, SrvMonInvokeCommandResponse response) throws Exception
name
- The application to issue the command to.command
- The command to issueargs
- The command argumentsresponse
- The command response
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
Exception
public final SrvMonListCommandsResponse issueGetCommands(SrvMonListCommandsRequest request) throws Exception
request
- The request.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
Exception
public final void startApp(String name, boolean async) throws Exception
name
- The name of the application to start.async
- Indicates whether to wait or nor to wait for the start to
complete. If async start is elected, then the start is initiated in the
background using a separate thread.
Exception
- Thrown in case an error is encountered during starting
of the application.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method starts an application. It looks up the application of the supplied name and starts it if not already started. An exeption is thrown if the app being started is already started
public final void stopApp(String name) throws Exception
name
- The name of the application to stop.
Exception
- Thrown in case an error is encountered during stoping
of the application.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method stops an application. It looks up the application of the supplied name and stops it if started. An exception is thrown if the application being stopped is not started
public final void unloadApp(String name)
name
- The name of the application to unload.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method unloads an application. It looks up if an application of the supplied name has been loaded and unloads it if it is. Upon successful completion of this method, the application has been stopped and unloaded. This method does invoke GC before returning to unload the application and classloader from memory. However, due to compiler inlining and other optimizations, it is still not guaranteed that this would happen. Therefore, the caller should also invoke GC in case it needs the application and/or classloader to be removed from memory.
public final void reloadApp(String name) throws Exception
name
- The name of the application to reload.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
Exception
- Thrown in case an error in encountered reloading
the application.
This method unloads and then reloads an application.
public final void dispatchEventToApp(String name, Object event) throws Exception
name
- The name of the application to dispatch the even to.event
- The event to dispatch.
Exception
- Thrown in case an error is encountered during dispatch
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
This method dispatched an event to an application. It looks up the application by the supplied name and dispatches the supplied event to it.
public final void scheduleAppUnload(String name) throws ESrvAppException
name
- The name of the application to unload.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
ESrvAppException
- Thrown in case an error was encountered
in scheduling the background task.
This method schedules the unload of a running application, It first checks if an application of the specified name is currently loaded. If so, it schedules the unload of the application to complete in the background and returns immediately. The method just returns if no application of the specified name is loaded.
public final void scheduleAppReload(String name) throws ESrvAppException
name
- The name of the application to reload.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
ESrvAppException
- Thrown in case an error was encountered
in scheduling the background task.
This method schedules the unload and reload of an application in the background and immediately returns. The background task just loads the application if no application of the specified name is loaded.
public final void scheduleAppEvent(String name, Object event) throws ESrvAppException
name
- The name of the application to schedule the event to.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.
IllegalArgumentException
- Thrown if no application of the supplied
name has been loaded.
ESrvAppException
- Thrown in case an error was encountered
in scheduling the background task.
This method schedules an event to be dispatched to a running application. It first checks if an application of the specified name is currently loaded. If so, it schedules the event to be dispatched to the application in the background and returns immediately. The method just returns if no application of the specified name is loaded.
public final void setAppMessageHandlingPolicy(String name, AepEngine.MessageHandlingPolicy policy)
name
- The name of the application whose policy to update.policy
- The new policy to set.
IllegalStateException
- Thrown if the application manager has not
been started or has been stopped.public final MessageBusBinding getAppServerBusBinding(String appName, String busName)
appName
- The name of the application whose binding to return.busName
- The name of the bus whose binding to return.
IllegalStateException
- Thrown if the application manager has not been
started or has been stopped.public final void stop()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |