|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An environment for provider execution. More formally,
this class provides information pertaining to the container that
a provider object executes within. Such information may be specific to
the user, to the web container, or be global (shared between multiple
users). This interface does not define what information falls into
each of these categories; this is left up to the implementation. For
example, it is up to the implementation whether a user's locale
(see getLocaleString()
and getLocale()
) is specific to the user
or is a global for all users.
At runtime, a single provider context object is shared between
all channels in the system. Methods in this interface that target
a specific channel require the channel name to be passed in as
a parameter to the method (see get*Property()
).
Any container channel that wishes to make a provider context available to
its contained leaf channels must do so using an agreed-upon contract between
the container and the leaf channels. Any channels that
extends ProviderAdapter
falls
into this category. See the ProviderAdapter
Javadocs for details.
A provider context forms the layer between the services used by the
provider and the provider code. A provider context isolates provider code
from specific service interfaces and implementations.
All methods in this interface may throw errors. Errors are thrown when
a serious problem arises such that a reasonable application either should
not try, or there is no clear way to resolve. The actual object thrown
will be a subclass of Error
. This error may be caught,
if it can be handled reasonably in the application.
Applications that wish to try and
resolve such errors may catch Error
.
The get*Property()
and set*Property()
methods
deserve special mention. It is considered a serious error when
an application attempts to get or set a property that does not exist.
Again, an error is thrown from these methods if the property does not exist.
The set of properties that an application uses is a
contract between the persistent store providing the properties and the
application. To avoid application errors,
the exists*Property()
methods can be used to check for the
existence of a property. Additionally, the get*Property()
method versions that accept a default value may be used.
There is a 1-1 mapping between a session and a ProviderContext object.
Typically, there is a unique session for every client accessing the Desktop.
However, there are exceptions to this. When accessed in authless mode,
multiple clients access the same ProviderContext object and therefore
the same session.
A subset of methods in
this interface access session functionality.
These include getSessionProperty(), setSessionProperty(),
getSessionID(),
and getUserID()
.
The getSessionProperty()
and setSessionProperty()
methods get and set properties per session,
or per ProviderContext object.
A session property is shared between all clients using the session.
In the case of authless, a session property is shared for all
authless clients.
In some cases it is desirable to set properties such that there is a
1-1 mapping between client and property. An example of this is a
selected tab name. In the case of authless, it would not do to
have the selected tab name shared between all authless clients
because this would cause all authless clients to have the same
selected tab. To set / get properties per accessing client, use the
setClientProperty()
and getClientProperty()
methods.
ProviderContext
is a generic interface, the documentation here describes
it in this light. There are implementation classes as well.
To make use of this interface, it is necessary to expose aspects of the
implementation.
While the implementation classes are private,
their semantics are documented.
Please see the iPS product documentation for details.
ProviderAdapter
,
ContainerProviderContext
Method Summary | |
void |
allContentChanged()
|
void |
contentChanged(String channelName)
|
void |
debugError(Object o)
Logs a message if the debugging level is "error". |
void |
debugError(Object o,
Throwable t)
Logs a message and stack trace, if the debugging level is "error". |
void |
debugMessage(Object o)
logs a message if the debugging level is "message" or higher. |
void |
debugMessage(Object o,
Throwable t)
Logs a message and stack trace if the debugging level is "message" or higher. |
void |
debugWarning(Object o)
Logs a message if the debugging level is "warning" or higher. |
void |
debugWarning(Object o,
Throwable t)
Logs a message and stack trace if the debugging level is "warning" or higher. |
String |
encodeURL(String url)
Encodes a URL. |
boolean |
existsBooleanProperty(String channel,
String name)
Tests for the existence of a boolean property. |
boolean |
existsCollectionProperty(String channel,
String name)
Tests for the existence of a collection property. |
boolean |
existsCollectionProperty(String channel,
String name,
boolean localized)
Tests for the existence of a collection property. |
boolean |
existsIntegerProperty(String channel,
String name)
Tests for the existence of an integer property. |
boolean |
existsStringProperty(String channel,
String name)
Tests for the existence of a string property. |
boolean |
existsStringProperty(String channel,
String name,
boolean localized)
Tests for the existence of a string property. |
boolean |
getBooleanProperty(String channel,
String name)
Gets a boolean property property. |
boolean |
getBooleanProperty(String channel,
String name,
boolean def)
Gets a boolean property property. |
String |
getCharset()
Gets the character set. |
String |
getClassName(String channel)
Gets the class name for the provider class that this object will be providing an environment for. |
String |
getClientPath()
Gets the client path. |
String |
getClientProperty(String name)
Get a client property. |
String |
getClientType()
Gets the client type. |
String |
getClientTypeProperty(String key)
Gets a client type property for the user's client type. |
String |
getClientTypeProperty(String clientType,
String key)
Gets a client type property for the given client type. |
Map |
getCollectionProperty(String channel,
String name)
Gets a collection property. |
Map |
getCollectionProperty(String channel,
String name,
boolean localized)
Gets the localized version of a collection property. |
Map |
getCollectionProperty(String channel,
String name,
Map def)
Gets a collection property. |
Map |
getCollectionProperty(String channel,
String name,
Map def,
boolean localized)
Gets the localized version of a collection property. |
String |
getConfigProperty(String key)
Gets the named configuration property. |
String |
getContentType()
Gets the content type. |
String |
getDefaultChannelName()
Gets the default channel name. |
String |
getDefaultClientType()
Gets the default client type. |
String |
getDesktopType()
Gets the Desktop type. |
String |
getDesktopURL(javax.servlet.http.HttpServletRequest req)
Gets the Desktop URL. |
int |
getIntegerProperty(String channel,
String name)
Gets an integer property. |
int |
getIntegerProperty(String channel,
String name,
int def)
Gets an integer property. |
Locale |
getLocale()
Gets the locale. |
String |
getLocaleString()
Gets the string form of the locale. |
String |
getLogoutURL()
Gets the logout URL. |
Iterator |
getNames(String channel)
Gets property names for the channel. |
Object |
getProperty(String channel,
String name)
Gets a property. |
Object |
getProperty(String channel,
String name,
Object def)
Gets a property. |
String |
getProviderName(String channel)
Gets the name of the provider that backs the channel that this object provides an environment for. |
StringBuffer |
getRequestServer(javax.servlet.http.HttpServletRequest req)
Gets the request server. |
javax.servlet.ServletConfig |
getServletConfig()
Gets the ServletConfig. |
String |
getSessionID()
Gets the unique session identifier. |
Object |
getSessionProperty(String name)
Get a session property. |
String |
getStaticContentPath()
Gets the URI prefix to web server static content. |
String |
getStringAttribute(String name)
Gets a string attribute. |
String |
getStringProperty(String channel,
String name)
Gets a String property. |
String |
getStringProperty(String channel,
String name,
boolean localized)
Gets the localized version of a String property. |
String |
getStringProperty(String channel,
String name,
String def)
Gets a String property. |
String |
getStringProperty(String channel,
String name,
String def,
boolean localized)
Gets the localized version of a String property. |
StringBuffer |
getTemplate(String name,
String file)
Gets a desktop template. |
StringBuffer |
getTemplate(String name,
String file,
Hashtable table)
Gets and tag swaps a desktop template. |
File |
getTemplateMostSpecificPath(String name,
String file)
Gets the most specific template path for the given channel name and the given template name. |
File |
getTemplatePath(String name,
String file)
Gets the template path for the given channel name and the given template name. |
String |
getUserID()
Get the user identifier. |
void |
init(javax.servlet.http.HttpServletRequest req)
Initializes this provider context. |
boolean |
isDebugEnabled()
Gets if the debug is enabled |
boolean |
isDebugErrorEnabled()
Gets if the debug is set to error |
boolean |
isDebugMessageEnabled()
Gets if the debug level is set to message or higher. |
boolean |
isDebugWarningEnabled()
Gets if the debug level is set to warning or higher. |
void |
refresh()
|
void |
setBooleanProperty(String channel,
String name,
boolean value)
Sets a boolean property. |
void |
setClientProperty(String name,
String value)
Set a client property. |
void |
setCollectionProperty(String channel,
String name,
List value)
Sets a collection property. |
void |
setCollectionProperty(String channel,
String key,
Map val)
Sets a collection property. |
void |
setIntegerProperty(String channel,
String name,
int value)
Sets an integer property. |
void |
setProperty(String channel,
String key,
Object val)
TBD |
void |
setSessionProperty(String name,
Object val)
Set a session property. |
void |
setStringAttribute(String name,
String val)
Sets a string attribute. |
void |
setStringProperty(String channel,
String key,
String val)
Sets a string property. |
Method Detail |
public void init(javax.servlet.http.HttpServletRequest req)
req
- Request object containing service specific data.public void refresh()
public void contentChanged(String channelName)
public void allContentChanged()
public String getDesktopURL(javax.servlet.http.HttpServletRequest req)
http://SERVER:PORT/ps/desktop
.
The request object parameter is included to facilitate implementations.
It may be used to build the Desktop URL by supplying the
server, port, and protocol of the request. It is not required
that the request object be utilizied to generate the Desktop URL.req
- Request object containing the protocol, server, port, etc.
information required to build the Desktop URL. If the implementation
does not use the request object, this parameter may be null.public String getLocaleString()
public Locale getLocale()
Locale
object representation of the locale.Locale
public String getDesktopType()
public String getLogoutURL()
public String getStringAttribute(String name)
get*Property()
methods.
Whether
a particular value is considered a property or an attribute depends
on the underlying implementation of ProviderContext
.name
- Attribute name.public void setStringAttribute(String name, String val)
set*Property()
methods.
Whether
a particular value is considered a property or an attribute depends
on the underlying implementation of ProviderContext
.name
- Attribute name.name
- Attribute value.public String encodeURL(String url)
url
- The URL to be encoded.public StringBuffer getRequestServer(javax.servlet.http.HttpServletRequest req)
HttpUtils.getRequestURL()
because the version of
that method does not use the
Host HTTP header field to reconstruct the URL.
The difference in this
version is that it grabs the servername:port
from the Host header if it is
there.req
- HTTP request object to grab the server information from.javax.servlet.http.HttpUtils#getRequestURL(HttpServletRequest)
public String getClientTypeProperty(String key)
key
- Property key.getClientType()
public String getClientTypeProperty(String clientType, String key)
clientType
- Client type to get the property from.key
- Property key.public String getDefaultClientType()
public String getClientType()
public String getCharset()
public String getClientPath()
public String getContentType()
String
valuepublic Object getSessionProperty(String name)
name
- Property name.public void setSessionProperty(String name, Object val)
name
- The property name.value
- The property value.public String getSessionID()
public String getUserID()
public String getClientProperty(String name)
name
- a String
, the property name.String
, the property value.public void setClientProperty(String name, String value)
name
- a String
, the property name.value
- String
, the property value.public boolean isDebugEnabled()
true
if the debugging is on,
otherwise false
.public boolean isDebugErrorEnabled()
true
if the debugging level is set to error,
otherwise false
.public boolean isDebugWarningEnabled()
true
if the debugging level is set to warning
or higher, otherwise false
.public boolean isDebugMessageEnabled()
true
if the debugging level is set to message
or higher, otherwise false
.public void debugMessage(Object o)
o
- Object to debug (o.toString() is logged).public void debugWarning(Object o)
o
- Object to debug (o.toString() is logged).public void debugError(Object o)
o
- Object to debug (o.toString() is logged).public void debugMessage(Object o, Throwable t)
o
- Object to debug (o.toString() is logged).t
- Throwable object to log a stack trace of.public void debugWarning(Object o, Throwable t)
o
- Object to debug (o.toString() is logged).t
- Throwable object to log a stack trace of.public void debugError(Object o, Throwable t)
o
- Object to debug (o.toString() is logged).t
- Throwable object to print a stack trace of.public StringBuffer getTemplate(String name, String file) throws ProviderContextException
name
- Channel namefile
- Template name to return.ProviderContextException
- if an error occurs in getting the
desktop template.public StringBuffer getTemplate(String name, String file, Hashtable table) throws ProviderContextException
name
- Channel namefile
- Template name to returntable
- Tag table to use for tag swapping.ProviderContextException
- if an error occurs in getting or
tag swapping the desktop template.public File getTemplatePath(String name, String file) throws ProviderContextException
name
- Channel name.file
- The template name, or null
if the template
for the name does not exist.ProviderContextException
- if an error occurs in getting the
template path.public File getTemplateMostSpecificPath(String name, String file) throws ProviderContextException
name
- Channel name.file
- The template name, or null
if the template
for the name does not exist.ProviderContextException
- if an error occurs in getting the
most specific template path.public String getClassName(String channel) throws ProviderContextException
channel
- Channel name.ProviderContextException
- if an error occurs in getting the
class name.public String getProviderName(String channel) throws ProviderContextException
getProviderClassName()
).channel
- Channel name.ProviderContextException
- if an error occurs in getting the
provider name.public Iterator getNames(String channel) throws ProviderContextException
channel
- Channel name.Iterator
over String
objects.ProviderContextException
- if an error occurs in getting the
property names.public Object getProperty(String channel, String name) throws ProviderContextException
Object
, of type String
, Integer
,
Boolean
, or Map
.channel
- Channel name.name
- Property name.ProviderContextException
- if an error occurs in getting the
property.public void setProperty(String channel, String key, Object val) throws ProviderContextException
public Object getProperty(String channel, String name, Object def) throws ProviderContextException
Object
, of type String
, Integer
,
Boolean
, or Map
.
If the property does not exist, then the default value is
returned.channel
- Channel name.name
- Property name.def
- Default value.ProviderContextException
- if an error occurs in setting the
property.public String getStringProperty(String channel, String name) throws ProviderContextException
channel
- Channel name.name
- Property name.ProviderContextException
- if an error occurs in getting the
String property.public String getStringProperty(String channel, String name, String def) throws ProviderContextException
channel
- Channel name.name
- Property name.def
- Default value.ProviderContextException
- if an error occurs in getting the
String property.public String getStringProperty(String channel, String name, boolean localized) throws ProviderContextException
channel
- Channel name.name
- Property name.localized
- Search for a localized version?ProviderContextException
- if an error occurs in getting the
localized version of the String property.public String getStringProperty(String channel, String name, String def, boolean localized) throws ProviderContextException
channel
- Channel name.name
- Property name.def
- Default value.localized
- Search for a localized version?ProviderContextException
- if an error occurs in getting the
localized version of the String property.public void setStringProperty(String channel, String key, String val) throws ProviderContextException
channel
- Channel name.name
- Property name.value
- Property value.ProviderContextException
- if an error occurs in setting the
String property.public Map getCollectionProperty(String channel, String name) throws ProviderContextException
Maps
or List
. For List
, the returned Java Map
object
contains key-value pairs where the key equals the value. For example,
to treat the Map
object as a List, do the following:
Set list = map.keySet();
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
setCollectionProperty()
to persist changes made
to a property returned from this method. However, if you are
setting a new collection value, you must call
setCollectionProperty()
. For example, it is not
necessary to call setCollectionProperty()
in
the following example:
Map m = pc.getCollectionProperty("foo");
m.put("a", "1");
This is because the Map m is returned from
getCollectionProperty()
and is therefore
persistent. However, in the example below, you must call
setCollectionProperty()
:
Map m = new HashMap();
m.put("a", "1");
Map m is not persistent because it was not returned from
getCollectionProperty()
method. The following
line is required to persist the changes:
pc.setCollectionProperty("foo", m);
channel
- Channel name.name
- Property name.Map
that maps
String
s to Java objects, either String
,
Integer
, Boolean
, or Map
.ProviderContextException
- if an error occurs in getting the
Collection property.setCollectionProperty(String, String, Map)
,
setCollectionProperty(String, String, List)
public Map getCollectionProperty(String channel, String name, boolean localized) throws ProviderContextException
channel
- Channel name.name
- Property name.localized
- Search for a localized version?Map that maps
String
s to Java objects, either String
,
Integer
, Boolean
, or Map
.- Throws:
ProviderContextException
- if an error occurs in getting
localized version of the Collection property.- See Also:
getCollectionProperty(String, String)
public Map getCollectionProperty(String channel, String name, Map def) throws ProviderContextException
channel
- Channel name.name
- Property name.def
- Default value.Map that maps
String
s to Java objects, either String
,
Integer
, Boolean
, or Map
.- Throws:
ProviderContextException
- if an error occurs in getting
the Collection property.- See Also:
getCollectionProperty(String, String)
public Map getCollectionProperty(String channel, String name, Map def, boolean localized) throws ProviderContextException
channel
- Channel name.name
- Property name.def
- Default value.localized
- Search for a localized version?Map that maps
String
s to Java objects, either String
,
Integer
, Boolean
, or Map
.- Throws:
ProviderContextException
- if an error occurs in getting
the localized version of the Collection property.- See Also:
getCollectionProperty(String, String)
public void setCollectionProperty(String channel, String key, Map val) throws ProviderContextException
channel
- Channel name.name
- Property name.value
- Property value.ProviderContextException
- if an error occurs in setting
the Collection property.getCollectionProperty(String, String)
public void setCollectionProperty(String channel, String name, List value) throws ProviderContextException
channel
- Channel name.name
- Property name.value
- Proeprty value.ProviderContextException
- if an error occurs in setting
the Collection property.getCollectionProperty(String, String)
public boolean getBooleanProperty(String channel, String name) throws ProviderContextException
channel
- Channel name.name
- Property name.ProviderContextException
- if an error occurs in getting
the boolean property.public boolean getBooleanProperty(String channel, String name, boolean def) throws ProviderContextException
channel
- Channel name.name
- Property name.def
- Default value.ProviderContextException
- if an error occurs in getting
the boolean property.public void setBooleanProperty(String channel, String name, boolean value) throws ProviderContextException
channel
- Channel name.name
- Property name.value
- Property value.ProviderContextException
- if an error occurs in setting
the boolean property.public int getIntegerProperty(String channel, String name) throws ProviderContextException
channel
- Channel name.name
- Property name.ProviderContextException
- if an error occurs in getting
the integer property.public int getIntegerProperty(String channel, String name, int def) throws ProviderContextException
channel
- Channel name.name
- Property name.def
- Default value.ProviderContextException
- if an error occurs in getting
the integer property.public void setIntegerProperty(String channel, String name, int value) throws ProviderContextException
channel
- Channel name.name
- Property name.value
- Property value.ProviderContextException
- if an error occurs in setting
the integer property.public boolean existsStringProperty(String channel, String name) throws ProviderContextException
channel
- Channel name.name
- a String
, the property name.boolean
, true
if the
property exists, otherwise false
.ProviderContextException
- if an error occurs in testing
for the existence of a String property.public boolean existsStringProperty(String channel, String name, boolean localized) throws ProviderContextException
channel
- Channel name.name
- a String
, the property name.localized
- a boolean
, whether to check the
existence of
localized properties.boolean
, true
if the
property exists, otherwise false
.ProviderContextException
- if an error occurs in testing
for the existence of a String property.public boolean existsBooleanProperty(String channel, String name) throws ProviderContextException
channel
- Channel name.name
- a String
, the property name.boolean
, true
if the
property exists, otherwise false
.ProviderContextException
- if an error occurs in testing
for the existence of a boolean property.public boolean existsIntegerProperty(String channel, String name) throws ProviderContextException
channel
- Channel name.name
- a String
, the property name.boolean
, true
if the
property exists, otherwise false
.ProviderContextException
- if an error occurs in testing
for the existence of an integer property.public boolean existsCollectionProperty(String channel, String name) throws ProviderContextException
channel
- Channel name.name
- a String
, the property name.boolean
, true
if the
property exists, otherwise false
.ProviderContextException
- if an error occurs in testing
for the existence of a Collection property.public boolean existsCollectionProperty(String channel, String name, boolean localized) throws ProviderContextException
channel
- Channel name.name
- a String
, the property name.localized
- a boolean
, whether to check the
existence of
localized properties.boolean
, true
if the
property exists, otherwise false
.ProviderContextException
- if an error occurs in testing
for the existence of a Collection property.public String getStaticContentPath()
http://server:port/STATIC_URI/images/foo.gif
- Returns:
- URI prefix.
public javax.servlet.ServletConfig getServletConfig()
public String getDefaultChannelName()
getSessionProperty
if exists. If not
returns the defaultChannelName attribute
using getStringAtribute
String
, name of the channelgetSessionProperty(String)
,
getStringAttribute(String)
public String getConfigProperty(String key)
key
- a String
, the property name.String
, the property value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |