com.iplanet.portalserver.providers
Class ProfileProviderAdapter

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

public class ProfileProviderAdapter
extends ProviderAdapter

This class implements the Provider interface and provides default implementations for its methods using the iPS Profile Service.

In addition, this class provides several convenience routines for working with providers and the iPS Session and Profile services.

ProfileProviderAdapter uses the iPS Profile service for its persistent store.

Classes that wish to implement a provider should extend ProfileProviderAdapter and implement Provider.

Unless otherwise noted, method descriptions are identical to those in Provider

See Also:
Provider

Constructor Summary
ProfileProviderAdapter()
           
 
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(java.util.Map m)
          This method has no effect.
 java.lang.String getDescription()
          Get the description for this channel.
 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.util.Vector getListProperty(java.lang.String component, java.lang.String key, java.util.Vector def)
          Get a list property for the provider.
 java.util.Vector getListProperty(java.lang.String key, java.util.Vector def)
          Get a list property for the provider.
 long getRefreshTime()
          Get the refresh time for this provider, in seconds.
 java.util.ResourceBundle getResourceBundle(java.lang.String component)
          Get the ResourceBundle based on User's locale.
 int getRow()
          Get the row in which this provider should be displayed in.
 java.lang.String getStringProperty(java.lang.String key, java.lang.String def)
          Get a string property for the provider.
 java.lang.String getStringProperty(java.lang.String component, java.lang.String key, java.lang.String def)
          Get a string property for the provider.
 java.lang.String getTitle()
          Get the title for this channel.
 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)
          Initialize the provider.
 boolean isAllowed(java.lang.String priv)
          Check for access to the named privilege.
 boolean isAllowed(java.lang.String component, java.lang.String privName)
          Check for access to the named privilege.
 boolean isAllowed(java.lang.String priv, java.lang.String value, int match)
          Check for access to the named privilege.
 boolean isAllowed(java.lang.String component, java.lang.String privName, java.lang.String value, int match)
          Check for access to the named privilege.
 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 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()
          Load properties from the profile store.
 void loadProperties(java.lang.String props)
          Load properties into provider.
 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.
 java.util.Vector setListProperty(java.lang.String component, java.lang.String key, java.util.Vector val)
          Set a list property for the provider.
 java.util.Vector setListProperty(java.lang.String key, java.util.Vector val)
          Set a list property for the provider.
 java.util.Vector setLocalListProperty(java.lang.String component, java.lang.String key, java.util.Vector val)
          Set a list property for the provider.
 java.util.Vector setLocalListProperty(java.lang.String key, java.util.Vector val)
          Set a list property for the provider.
 java.lang.String setLocalStringProperty(java.lang.String key, java.lang.String val)
          Set a string property for the provider.
 java.lang.String setLocalStringProperty(java.lang.String component, java.lang.String key, java.lang.String val)
          Set a string property for the provider.
 boolean setMinimized(boolean minimized)
          This method has no effect.
 int setRow(int row)
          This method has no effect.
 java.lang.String setStringProperty(java.lang.String key, java.lang.String val)
          Set a string property for the provider.
 java.lang.String setStringProperty(java.lang.String component, java.lang.String key, java.lang.String val)
          Set a string property for the provider.
 void store()
          Store properties to the profile store.
 
Methods inherited from class com.iplanet.portalserver.providers.ProviderAdapter
getContent, getEdit, getName, getSession, isPresentable, processEdit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileProviderAdapter

public ProfileProviderAdapter()
Method Detail

init

public void init(java.lang.String n,
                 Session s)
          throws ProviderException
Initialize the provider. If additional initialization is required by the provider, this method may be overriden. However, the overriding init() call must always have super.init() as the first statement executed.

This method calls the provider's load() method.

Overrides:
init in class ProviderAdapter
Parameters:
n - The unique indentifying name for this provider.
s - The user's session.
See Also:
Provider.init(java.lang.String, com.iplanet.portalserver.session.Session)

getContent

public java.lang.StringBuffer getContent(java.util.Map m)
                                  throws ProviderException
Description copied from class: ProviderAdapter
This method has no effect.
Overrides:
getContent in class ProviderAdapter
See Also:
Provider.getContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

getEdit

public java.lang.StringBuffer getEdit(java.util.Map m)
                               throws ProviderException
Description copied from class: ProviderAdapter
This method has no effect.
Overrides:
getEdit in class ProviderAdapter
See Also:
Provider.getEdit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

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().
Overrides:
getEditType in class ProviderAdapter
See Also:
Provider.getEditType()

processEdit

public java.net.URL processEdit(java.util.Map m)
                         throws ProviderException
Description copied from class: ProviderAdapter
This method has no effect.
Overrides:
processEdit in class ProviderAdapter
See Also:
Provider.processEdit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

getStringProperty

public java.lang.String getStringProperty(java.lang.String component,
                                          java.lang.String key,
                                          java.lang.String def)
Get a string property for the provider.
Parameters:
component - The profile component which this property belongs to.
key - The key for the property to be returned.
default - The default value to be returned if the property does not exist.
Returns:
The string value corresponding to the key.

getStringProperty

public java.lang.String getStringProperty(java.lang.String key,
                                          java.lang.String def)
Get a string property for the provider. This method assumes that the property lives in the profile component for the provider.
Parameters:
key - The key for the property to be returned.
default - The default value to be returned if the property does not exist.
Returns:
The string value corresponding to the key.

getListProperty

public java.util.Vector getListProperty(java.lang.String component,
                                        java.lang.String key,
                                        java.util.Vector def)
Get a list property for the provider.
Parameters:
component - The profile component which this property belongs to.
key - The key for the property to be returned.
default - The default value to be returned if the property does not exist.
Returns:
The string value corresponding to the key.

getListProperty

public java.util.Vector getListProperty(java.lang.String key,
                                        java.util.Vector def)
Get a list property for the provider. This method assumes that the property lives in the profile component for the provider.
Parameters:
key - The key for the property to be returned.
default - The default value to be returned if the property does not exist.
Returns:
The string value corresponding to the key.

isAllowed

public boolean isAllowed(java.lang.String priv)
Check for access to the named privilege. This method assumes that the named privilege lives in the profile component of the provider.
Parameters:
priv - The privilege to check.
Returns:
true if the user is granted access by the named privilege, otherwise false.

isAllowed

public boolean isAllowed(java.lang.String component,
                         java.lang.String privName)
Check for access to the named privilege.
Parameters:
component - The profile component where the privilege lives.
priv - The privilege to check.
Returns:
true if the user is granted access by the named privilege, otherwise false.

isAllowed

public boolean isAllowed(java.lang.String priv,
                         java.lang.String value,
                         int match)
Check for access to the named privilege. This method assumes that the named privilege lives in the profile component of the provider.
Parameters:
priv - The privilege to check.
value - The privilege value.
match - Profile.REGULAR, Profile.SUFFIX, or Profile.PREFIX
Returns:
true if the user is granted access by the named privilege, otherwise false.
See Also:
Profile.isAllowed

isAllowed

public boolean isAllowed(java.lang.String component,
                         java.lang.String privName,
                         java.lang.String value,
                         int match)
Check for access to the named privilege.
Parameters:
component - The profile component where the privilege lives.
priv - The privilege to check.
value - The privilege value.
match - Profile.REGULAR, Profile.SUFFIX, or Profile.PREFIX
Returns:
true if the user is granted access by the named privilege, otherwise false.
See Also:
Profile.isAllowed

setStringProperty

public java.lang.String setStringProperty(java.lang.String component,
                                          java.lang.String key,
                                          java.lang.String val)
Set a string property for the provider.
Parameters:
component - The profile component where this string should be set.
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

setLocalStringProperty

public java.lang.String setLocalStringProperty(java.lang.String component,
                                               java.lang.String key,
                                               java.lang.String val)
Set a string property for the provider. Properties set by this method will not be written to the persistent profile store.
Parameters:
component - The profile component where this string should be set.
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

setStringProperty

public java.lang.String setStringProperty(java.lang.String key,
                                          java.lang.String val)
Set a string property for the provider. This method assumes that the property lives in the profile component of the provider.
Parameters:
component - The profile component where this string should be set.
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

setLocalStringProperty

public java.lang.String setLocalStringProperty(java.lang.String key,
                                               java.lang.String val)
Set a string property for the provider. This method assumes that the property lives in the profile component of the provider. Properties set by this method will not be written to the persistent profile store.
Parameters:
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

setListProperty

public java.util.Vector setListProperty(java.lang.String component,
                                        java.lang.String key,
                                        java.util.Vector val)
Set a list property for the provider.
Parameters:
component - The profile component where this string should be set.
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

setLocalListProperty

public java.util.Vector setLocalListProperty(java.lang.String component,
                                             java.lang.String key,
                                             java.util.Vector val)
Set a list property for the provider. Properties set by this method will not be written to the persistent profile store.
Parameters:
component - The profile component where this string should be set.
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

setListProperty

public java.util.Vector setListProperty(java.lang.String key,
                                        java.util.Vector val)
Set a list property for the provider. This method assumes that the property lives in the profile component of the provider.
Parameters:
component - The profile component where this string should be set.
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

setLocalListProperty

public java.util.Vector setLocalListProperty(java.lang.String key,
                                             java.util.Vector val)
Set a list property for the provider. This method assumes that the property lives in the profile component of the provider. Properties set by this method will not be written to the persistent profile store.
Parameters:
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.

loadProperties

public void loadProperties(java.lang.String props)
                    throws LoadPropertiesException
Load properties into provider. By default, when load() is called, only the properties for the provider are loaded. If you wish to load properties that live in other components, you must manually load them with this method.
Parameters:
props - A wildcard string specifying the properties to load. e.g., "iwtUser*", "iwtUser-IMAPServerName", "iwtDesktop-type"
Throws:
LoadPropertiesException - If there was an error loading the named properties.

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.
Overrides:
isEditable in class ProviderAdapter
See Also:
Provider.isEditable(), 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.
Overrides:
hasHelp in class ProviderAdapter
See Also:
Provider.hasHelp()

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.
Overrides:
hasBorder in class ProviderAdapter
See Also:
Provider.hasBorder()

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.
Overrides:
hasFrame in class ProviderAdapter
See Also:
Provider.hasFrame()

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.
Overrides:
isDetachable in class ProviderAdapter
See Also:
Provider.isDetachable()

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.
Overrides:
isMinimizable in class ProviderAdapter
See Also:
Provider.isMinimizable()

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.
Overrides:
isRemovable in class ProviderAdapter
See Also:
Provider.isRemovable()

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.
Overrides:
isMovable in class ProviderAdapter
See Also:
Provider.isMovable()

getTitle

public java.lang.String getTitle()
Get the title for this channel. The title is retrieved by calling getResourceBundle(getName()) and asking for the "title" resource from the returned resource bundle. If this lookup fails (there is no resource bundle associated with the channel, or there is no "title" resource in the bundle) then the title is read from the -title attribute in the channel's profile component.
Overrides:
getTitle in class ProviderAdapter
See Also:
Provider.getTitle(), getResourceBundle(java.lang.String)

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.
Overrides:
getColumn in class ProviderAdapter
See Also:
Provider.getColumn()

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.
Overrides:
getRow in class ProviderAdapter
See Also:
Provider.getRow()

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.
Overrides:
getHelp in class ProviderAdapter
See Also:
Provider.getHelp()

setColumn

public int setColumn(int column)
Description copied from class: ProviderAdapter
This method has no effect.
Overrides:
setColumn in class ProviderAdapter
See Also:
Provider.setColumn(int)

setRow

public int setRow(int row)
Description copied from class: ProviderAdapter
This method has no effect.
Overrides:
setRow in class ProviderAdapter
See Also:
Provider.setRow(int)

getDescription

public java.lang.String getDescription()
Get the description for this channel. The description is retrieved by calling getResourceBundle(getName()) and asking for the "description" resource from the returned resource bundle. If this lookup fails (there is no resource bundle associated with the channel, or there is no "description" resource in the bundle) then the description of the channel's profile component is used.
Overrides:
getDescription in class ProviderAdapter
See Also:
Provider.getDescription(), getResourceBundle(java.lang.String)

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.
Overrides:
getWidth in class ProviderAdapter
See Also:
Provider.getWidth()

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.

Overrides:
isDetached in class ProviderAdapter
See Also:
Provider.isDetached()

setDetached

public boolean setDetached(boolean detached)
Description copied from class: ProviderAdapter
This method has no effect.
Overrides:
setDetached in class ProviderAdapter
See Also:
Provider.setDetached(boolean)

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.
Overrides:
isMinimized in class ProviderAdapter
See Also:
Provider.isMinimized()

setMinimized

public boolean setMinimized(boolean minimized)
Description copied from class: ProviderAdapter
This method has no effect.
Overrides:
setMinimized in class ProviderAdapter
See Also:
Provider.setMinimized(boolean)

store

public void store()
           throws ProviderException
Store properties to the profile store. Only properties which have been modified with non "Local" set- methods are stored. All properties that have been loaded are effected by this. By default, only the properties for the provider are loaded, but additional properties may have been loaded via the loadProperties method.
Overrides:
store in class ProviderAdapter
See Also:
Provider.load(), loadProperties(java.lang.String), setListProperty(java.lang.String, java.lang.String, java.util.Vector), setStringProperty(java.lang.String, java.lang.String, java.lang.String), Provider.store()

load

public void load()
          throws ProviderException
Load properties from the profile store. Only properties for the provider are loaded; if you wish to load properties belonging to other components, you must use loadProperties.
Overrides:
load in class ProviderAdapter
See Also:
Provider.load(), loadProperties(java.lang.String)

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.

Overrides:
getRefreshTime in class ProviderAdapter
See Also:
Provider.getRefreshTime()

getBackgroundColor

public java.lang.String getBackgroundColor()
Description copied from interface: Provider
Get the background color for this provider.
Overrides:
getBackgroundColor in class ProviderAdapter
See Also:
Provider.getBackgroundColor()

getResourceBundle

public java.util.ResourceBundle getResourceBundle(java.lang.String component)
Get the ResourceBundle based on User's locale.
Parameters:
component - ResourceBundle name.
Returns:
ResourceBundle.