Changeset 238

Show
Ignore:
Timestamp:
12/15/06 11:16:43 (2 years ago)
Author:
sacha
Message:

closing connection
multiparty information added to the ebXML message info structure

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/message-handling-refactor-branch/src/hefeweizen_big_ania.rb

    r235 r238  
    453453              command, expectation = start_delivery( transaction, command_hash['b2b_system_name'] ) 
    454454              if command.nil? then 
    455                 @logger.warn "Unable to proceed with start deliervy." 
    456                 transaction.fail "Error starting delivery
     455                @logger.warn "Unable to proceed with start delivery." 
     456                transaction.fail "Error starting delivery.
    457457                return true 
    458458              else 
     
    462462              end 
    463463            elsif result == false then 
    464               @logger.debug "Problems processing new directive xx." 
    465               # ??? what TODO? 
    466               return false 
     464              msg = "Problems processing new directive. Check the logs." 
     465              @logger.debug msg 
     466              transaction.fail msg 
     467              return true 
    467468            end 
    468469          elsif result.class == String then 
     
    637638      ebMS_info = get_ebMS_info ebXML_message_id, b2b_system_name 
    638639      if ebMS_info.nil? then 
    639         @logger.warn "Problems gettig the ebXML Message Info structore from the message data store for ebXML message with id #{ebXML_message_id}" 
     640        @logger.warn "Problems gettig the ebXML Message Info structure from the message data store for ebXML message with id #{ebXML_message_id}" 
    640641        return false 
    641642      end 
     
    643644       
    644645#      # adding delivery informationn to the ebMS_info 
    645 #      ebMS_info.merge! = get_delivery_info ebMS_info 
    646        
    647 #      store_ebMS_info ebMS_info, b2b_system_name 
     646      delivery = ebMS_info['delivery'] = Hash.new 
     647      delivery['start delivery'] = Time.now.to_s 
     648      store_ebMS_info ebMS_info, b2b_system_name 
    648649       
    649650      ebXML_message_file_path = "#{@config['MESSAGE_DIR']}/#{b2b_system_name}/#{ebMS_info['ebXML_message']['ebXML_message_id']}/ebXML_message.ebMS2" 
     
    677678    def start_delivery transaction, b2b_system_name 
    678679      @logger.debug "Starting the delivery process." 
    679       transaction.transition_to_new_state "ebXML message delivery process started" 
    680680 
    681681      expectation = "start_ebXML_message_delivery" 
     
    779779 
    780780 
     781    # This method processes a new directive. 
     782    # This method will forward the request to process the directive  
     783    # to the the b2b_system. If the b2b system could process the directive 
     784    # then this method updates the transaction to know about the new ebXML message 
     785    # and ebXML message info. 
    781786    def process_new_directive2 command, command_hash, transaction 
    782787       
     
    827832      end 
    828833       
    829       # Some transaction stuff 
    830       path = "#{@config['MESSAGE_DIR']}/#{b2b_system.system_name}/#{ebMS_info['ebXML_message']['ebXML_message_id']}" 
    831       complete_ebXML_message_file_path = "#{path}/ebXML_message.ebMS2" 
    832       complete_ebXML_message_parameters_file_path = "#{path}/ebXML_message_parameters.yml" 
    833  
    834       transaction.attach_file complete_ebXML_message_file_path, "outgoing ebXML message" 
    835       transaction.attach_file complete_ebXML_message_parameters_file_path, "outgoing ebXML message parameters" 
    836  
    837       # attach the ebXML message to the transaction 
    838       transaction.transition_to_new_state "plain outgoing ebXML message created" 
    839       @logger.debug "Setting ebXML message id '#{ebMS_info['ebXML_message']['ebXML_message_id']}' to transaction." 
    840       transaction.add_ebXML_message_id_reference ebMS_info['ebXML_message']['ebXML_message_id'] 
    841  
    842  
    843       # ebXML message is created. 
     834      add_ebXML_message_info_to_transaction transaction, b2b_system.system_name, ebMS_info 
     835 
     836      transaction.transition_to_new_state "directive processed." 
     837 
    844838      # Continue with processing 
    845839 
     
    868862      end 
    869863       
     864      return true 
     865    end 
     866 
     867    # Add the information of an ebXML message to a transaction. 
     868    def add_ebXML_message_info_to_transaction transaction, b2b_system_name, ebMS_info 
     869      @logger.debug "Adding ebXML message information to transaction" 
     870      path = "#{@config['MESSAGE_DIR']}/#{b2b_system_name}/#{ebMS_info['ebXML_message']['ebXML_message_id']}" 
     871      complete_ebXML_message_file_path = "#{path}/ebXML_message.ebMS2" 
     872      complete_ebXML_message_parameters_file_path = "#{path}/ebXML_message_parameters.yml" 
     873 
     874      transaction.attach_file complete_ebXML_message_file_path, "outgoing ebXML message" 
     875      transaction.attach_file complete_ebXML_message_parameters_file_path, "outgoing ebXML message parameters" 
     876 
     877      # attach the ebXML message to the transaction 
     878      @logger.debug "Setting ebXML message id '#{ebMS_info['ebXML_message']['ebXML_message_id']}' to transaction." 
     879      transaction.add_ebXML_message_id_reference ebMS_info['ebXML_message']['ebXML_message_id'] 
     880 
    870881      return true 
    871882    end 
     
    12141225 
    12151226    def close_open_connection command_hash, instruction_pipe, transaction 
    1216       if command_hash['transport_protocol'].upcase == 'HTTP' then 
    1217         if command_hash["transport_request_or_response"] = "response" then 
    1218           @logger.debug "There is nothing to be closed because we are already on the HTTP response leg." 
    1219           return true 
    1220         end 
    1221       end 
     1227#      if command_hash['transport_protocol'].upcase == 'HTTP' then 
     1228#        if command_hash["transport_request_or_response"] = "response" then 
     1229#          @logger.debug "There is nothing to be closed because we are already on the HTTP response leg." 
     1230#          return true 
     1231#        end 
     1232#      end 
    12221233 
    12231234      command_to_http_server = { 
  • branches/message-handling-refactor-branch/src/hefeweizen_library_b2b_system.rb

    r233 r238  
    173173      end 
    174174 
    175       # This message processes a directive. This typically invloves to create an ebXML message. 
     175      # This message processes a directive.  
     176      # This typically invloves  
     177      # o to create an ebXML message. 
     178      # o add the ebXML message to the message store 
     179      # This method returns the ebXML message info that includes the  
     180      # ebXML message id etc. 
    176181      def process_directive directive 
    177182        # get the ebXML Message information 
    178         # this will hold all the required information about what has to be 
    179         # in the ebXML message plus how it has to be sent. 
    180183        ebMS_message_info = get_ebMS_message_info directive 
    181184        if ebMS_message_info.nil? then 
     
    198201        dev['ebXML_message_id'] = metadata['ebXML_message_id'] 
    199202        dev['ebXML_message_conversation_id'] = metadata['ebXML_message_conversation_id'] 
     203        dev['ebXML_message_is_mutliparty'] = metadata['ebXML_message_is_multiparty'] 
    200204 
    201205        # add directive stuff to ebMS_info 
  • branches/message-handling-refactor-branch/src/hefeweizen_library_ebMS_message2.rb

    r233 r238  
    7171 
    7272        # creating the ebXML message 
    73         success = TempEBMessage2.create_message( party_ids, directive, ebMS_message_info,  
     73        success, is_multiparty = TempEBMessage2.create_message( party_ids, directive, ebMS_message_info,  
    7474                                                 file_path, @config, message_id, conversation_id) 
    7575         
     
    8585          'temp_ebXML_message_file_path' => file_path, 
    8686          'ebXML_message_id' => message_id,  
    87           'ebXML_message_conversation_id' => conversation_id} 
     87          'ebXML_message_conversation_id' => conversation_id, 
     88          'ebXML_message_is_multiparty' => is_multiparty 
     89        } 
    8890 
    8991      end 
     
    391393      def TempEBMessage2.create_message party_ids, directive, ebMS_message_info, complete_ebXML_message_file_path,  
    392394        config, message_id, conversation_id 
     395 
     396        is_multiparty = false 
    393397 
    394398        # Party Identities 
     
    426430           
    427431          ebXML_message.close 
    428           return true 
     432          return true, is_multiparty 
    429433 
    430434        else 
     
    460464          my_payloads = Array.new 
    461465          if !directive.payloads.nil? and !directive.payloads.empty? then 
     466            is_multiparty = true 
    462467            config['LOGGER'].debug "Number of payloads in directives is #{directive.payloads.size.to_s}." 
    463468            errors = false 
     
    559564          end 
    560565           
    561           return true 
     566          return true, is_multiparty 
    562567           
    563568        end 
  • branches/message-handling-refactor-branch/src/taskers/hefeweizen_tasker_application_send_ebXML_message.rb

    r233 r238  
    120120          # TODO 
    121121          extra_header = 'Content-Type: type="text/xml";' 
    122           if @ebXML_message_parameters['is_multipart'] then 
     122          if @ebXML_message_parameters['ebXML_message']['is_multiparty'] == true then 
    123123            extra_header += ' multipart/related; boundary="HefeWeizenBoundary"' 
    124124          end