org.zkoss.zk.ui.impl
Class AbstractWebApp

java.lang.Object
  extended by org.zkoss.zk.ui.impl.AbstractWebApp
All Implemented Interfaces:
org.zkoss.util.resource.Locator, WebAppCtrl, WebApp
Direct Known Subclasses:
SimpleWebApp

public abstract class AbstractWebApp
extends java.lang.Object
implements WebApp, WebAppCtrl

A skeletal implementation of WebApp.

Author:
tomyeh

Constructor Summary
protected AbstractWebApp()
          Constructor.
 
Method Summary
 void destroy()
          Destroys this Web applicaiton.
 java.lang.String getAppName()
          Returns the application name, never null.
 Configuration getConfiguration()
          Returns the configuration.
 DesktopCache getDesktopCache(Session sess)
          Returns the desktop cache.
 DesktopCacheProvider getDesktopCacheProvider()
          Returns the desktop cache provider.
 FailoverManager getFailoverManager()
          Returns the failover manager, or null if not available.
 IdGenerator getIdGenerator()
          Returns the ID generator, or null if not available.
 int getSubversion(int portion)
          Returns a portion of the version in an integer by specifying its index.
 UiEngine getUiEngine()
          Returns the UI engine for this Web application (never null).
 UiFactory getUiFactory()
          Returns the UI factory for this Web application (never null).
 java.lang.String getVersion()
          Returns the ZK version, such as "1.1.0" and "2.0.0".
 void init(java.lang.Object context, Configuration config)
          Initializes this Web application.
 void sessionDidActivate(Session sess)
          Invokes getDesktopCacheProvider()'s DesktopCacheProvider.sessionDidActivate(org.zkoss.zk.ui.Session).
 void sessionWillPassivate(Session sess)
          Invokes getDesktopCacheProvider()'s DesktopCacheProvider.sessionWillPassivate(org.zkoss.zk.ui.Session).
 void setAppName(java.lang.String name)
          Sets the applicationname.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zkoss.zk.ui.WebApp
getAttribute, getAttributes, getInitParameter, getInitParameterNames, getMimeType, getNativeContext, getRealPath, getResource, getResourceAsStream, getResourcePaths, getWebApp, removeAttribute, setAttribute
 
Methods inherited from interface org.zkoss.util.resource.Locator
getDirectory
 

Constructor Detail

AbstractWebApp

protected AbstractWebApp()
Constructor.

Note: after constructed, it is not initialized completely. For example, getConfiguration() returns null.

WebManager will initialize it later such as initializing a Configuration instance by loading zk.xml, and then calling init(java.lang.Object, org.zkoss.zk.ui.util.Configuration).

Method Detail

getAppName

public java.lang.String getAppName()
Description copied from interface: WebApp
Returns the application name, never null. Developer can set it to any name that describes his application.

Default: ZK

Specified by:
getAppName in interface WebApp

setAppName

public void setAppName(java.lang.String name)
Description copied from interface: WebApp
Sets the applicationname. Developer can set it to any name that describes his application.

Specified by:
setAppName in interface WebApp

getVersion

public final java.lang.String getVersion()
Description copied from interface: WebApp
Returns the ZK version, such as "1.1.0" and "2.0.0".

Specified by:
getVersion in interface WebApp
See Also:
WebApp.getSubversion(int)

getSubversion

public int getSubversion(int portion)
Description copied from interface: WebApp
Returns a portion of the version in an integer by specifying its index. For example, getSubversion(0) returns the so-called major version (2 in "2.4.0"), getSubversion(1) returns the so-called minor version (4 in "2.4.0"), and both getSubversion(2) and getSubversion(3) return 0.

Specified by:
getSubversion in interface WebApp
Parameters:
portion - which portion of the version; starting from 0. If you want to retrieve the major verion, specify 0.
See Also:
WebApp.getVersion()

getConfiguration

public final Configuration getConfiguration()
Description copied from interface: WebApp
Returns the configuration.

Specified by:
getConfiguration in interface WebApp

init

public void init(java.lang.Object context,
                 Configuration config)
Description copied from interface: WebAppCtrl
Initializes this Web application.

Specified by:
init in interface WebAppCtrl
Parameters:
context - the servlet context, if servlets are used. Currently, ZK supports only servlets. In the future there might be more to support.
config - the configuration (never null)

destroy

public void destroy()
Description copied from interface: WebAppCtrl
Destroys this Web applicaiton.

Note; once destroyed, this instance cannot be used anymore.

Specified by:
destroy in interface WebAppCtrl

getUiEngine

public final UiEngine getUiEngine()
Description copied from interface: WebAppCtrl
Returns the UI engine for this Web application (never null).

Specified by:
getUiEngine in interface WebAppCtrl

getDesktopCache

public DesktopCache getDesktopCache(Session sess)
Description copied from interface: WebAppCtrl
Returns the desktop cache. A shortcut of WebAppCtrl.getDesktopCacheProvider()'s DesktopCacheProvider.getDesktopCache(org.zkoss.zk.ui.Session).

Specified by:
getDesktopCache in interface WebAppCtrl

getDesktopCacheProvider

public DesktopCacheProvider getDesktopCacheProvider()
Description copied from interface: WebAppCtrl
Returns the desktop cache provider.

Specified by:
getDesktopCacheProvider in interface WebAppCtrl

getUiFactory

public UiFactory getUiFactory()
Description copied from interface: WebAppCtrl
Returns the UI factory for this Web application (never null).

Specified by:
getUiFactory in interface WebAppCtrl

getFailoverManager

public FailoverManager getFailoverManager()
Description copied from interface: WebAppCtrl
Returns the failover manager, or null if not available.

Specified by:
getFailoverManager in interface WebAppCtrl

getIdGenerator

public IdGenerator getIdGenerator()
Description copied from interface: WebAppCtrl
Returns the ID generator, or null if not available.

Specified by:
getIdGenerator in interface WebAppCtrl

sessionWillPassivate

public void sessionWillPassivate(Session sess)
Invokes getDesktopCacheProvider()'s DesktopCacheProvider.sessionWillPassivate(org.zkoss.zk.ui.Session).

Specified by:
sessionWillPassivate in interface WebAppCtrl

sessionDidActivate

public void sessionDidActivate(Session sess)
Invokes getDesktopCacheProvider()'s DesktopCacheProvider.sessionDidActivate(org.zkoss.zk.ui.Session).

Specified by:
sessionDidActivate in interface WebAppCtrl


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.