Class: OpenWFE::InMemoryErrorJournal

Inherits:
ErrorJournal show all
Defined in:
lib/openwfe/expool/errorjournal.rb

Overview

Stores all the errors in a hash… For testing purposes only, like the InMemoryExpressionStorage.

Instance Attribute Summary

Attributes included from ServiceMixin

#service_name

Attributes included from Contextual

#application_context

Instance Method Summary collapse

Methods inherited from ErrorJournal

#has_errors?, reduce_error_list

Methods included from OwfeServiceLocator

#get_engine, #get_error_journal, #get_expool, #get_expression_map, #get_expression_pool, #get_expression_storage, #get_expression_storages, #get_journal, #get_participant_map, #get_scheduler, #get_wfid_generator

Methods included from ServiceMixin

#service_init, #stop

Methods included from Contextual

#get_work_directory, #init_service, #lookup

Methods included from Logging

#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn

Constructor Details

#initialize(service_name, application_context) ⇒ InMemoryErrorJournal

Returns a new instance of InMemoryErrorJournal.



259
260
261
262
263
264
# File 'lib/openwfe/expool/errorjournal.rb', line 259

def initialize (service_name, application_context)

    super

    @per_processes = {}
end

Instance Method Details

#get_error_log(wfid) ⇒ Object

Returns a list (older first) of the errors for a process instance identified by its fei or wfid.

Will return an empty list if there a no errors for the process instances.



273
274
275
276
277
# File 'lib/openwfe/expool/errorjournal.rb', line 273

def get_error_log (wfid)

    wfid = extract_wfid wfid, true
    @per_processes[wfid] or []
end

#get_error_logsObject

Reads all the error logs currently stored. Returns a hash wfid –> error list.



308
309
310
311
# File 'lib/openwfe/expool/errorjournal.rb', line 308

def get_error_logs

    @per_processes
end

#remove_error_log(wfid) ⇒ Object

Removes the error log for a process instance.



282
283
284
285
286
# File 'lib/openwfe/expool/errorjournal.rb', line 282

def remove_error_log (wfid)

    wfid = extract_wfid wfid, true
    @per_processes.delete(wfid)
end

#remove_errors(wfid, errors) ⇒ Object

Removes a list of errors from the error journal.

The ‘errors’ parameter may be a single error (instead of an array).



293
294
295
296
297
298
299
300
301
302
# File 'lib/openwfe/expool/errorjournal.rb', line 293

def remove_errors (wfid, errors)

    errors = Array(errors)

    log = get_error_log wfid

    errors.each do |e|
        log.delete e
    end
end