<commit_before># Libs directory definition
JEE_LIB_DIR = File.expand_path(File.dirname(__FILE__)) + '/jms'

# Befor all, the fundamental require for us
require 'java'

# Lib to JMS integration (contain the META-INF/applicationContext.xml)
require "#{JEE_LIB_DIR}/jsparrow-essential.jar"

#  Java EE
require "#{JEE_LIB_DIR}/javaee-1.5.jar"

# JMS API
require "#{JEE_LIB_DIR}/jms.jar"

module JSparrow
  module JMS

    module Session
      #
      # Sobrescreve metodos de instancia.
      #
      module OverrideMethods
        def create_text_message(text_message)
          enriches_message super(text_message)
        end

        def create_object_message(object_message)
          enriches_message super(object_message)
        end

        def create_map_message
          enriches_message super
        end
      
        def create_consumer(destination, criteria_for_receiving)
          enriches_consumer super(destination, criteria_for_receiving)
        end
      
        # --- Private methods -- #
        private
      
          def enriches_message(message)
            class << message
              include Message::EnrichesWithTyping
              include Message::EnrichesWithCriteria
            end
          
            message
          end
        
          def enriches_consumer(consumer)
            class << consumer
              include Consumer::OverrideMethods
            end
          
            consumer
          end
      end
    end
    
    module Consumer
      #
      # Sobrescreve metodos de instancia.
      #
      module OverrideMethods
        def receive(timeout)
          received_message = super(timeout)
        
          if received_message.nil?
            received_message
          else
            enriches_message received_message
          end
        end
      
        # --- Private methods -- #
        private
      
          def enriches_message(message)
            class << message
              include Message::EnrichesWithTyping
            end
          
            message
          end
      end
    end
    
    module Message
      #
      # Identifica o tipo de uma mensagem.
      #
      module EnrichesWithTyping
        def is_text_message?
          respond_to? :get_text
        end
    
        def is_object_message?
          (respond_to? :get_object and !(respond_to? :get_long))
        end
    
        def is_map_message?
          respond_to? :get_long
        end
      end
    
      #
      # Adiciona criterios a mensagem.
      #
      module EnrichesWithCriteria
        def add_criteria_to_reception(name, value)
          set_string_property(name, value)
        end
      end
    end
  end
end<commit_msg>firulitx<commit_after># Libs directory definition
JEE_LIB_DIR = File.expand_path(File.dirname(__FILE__)) + '/jms'

require 'java'
require "#{JEE_LIB_DIR}/jsparrow-essential.jar"
require "#{JEE_LIB_DIR}/javaee-1.5.jar"
require "#{JEE_LIB_DIR}/jms.jar"

module JSparrow
  module JMS

    module Session
      #
      # Sobrescreve metodos de instancia.
      #
      module OverrideMethods
        def create_text_message(text_message)
          enriches_message super(text_message)
        end

        def create_object_message(object_message)
          enriches_message super(object_message)
        end

        def create_map_message
          enriches_message super
        end
      
        def create_consumer(destination, criteria_for_receiving)
          enriches_consumer super(destination, criteria_for_receiving)
        end
      
        # --- Private methods -- #
        private
      
          def enriches_message(message)
            class << message
              include Message::EnrichesWithTyping
              include Message::EnrichesWithCriteria
            end
          
            message
          end
        
          def enriches_consumer(consumer)
            class << consumer
              include Consumer::OverrideMethods
            end
          
            consumer
          end
      end
    end
    
    module Consumer
      #
      # Sobrescreve metodos de instancia.
      #
      module OverrideMethods
        def receive(timeout)
          received_message = super(timeout)
        
          if received_message.nil?
            received_message
          else
            enriches_message received_message
          end
        end
      
        # --- Private methods -- #
        private
      
          def enriches_message(message)
            class << message
              include Message::EnrichesWithTyping
            end
          
            message
          end
      end
    end
    
    module Message
      #
      # Identifica o tipo de uma mensagem.
      #
      module EnrichesWithTyping
        def is_text_message?
          respond_to? :get_text
        end
    
        def is_object_message?
          (respond_to? :get_object and !(respond_to? :get_long))
        end
    
        def is_map_message?
          respond_to? :get_long
        end
      end
    
      #
      # Adiciona criterios a mensagem.
      #
      module EnrichesWithCriteria
        def add_criteria_to_reception(name, value)
          set_string_property(name, value)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.05051789932763947, 'fraction_numerical': 0.0007268762493185535, 'mean_word_length': 1.4108628996933859, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2422432', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1451, 'n_words': 323}