Class PipeLineSession

    • Constructor Detail

      • PipeLineSession

        public PipeLineSession()
      • PipeLineSession

        public PipeLineSession​(int initialCapacity)
      • PipeLineSession

        public PipeLineSession​(int initialCapacity,
                               float loadFactor)
      • PipeLineSession

        public PipeLineSession​(@Nonnull
                               Map<String,​Object> t)
        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 Detail

      • mergeToParentSession

        public void mergeToParentSession​(String keysToCopy,
                                         Map<String,​Object> to)
        Copy specified keys from the from PipeLineSession to the parent PipeLineSession or Map 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 is null 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 ;}. If null then all keys will be copied. If an empty string then no keys will be copied.
        to - Parent PipeLineSession or Map.
      • getMessageId

        @Nullable
        public String getMessageId()
      • getCorrelationId

        @Nullable
        public String getCorrelationId()
      • getMessage

        @Nonnull
        public Message getMessage​(String key)
        Retrieves the value associated with the specified key and returns it as a Message 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

        public Instant getTsReceived()
      • getTsSent

        public Instant getTsSent()
      • 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

        public void setSecurityHandler​(ISecurityHandler handler)
      • getSecurityHandler

        public ISecurityHandler getSecurityHandler()
                                            throws org.apache.commons.lang3.NotImplementedException
        Throws:
        org.apache.commons.lang3.NotImplementedException
      • isUserInRole

        public boolean isUserInRole​(String role)
                             throws org.apache.commons.lang3.NotImplementedException
        Throws:
        org.apache.commons.lang3.NotImplementedException
      • getPrincipal

        public Principal getPrincipal()
                               throws org.apache.commons.lang3.NotImplementedException
        Throws:
        org.apache.commons.lang3.NotImplementedException
      • getString

        @Nullable
        public String getString​(@Nonnull
                                String key)
        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

        @Nullable
        public String get​(@Nonnull
                          String key,
                          @Nullable
                          String defaultValue)
        Retrieves a String value from the PipeLineSession
        Parameters:
        key - the referenced key
        defaultValue - the value to return when the key cannot be found
        Returns:
        String
      • get

        public boolean get​(String key,
                           boolean defaultValue)
        Retrieves a boolean value from the PipeLineSession
        Parameters:
        key - the referenced key
        defaultValue - the value to return when the key cannot be found
        Returns:
        boolean
      • getBoolean

        @Nullable
        public Boolean getBoolean​(String key)
        Retrieves a Boolean value from the PipeLineSession
        Parameters:
        key - the referenced key
        Returns:
        Boolean
      • get

        public int get​(String key,
                       int defaultValue)
        Retrieves an int value from the PipeLineSession
        Parameters:
        key - the referenced key
        defaultValue - the value to return when the key cannot be found
        Returns:
        int
      • getInteger

        @Nullable
        public Integer getInteger​(String key)
        Retrieves an Integer value from the PipeLineSession
        Parameters:
        key - the referenced key
        Returns:
        Integer
      • get

        public long get​(String key,
                        long defaultValue)
        Retrieves a long value from the PipeLineSession
        Parameters:
        key - the referenced key
        defaultValue - the value to return when the key cannot be found
        Returns:
        long
      • get

        public double get​(String key,
                          double defaultValue)
        Retrieves a double value from the PipeLineSession
        Parameters:
        key - the referenced key
        defaultValue - the value to return when the key cannot be found
        Returns:
        double
      • scheduleCloseOnSessionExit

        public void scheduleCloseOnSessionExit​(AutoCloseable resource,
                                               String requester)
      • isScheduledForCloseOnExit

        public boolean isScheduledForCloseOnExit​(AutoCloseable message)
      • unscheduleCloseOnSessionExit

        public void unscheduleCloseOnSessionExit​(AutoCloseable message)