Class: UU::OS::CMD::CommandCallbackContext

Inherits:
CommandContext show all
Defined in:
uu_os_cmd-server-2.5.1/lib/uu/os/cmd/command_callback_context.rb

Overview

Callback execution context.

Constant Summary

Instance Attribute Summary (collapse)

Attributes inherited from Application::UseCaseContext

#parameters, #session, #uu_uri

Instance Method Summary (collapse)

Methods inherited from CommandContext

#invoke_async, #invoke_async_status

Instance Attribute Details

- (Exception?) exception (readonly)

Error raised from invocation of asynchronous command for which was callback invoked. In case asynchronous command finished successfully, exception should be nil.

Returns:

  • (Exception, nil)

    Asynchronous command error.



23
24
25
# File 'uu_os_cmd-server-2.5.1/lib/uu/os/cmd/command_callback_context.rb', line 23

def exception
  @exception
end

- (Object?) result (readonly)

Result of asynchronous command for which was callback invoked. May be nil if asynchronous command did not provide any result or invocation of asynchronous command failed.

Returns:

  • (Object, nil)

    Asynchronous command result.



18
19
20
# File 'uu_os_cmd-server-2.5.1/lib/uu/os/cmd/command_callback_context.rb', line 18

def result
  @result
end

- (String) state (readonly)

State of asynchronous command for which was callback invoked.

Returns:



13
14
15
# File 'uu_os_cmd-server-2.5.1/lib/uu/os/cmd/command_callback_context.rb', line 13

def state
  @state
end

Instance Method Details

- (Object) prepare_callback(action, session = nil, options = {})

Prepares callback object to be used in UU::OS::CMD::CommandClient.

Parameters:

  • action (Symbol, String)

    Action to be invoked as callback handler.

  • session (UU::OS::Security::Session) (defaults to: nil)

    Instance of session object to use for callback. If not set, callback will be invoked with the same session as asynchronous command for which the callback is defined.

  • options (Hash) (defaults to: {})

    Additional callback options.

Options Hash (options):

  • :parameters (Hash)

    Parameters to send to callback handler.

Returns:



53
54
55
# File 'uu_os_cmd-server-2.5.1/lib/uu/os/cmd/command_callback_context.rb', line 53

def prepare_callback(action, session = nil, options = {})
  raise 'Not supported for callbacks'
end