Package org.frankframework.core
Class PipeLineSession
- All Implemented Interfaces:
Serializable
,AutoCloseable
,Cloneable
,Map<String,
Object>
Basic implementation of
PipeLineSession
.- Since:
- version 3.2.2
- Author:
- Johan Verrips IOS
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorDescriptionPipeLineSession
(int initialCapacity) PipeLineSession
(int initialCapacity, float loadFactor) Create new PipeLineSession from existing map or session. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
Retrieves aboolean
value from the PipeLineSessiondouble
Retrieves adouble
value from the PipeLineSessionint
Retrieves anint
value from the PipeLineSessionlong
Retrieves along
value from the PipeLineSessionRetrieves aString
value from the PipeLineSessiongetBoolean
(String key) Retrieves aBoolean
value from the PipeLineSessiongetInteger
(String key) Retrieves anInteger
value from the PipeLineSessiongetMessage
(String key) Retrieves the value associated with the specified key and returns it as aMessage
object.Get value of a PipeLineSession key as String.static Instant
getTsReceived
(Map<String, Object> context) static Instant
boolean
isScheduledForCloseOnExit
(AutoCloseable message) void
mergeToParentSession
(String keysToCopy, Map<String, Object> to) void
void
scheduleCloseOnSessionExit
(AutoCloseable resource, String requester) void
setExitState
(PipeLine.ExitState state, Integer code) void
setExitState
(PipeLineResult pipeLineResult) void
setSecurityHandler
(ISecurityHandler handler) void
static void
Convenience method to set required parameters from listeners.static void
updateListenerParameters
(Map<String, Object> map, String messageId, String correlationId, Instant tsReceived, Instant tsSent) Convenience method to set required parameters from listeners.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
SYSTEM_MANAGED_RESOURCE_PREFIX
- See Also:
-
ORIGINAL_MESSAGE_KEY
- See Also:
-
MESSAGE_ID_KEY
- See Also:
-
CORRELATION_ID_KEY
- See Also:
-
STORAGE_ID_KEY
- See Also:
-
MANUAL_RETRY_KEY
- See Also:
-
TS_RECEIVED_KEY
- See Also:
-
TS_SENT_KEY
- See Also:
-
SECURITY_HANDLER_KEY
- See Also:
-
HTTP_METHOD_KEY
- See Also:
-
HTTP_REQUEST_KEY
- See Also:
-
HTTP_RESPONSE_KEY
- See Also:
-
API_PRINCIPAL_KEY
- See Also:
-
EXIT_STATE_CONTEXT_KEY
- See Also:
-
EXIT_CODE_CONTEXT_KEY
- See Also:
-
-
Constructor Details
-
PipeLineSession
public PipeLineSession() -
PipeLineSession
public PipeLineSession(int initialCapacity) -
PipeLineSession
public PipeLineSession(int initialCapacity, float loadFactor) -
PipeLineSession
Create new PipeLineSession from existing map or session. This may not be null!- Parameters:
t
-Map
or PipeLineSession from which to copy session variables into the new session. Should not be null!
-
-
Method Details
-
setExitState
-
setExitState
-
mergeToParentSession
Copy specified keys from thefrom
PipeLineSession
to the parentPipeLineSession
orMap
to
. Any keys present in both parent and child session will be unregistered from closing on the closing of the child session.The keys which will be copied are specified in parameter
keysToCopy
. Keys names are separated by , or ; symbols. If that parameter isnull
then all keys will be copied, if it is an empty string then no keys will be copied.- Parameters:
keysToCopy
- Keys to be copied, separated by {@value ,} or {@value ;}. Ifnull
then all keys will be copied. If an empty string then no keys will be copied.to
- ParentPipeLineSession
orMap
.
-
put
-
putAll
-
getMessageId
-
getCorrelationId
-
getMessage
Retrieves the value associated with the specified key and returns it as aMessage
object. If the key does not exist or the value is null, it returns a null message.NB: If the underlying value was a stream, reading the message will read the underlying stream. The value can be preserved in the message, but the underlying stream can not be preserved and reading the same session key again will effectively return an empty value.
- Parameters:
key
- The key for which to retrieve the value.- Returns:
- The value associated with the key encapsulated in a
Message
object. If the key does not exist or the value is null, a null message is returned.
-
getTsReceived
-
getTsReceived
-
getTsSent
-
getTsSent
-
updateListenerParameters
public static void updateListenerParameters(@Nonnull Map<String, Object> map, @Nullable String messageId, @Nullable String correlationId) Convenience method to set required parameters from listeners. Will not update messageId and correlationId when NULL. Sets the current date-time as TS-Received. -
updateListenerParameters
public static void updateListenerParameters(@Nonnull Map<String, Object> map, @Nullable String messageId, @Nullable String correlationId, @Nullable Instant tsReceived, @Nullable Instant tsSent) Convenience method to set required parameters from listeners. Will not update messageId and correlationId when NULL. Will use current date-time for TS-Received if null. -
setSecurityHandler
-
getSecurityHandler
public ISecurityHandler getSecurityHandler() throws org.apache.commons.lang3.NotImplementedException- Throws:
org.apache.commons.lang3.NotImplementedException
-
getString
Get value of a PipeLineSession key as String.NB: If the value was a stream, the stream is read and closed. If the value was another kind of
AutoCloseable
, then a side effect of this method may also be the value was closed.- Parameters:
key
- Session key to get.- Returns:
- Value of the session key as String, or NULL of either the key was not present or had a NULL value.
-
get
Retrieves aString
value from the PipeLineSession- Parameters:
key
- the referenced keydefaultValue
- the value to return when the key cannot be found- Returns:
- String
-
get
Retrieves aboolean
value from the PipeLineSession- Parameters:
key
- the referenced keydefaultValue
- the value to return when the key cannot be found- Returns:
- boolean
-
getBoolean
Retrieves aBoolean
value from the PipeLineSession- Parameters:
key
- the referenced key- Returns:
- Boolean
-
get
Retrieves anint
value from the PipeLineSession- Parameters:
key
- the referenced keydefaultValue
- the value to return when the key cannot be found- Returns:
- int
-
getInteger
Retrieves anInteger
value from the PipeLineSession- Parameters:
key
- the referenced key- Returns:
- Integer
-
get
Retrieves along
value from the PipeLineSession- Parameters:
key
- the referenced keydefaultValue
- the value to return when the key cannot be found- Returns:
- long
-
get
Retrieves adouble
value from the PipeLineSession- Parameters:
key
- the referenced keydefaultValue
- the value to return when the key cannot be found- Returns:
- double
-
scheduleCloseOnSessionExit
-
isScheduledForCloseOnExit
-
unscheduleCloseOnSessionExit
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
getCloseables
-