server/handlerwrappers/default.rb in cpee-1.3.193 vs server/handlerwrappers/default.rb in cpee-1.3.194

- old
+ new

@@ -11,10 +11,30 @@ # You should have received a copy of the GNU General Public License along with # CPEE (file COPYING in the main directory). If not, see # <http://www.gnu.org/licenses/>. class DefaultHandlerWrapper < WEEL::HandlerWrapperBase + def self::inform_syntax_error(arguments,err,code)# {{{ + controller = arguments[0] + controller.notify("description/error", :instance => controller.instance, :message => err.message) + end# }}} + def self::inform_state_change(arguments,newstate) # {{{ + controller = arguments[0] + controller.serialize_state! + controller.notify("state/change", :instance => controller.instance, :state => newstate) + end # }}} + def self::inform_handlerwrapper_error(arguments,err) # {{{ + controller = arguments[0] + controller.notify("handlerwrapper/error", :instance => controller.instance, :message => err.message) + end # }}} + def self::inform_position_change(arguments,ipc={}) # {{{ + controller = arguments[0] + controller.serialize_positions! + ipc[:instance] = controller.instance + controller.notify("position/change", ipc) + end # }}} + def initialize(arguments,endpoint=nil,position=nil,continue=nil) # {{{ @controller = arguments[0] @log_hash = {} @handler_continue = continue @handler_endpoint = endpoint @@ -98,14 +118,10 @@ def inform_activity_failed(err) # {{{ puts err.message puts err.backtrace @controller.notify("activity/failed", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1]) end # }}} - - def inform_syntax_error(err,code)# {{{ - @controller.notify("description/error", :instance => @controller.instance, :message => err.message) - end# }}} def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{ unless status.nil? @controller.serialize_status! @controller.notify("status/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :id => status.id, :message => status.message) end @@ -116,21 +132,10 @@ unless changed_endpoints.nil? @controller.serialize_endpoints! @controller.notify("endpoints/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :changed => changed_endpoints) end end # }}} - def inform_position_change(ipc={}) # {{{ - @controller.serialize_positions! - ipc[:instance] = @controller.instance - @controller.notify("position/change", ipc) - end # }}} - def inform_state_change(newstate) # {{{ - if @controller - @controller.serialize_state! - @controller.notify("state/change", :instance => @controller.instance, :state => newstate) - end - end # }}} def vote_sync_after # {{{ @controller.call_vote("activity/syncing_after", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position) end # }}} def vote_sync_before(parameters=nil) # {{{ @@ -190,10 +195,10 @@ @handler_passthrough = nil @handler_continue.continue end end - def simulate(type,nesting,tid,parent,parameters={}) #{{{ + def simulate(type,nesting,tid,parent,parameters={}) #{{{ pp "#{type} - #{nesting} - #{tid} - #{parent} - #{parameters.inspect}" @controller.call_vote("simulating/step", :endpoint => @handler_endpoint, :instance => @controller.instance,