|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object creamtec.webcream.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 WebCream 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 |
useWebCreamFontsConfigFile
|
Constructor Summary | |
---|---|
ClientAgent(java.lang.String agentName,
java.lang.String appName)
Initializes the client agent |
Method Summary | |
---|---|
void |
addBlockedThread(WebCreamThread 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. |
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 |
static ClientAgent |
getCurrentInstance()
Returns the instance of ClientAgent, associated with the calling thread May not work correctly in a multi threaded application |
AbstractDocumentRenderer |
getDocumentRenderer()
Returns the instance of PageRenderer, associated with this client |
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 |
HTMLPage |
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 |
WebCreamProperties |
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 |
WebCreamUIManager |
getUIManager()
Returns the instance of UIManager, associated with this client |
WebCreamThreadGroup |
getWebCreamThreadGroup()
Returns the thread group that owns all threads of this agent |
java.lang.String |
getWindowProperty(java.lang.String windowTitle,
java.lang.String property)
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. |
static void |
installToolkit()
Installs AWT toolkit. |
boolean |
isApplet()
Can be used to test if the application is running as an applet |
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(WebCreamThread thread)
Removes the given thread from a list of blocked threads. |
HttpResponseData |
renderCurrentWindow(HttpRequestData data)
Renders the current window on EventDispatch thread |
void |
renderStandardPage(int status,
java.lang.Throwable x)
Renders a standard page based on the template and the status |
void |
runApp(boolean wait)
Runs the application/applet. |
void |
setAllowExit(boolean allow)
Used to allow or disallow JVM shutdown |
void |
setException(java.lang.Throwable x)
Sets the exception that occured in while processing a request |
void |
setResponseData(HttpResponseData httpResponseData)
Sets the data structure for HTTP response |
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 useWebCreamFontsConfigFile
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 ClientAgentRemote
java.rmi.RemoteException
java.lang.Exception
public void initProperties(java.lang.String appName) throws java.rmi.RemoteException, java.lang.Exception
java.rmi.RemoteException
java.lang.Exception
public void shutdown()
shutdown
in interface ClientAgentRemote
public boolean allowExit()
public void exit()
public void setAllowExit(boolean allow)
allow
- true to allow JVM shutdownpublic java.awt.EventQueue getEventQueue()
public int getBrowserID()
public float getBrowserVersion()
public HttpResponseData renderCurrentWindow(HttpRequestData data) throws WebCreamException, java.rmi.RemoteException
renderCurrentWindow
in interface ClientAgentRemote
data
- request data to be processed
WebCreamException
java.rmi.RemoteException
public HttpResponseData processHttpRequest(HttpRequestData requestData) throws java.rmi.RemoteException, WebCreamException
processHttpRequest
in interface ClientAgentRemote
java.rmi.RemoteException
WebCreamException
public void renderStandardPage(int status, java.lang.Throwable x) throws WebCreamException
WebCreamException
public void emulateRequest(HttpRequestData data) throws java.lang.Throwable
data
- request data
java.lang.Throwable
public void runApp(boolean wait) throws WebCreamException, java.rmi.RemoteException
runApp
in interface ClientAgentRemote
WebCreamException
java.rmi.RemoteException
public void doRun()
public HTMLPage getHTMLPage()
public boolean isRunning()
public WebCreamUIManager getUIManager()
public static ClientAgent getCurrentInstance()
public void addBlockedThread(WebCreamThread thread)
public void removeBlockedThread(WebCreamThread thread)
public void waitForBlockedThreads(java.lang.Object[] blockedThreads) throws java.lang.Throwable
blockedThreads
-
java.lang.Throwable
public 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.Exception
public AbstractDocumentRenderer getDocumentRenderer()
public WindowUpdater getWindowUpdater()
public WebCreamProperties getProps()
public AgentInitData getInitData()
public java.util.List getTempFiles()
public long getRequestId()
public static boolean isToolkitInstalled()
public static void installToolkit()
public void ping() throws java.rmi.RemoteException
ping
in interface ClientAgentRemote
java.rmi.RemoteException
public static void installExitTrap()
public java.lang.Throwable getException()
public HttpRequestData getRequestData()
public HttpResponseData getResponseData()
public void setResponseData(HttpResponseData httpResponseData)
httpResponseData
- HttpResponseDatapublic AgentRequestFilter getRequestFilter()
public WebCreamThreadGroup getWebCreamThreadGroup()
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 property)
windowTitle
- window title text, which does not have to be an exact match and can be a substringproperty
- property name to search for, for example "refresh"
public java.lang.ClassLoader getClassLoader()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |