|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.creamtec.ajaxswing.core.ClientAgent
public class ClientAgent
Main class within the client process/virtual process. The agent is responsible for loading the client starting class, executing it's main function, and responding to request to process Http requests. It also emulates user actions for the running client process and acts as a main point of contact and coordination of the client application. Client Agent can execute in within a shared JVM or as a stand alone process, in which case it makes itself available through RMI.
Each user, that connects to the AjaxSwing enabled application, receives his own instance of the client agent.
| Nested Class Summary | |
|---|---|
static class |
ClientAgent.InitLock
Synchronizes the initialization of the JVM |
static class |
ClientAgent.OperationLock
Synchronizes the processing of a user-defined operation. |
static class |
ClientAgent.RequestLock
Syncrhonizes the processing of a request. |
| Field Summary | |
|---|---|
static boolean |
shuttingDown
|
static boolean |
useAjaxSwingFontsConfigFile
|
| Constructor Summary | |
|---|---|
ClientAgent(java.lang.String agentName,
java.lang.String appName)
Initializes the client agent |
|
| Method Summary | |
|---|---|
void |
addBlockedThread(AjaxSwingThread thread)
Adds the given thread to the list of blocked threads within the clinet. |
boolean |
allowExit()
Checks if System.exit() is allowed to shutdown the JVM |
void |
beginOperation()
Begins a custom operation |
void |
doRun()
Does the job of running the client application |
void |
emulateRequest(HttpRequestData data)
Emulates the given request and action, as though triggered by the application user The action is executed on a separate threads, and all threads, spawned from the emulation thread are monitored for their state. |
void |
endOperation()
Marks an end of custom operation |
void |
exit()
Safe shutdown of JVM. |
AjaxSwingThreadGroup |
getAjaxSwingThreadGroup()
Returns the thread group that owns all threads of this agent |
java.lang.String |
getAppName()
Returns application name |
int |
getBrowserID()
Returns the browser ID of the user, that the client agent is associated with |
float |
getBrowserVersion()
Returns the browser version of the user, that the client agent is associated with |
java.lang.ClassLoader |
getClassLoader()
Returns the class loader used to load the classes of this virtual client |
int |
getClientId()
Returns agent name |
java.awt.datatransfer.Clipboard |
getClipboard()
|
java.lang.String |
getComponentProperty(java.lang.Object component,
java.lang.String property)
Looks up and returns the value of the component property in the current window |
static ClientAgent |
getCurrentInstance()
Returns the instance of ClientAgent, associated with the calling thread May not work correctly in a multi threaded application |
java.awt.EventQueue |
getEventQueue()
Used to retrieve the virtual user specific AWT event queue |
java.lang.Throwable |
getException()
Returns the exception cought while processing a request |
AbstractDocument |
getHTMLPage()
Returns HTML Page, associated with this client |
AgentInitData |
getInitData()
Returns application initialization data |
java.awt.Dimension |
getMaximumWindowSize(java.awt.Window window)
|
java.lang.Object |
getOperationLock()
Used to control multithreaded applications |
AbstractDocumentRenderer |
getPageRenderer()
Returns the instance of PageRenderer, associated with this client |
AjaxSwingProperties |
getProps()
Returns the application initialization properties |
HttpRequestData |
getRequestData()
Returns data received from the browser |
AgentRequestFilter |
getRequestFilter()
Returns request filter instance or null |
long |
getRequestId()
Each request increments the id |
HttpResponseData |
getResponseData()
Returns data received from the browser |
java.util.HashMap |
getSession()
Returns the session map associated with the client. |
java.util.List |
getTempFiles()
Client agent stores the temporary files created for the user They are automatically deleted when the agent is shutdown |
AjaxSwingUIManager |
getUIManager()
Returns the instance of UIManager, associated with this client |
java.lang.String |
getWindowProperty(java.lang.String windowTitle,
java.lang.String key)
Looks up and returns the value of the property if set for a window with the given title |
WindowUpdater |
getWindowUpdater()
Returns the instance of WindowUpdater, associated with this client |
void |
init(AgentInitData data)
Completes client initialization by storing the data. |
void |
initProperties(java.lang.String appName)
Initializes generic properties and variables of the client agent that do not depend on the specific application configuration |
static void |
installExitTrap()
Installs the security manager to intercept System.exit() attempts. |
void |
installToolkit()
Installs AWT toolkit. |
boolean |
isApplet()
Can be used to test if the application is running as an applet |
boolean |
isBrowserNS()
Returns true if user agent is Netscape or compatible |
boolean |
isOperationActive()
Operations can be defined using the application properties file to fine tune a multithreaded application |
boolean |
isRequestActive()
Can be used to test if the agent is currently processing a request |
boolean |
isRunning()
Returns true if the client is already executing |
static boolean |
isToolkitInstalled()
Returns true if the toolkit has already been installed |
void |
ping()
Renews a lease on the agent. |
HttpResponseData |
processHttpRequest(HttpRequestData requestData)
Processes HTTP request, as received by the servlet. |
void |
removeBlockedThread(AjaxSwingThread thread)
Removes the given thread from a list of blocked threads. |
HttpResponseData |
renderWindows(HttpRequestData data)
Renders the current window on EventDispatch thread |
void |
runApp(boolean wait)
Runs the application/applet. |
void |
setAllowExit(boolean allow)
Used to allow or disallow JVM shutdown |
void |
setClientSize(int width,
int height)
|
void |
setException(java.lang.Throwable x)
Sets the exception that occured in while processing a request |
void |
setHTMLPage(AbstractDocument page)
|
void |
setResponseData(HttpResponseData httpResponseData)
Sets the data structure for HTTP response |
void |
setUpdateBrowser(boolean updateBrowser)
|
boolean |
shouldUpdateBrowser()
|
void |
shutdown()
Ends client session and cleans up all client resources. |
void |
waitForBlockedThreads(java.lang.Object[] blockedThreads)
Waits until all blocked threads finish running |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean shuttingDown
public static boolean useAjaxSwingFontsConfigFile
| Constructor Detail |
|---|
public ClientAgent(java.lang.String agentName,
java.lang.String appName)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
public void init(AgentInitData data)
throws java.rmi.RemoteException,
java.lang.Exception
init in interface ClientAgentRemotejava.rmi.RemoteException
java.lang.Exception
public void setClientSize(int width,
int height)
public void initProperties(java.lang.String appName)
throws java.rmi.RemoteException,
java.lang.Exception
java.rmi.RemoteException
java.lang.Exceptionpublic void shutdown()
shutdown in interface ClientAgentRemotepublic boolean allowExit()
public void exit()
public void setAllowExit(boolean allow)
allow - true to allow JVM shutdownpublic java.awt.EventQueue getEventQueue()
public int getBrowserID()
public boolean isBrowserNS()
public float getBrowserVersion()
public HttpResponseData renderWindows(HttpRequestData data)
throws java.lang.Exception,
java.rmi.RemoteException
renderWindows in interface ClientAgentRemotedata - request data to be processed
java.lang.Exception
java.rmi.RemoteException
public HttpResponseData processHttpRequest(HttpRequestData requestData)
throws java.rmi.RemoteException,
java.lang.Exception
processHttpRequest in interface ClientAgentRemotejava.rmi.RemoteException
java.lang.Exception
public void emulateRequest(HttpRequestData data)
throws java.lang.Throwable
data - request data
java.lang.Throwable
public void runApp(boolean wait)
throws AjaxSwingException,
java.rmi.RemoteException
runApp in interface ClientAgentRemoteAjaxSwingException
java.rmi.RemoteExceptionpublic void doRun()
public AbstractDocument getHTMLPage()
public void setHTMLPage(AbstractDocument page)
throws java.lang.Exception
java.lang.Exceptionpublic boolean isRunning()
public AjaxSwingUIManager getUIManager()
public static ClientAgent getCurrentInstance()
public void addBlockedThread(AjaxSwingThread thread)
public void removeBlockedThread(AjaxSwingThread thread)
public void waitForBlockedThreads(java.lang.Object[] blockedThreads)
throws java.lang.Throwable
blockedThreads -
java.lang.Throwablepublic boolean isRequestActive()
public boolean isOperationActive()
public boolean isApplet()
public java.lang.Object getOperationLock()
public void beginOperation()
throws java.lang.Exception
java.lang.Exception
public void endOperation()
throws java.lang.Exception
java.lang.Exceptionpublic AbstractDocumentRenderer getPageRenderer()
public WindowUpdater getWindowUpdater()
public AjaxSwingProperties getProps()
public AgentInitData getInitData()
public java.util.List getTempFiles()
public long getRequestId()
public static boolean isToolkitInstalled()
public void installToolkit()
public void ping()
throws java.rmi.RemoteException
ping in interface ClientAgentRemotejava.rmi.RemoteExceptionpublic static void installExitTrap()
public java.lang.Throwable getException()
public HttpRequestData getRequestData()
public HttpResponseData getResponseData()
public void setResponseData(HttpResponseData httpResponseData)
httpResponseData - HttpResponseDatapublic AgentRequestFilter getRequestFilter()
public AjaxSwingThreadGroup getAjaxSwingThreadGroup()
public void setException(java.lang.Throwable x)
x - exception to be reported to the userpublic java.util.HashMap getSession()
public java.lang.String getAppName()
public int getClientId()
public java.awt.Dimension getMaximumWindowSize(java.awt.Window window)
public java.lang.String getWindowProperty(java.lang.String windowTitle,
java.lang.String key)
windowTitle - window title text, which does not have to be an exact match and can be a substringkey - property name to search for, for example "refresh"
public java.lang.String getComponentProperty(java.lang.Object component,
java.lang.String property)
componentKey - property name to search for, for example "refresh"
public java.lang.ClassLoader getClassLoader()
public java.awt.datatransfer.Clipboard getClipboard()
public boolean shouldUpdateBrowser()
public void setUpdateBrowser(boolean updateBrowser)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||