Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01

weblogic.workarea
Interface WorkContextMap


public interface WorkContextMap

WorkContextMap provides users with 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 WorkContexts in existance in the map.
 boolean isPropagationModePresent(int PropagationMode)
          Given a PropagationMode PropagationMode , this method will iterate over the map and return true if the propagation mode is present.
 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

put

WorkContext put(String key,
                WorkContext ctx)
                throws PropertyReadOnlyException
Adds context data with key 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.

Parameters:
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.

put

WorkContext put(String key,
                WorkContext ctx,
                int propagationMode)
                throws PropertyReadOnlyException
Adds context data with key 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. PropagationModes are additive and can be used together. PropagationMode.GLOBAL is an alias for PropagationMode.RMI, PropagationMode.SOAP, PropagationMode.JMS_QUEUE and PropagationMode.MIME_HEADERS

Parameters:
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.
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.
See Also:
PropagationMode

get

WorkContext get(String key)
Get the current WorkContextMap's context data for key. If the current WorkContextMap has no value for key then null is returned.

Parameters:
key - a unique String that is used to obtain a reference to a particular WorkContext
Returns:
a WorkContext value or null if there is none.

getPropagationMode

int getPropagationMode(String key)
Get the current WorkContextMap's PropagationMode value for key. If the current WorkContextMap has no value for key then PropagationMode.LOCAL is returned.

Parameters:
key - a unique String that is used to obtain a reference to a particular WorkContext
Returns:
a bitwise-OR of PropagationMode values prescribing how the WorkContext entry should be propagated.

isPropagationModePresent

boolean isPropagationModePresent(int PropagationMode)
Given a PropagationMode PropagationMode , this method will iterate over the map and return true if the propagation mode is present. The method should return true if there exists at least one entry in the map which has at least one propagation mode specified by propMode

Parameters:
PropagationMode - PropagationMode value
Returns:
boolean true or false

remove

WorkContext remove(String key)
                   throws NoWorkContextException,
                          PropertyReadOnlyException
Remove the context data for key from the current WorkContextMap. This will throw PropertyReadOnlyException if the permissions on the key do not allow deletion.

Parameters:
key - a unique String that is used to obtain a reference to a particular WorkContext
Returns:
the removed WorkContext
Throws:
NoWorkContextException - if there is no mapping for key
PropertyReadOnlyException - if a mapping exists but is read-only.

isEmpty

boolean isEmpty()
Tests to see whether there are any WorkContexts in existance in the map. Returns true if there are no elements in the map, false otherwise.

Returns:
a boolean value

iterator

Iterator iterator()
Return a iterator for all of the current WorkContext entries. If there are no entries then null is returned.

Returns:
a Iterator representing the current entries.

keys

Iterator keys()
Return a iterator for all of the current WorkContext keys. If there are no entries then null is returned.

Returns:
a Iterator representing the current keys.

Copyright 1996, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01