Changeset 233

Show
Ignore:
Timestamp:
12/14/06 15:24:52 (2 years ago)
Author:
sacha
Message:

more fixes to get the basics working

Files:

Legend:

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

    r232 r233  
    666666    end 
    667667     
    668     def temp_close_connection command, command_hash, transaction 
    669       puts 'xxxxxxxxxxxxxxxxxxxx' 
    670     end 
    671  
    672668    def delivery_ack_requested? ebMS_info 
    673669      (ebMS_info['info']['mc-ackRequested'] == 'always' or ( ebMS_info['info']['mc-ackRequested'] == 'perMessage' and !ebMS_info['directive']['ackRequested'].nil? ) ) ? true : false 
     
    760756              return false, msg 
    761757            else 
    762               @logger.debug "Processing response from sending ebXMl message." 
     758              @logger.debug "Processing response from sending ebXML message." 
    763759              result = process_new_ebXML_message2 command, command_hash, transaction               
    764760              if result == false then 
     
    915911      # depends whether this is received on server or is a response from a client. 
    916912      if command_hash['file_full'] then 
     913        @logger.debug "This ebXML message seems to be received by an server" 
    917914        # setting root cause of this new transaction. 
    918915        transaction.set_root_cause command_hash['file_full'] 
     
    923920        transaction.remember_file_to_remove [command_hash['file_full'], command_hash['file_body'], command_hash['file_header']] 
    924921      else 
     922        @logger.debug "This ebXML message seems to be received by an client" 
    925923        # setting root cause of this new transaction. 
    926924        transaction.set_root_cause command_hash['response_file_path'] 
     
    976974 
    977975 
    978        
    979976      # CONTINUE WITH PROCESSING 
    980977      # ------------------------ 
     
    10341031 
    10351032        # CONTINUE PROCESSING 
     1033        # ------------------- 
    10361034 
    10371035        # Check if there is something else to do. 
     
    10681066          @logger.debug "No futher action required for ebXML message '#{ebXML_message_object.summary}'." 
    10691067        end 
    1070          
    1071         instruction_pipe = command_hash['pipe_for_instructions'] 
    1072  
    1073         if new_delivery == true then 
    1074  
    1075           @logger.debug "There are responses to be delivered." 
     1068      end 
     1069   
     1070      instruction_pipe = command_hash['pipe_for_instructions'] 
     1071       
     1072      if new_delivery == true then 
    10761073           
    1077           if ebMS_info['info']['transport-protocol-name'].upcase != "HTTP" then 
    1078             close_open_connection instruction_pipe, transaction 
    1079             # start new sending tasker. 
    1080  
    1081           else 
    1082  
    1083             # new_ebXML_message_object 
    1084             # new_ebXML_message_info 
     1074        @logger.debug "There are responses to be delivered." 
     1075         
     1076        if ebMS_info['info']['transport-protocol-name'].upcase != "HTTP" then 
     1077          @logger.debug "If we do not have the HTTP transport protocol then we can close the connection." 
     1078          close_open_connection instruction_pipe, transaction 
     1079 
     1080          # start new sending tasker. 
     1081          @logger.error "Sending non HTTP transport protocol is not yet implemented." 
     1082          return false 
     1083           
     1084        else 
     1085           
     1086          @logger.debug "Sending an ebXML response message via the HTTP transport protocol." 
     1087 
     1088          # new_ebXML_message_object 
     1089          # new_ebXML_message_info 
     1090           
     1091          # -> sign messages? 
     1092          # start delivery? command? 
     1093           
     1094          if new_ebXML_message_object.is_ebMS_signal? then 
     1095            # <enumeration value="mshSignalsOnly"/> 
     1096            # <enumeration value="responseOnly"/> 
     1097            # <enumeration value="signalsAndResponse"/> 
     1098            # <enumeration value="signalsOnly"/> 
     1099            # <enumeration value="none"/> 
    10851100             
    1086             # -> sign messages? 
    1087             # start delivery? command? 
    1088  
    1089             if new_ebXML_message_object.is_ebMS_signal? then 
    1090               # <enumeration value="mshSignalsOnly"/> 
    1091               # <enumeration value="responseOnly"/> 
    1092               # <enumeration value="signalsAndResponse"/> 
    1093               # <enumeration value="signalsOnly"/> 
    1094               # <enumeration value="none"/> 
    1095  
    1096               if ebMS_info['info']['mc-syncReplyMode'] == 'none' then 
    1097                 close_open_connection instruction_pipe, transaction 
    1098                 #start new sending tasker. 
    1099                 @logger.error "Not implemented yet to asynchronously send an ebXML response message" 
    1100                 # xxxxxxxxxxxxxxxx 
    1101               elsif ebMS_info['info']['mc-syncReplyMode'] == 'mshSignalsOnly' 
    1102                 @logger.debug "Sending msh signal synchronously back over HTTP transport protocol." 
    1103                 send_sync_response new_ebXML_message_object.raw_ebXML_message, transaction, instruction_pipe 
    1104  
    1105               elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsOnly' 
    1106                 @logger.warn "signalsAndResponse as syncReplyMode not implemented." 
    1107                 close_open_connection instruction_pipe, transaction 
    1108                 # ???? 
    1109                 return false 
    1110  
    1111               elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsAndResponse' 
    1112                 @logger.warn "signalsAndResponse as syncReplyMode not implemented." 
    1113                 close_open_connection instruction_pipe, transaction 
    1114                 # ???? 
    1115                 return false 
    1116  
    1117               elsif ebMS_info['info']['mc-syncReplyMode'] == 'responseOnly' 
    1118                 @logger.warn "signalsAndResponse as syncReplyMode not implemented." 
    1119                 close_open_connection instruction_pipe, transaction 
    1120                 # ???? 
    1121                 return false 
    1122  
    1123               else 
    1124                 @logger.debug "Unknown syncReplyMode '#{ebMS_info['info']['mc-syncReplyMode']}'. Not returning new responses." 
    1125                 close_open_connection instruction_pipe, transaction 
    1126                 # ???? 
     1101            if ebMS_info['info']['mc-syncReplyMode'] == 'none' then 
     1102              @logger.debug "The CPA indicates that the response ebXML message must be sent asynchronously. So closing connection first (if there is a connection)." 
     1103              close_open_connection instruction_pipe, transaction 
     1104              @logger.debug "The response ebXML message must be sent asynchronously ... so starting the delivery process for this new ebXML message." 
     1105               
     1106              # CREATING A NEW TRANSACTION FOR NEW ASYNC EBXML MESSAGE 
     1107              # ------------------------------------------------------ 
     1108 
     1109              puts '----------------' 
     1110              new_transaction = @transaction_manager.get_new_transaction 
     1111              puts 'oooooooooooooooo' 
     1112 
     1113              if new_transaction.nil? then 
     1114                @logger.debug "Error creating a new transaction." 
    11271115                return false 
    11281116              end 
    11291117 
     1118              @logger.debug "Created a new transaction for outgoing ebXML response message. Transaction id: #{new_transaction.transaction_id}" 
     1119 
     1120              # This is a new transaction so we have to set the root cause of this new transaction. 
     1121              if !new_transaction.set_root_cause new_ebXML_message_object.raw_message_file_path then 
     1122                @logger.error "Unable to store the new response ebXML message as root cause to the new transaction" 
     1123                # TODO remove stuff? 
     1124                return false 
     1125              else 
     1126                @logger.debug "Succesfully stored the directive as root cause" 
     1127              end 
     1128               
     1129              # Some transaction stuff 
     1130              path = "#{@config['MESSAGE_DIR']}/#{b2b_system.system_name}/#{new_ebXML_message_object.message_id}" 
     1131              complete_ebXML_message_file_path = "#{path}/ebXML_message.ebMS2" 
     1132              complete_ebXML_message_parameters_file_path = "#{path}/ebXML_message_parameters.yml" 
     1133               
     1134              new_transaction.attach_file complete_ebXML_message_file_path, "outgoing ebXML message (response)" 
     1135              new_transaction.attach_file complete_ebXML_message_parameters_file_path, "outgoing ebXML message parameters (response)" 
     1136               
     1137              # attach the ebXML message to the transaction 
     1138              new_transaction.transition_to_new_state "plain outgoing ebXML message created" 
     1139              @logger.debug "Setting ebXML message id '#{ebMS_info['ebXML_message']['ebXML_message_id']}' to transaction." 
     1140              new_transaction.add_ebXML_message_id_reference new_ebXML_message_object.message_id 
     1141               
     1142              command, expectation = start_delivery( new_transaction, b2b_system.system_name ) 
     1143              if command.nil? then 
     1144                @logger.warn "Unable to proceed with start deliervy." 
     1145                transaction.fail "Error starting delivery" 
     1146                return true 
     1147              else 
     1148                transaction.set_next_expectation(expectation) 
     1149                say_to_ania command 
     1150                return true 
     1151              end 
     1152 
     1153            elsif ebMS_info['info']['mc-syncReplyMode'] == 'mshSignalsOnly' 
     1154              @logger.debug "Sending msh signal synchronously back over HTTP transport protocol." 
     1155              send_sync_response new_ebXML_message_object.raw_message_file_path, transaction, instruction_pipe 
     1156               
     1157            elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsOnly' 
     1158              @logger.warn "signalsAndResponse as syncReplyMode not implemented." 
     1159              close_open_connection instruction_pipe, transaction 
     1160              # ???? 
     1161              return false 
     1162               
     1163            elsif ebMS_info['info']['mc-syncReplyMode'] == 'signalsAndResponse' 
     1164              @logger.warn "signalsAndResponse as syncReplyMode not implemented." 
     1165              close_open_connection instruction_pipe, transaction 
     1166              # ???? 
     1167              return false 
     1168               
     1169            elsif ebMS_info['info']['mc-syncReplyMode'] == 'responseOnly' 
     1170              @logger.warn "signalsAndResponse as syncReplyMode not implemented." 
     1171              close_open_connection instruction_pipe, transaction 
     1172              # ???? 
     1173              return false 
     1174               
    11301175            else 
     1176              @logger.debug "Unknown syncReplyMode '#{ebMS_info['info']['mc-syncReplyMode']}'. Not returning new responses." 
     1177              close_open_connection instruction_pipe, transaction 
     1178              # ???? 
     1179              return false 
    11311180            end 
    11321181 
     1182          else 
     1183            @logger.error "Responding an ebXML user message as a response to an ebXML message is not yet implemented." 
     1184            return false 
    11331185          end 
    1134  
    1135  
    1136         else 
    1137           @logger.debug "There are no responses to be delivered. Closing any open connection" 
    1138           close_open_connection instruction_pipe, transaction 
    1139         end 
    1140  
     1186           
     1187        end 
     1188         
     1189        # some more validations! 
    11411190        # o if sync protocol and no sync response expected. 
    11421191         
    1143          
    1144       end 
    1145  
    1146  
     1192      else           
     1193        @logger.debug "There are no responses to be delivered. Closing any open connection" 
     1194        close_open_connection instruction_pipe, transaction 
     1195       
     1196      end # if new_delivery == true 
    11471197 
    11481198      return true 
    1149  
    11501199 
    11511200    end 
     
    12091258          return false 
    12101259        else 
    1211           @logger.warn "Unkown type of ebXML message '#{ebXML_message_object.summary}'. No action taken." 
     1260          @logger.debug "No known action required for ebXML message with service '#{ebXML_message_object.service}' and action '#{ebXML_message_object.action}'. No action taken." 
     1261          return false 
    12121262        end 
    12131263      else 
     
    12161266      end 
    12171267    end 
     1268 
     1269 
     1270 
     1271 
     1272 
     1273 
    12181274 
    12191275    ################# rewrite 
  • branches/message-handling-refactor-branch/src/hefeweizen_library_b2b_system.rb

    r232 r233  
    267267        end 
    268268         
    269         file = command_hash['file_full'].nil? ? command_hash['response_file'] : command_hash['file_full'] 
     269        file = command_hash['file_full'].nil? ? command_hash['response_file_path'] : command_hash['file_full'] 
    270270 
    271271        # 1. create an ebXML message object 
     
    445445          # TODO remove new ebxml object ? 
    446446          return nil 
     447        else 
     448          ebXML_message_object.raw_message_file_path = "#{directory}/ebXML_message.ebMS2" 
    447449        end 
    448450 
  • branches/message-handling-refactor-branch/src/hefeweizen_library_ebMS_message2.rb

    r232 r233  
    280280      attr_reader :references, :payloads 
    281281      attr_reader :errors 
    282       attr_reader :raw_message_file_path 
     282      attr_accessor :raw_message_file_path 
    283283       
    284284      def get_hash_value cpa 
  • branches/message-handling-refactor-branch/src/hefeweizen_library_transactions.rb

    r232 r233  
    6969      end 
    7070       
     71      def get_new_transaction 
     72        get_transaction HefeWeizen::HefeWeizenLibrary::HefeWeizenUUID.uuid 
     73      end 
     74 
    7175      def get_transaction transaction_id 
    7276        transaction = nil 
  • branches/message-handling-refactor-branch/src/hefeweizen_library_utils.rb

    r205 r233  
    6969     
    7070    class HefeWeizenUUID 
    71       def self.uuid 
     71      def HefeWeizenUUID.uuid 
    7272        %x( uuid ).strip 
    7373      end 
  • branches/message-handling-refactor-branch/src/taskers/hefeweizen_tasker_application_send_ebXML_message.rb

    r232 r233  
    107107          # FIX ME FOR TESTING PURPOSE SEND IT TO A LOCAL WEBSERVER 
    108108          #        http_url = "localhost:5555/test" 
     109 
     110          # FIX ME FOR TESTING PURPOSE SEND IT TO A LOCAL WEBSERVER 
     111#          http_url = "192.168.1.49:8888/gnaraloo" 
    109112           
    110113          time = Time.now.to_f.to_s