|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.creamtec.ajaxswing.core.ClientAgent
public abstract 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
Synchronizes the processing of a request. |
Field Summary | |
---|---|
static java.lang.ClassLoader |
commonClassLoader
|
static boolean |
shuttingDown
|
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. |
void |
addDownloadFileName(java.lang.String filename)
|
void |
addFastSubmitHandler(FastSubmitHandler handler,
java.lang.String paramKey)
|
void |
addKeepAliveEventHandler(KeepAliveEventHandler handler)
|
void |
addURLParamHandler(URLParameterHandler handler,
java.lang.String paramKey)
|
void |
allowDownload(java.lang.String downloadFileName)
|
boolean |
allowExit()
Checks if System.exit() is allowed to shutdown the JVM |
void |
appendJavaScript(java.lang.String javaScript)
|
void |
beginOperation()
Begins a custom operation |
void |
checkAndMonitorAsynchronousUpdates()
Checks if the number of threads at the moment called is different then the number of threads last marked. |
void |
clearAppendJavaScript()
|
void |
clearUrlForOpenInNewTab()
|
void |
denyDownload(java.io.File file)
Remove download file from session by File |
void |
denyDownload(java.lang.String downloadFileName)
Remove download file from session by name |
void |
doRun()
Does the job of running the client application |
void |
endOperation()
Marks an end of custom operation |
void |
endOperation(boolean endsOnModalDialog)
Marks that next modal dialog ends custom operation |
void |
exit()
Safe shutdown of JVM. |
AjaxSwingThreadGroup |
getAjaxSwingThreadGroup()
Returns the thread group that owns all threads of this agent |
java.lang.String |
getAppendJavaScript()
|
java.lang.String |
getAppName()
Returns application name |
int |
getBrowserID()
Returns the browser ID of the user, that the client agent is associated with |
java.lang.String |
getBrowserLocale()
|
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 |
java.lang.String |
getCsrfToken()
|
static ClientAgent |
getCurrentInstance()
Returns the instance of ClientAgent, associated with the calling thread May not work correctly in a multi threaded application |
java.util.Map |
getDownloadFileNames()
|
boolean |
getEndOperationOnModalDialog()
|
AjaxSwingEventQueue |
getEventQueue()
Used to retrieve the virtual user specific AWT event queue |
java.lang.Throwable |
getException()
Returns the exception cought while processing a request |
java.lang.String |
getExitPage()
|
java.awt.KeyboardFocusManager |
getFocusManager()
|
double |
getFontCalibrationData(java.lang.String fontName,
int fontSize,
boolean isCapital)
|
AbstractDocument |
getHTMLPage()
Returns HTML Page, associated with this client |
AbstractDocument |
getHTMLPageWait()
|
AgentInitData |
getInitData()
Returns application initialization data |
KeepAliveEvent |
getLastKeepAliveEvent()
|
java.awt.Dimension |
getMaximumWindowSize(java.awt.Window window)
|
javax.swing.MenuSelectionManager |
getMenuSelectionManager()
|
java.lang.Object |
getMouseGrabber()
|
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 |
AjaxSwingRepaintManager |
getRepaintManager()
|
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 |
SchedulingEventQueue |
getSchedulingEventQueue()
|
java.util.HashMap |
getSession()
Returns the session map associated with the client. |
long |
getSessionTimeout()
|
java.lang.String |
getShortFileName(java.lang.String downloadFileName)
|
java.util.List |
getTempFiles()
Client agent stores the temporary files created for the user They are automatically deleted when the agent is shutdown |
java.util.TimeZone |
getTimeZone()
returns timezone for client browser, based on available information from browser. |
int |
getTimeZoneCurrentOffset()
returns the time difference between GMT and current local time, in minutes |
int |
getTimeZoneRawOffset()
returns the time difference between GMT and local time, in minutes, not affected by daylight saving time |
boolean |
getTimeZoneUseDaylight()
returns if timezone use daylight saving time |
AjaxSwingUIManager |
getUIManager()
Returns the instance of UIManager, associated with this client |
int |
getUpdateBrowserInterval()
|
java.lang.String |
getUrlForOpenInNewTab()
If set, on response will rerun url for open in new tab |
java.util.Locale |
getUserLocale()
|
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 |
int |
getWindowProperty(java.lang.String windowTitle,
java.lang.String key,
int defaultValue)
|
java.util.List |
getWindowsForRendering()
|
WindowUpdater |
getWindowUpdater()
Returns the instance of WindowUpdater, associated with this client |
void |
init(AgentInitData data,
HttpRequestData requestData)
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 |
installGraphicsEnvironmentProperties(AjaxSwingProperties props,
java.lang.Object traceObject)
Installs GraphicsEnvironmentProperties. |
void |
installToolkit()
Installs AWT toolkit. |
boolean |
isApplet()
Can be used to test if the application is running as an applet |
boolean |
isBrowserIE()
Returns true if user agent is Netscape or compatible |
boolean |
isDownloadAllowed(java.lang.String downloadFileName)
Returns true if the download of the given file name is allowed |
boolean |
isFocusChangeAllowed(java.awt.Component component)
|
static boolean |
isGraphicsEnvironmentPropertiesInstalled()
Returns true if the GraphicsEnvironmentProperties has already been installed |
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 |
monitorAsynchronousUpdates()
Starts monitoring of UI updates by enabling browser update interval |
void |
monitorAsynchronousUpdates(int duration,
int interval)
|
void |
openInNewTab(java.lang.String urlForOpenInNewTab)
Set url for open in new tab |
void |
print(byte[] pdfFile)
|
void |
removeBlockedThread(AjaxSwingThread thread)
Removes the given thread from a list of blocked threads. |
void |
removeDownloadFileName(java.lang.String filename)
Remove download file from map where we wait files for download while them doesn't ready |
void |
removeFastSubmitHandler(FastSubmitHandler handler,
java.lang.String paramKey)
|
void |
removeKeepAliveEventHandler(KeepAliveEventHandler handler)
|
void |
removeURLParamHandler(URLParameterHandler handler,
java.lang.String paramKey)
|
void |
runApp(boolean wait)
Runs the application/applet. |
void |
setAllowExit(boolean allow)
Used to allow or disallow JVM shutdown |
void |
setBrowserLocale(java.lang.String browserLocale)
|
void |
setClientSize(int width,
int height)
|
void |
setException(java.lang.Throwable x)
Sets the exception that occured in while processing a request |
void |
setExitPage(java.lang.String pageName)
|
void |
setFocusChangeAllowed(boolean allowed)
|
void |
setFontCalibrationData(java.lang.String allCalibrationData)
|
void |
setHTMLPage(AbstractDocument page)
|
void |
setMouseGrabber(java.lang.Object mouseGrabber)
|
void |
setRequestData(HttpRequestData data)
|
void |
setResponseData(HttpResponseData httpResponseData)
Sets the data structure for HTTP response |
void |
setSessionTimeout(long seconds)
|
void |
setUpdateBrowser(boolean updateBrowser)
If set to true, when next updateInterval call comes, the browser will be refreshed to synchronize it with the Swing state on the server |
void |
setUpdateBrowserInterval(int newUpdateInterval)
Sets the value of router.updateInterval property |
void |
setUserLocale(java.util.Locale currentLocale)
|
boolean |
shouldUpdateBrowser()
|
void |
shutdown()
Initiates shutdown sequence and returns immediately |
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 |
Methods inherited from interface com.creamtec.ajaxswing.core.ClientAgentRemote |
---|
ping, processHttpRequest, renderWindows |
Field Detail |
---|
public static boolean shuttingDown
public static java.lang.ClassLoader commonClassLoader
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, HttpRequestData requestData) throws java.rmi.RemoteException, java.lang.Exception
init
in interface ClientAgentRemote
java.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.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 AjaxSwingEventQueue getEventQueue()
public int getBrowserID()
public boolean isBrowserIE()
public float getBrowserVersion()
public java.util.List getWindowsForRendering() throws java.lang.Exception
java.lang.Exception
public void runApp(boolean wait) throws AjaxSwingException, java.rmi.RemoteException
runApp
in interface ClientAgentRemote
AjaxSwingException
java.rmi.RemoteException
public AjaxSwingRepaintManager getRepaintManager()
public void doRun()
public AbstractDocument getHTMLPage()
public AbstractDocument getHTMLPageWait()
public void setHTMLPage(AbstractDocument page) throws java.lang.Exception
java.lang.Exception
public boolean isRunning()
public AjaxSwingUIManager getUIManager()
public SchedulingEventQueue getSchedulingEventQueue()
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.Throwable
public boolean isRequestActive()
public boolean isOperationActive()
public boolean isApplet()
public java.lang.Object getOperationLock()
public void beginOperation()
java.lang.Exception
public void endOperation()
java.lang.Exception
public void endOperation(boolean endsOnModalDialog)
java.lang.Exception
public boolean getEndOperationOnModalDialog()
public AbstractDocumentRenderer getPageRenderer()
public WindowUpdater getWindowUpdater()
public AjaxSwingProperties getProps()
getProps
in interface ClientAgentRemote
public AgentInitData getInitData()
public java.util.List getTempFiles()
getTempFiles
in interface ClientAgentRemote
public long getRequestId()
public static boolean isToolkitInstalled()
public static boolean isGraphicsEnvironmentPropertiesInstalled()
public static void installGraphicsEnvironmentProperties(AjaxSwingProperties props, java.lang.Object traceObject)
public void installToolkit()
public static void installExitTrap()
public java.lang.Throwable getException()
public HttpRequestData getRequestData()
public void setRequestData(HttpRequestData data)
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 int getWindowProperty(java.lang.String windowTitle, java.lang.String key, int defaultValue)
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)
updateBrowser
- public int getUpdateBrowserInterval()
public void setUpdateBrowserInterval(int newUpdateInterval)
newUpdateInterval
- public boolean isDownloadAllowed(java.lang.String downloadFileName) throws java.rmi.RemoteException
isDownloadAllowed
in interface ClientAgentRemote
java.rmi.RemoteException
public void allowDownload(java.lang.String downloadFileName)
public void denyDownload(java.lang.String downloadFileName)
ClientAgentRemote
denyDownload
in interface ClientAgentRemote
public void denyDownload(java.io.File file)
ClientAgentRemote
denyDownload
in interface ClientAgentRemote
public java.lang.String getShortFileName(java.lang.String downloadFileName)
public void print(byte[] pdfFile)
public java.lang.String getAppendJavaScript()
public void clearAppendJavaScript()
public void appendJavaScript(java.lang.String javaScript)
public void setSessionTimeout(long seconds)
setSessionTimeout
in interface ClientAgentRemote
public long getSessionTimeout()
getSessionTimeout
in interface ClientAgentRemote
public void addURLParamHandler(URLParameterHandler handler, java.lang.String paramKey)
public void removeURLParamHandler(URLParameterHandler handler, java.lang.String paramKey)
public void addKeepAliveEventHandler(KeepAliveEventHandler handler)
public void removeKeepAliveEventHandler(KeepAliveEventHandler handler)
public KeepAliveEvent getLastKeepAliveEvent()
public void addFastSubmitHandler(FastSubmitHandler handler, java.lang.String paramKey)
public void removeFastSubmitHandler(FastSubmitHandler handler, java.lang.String paramKey)
public void monitorAsynchronousUpdates()
component
- public void monitorAsynchronousUpdates(int duration, int interval)
public void checkAndMonitorAsynchronousUpdates()
public int getTimeZoneCurrentOffset()
public int getTimeZoneRawOffset()
public boolean getTimeZoneUseDaylight()
public java.util.TimeZone getTimeZone()
public java.lang.String getExitPage()
getExitPage
in interface ClientAgentRemote
public void setExitPage(java.lang.String pageName)
setExitPage
in interface ClientAgentRemote
public java.util.Locale getUserLocale()
getUserLocale
in interface ClientAgentRemote
public void setUserLocale(java.util.Locale currentLocale)
setUserLocale
in interface ClientAgentRemote
public java.lang.String getBrowserLocale()
getBrowserLocale
in interface ClientAgentRemote
public void setBrowserLocale(java.lang.String browserLocale)
setBrowserLocale
in interface ClientAgentRemote
public void setFocusChangeAllowed(boolean allowed)
public boolean isFocusChangeAllowed(java.awt.Component component)
public java.lang.String getCsrfToken()
getCsrfToken
in interface ClientAgentRemote
public java.awt.KeyboardFocusManager getFocusManager()
public javax.swing.MenuSelectionManager getMenuSelectionManager()
public void addDownloadFileName(java.lang.String filename)
public void removeDownloadFileName(java.lang.String filename)
ClientAgentRemote
removeDownloadFileName
in interface ClientAgentRemote
public java.util.Map getDownloadFileNames()
public java.lang.String getUrlForOpenInNewTab()
public void openInNewTab(java.lang.String urlForOpenInNewTab)
public void clearUrlForOpenInNewTab()
public java.lang.Object getMouseGrabber()
public void setMouseGrabber(java.lang.Object mouseGrabber)
public void setFontCalibrationData(java.lang.String allCalibrationData)
setFontCalibrationData
in interface ClientAgentRemote
public double getFontCalibrationData(java.lang.String fontName, int fontSize, boolean isCapital)
getFontCalibrationData
in interface ClientAgentRemote
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |