The WDK environment package contains APIs that enable WDK to operate on J2EE application servers, JSR-168 compliant portal servers, or non-JSR-168 compliant portal servers. Environments are provided for J2EE standalone Web applications and for several JSR-168 compliant portal servers.
For certified J2EE application servers, refer to Web Development Kit Release Notes. For certified portal servers, refer to WDK for Portlets Release Notes.
The following topics describe the configurable and customizable environments in WDK:
If you are using a portal that is listed in the certification table of the WDK for Portlets release notes, your portal environment is provided by the installer and you can simply use Documentum portlets and components in your application after running the installer.
If you are using a JSR-168 compliant portal that does not have an environment provided by Documentum, you must extend the Jsr168Environment class and provide methods that write user preferences using the portal-specific APIs. For an example, refer to Writing user-level preferences. If you are using a portal that is not JSR-168 compliant, you must extend the PortalEnvironment class and provide methods that both read and write user preferences. For examples, refer to Writing user-level preferences and Reading user-level preferences
The environment layer is a set of classes in the com.documentum.web.env package that comprise base implementations, hooks and interfaces. The Environment class encapsulates an environment's specific behavior and functionality. WDK instantiates and uses the registered environment class whenever it requires information from its environment.
A portal-specific environment is implemented as a single Java class that extends the abstract Environment class and implements one or more of the com.documentum.web.env interfaces. WDK environments are packaged in com.documentum.web.env.xxx where xxx is the name of the environment; for example, com.documentum.web.env.sun.
WDK instantiates an environment as a singleton object, and all threads call into the single instance. All methods implemented for a custom environment must be thread-safe. If you need to store state, the base Environment class provides instance methods to store and retrieve your attributes in the environment implementation.
The environment layer of WDK consists of a set of classes that provide a number of starting places for your integration depending on the type of portal server you have. The environment APIs are shown in the diagram below.
The environment classes are the following:
The AbstractEnvironment class is abstract and provides default implementations of environment APIs.
The Environment class is also abstract. It extends AbstractEnvironment and adds default implementations for session and request access, dispatching, encryption, and portal API access.
Many of these APIs must be overridden for specific portals.
The AppServerEnvironment Class provides a configured environment for integrating with J2EE Application Servers.
The PortalEnvironment class provides a configured environment for non-JSR-168 compliant portal servers. If you are integrating with a non-JSR-168 compliant Portal Server then you should extend the PortalEnvironment class.
The Jsr168Environment class provides a configured environment for integrating with JSR-168 compliant portal servers.
The SunPortalEnvironment Class integrates with the Sun Portal Server. (For specific versions, refer to the release notes.)
The AbstractEnvironment class provides a set of methods that return the environment interface contracts. The AbstractEnvironment class returns whether the environment is a Portal environment using the isPortalEnvironment() method. The current HttpServletRequest, HttpServletResponse, and HttpSession are returned from the getRequest(), getResponse(), and getSession() methods.
The Environment class is also an abstract class and cannot be instantiated directly. The Environment class provides default implementations for the lifecycle events, security, error handling, page dispatching, action processing, content transfer, branding, environment properties, and attribute storage. These implementations should be sufficient for most environments:
The lifecycle methods store the request, response and session objects in thread safe storage. If you are overriding any of these methods and you need to continue to store the objects in the thread safe storage, then you must call the superclass implementation.
The security methods encode and decode passwords and encrypt and decrypt the trusted authenticator password using a Caesar cipher. For details on trusted authentication, refer to User principal authentication. Methods also get the user name, password, and domain.
The error methods get the error URL and handle errors.
Page dispatching methods include forward and inline dispatch and access to the object. By default, pages are included and actions are processed before the page is rendered.
The queryExecute() method is provided to test action preconditions
The content transfer method returns the content transfer mechanism, which is UCF-based by default in portal environments.
The Environment class looks for mapping of WDK CSS classes to portal styles. For details on this mapping, refer to Portal styles
The getResourceBundle() method returns the properties file that configures the environment.
Attribute storage methods get, set, and remove attributes from the environment's thread-safe local store. A log() method is also provided.
The AppServerEnvironment class inherits from Environment. The AppServerEnvironment class is used by WDK for non-portal J2EE applications such as Webtop. This class includes all of the implementations for running on a J2EE environment.
For backwards compatibility with previous versions of WDK, the following implementations are in the AppServerEnvironment class:
The encodeUrl() method returns the full path to the JSP page that is to receive the next post-server event.
The implementations of the IPreference interface hook into the WDK HTTP cookie store used in previous versions of WDK.
The PortalEnvironment class inherits from Environment and serves as the superclass for all portal environment implementations. You can extend this class to support WDK portlets on a non-JSR-168 compliant portal server.
The following methods are implemented:
Turns on pre-processing.
Removes the action URL in order to force all server events to be posted through the component dispatcher.
Report errors to the WDK's error message service and handles the user event that is generated when the user acknowledges an error dialog.
Turns on post-processing.
The Jsr168Environment class inherits from PortalEnvironment. You can extend Jsr168Environment to integrate WDK portlets into a JSR-168 compliant portal server that does not have an environment supplied by Documentum. The following methods are implemented:
The onRequestStart() and onRequestFinish() methods provide access to the request events
The getUsername(), getUserPassword(), getDomain(), getDocbaseName(), getUserPrincipal(), and getLocale() methods provide access to the user's portal session.
The preProcess() method turns on pre-processing.
The encodeUrl() method returns a JSR-168 action URL.
Several methods enumerate preferences and look up or write preference values (user-level or portlet-level, or application-level). The Jsr168Environment class handles the writing of Portlet level preferences through the writePortletLevelPreference() method. The writing of user level preferences is not covered by the JSR-168 specification: They are written by vendor-specific environment classes.
The getErrorUrl() method handles errors in a JSR-168 environment, passing the error to the stack trace.
The SunPortalEnvironment class inherits from Jsr168Environment. The SunPortalEnvironment integrates with the Sun portal server. (For specific versions refer to the release notes.) This class implements the following methods:
Looks up the user principal for trusted authentication mode using classes in the com.iplanet.sso package.
Returns an enumeration of the preference types that can be written.
Uniquely identifies the HTML for two portlets on the same page in a Sun portal environment.
Writes preferences using APIs in the com.iplanet.am.sdk package.