|
BEA Systems, Inc. | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
WorkContextMap
provides internal users and layered products
mechanisms for tagging certain requests (whether remote or local)
and propagating that information based on certain policy
constraints.
WorkContextMap
is part of a client or
application's JNDI environment and can be access through JNDI:
WorkContextMap rc = (WorkContextMap) new InitialContext().lookup("java:comp/WorkContextMap");
Method Summary | |
WorkContext |
get(String key)
Get the current WorkContextMap's context data for key. |
int |
getPropagationMode(String key)
Get the current WorkContextMap 's
PropagationMode value for key. |
boolean |
isEmpty()
Tests to see whether there are any WorkContext s in
existance in the map. |
Iterator |
iterator()
Return a iterator for all of the current WorkContext
entries. |
Iterator |
keys()
Return a iterator for all of the current WorkContext
keys. |
WorkContext |
put(String key,
WorkContext ctx)
Adds context data with key key to the current
WorkContextMap and associates it with the current thread. |
WorkContext |
put(String key,
WorkContext ctx,
int propagationMode)
Adds context data with key key to the current
WorkContextMap and associates it with the current thread. |
WorkContext |
remove(String key)
Remove the context data for key from the current WorkContextMap. |
Method Detail |
public WorkContext get(String key)
key
- a unique String
that is used to obtain a
reference to a particular WorkContext
WorkContext
value or null if there is
none.public int getPropagationMode(String key)
WorkContextMap
's
PropagationMode
value for key. If the current
WorkContextMap
has no value for key then
PropagationMode.LOCAL is returned.
key
- a unique String
that is used to obtain a
reference to a particular WorkContext
PropagationMode
values
prescribing how the WorkContext
entry should be
propagated.public boolean isEmpty()
WorkContext
s in
existance in the map. Returns true if there are no elements in
the map, false otherwise.
boolean
valuepublic Iterator iterator()
WorkContext
entries. If there are no entries then null is returned.
Iterator
representing the current entries.public Iterator keys()
WorkContext
keys. If there are no entries then null is returned.
Iterator
representing the current keys.public WorkContext put(String key, WorkContext ctx) throws PropertyReadOnlyException
key
to the current
WorkContextMap and associates it with the current thread. The context
data is propagated according to the default
PropagationMode
. The
defaults are PropagationMode.DEFAULT
.
key
- a unique String
that is used to obtain a
reference to a particular WorkContext
. Keys are
encoded as DataOutput.writeUTF(java.lang.String)
. In order to protect
the key namespace a good convention is to use package names as a
prefix. For example com.you.SomeKey}.ctx
- The WorkContext
to put in the map.
- Returns:
- the previous WorkContext for key
- Throws:
PropertyReadOnlyException
- if the property already
exists and is read-only.
NullPointerException
- if the property or context is null.
public WorkContext put(String key, WorkContext ctx, int propagationMode) throws PropertyReadOnlyException
key
to the current
WorkContextMap and associates it with the current thread. This context
data is propagated according to the provided mode
propagationMode
. Any existing value for key will be
changed as per the property mode
propertyModeType
. It is legal for multiple context
data items to be propagated as long as their keys differ.
Properties that are set in the WorkContextMap are propagated
based on propagation policies assigned to the property. By
default a property is not propagated out of the current
thread. Applying PropagationMode.WORK
allows a
property to be propagated to Work instances. Applying
PropagationMode.RMI
allows a property to be
propagated in RMI calls. Applying
PropagationMode.TRANSACTION
allows a property to be
propagated between different global transactions. Applying
PropagationMode.JMS_QUEUE
allows a property to be
propagated to JMS consumers. Applying
PropagationMode.JMS_TOPIC
allows a property to be
propagated from JMS producers. Applying
PropagationMode.SOAP
allows a property to be
propagated across SOAP messages. Applying
PropagationMode.MIME_HEADER
allows a property to be
propagated from mail messages or cookies.
PropagationMode
s are additive and can be used
together. PropagationMode.GLOBAL
is an alias for
PropagationMode.RMI, PropagationMode.SOAP,
PropagationMode.JMS_QUEUE
and
PropagationMode.MIME_HEADERS
key
- a unique String
that is used to obtain a
reference to a particular WorkContext
. Keys are
encoded as DataOutput.writeUTF(java.lang.String)
. In order to protect
the key namespace a good convention is to use package names as a
prefix. For example com.you.SomeKey
.ctx
- The WorkContext
to put in the map.
specifies how the WorkContext
entry can be modified.propagationMode
- a bitwise-OR of
PropagationMode
values prescribing how the
WorkContext
entry should be propagated.
PropertyReadOnlyException
- if the property already
exists and is read-only.
NullPointerException
- if the property or context is null.PropagationMode
public WorkContext remove(String key) throws NoWorkContextException, PropertyReadOnlyException
PropertyReadOnlyException
if the
permissions on the key do not allow deletion.
key
- a unique String
that is used to obtain a
reference to a particular WorkContext
NoWorkContextException
- if there is no mapping for
key
PropertyReadOnlyException
- if a mapping exists but is
read-only.
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs90 Copyright 2005 BEA Systems Inc. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |