com.sun.portal.providers
Class ProfileProviderAdapter

java.lang.Object
  extended bycom.sun.portal.providers.ProviderAdapter
      extended bycom.sun.portal.providers.ProfileProviderAdapter
All Implemented Interfaces:
Provider, ProviderEditTypes, ProviderWidths
Direct Known Subclasses:
ContainerProviderAdapter, JSPProvider, URLScraperProvider

public abstract class ProfileProviderAdapter
extends ProviderAdapter

This class adds convenience wrappers around some commonly used methods in the ProviderContext interface.

See Also:
Provider, ProviderAdapter, ProviderContext

Field Summary
 
Fields inherited from interface com.sun.portal.providers.ProviderWidths
WIDTH_FULL_BOTTOM, WIDTH_FULL_TOP, WIDTH_THICK, WIDTH_THIN
 
Fields inherited from interface com.sun.portal.providers.ProviderEditTypes
EDIT_COMPLETE, EDIT_SUBSET
 
Constructor Summary
ProfileProviderAdapter()
           
 
Method Summary
 boolean existsBooleanProperty(java.lang.String name)
          Tests for the existence of a boolean property in the channel.
 boolean existsIntegerProperty(java.lang.String name)
          Tests for the existence of an integer property in the channel.
 boolean existsListProperty(java.lang.String name)
          Tests for the existence of a list property in the channel.
 boolean existsListProperty(java.lang.String name, boolean localized)
          Tests for the existence of a listproperty in the channel.
 boolean existsStringProperty(java.lang.String name)
          Tests for the existence of a string property in the channel.
 boolean existsStringProperty(java.lang.String name, boolean localized)
          Tests for the existence of a string property in the channel.
 boolean getBooleanProperty(java.lang.String key)
          Get a boolean property for the channel.
 boolean getBooleanProperty(java.lang.String key, boolean def)
          Get a boolean property for the channel.
 boolean getBooleanProperty(java.lang.String key, boolean def, java.util.List pflist)
          Get the filtered boolean property for the channel.
 boolean getBooleanProperty(java.lang.String key, java.util.List pflist)
          Get the filtered boolean property for the channel.
 java.lang.String getClientProperty(java.lang.String name)
          Get the client property.
 int getIntegerProperty(java.lang.String key)
          Get an integer property for the channel.
 int getIntegerProperty(java.lang.String key, int def)
          Get an integer property for the channel.
 int getIntegerProperty(java.lang.String key, int def, java.util.List pflist)
          Get an integer property for the channel.
 int getIntegerProperty(java.lang.String key, java.util.List pflist)
          Get an integer property for the channel.
 java.util.List getListProperty(java.lang.String key)
          Get a list property for the channel.
 java.util.List getListProperty(java.lang.String key, java.util.List def)
          Get a list property for the provider.
 java.util.Map getMapProperty(java.lang.String key)
          Get a map property for the channel.
 java.util.Map getMapProperty(java.lang.String key, boolean localized)
          Get the localized version of a map property for the channel.
 java.util.Map getMapProperty(java.lang.String key, java.util.List pflist)
          Get the filtered map property for the channel.
 java.util.Map getMapProperty(java.lang.String key, java.util.Map def)
          Get a map property for the channel.
 java.util.Map getMapProperty(java.lang.String key, java.util.Map def, boolean localized)
          Get the localized version of a map property for the channel.
 java.util.Map getMapProperty(java.lang.String key, java.util.Map def, java.util.List pflist)
          Get the filtered map property for the channel.
 java.lang.String getStringAttribute(java.lang.String name)
          Get a string attribute.
 java.lang.String getStringProperty(java.lang.String key)
          Get a string property for the channel.
 java.lang.String getStringProperty(java.lang.String key, boolean localized)
          Get a localized string property for the channel.
 java.lang.String getStringProperty(java.lang.String key, java.util.List pflist)
          Get a filtered string property for the channel.
 java.lang.String getStringProperty(java.lang.String key, java.lang.String def)
          Get a string property for the channel.
 java.lang.String getStringProperty(java.lang.String key, java.lang.String def, boolean localized)
          Get a localized string property for the channel.
 java.lang.String getStringProperty(java.lang.String key, java.lang.String def, java.util.List pflist)
          Get a filtered string property for the channel.
 java.lang.StringBuffer getTemplate(java.lang.String file)
          Get template for the provider.
 java.lang.StringBuffer getTemplate(java.lang.String file, java.util.Hashtable table)
          Get template for the provider, and tag swap the results before returning.
 java.io.File getTemplatePath(java.lang.String file)
          Get the template path for the given channel name and the given template name.
 boolean isAllowed(java.lang.String priv)
          Deprecated. use getBooleanProperty()
 boolean setBooleanProperty(java.lang.String key, boolean val)
          Sets a boolean property for the channel.
 void setClientProperty(java.lang.String name, java.lang.String val)
          Sets a client property.
 int setIntegerProperty(java.lang.String key, int val)
          Sets a integer property for the channel.
 java.util.List setListProperty(java.lang.String key, java.util.List val)
          Sets a list property for the channel.
 java.util.Map setMapProperty(java.lang.String key, java.util.Map val)
          Sets a map property for the channel.
 void setStringAttribute(java.lang.String name, java.lang.String val)
          Sets a string attribute.
 java.lang.String setStringProperty(java.lang.String key, java.lang.String val)
          Sets a string property for the channel.
 
Methods inherited from class com.sun.portal.providers.ProviderAdapter
getContent, getContent, getDescription, getEdit, getEdit, getEditType, getHelp, getHelp, getName, getProviderContext, getRefreshTime, getResourceBundle, getResourceBundle, getTitle, getWidth, init, isEditable, isPresentable, isPresentable, processEdit, processEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileProviderAdapter

public ProfileProviderAdapter()
Method Detail

getStringProperty

public java.lang.String getStringProperty(java.lang.String key)
                                   throws ProviderException
Get a string property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be returned.
Returns:
The string value corresponding to the key.
Throws:
ProviderException - if an error occurs in getting the String property.

getStringProperty

public java.lang.String getStringProperty(java.lang.String key,
                                          java.lang.String def)
                                   throws ProviderException
Get a string property for the channel.

This method returns a default value if the property does not exist.

Parameters:
key - The key for the property to be returned.
def - The default value to be returned if the property does not exist.
Returns:
The string value corresponding to the key.
Throws:
ProviderException - if an error occurs in getting the String property.

getStringProperty

public java.lang.String getStringProperty(java.lang.String key,
                                          java.util.List pflist)
                                   throws ProviderException
Get a filtered string property for the channel.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned.

Parameters:
key - The key for the property to be returned.
pflist - An ordered list of PropertiesFilter objects
Returns:
The string value corresponding to the key.
Throws:
ProviderException - if an error occurs in getting the filtered String property.
See Also:
PropertiesFilter

getStringProperty

public java.lang.String getStringProperty(java.lang.String key,
                                          java.lang.String def,
                                          java.util.List pflist)
                                   throws ProviderException
Get a filtered string property for the channel.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned. If the unfiltered property is unavailble, then the default value is returned.

Parameters:
key - The key for the property to be returned.
def - Default value.
pflist - An ordered list of PropertiesFilter objects
Returns:
The string value corresponding to the key.
Throws:
ProviderException - if an error occurs in getting the filtered String property.
See Also:
PropertiesFilter

getStringProperty

public java.lang.String getStringProperty(java.lang.String key,
                                          boolean localized)
                                   throws ProviderException
Get a localized string property for the channel.

If localized is true, then this method will attempt to find a localized version of the string named by the key. The locale for the user who this object is executing is read from the ProviderContext object associated with this provider object. Locale-based strings are searched for from more specific to less specific locales. For exmaple, if the user locale was "en_US_SW", the search order would be:



This lookup order is the same as defined by Java resource bundles.

If a locale version of this string is not found, and a non-locale version of this string is not found, then an java.lang.Error is thrown. Client of this call can catch the error and provide code to handle the error condition accordingly.

Parameters:
key - The key for the property to be returned.
localized - If true, first search for a localized string matching the given key.
Returns:
The string value corresponding to the key.
Throws:
ProviderException - if an error occurs in getting the localized String property.

getStringProperty

public java.lang.String getStringProperty(java.lang.String key,
                                          java.lang.String def,
                                          boolean localized)
                                   throws ProviderException
Get a localized string property for the channel.

If localized is true, then this method will attempt to find a localized version of the string named by the key. The locale for the user who this object is executing is read from the ProviderContext object associated with this provider object. Locale-based strings are searched for from more specific to less specific locales. For exmaple, if the user locale was "en_US_SW", the search order would be:



This lookup order is the same as defined by Java resource bundles. If a locale version of this string is not found, and a non-locale version of this string is not found, then this method returns a default value.

Parameters:
key - The key for the property to be returned.
def - Default value.
localized - If true, first search for a localized string matching the given key.
Returns:
The string value corresponding to the key.
Throws:
ProviderException - if an error occurs in getting the localized String property.

getListProperty

public java.util.List getListProperty(java.lang.String key)
                               throws ProviderException
Get a list property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be returned.
Returns:
The list value corresponding to the key.
Throws:
ProviderException

getListProperty

public java.util.List getListProperty(java.lang.String key,
                                      java.util.List def)
                               throws ProviderException
Get a list property for the provider.

This method will return the defaule list passed in if the property is undefined for the channel.

Parameters:
key - The key for the property to be returned.
def - The default list to be returned if the property does not exist.
Returns:
The list value corresponding to the key.
Throws:
ProviderException

getMapProperty

public java.util.Map getMapProperty(java.lang.String key)
                             throws ProviderException
Get a map property for the channel.

This method assumes that the property is defined.

The Java Map object returned from this method fronts the persistent store for the property. Changes to this object are immediately reflected in the persistent store.

Because of this, it is not necessary to call setMapProperty() to persist changes made to a property returned from this method. However, if you are setting a new map value, you must call setMapProperty(). For example, it is not necessary to call setMapProperty() in the following example:

Map m = p.getMapProperty("foo");
m.put("a", "1");

This is because the Map m is returned from getMapProperty() and is therefore persistent. However, in the example below, you must call setMapProperty():

Map m = new HashMap();
m.put("a", "1");

Map m is not persistent because it was not returned from getMapProperty() method. The following line is required to persist the changes:

p.setMapProperty("foo", m);

Parameters:
key - The key for the property to be returned.
Returns:
The map value corresponding to the key.
Throws:
ProviderException

getMapProperty

public java.util.Map getMapProperty(java.lang.String key,
                                    java.util.List pflist)
                             throws ProviderException
Get the filtered map property for the channel.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned. If the unfiltered property is unavailble, then the default value is returned.

Parameters:
key - The key for the property to be returned.
pflist - An ordered list of PropertiesFilter objects.
Returns:
The map value corresponding to the key and the filters.
Throws:
ProviderException
See Also:
PropertiesFilter

getMapProperty

public java.util.Map getMapProperty(java.lang.String key,
                                    boolean localized)
                             throws ProviderException
Get the localized version of a map property for the channel.

If localized is true, then this method will attempt to find a localized version of the map named by the key. The locale for the user who this object is executing is read from the ProviderContext object associated with this providero object. Locale-based maps are searched for from more specific to less specific locales. For exmaple, if the user locale was "en_US_SW", the search order would be:



This lookup order is the same as defined by Java resource bundles.

If a locale version of this map is not found, and a non-locale version of this map is not found, then an java.lang.Error is thrown. Client of this call can catch the error and provide code to handle the error condition accordingly.

Parameters:
key - The key for the property to be returned.
localized - If true, first search for a localized map matching the given key.
Returns:
The map value corresponding to the key.
Throws:
ProviderException

getMapProperty

public java.util.Map getMapProperty(java.lang.String key,
                                    java.util.Map def)
                             throws ProviderException
Get a map property for the channel.

This method returns a default value if the property does not exist.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be returned.
def - Default value.
Returns:
The map value corresponding to the key.
Throws:
ProviderException

getMapProperty

public java.util.Map getMapProperty(java.lang.String key,
                                    java.util.Map def,
                                    java.util.List pflist)
                             throws ProviderException
Get the filtered map property for the channel.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned. If the unfiltered property is unavailble, then the default value is returned.

Parameters:
key - The key for the property to be returned.
def - Default value.
pflist - An ordered list of PropertiesFilter objects
Returns:
The map value corresponding to the key and the filters.
Throws:
ProviderException
See Also:
PropertiesFilter

getMapProperty

public java.util.Map getMapProperty(java.lang.String key,
                                    java.util.Map def,
                                    boolean localized)
                             throws ProviderException
Get the localized version of a map property for the channel.

If localized is true, then this method will attempt to find a localized version of the map named by the key. The locale for the user who this object is executing is read from the ProviderContext object associated with this providero object. Locale-based maps are searched for from more specific to less specific locales. For exmaple, if the user locale was "en_US_SW", the search order would be:



This lookup order is the same as defined by Java resource bundles.

If a locale version of this map is not found, and a non-locale version of this string is not found, then this method returns a default value.

Parameters:
key - The key for the property to be returned.
def - Default value.
localized - If true, first search for a localized map matching the given key.
Returns:
The map value corresponding to the key.
Throws:
ProviderException

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key)
                           throws ProviderException
Get a boolean property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be returned.
Returns:
The boolean value corresponding to the key.
Throws:
ProviderException

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key,
                                  java.util.List pflist)
                           throws ProviderException
Get the filtered boolean property for the channel.

This method assumes that the property is defined.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned. If the unfiltered property is unavailble, then the default value is returned.

Parameters:
key - The key for the property to be returned.
pflist - An ordered list of PropertiesFilter objects
Returns:
The boolean value corresponding to the key.
Throws:
ProviderException

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key,
                                  boolean def)
                           throws ProviderException
Get a boolean property for the channel.

This method returns a default value if the property does not exist.

Parameters:
key - The key for the property to be returned.
def - Default value.
Returns:
The boolean value corresponding to the key.
Throws:
ProviderException

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key,
                                  boolean def,
                                  java.util.List pflist)
                           throws ProviderException
Get the filtered boolean property for the channel.

This method returns a default value if the property does not exist.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned. If the unfiltered property is unavailble, then the default value is returned.

Parameters:
key - The key for the property to be returned.
def - Default value.
pflist - An ordered list of PropertiesFilter objects
Returns:
The boolean value corresponding to the key.
Throws:
ProviderException

getIntegerProperty

public int getIntegerProperty(java.lang.String key)
                       throws ProviderException
Get an integer property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be returned.
Returns:
The integer value corresponding to the key.
Throws:
ProviderException

getIntegerProperty

public int getIntegerProperty(java.lang.String key,
                              java.util.List pflist)
                       throws ProviderException
Get an integer property for the channel.

This method assumes that the property is defined.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned. If the unfiltered property is unavailble, then the default value is returned.

Parameters:
key - The key for the property to be returned.
pflist - An ordered list of PropertiesFilter objects
Returns:
The integer value corresponding to the key.
Throws:
ProviderException

getIntegerProperty

public int getIntegerProperty(java.lang.String key,
                              int def)
                       throws ProviderException
Get an integer property for the channel.

This method returns a default value if the property does not exist.

Parameters:
key - The key for the property to be returned.
def - Default value.
Returns:
The integer value corresponding to the key.
Throws:
ProviderException

getIntegerProperty

public int getIntegerProperty(java.lang.String key,
                              int def,
                              java.util.List pflist)
                       throws ProviderException
Get an integer property for the channel.

This method returns a default value if the property does not exist.

Filter criteria can be specified using a series of PropertiesFilter objects. The order in that the PropertiesFilter objects are listed determines the order that the property is searched. If there is no property that exactly matches the filter criteria, the best partial match is returned. When there is not even a partial match, an unfiltered property is returned. If the unfiltered property is unavailble, then the default value is returned.

Parameters:
key - The key for the property to be returned.
def - Default value.
pflist - An ordered list of PropertiesFilter objects
Returns:
The integer value corresponding to the key.
Throws:
ProviderException

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String name)
Get a string attribute.

"Attributes" are settings that are not channel-specific. An example of an attribute might be the user's first and last name. Channel-specific settings are called "properties".

Properties can be retrieved by calling the get*Property() methods. Whether a particular value is considered a property or an attribute depends on the underlying implementation of ProviderContext.

Parameters:
name - Attribute name.
Returns:
Attribute value as a string. If attribute is not not found, null is returned.

getClientProperty

public java.lang.String getClientProperty(java.lang.String name)
Get the client property.

Parameters:
name - Property name.
Returns:
Property value. If the property is not not found, then null is returned.

isAllowed

public boolean isAllowed(java.lang.String priv)
                  throws ProviderException
Deprecated. use getBooleanProperty()

Checks for access to the named privilege.

This method is provided for backwards compatibility. There is no longer a concept of a privilege in the Provider API. Instead, use boolean properties.

This method simply calls getBooleanProperty() to determine its return value.

Parameters:
priv - The privilege to check.
Returns:
A boolean value. true if the user is granted access by the named privilege, otherwise false.
Throws:
ProviderException

setStringProperty

public java.lang.String setStringProperty(java.lang.String key,
                                          java.lang.String val)
                                   throws ProviderException
Sets a string property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.
Throws:
ProviderException

setListProperty

public java.util.List setListProperty(java.lang.String key,
                                      java.util.List val)
                               throws ProviderException
Sets a list property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.
Throws:
ProviderException

setMapProperty

public java.util.Map setMapProperty(java.lang.String key,
                                    java.util.Map val)
                             throws ProviderException
Sets a map property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.
Throws:
ProviderException

setBooleanProperty

public boolean setBooleanProperty(java.lang.String key,
                                  boolean val)
                           throws ProviderException
Sets a boolean property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.
Throws:
ProviderException

setIntegerProperty

public int setIntegerProperty(java.lang.String key,
                              int val)
                       throws ProviderException
Sets a integer property for the channel.

This method assumes that the property is defined.

Parameters:
key - The key for the property to be set.
val - The value for the propery to be set.
Returns:
The previous value.
Throws:
ProviderException

setStringAttribute

public void setStringAttribute(java.lang.String name,
                               java.lang.String val)
Sets a string attribute.

"Attributes" are settings that are not channel-specific. An example of an attribute might be the user's first and last name. Channel-specific settings are called "properties".

Properties can be set by calling the set*Property() methods. Whether a particular value is considered a property or an attribute depends on the underlying implementation of ProviderContext.

Parameters:
name - Attribute name.

setClientProperty

public void setClientProperty(java.lang.String name,
                              java.lang.String val)
Sets a client property.

Parameters:
name - The property name.

existsStringProperty

public boolean existsStringProperty(java.lang.String name)
                             throws ProviderException
Tests for the existence of a string property in the channel.

Parameters:
name - A String, the property name.
Returns:
A boolean, true if the property exists, otherwise false.
Throws:
ProviderException

existsStringProperty

public boolean existsStringProperty(java.lang.String name,
                                    boolean localized)
                             throws ProviderException
Tests for the existence of a string property in the channel.

This method will also check for the existence of the localized version of the property.

Parameters:
name - A String, the property name.
localized - A boolean, whether to check the existence of localized properties.
Returns:
A boolean, true if the property exists, otherwise false.
Throws:
ProviderException

existsBooleanProperty

public boolean existsBooleanProperty(java.lang.String name)
                              throws ProviderException
Tests for the existence of a boolean property in the channel.

Parameters:
name - A String, the property name.
Returns:
A boolean, true if the property exists, otherwise false.
Throws:
ProviderException

existsIntegerProperty

public boolean existsIntegerProperty(java.lang.String name)
                              throws ProviderException
Tests for the existence of an integer property in the channel.

Parameters:
name - A String, the property name.
Returns:
A boolean, true if the property exists, otherwise false.
Throws:
ProviderException

existsListProperty

public boolean existsListProperty(java.lang.String name)
                           throws ProviderException
Tests for the existence of a list property in the channel.

Parameters:
name - A String, the property name.
Returns:
A boolean, true if the property exists, otherwise false.
Throws:
ProviderException

existsListProperty

public boolean existsListProperty(java.lang.String name,
                                  boolean localized)
                           throws ProviderException
Tests for the existence of a listproperty in the channel.

This method will also check for the existence of the localized version of the property.

Parameters:
name - A String, the property name.
localized - A boolean, whether to check the existence of localized properties.
Returns:
A boolean, true if the property exists, otherwise false.
Throws:
ProviderException

getTemplate

public java.lang.StringBuffer getTemplate(java.lang.String file)
                                   throws ProviderException

Get template for the provider.

The directory search order of the template file is as follows:

Where

  1. <type> is the value of the desktop template type property
  2. <locale> is the user's locale
  3. <component> is the component name (or channel name)
  4. <clientPath> is an optional file-path containing client-specific templates

If there is no <clientPath> specified, then the directory search order is as follows:



Parameters:
file - The template file name
Returns:
template A StringBuffer represents the template
Throws:
ProviderException

getTemplatePath

public java.io.File getTemplatePath(java.lang.String file)
                             throws ProviderException

Get the template path for the given channel name and the given template name. If non-null, the key returned by this method will map to a most specific, existing template file. The format of the returned path is implementation dependent.

Throws:
ProviderException
See Also:
getTemplate(String)

getTemplate

public java.lang.StringBuffer getTemplate(java.lang.String file,
                                          java.util.Hashtable table)
                                   throws ProviderException

Get template for the provider, and tag swap the results before returning.

Throws:
ProviderException
See Also:
getTemplate(String)