com.iplanet.portalserver.providers
Class ProviderAdapter

java.lang.Object
  |
  +--com.iplanet.portalserver.providers.ProviderAdapter
Direct Known Subclasses:
ProfileProviderAdapter

public class ProviderAdapter
extends java.lang.Object
implements Provider

This class provides default implementations for the Provider API. Note that in most cases, the action taken or value returned from these methods is meaningless. In most cases the methods provided here should always be overriden.

Developers who wish to implement a provider should extend this class. Alternatively, developers who wish to author providers that use the iPS profile service should extend ProfileProviderAdapter.

The advantage of extending this class versus implementing the Provider interface directly is that you will maintain forward compatability as additions are made to the Provider API. Existing code will by default call the methods in this class. Eventually, code should be written to implement all of the methods in the Provider interface.

For method details, see the descriptions in the Provider interface.

See Also:
ProfileProviderAdapter, Provider

Fields inherited from interface com.iplanet.portalserver.providers.Provider
EDIT_COMPLETE, EDIT_SUBSET, WIDTH_FULL_BOTTOM, WIDTH_FULL_TOP, WIDTH_THICK, WIDTH_THIN
 
Constructor Summary
ProviderAdapter()
           
 
Method Summary
 java.lang.String getBackgroundColor()
          Get the background color for this provider.
 int getColumn()
          Get the column in which this provider should be displayed in.
 java.lang.StringBuffer getContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Call getContent(Map) with the request parameters.
 java.lang.StringBuffer getContent(java.util.Map m)
          This method has no effect.
 java.lang.String getDescription()
          Get the description of this provider.
 java.lang.StringBuffer getEdit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Call getEdit(Map) with the request parameters.
 java.lang.StringBuffer getEdit(java.util.Map m)
          This method has no effect.
 int getEditType()
          Get the edit form type of the provider.
 java.net.URL getHelp()
          Get the help link for this provider.
 java.lang.String getName()
          Get the name of this provider.
 long getRefreshTime()
          Get the refresh time for this provider, in seconds.
 int getRow()
          Get the row in which this provider should be displayed in.
 Session getSession()
          Get the session object for this provider.
 java.lang.String getTitle()
          Get the title of this provider.
 int getWidth()
          Get the width of this provider.
 boolean hasBorder()
          Should this provider have a border drawn around it? The desktop calls this method when the front page is drawn.
 boolean hasFrame()
          Should this provider have a window frame around it? A frame is defined as the "window" frame containing a title and channel controls that surround provider content.
 boolean hasHelp()
          Determine if the provider has a help page associated with it.
 void init(java.lang.String n, Session s)
          Initializes the provider.
 boolean isDetachable()
          Determine if the provider can be detached from the Desktop.
 boolean isDetached()
          Determine if the provider is detached from the Desktop.
 boolean isEditable()
          Determine if the provider has an edit page.
 boolean isMinimizable()
          Determine if the provider can be minimized on the Desktop.
 boolean isMinimized()
          Determine if the provider is minimized on the Desktop.
 boolean isMovable()
          Determine if the user can move this channel around on the desktop This method is called by the desktop when the user attempts to change the layout to see if they are allowed to move said channels.
 boolean isPresentable()
          Dictates whether the provider is presentable.
 boolean isRemovable()
          Determine if the user can remove this provider from the desktop This method is called by the desktop when it draws the front page.
 void load()
          This method has no effect.
 java.net.URL processEdit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Call processEdit(Map) with the request parameters.
 java.net.URL processEdit(java.util.Map m)
          This method has no effect.
 int setColumn(int column)
          This method has no effect.
 boolean setDetached(boolean detached)
          This method has no effect.
 boolean setMinimized(boolean minimized)
          This method has no effect.
 int setRow(int row)
          This method has no effect.
 void store()
          This method has no effect.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProviderAdapter

public ProviderAdapter()
Method Detail

init

public void init(java.lang.String n,
                 Session s)
          throws ProviderException
Description copied from interface: Provider
Initializes the provider. This method is called by the desktop when a new user session is created; it is called only one per user session.
Specified by:
init in interface Provider
Tags copied from interface: Provider
Parameters:
session - The Session object corresponding to the request received by the desktop. This object allows the provider to query the webtop profile service for information about itself or the user who initiated the request. This parameter can be ignored if your provider does not query the profile service.
name - Unique name identifying this provider. This value should always be returned from getName().
Throws:
ProviderException - If there was an error initializing the provider.
See Also:
Provider.getName()

getContent

public java.lang.StringBuffer getContent(javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
                                  throws ProviderException
Call getContent(Map) with the request parameters.
Specified by:
getContent in interface Provider
Tags copied from interface: Provider
Parameters:
request - An HttpServletRequest that contains information related to this request for content.
response - An HttpServletResponse that allows the provider to influence the overall response for the desktop page (besides generating the content).
Returns:
StringBuffer holding the html content.
Throws:
ProviderException - If there was an error generating the content. Upon catching this error, the desktop application will attempt to fetch a cached copy of the content. If a cached copy does not exist, then an error message will be displayed in the body of the provider.
ProviderException - If there was an error getting provider content.
See Also:
ProviderException

getSession

public Session getSession()
Get the session object for this provider. A provider can call this method to retrieve the session object. This method is not called by the desktop (it is not pat of the Provider interface).
Returns:
the Session object for this provider.
See Also:
Session

getContent

public java.lang.StringBuffer getContent(java.util.Map m)
                                  throws ProviderException
This method has no effect.
Specified by:
getContent in interface Provider
Returns:
null, always.

getEdit

public java.lang.StringBuffer getEdit(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws ProviderException
Call getEdit(Map) with the request parameters.
Specified by:
getEdit in interface Provider
Tags copied from interface: Provider
Parameters:
request - An HttpServletRequest that contains information related to this request for content.
response - An HttpServletResponse that allows the provider to influence the overall response for the desktop page (besides generating the content).
Returns:
StringBuffer holding the html edit form.
Throws:
ProviderException - If there was an error generating the edit form. The desktop does not do anything special if it catches this exception; it will display an error page.
See Also:
Provider.getContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), Provider.isEditable(), Provider.processEdit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), Provider.getEditType(), DesktopURL, ProviderException

getEdit

public java.lang.StringBuffer getEdit(java.util.Map m)
                               throws ProviderException
This method has no effect.
Specified by:
getEdit in interface Provider
Returns:
null, always.

getEditType

public int getEditType()
                throws UnknownEditTypeException
Description copied from interface: Provider
Get the edit form type of the provider. This method returns, and therefore defines, the edit for type that must be returned from .getEdit().
Specified by:
getEditType in interface Provider
Returns:
Provider.EDIT_SUBSET, always.

processEdit

public java.net.URL processEdit(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
                         throws ProviderException
Call processEdit(Map) with the request parameters.
Specified by:
processEdit in interface Provider
Tags copied from interface: Provider
Parameters:
request - An HttpServletRequest that contains information related to this request for content.
response - An HttpServletResponse that allows the provider to influence the overall response for the desktop page (besides generating the content).
Returns:
StringBuffer holding the html edit form.
Throws:
ProviderException - If there was an error processing the edit form. The desktop application catches all such exceptions from this method. The text of the exception (from its getMessage() method) is inserted in the resulting content as an inline error. An exception of type InvalidEditFormData causes the desktop to re-display the provider's edit page, otherwise, the front page is returned.
See Also:
Provider.getEdit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), Provider.isEditable(), com.iplanet.portalserver.providers.InvalidEditFormData, DesktopURL

processEdit

public java.net.URL processEdit(java.util.Map m)
                         throws ProviderException
This method has no effect.
Specified by:
processEdit in interface Provider
Returns:
null, always

isEditable

public boolean isEditable()
Description copied from interface: Provider
Determine if the provider has an edit page. This method is called by the desktop when it draws the front page.
Specified by:
isEditable in interface Provider
Returns:
false, always.

isPresentable

public boolean isPresentable()

Dictates whether the provider is presentable.

Searches for the key genericHTML with the value true on the client data for the session's client type and returns true. If there is no such key, method will return true if the session's client type is named genericHTML.

In both cases, the content-type for the session's client type must equal text/html in order for the method to return true.

Specified by:
isPresentable in interface Provider
Returns:
boolean value dictating presentability
See Also:
Provider.isPresentable()

hasHelp

public boolean hasHelp()
Description copied from interface: Provider
Determine if the provider has a help page associated with it. This method is called by the desktop when it draws the front page.
Specified by:
hasHelp in interface Provider
Returns:
false, always.

isDetachable

public boolean isDetachable()
Description copied from interface: Provider
Determine if the provider can be detached from the Desktop. This method is called by the desktop when it draws the front page.
Specified by:
isDetachable in interface Provider
Returns:
false, always.

isMinimizable

public boolean isMinimizable()
Description copied from interface: Provider
Determine if the provider can be minimized on the Desktop. If the provider ever returns true from this method, then it must persistently store the detached state. This method is called by the desktop when it draws the front page.
Specified by:
isMinimizable in interface Provider
Returns:
false, always.

isRemovable

public boolean isRemovable()
Description copied from interface: Provider
Determine if the user can remove this provider from the desktop This method is called by the desktop when it draws the front page.
Specified by:
isRemovable in interface Provider
Returns:
true, always.

isMovable

public boolean isMovable()
Description copied from interface: Provider
Determine if the user can move this channel around on the desktop This method is called by the desktop when the user attempts to change the layout to see if they are allowed to move said channels.
Specified by:
isMovable in interface Provider
Returns:
true, always.

setDetached

public boolean setDetached(boolean detached)
This method has no effect.
Specified by:
setDetached in interface Provider
Returns:
false, always.

isDetached

public boolean isDetached()
Description copied from interface: Provider
Determine if the provider is detached from the Desktop. If the provider ever returns true from the isDetachable() method, then is must then persistently store the detached state.

The desktop calls this method when the front page is drawn.

Specified by:
isDetached in interface Provider
Returns:
false, always.

isMinimized

public boolean isMinimized()
Description copied from interface: Provider
Determine if the provider is minimized on the Desktop. If the provider ever returns true from isMinimizable(), it must then persistently store the minimized state. The desktop calls this method when the front page is drawn.
Specified by:
isMinimized in interface Provider
Returns:
false, always.

getTitle

public java.lang.String getTitle()
Description copied from interface: Provider
Get the title of this provider. The desktop calls this method when the front page is drawn, and when the user selects the content page.
Specified by:
getTitle in interface Provider
Returns:
The result of getName(), always.

getName

public java.lang.String getName()
Description copied from interface: Provider
Get the name of this provider. The name returned from this mathod must match the name of the provider which was entered into the desktop profile.
Specified by:
getName in interface Provider
Returns:
An empty string, always.

getDescription

public java.lang.String getDescription()
Description copied from interface: Provider
Get the description of this provider. The desktop calls this method when the user selects the content page.
Specified by:
getDescription in interface Provider
Returns:
The result of getName(), always.

getBackgroundColor

public java.lang.String getBackgroundColor()
Description copied from interface: Provider
Get the background color for this provider.
Specified by:
getBackgroundColor in interface Provider
Returns:
null, always.

hasBorder

public boolean hasBorder()
Description copied from interface: Provider
Should this provider have a border drawn around it? The desktop calls this method when the front page is drawn.
Specified by:
hasBorder in interface Provider
Returns:
true, always.

hasFrame

public boolean hasFrame()
Description copied from interface: Provider
Should this provider have a window frame around it? A frame is defined as the "window" frame containing a title and channel controls that surround provider content. The desktop calls this method when the front page is drwan.
Specified by:
hasFrame in interface Provider
Returns:
true, always.

getWidth

public int getWidth()
Description copied from interface: Provider
Get the width of this provider. The desktop calls this method when the front page is drawn, when the layout page is drawn, and when the content page is drawn.
Specified by:
getWidth in interface Provider
Returns:
WIDTH_THIN, always.
See Also:
Provider.WIDTH_THIN

getColumn

public int getColumn()
Description copied from interface: Provider
Get the column in which this provider should be displayed in. The desktop calls this method when the front page is drawn, and when the layout page is drawn.
Specified by:
getColumn in interface Provider
Returns:
1, always.

getRow

public int getRow()
Description copied from interface: Provider
Get the row in which this provider should be displayed in. this controls the horizontal position within the channel's column. The desktop calls this method when the front page is drawn, and when the layout page is drawn.
Specified by:
getRow in interface Provider
Returns:
1, always.

getHelp

public java.net.URL getHelp()
Description copied from interface: Provider
Get the help link for this provider. The desktop calls this method when the front page is drawn.
Specified by:
getHelp in interface Provider
Returns:
null, always.

setMinimized

public boolean setMinimized(boolean minimized)
This method has no effect.
Specified by:
setMinimized in interface Provider
Returns:
false, always.

setColumn

public int setColumn(int column)
This method has no effect.
Specified by:
setColumn in interface Provider
Returns:
"1", always.

setRow

public int setRow(int row)
This method has no effect.
Specified by:
setRow in interface Provider
Returns:
"1", always.

load

public void load()
          throws ProviderException
This method has no effect.
Specified by:
load in interface Provider
Tags copied from interface: Provider
Throws:
ProviderException - If there was an error loading the persistent data for this provider. If the desktop catches this exception, nothing special is done; an error page is displayed.

store

public void store()
           throws ProviderException
This method has no effect.
Specified by:
store in interface Provider
Tags copied from interface: Provider
Throws:
ProviderException - If there was an error storing the persistent data for this provider. If the desktop catches this exception, nothing special is done; an error page is displayed.

getRefreshTime

public long getRefreshTime()
Description copied from interface: Provider
Get the refresh time for this provider, in seconds. When the desktop fetches the content for a channel, it first checks to see whether the refresh time has expired; it checks if the difference between the current time and the time when the channel's content was last cached is greater than the value returned from this method.

If provider content is expected to change very infrequently, this method can return some value so that the provider's content is not fetched every time the front page is drawn, thereby saving significant processing time.

Specified by:
getRefreshTime in interface Provider
Returns:
0, always.