|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An environment for container provider execution. More formally, this
class adds container channel functionality to the
ProviderContext
interface. Container channel functionality
includes getting provider objects, fetching content, content caching
features, and getting / setting selected and available channel lists.
ProviderContext
Field Summary | |
static char |
CHANNEL_NAME_SEPARATOR
Separator character for nested channel names. |
Method Summary | |
void |
copyChannel(java.lang.String srcName,
java.lang.String dstName)
Copies a channel. |
void |
createChannel(java.lang.String channelName,
java.lang.String providerName)
Creates a new channel. |
void |
createContainer(java.lang.String channelName,
java.lang.String providerName)
Creates a new container channel. |
boolean |
existsChannel(java.lang.String channel)
Tests if channel configuration exists. |
java.util.List |
getAvailableChannels(java.lang.String container)
Gets the available channels for the container channel that this is providing an environment for. |
java.lang.StringBuffer |
getCachedContent(java.lang.String name)
Gets the cached content view for a channel. |
long |
getCachedTime(java.lang.String name)
Gets the content view cache time for a channel. |
java.util.Map |
getContent(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String container,
java.util.List channels,
int timeout)
Gets the content view for a set of channels. |
java.lang.StringBuffer |
getContent(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String container,
java.lang.String channel)
Gets the content view for the named channel. |
Provider |
getProvider(javax.servlet.http.HttpServletRequest req,
java.lang.String container,
java.lang.String channel)
Gets a provider. |
java.util.List |
getSelectedChannels(java.lang.String container)
Gets the selected channels for the container channel that this is providing an environment for. |
void |
initProviders(javax.servlet.http.HttpServletRequest req,
java.lang.String container,
java.util.List channels,
int timeout)
Initializes a set of channels. |
void |
putCachedContent(java.lang.String name,
java.lang.StringBuffer content)
Puts the cached content into a map and using the provider name as the key. |
void |
removeChannel(java.lang.String channelName)
Removes a global scope channel. |
void |
setAvailableChannels(java.lang.String container,
java.util.List available)
Sets the available channels for the container channel that this is providing an environment for. |
void |
setSelectedChannels(java.lang.String container,
java.util.List selelected)
Sets the selected channels for the container channel that this is providing an environment for. |
Field Detail |
public static final char CHANNEL_NAME_SEPARATOR
X + CHANNEL_NAME_SEPARATOR + A
. This name is used
in all ContainerProviderContext
and ProviderContext
methods that accept a channel name. Examples of this are:
Method Detail |
public boolean existsChannel(java.lang.String channel)
channel
- a String
, the channel name.
boolean
, true
if the
channel has been added, otherwise false
.public void createChannel(java.lang.String channelName, java.lang.String providerName) throws ProviderContextException
createChannel("X" + CHANNEL_NAME_SEPARATOR + "A", "P");
This method only modifies the underlying configuration and
does not create a Provider
object. After calling this method, to get the provider object
that backs this channel, call getProvider()
.
channelName
- Name of the channel being created.providerName
- Symbolic name of the provider that will back the channel being created.
ProviderContextException
- if an error occurs in creating the
new global scope channel.getProvider(HttpServletRequest, String, String)
public void createContainer(java.lang.String channelName, java.lang.String providerName) throws ProviderContextException
createContainer("X" + CHANNEL_NAME_SEPARATOR + "C", "P");
This method only modifies the underlying configuration and
does not create a Provider
object. After calling this method, to get the provider object
that backs this channel, call getProvider()
.
channelName
- Name of the channel being created.providerName
- Symbolic name of the provider that will back the container being created.
ProviderContextException
- if an error occurs in creating a
global scope container channel.getProvider(HttpServletRequest, String, String)
public void copyChannel(java.lang.String srcName, java.lang.String dstName) throws ProviderContextException
copyChannel("A", "X" + CHANNEL_NAME_SEPARATOR + "B");
This method only modifies the underlying configuration and
does not create a Provider
object. After calling this method, to get the provider object
that backs this channel, call getProvider()
.
This method copies container channels as well as channels. To copy a container channel, simply supply its name as the source.
srcName
- Name of the source channel, the channel to be copied.dstName
- Name of the destination channe, the channel copy.
ProviderContextException
- if an error occurs copying the channel.getProvider(HttpServletRequest, String, String)
public void removeChannel(java.lang.String channelName) throws ProviderContextException
This method only modifies the underlying configuration and does not modify the references of the channel in other places in the configuration.
channelName
- Name of the channel being removed.
ProviderContextException
- if an error occurs in removing the
global scope channel.public Provider getProvider(javax.servlet.http.HttpServletRequest req, java.lang.String container, java.lang.String channel)
Provider
object
for the named channel. This method will return null if the provider
object is not available.
req
- an HttpServletRequest
object
containing provider initialization information.container
- Container channel name, or null
if the
channel is not contained.channel
- a String
, the channel name.
Provider
object for the given channel name.public java.lang.StringBuffer getContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String container, java.lang.String channel) throws ProviderException
Provider.getContent(HttpServletRequest, HttpServletResponse)
.
req
- an HttpServletRequest
object to pass on to the
provider object.res
- an HttpServletResponse
object to pass on to the
provider object.container
- Container channel name, or null
if the
channel is not contained.
StringBuffer
that is the channels content view, or
null if there is an error in getting the channel content or if the
channel is not presentable for that
particular client type.
ProviderException
- if an error occurs in the provider's
getContent()
method.Provider.getContent(HttpServletRequest, HttpServletResponse)
public void initProviders(javax.servlet.http.HttpServletRequest req, java.lang.String container, java.util.List channels, int timeout)
Provider.init()
method. Channel initialization can be
an expenesive operation. This method allows said operation to
be done for all channels at one time allowing for optimizations
such as parallelization.
req
- a HttpServletRequest
object passed to each
channel for initialized.container
- Container channel name, or null
if the
channel is not contained.channels
- a List
of String
objects;
the channel names.timeout
- an int
specifying the time to wait for
all channels to complete initialization.Provider.init(String, HttpServletRequest)
public java.util.Map getContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String container, java.util.List channels, int timeout) throws ProviderException
Provider.getContent()
method. Fetching a channel's
content view can be an expensive operation. This method allows said
operation to be done in bulk for all of the channels constributing
to the page allowing for optimizations such as parallelization.
req
- a HttpServletRequest
object passed to each
channel in the request for its content view.res
- a HttpServletResponse
object passed to each
channel in the request for its content view.container
- Container channel name, or null
if the
channel is not contained.channels
- a List
object of String
s;
the channel names.timeout
- an int
specifying the time to wait for
all channels to complete getting their content view.
Map
object; mapping String
channel names to
StringBuffer
content, or mapping String
channel names to null if there is an error in getting the channel
content or if the channel is
not presentable for that particular client type.
ProviderException
- if an error occurs in the provider's
getContent()
method.Provider.getContent(HttpServletRequest, HttpServletResponse)
public java.lang.StringBuffer getCachedContent(java.lang.String name)
getRefreshTime()
method. This method then gets this
cached content for the channel. If containers wish to support
this type of content caching, they can use this method.
getContent()
methods
in this interface call this method automatically. It is up to the
client of this interface to manually check the cache time
and either call this method or call getContent()
for the channel. It is not mandatory that a container channel
use these features and thereby support content caching.
name
- a String
, the channel name.
StringBuffer
, the cached content, or
null
if there is no cached content for the channel.Provider.getRefreshTime()
,
getCachedTime(String)
public void putCachedContent(java.lang.String name, java.lang.StringBuffer content)
name
- a String
, the channel name.content
- StringBuffer
, the cached content
for the channel.public long getCachedTime(java.lang.String name)
getCachedContent()
)
the time that it was cached is also recorded. This information
can be used by the client to decide if the cached value is
stale.
name
- a String
, the channel name.
long
, the cache time, in milliseconds, or -1
if the content is not cached.getCachedContent(String)
public java.util.List getSelectedChannels(java.lang.String container) throws ProviderContextException
container
- Container channel name.
channel is not contained.
List
of String
s; the channel names.
ProviderContextException
- if an error occurs in getting the
selected channels for the named container.public java.util.List getAvailableChannels(java.lang.String container) throws ProviderContextException
container
- Container channel name.
List
of String
s; the channel names.
ProviderContextException
- if an error occurs in getting the
available channels for the named container.public void setSelectedChannels(java.lang.String container, java.util.List selelected) throws ProviderContextException
container
- Container channel name.
ProviderContextException
- if an error occurs in setting the
selected channels for the named container.public void setAvailableChannels(java.lang.String container, java.util.List available) throws ProviderContextException
container
- Container channel name.available
- List
of
String
s; the channel names.
ProviderContextException
- if an error occurs in setting the
available channels for the named container.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |