X4 Produktdokumentation

Global Context Manipulation

Similar to process variables, this adapter offers the option of caching arbitrary documents from a Technical Process in a global hash table so that this context can also be accessed by other processes, see the X4 Designer - Variable Block manual.

The documents stored in the global context are stored under a key and are available for the entire runtime of the X4 Server. The feature adapter can create, overwrite, and delete entries in the hash table, and list all or selected keys of the hash table entries.

Because a context applies X4 Server-wide and all Technical Processes access the same hash table, it is possible for other threads to set a document under the same key in parallel. In addition, small time differences between the Put and PutGet operations can provide ambiguous (e.g. empty) results.

Within XSL mappings, you can access previously defined context keys at run time via the globalcontext: URL protocol, see X4 Developer Guide – globalcontext: URL protocol.

Properties

Operation

Describes which operation the adapter performs.

Possible values:

  • Get: Read the entry whose key was set in the Key parameter from the global context and return the last fully saved document

  • Put: Save the input document with the key specified in the Key parameter in the global context and return the set entry

  • PutGet: Save the input document with a key in the global context and output the last fully saved document (it cannot be guaranteed that the most recent document will be returned!)

  • Remove: Delete the entry whose key was set in the Key parameter from the global context and return the deleted entry

  • List: Return all global context keys in an XML document

  • RemoveAllMatching: Delete all entries in the global context whose keys match the Regex filter expression in the Filter parameter

  • KeepAllMatching: Keep only entries in the global context whose keys match the Regex filter expression in the Filter parameter (delete all other entries)

  • ListAllMatchingKeys: Return all global context keys that match the Regex filter expression in the Filter parameter to an XML document

  • ListAllNotMatchingKeys: Return only global context keys that do not match the Regex filter expression in the Filter parameter in an XML document

Parameters

Key

Key under which an entry is stored in the global context

Possible values: Any string

Filter

Regular expression (regex) to filter for keys in the global context, according to java.util.pattern, see http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

Possible values: Any regular expression (e.g. .*Test.*)

Status values

1

The operation was successful.

0

The operation was successful, but the result is null or an empty list.

-1

The adapter could not be executed.