Module: RSence

Defined in:
lib/rsence.rb,
lib/rsence/msg.rb,
lib/rsence/argv.rb,
lib/rsence/value.rb,
lib/rsence/daemon.rb,
lib/rsence/plugins.rb,
lib/rsence/plugins.rb,
lib/rsence/sigcomm.rb,
lib/rsence/http/broker.rb,
lib/rsence/http/rackup.rb,
lib/rsence/transporter.rb,
lib/rsence/dependencies.rb,
lib/rsence/http/request.rb,
lib/rsence/valuemanager.rb,
lib/rsence/http/response.rb,
lib/rsence/pluginmanager.rb,
lib/rsence/argv/argv_util.rb,
lib/rsence/argv/env_check.rb,
lib/rsence/argv/help_argv.rb,
lib/rsence/argv/save_argv.rb,
lib/rsence/argv/test_port.rb,
lib/rsence/default_config.rb,
lib/rsence/plugins/plugin.rb,
lib/rsence/sessionmanager.rb,
lib/rsence/sessionstorage.rb,
lib/rsence/plugins/servlet.rb,
lib/rsence/argv/status_argv.rb,
lib/rsence/argv/initenv_argv.rb,
lib/rsence/argv/startup_argv.rb,
lib/rsence/plugins/guiparser.rb,
lib/rsence/plugins/gui_plugin.rb,
lib/rsence/plugins/plugin_base.rb,
lib/rsence/plugins/plugin_plugins.rb,
lib/rsence/plugins/plugin_sqlite_db.rb,
lib/rsence/plugins/plugin_localization.rb

Overview

The RSence module contains the server interfaces of RSence.

The classes that matter from a Plugin developer’s point of view are:

  • GUIPlugin

    • Use for user interface plugins. Supports GUITree handling; the user interface starts automatically.

    • No server programming except defining GUITree YAML structures is required to define a user interface when using this class.

  • Plugin

    • Use for supporting plugins and advanced client-server development.

    • Great for providing backend functionality and miscellaneous API’s for other Plugins.

  • Servlet

    • Use for raw POST / GET handlers to provide external API’s, search engine indexes, plain html fallback etc.

  • HValue

    • Use for syncing data objects between client and server automatically.

    • Bind any plugin methods as responders / validators; they will be called whenever a client-server change triggers an data change event.

  • Message (msg)

    • Used extensively to pass around session, data and request/response bindings.

    • The standard convention is usage as the first parameter, named msg, of any method that includes handling session-related data.

Most other classes are inner workings of RSence itself and are subject to change without further notice.

Defined Under Namespace

Modules: ArgvUtil, Broker, Plugins Classes: Configuration, Dependencies, HValue, Message, PluginManager, Request, Response, SessionManager, SessionStorage, Transporter

Constant Summary collapse

SessionBackend =
SequelSessionStorage

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.argsHash

Command line options parsed

Key (Symbol)

Value

:env_path

(String) The directory of the environment.

:conf_files

(Array of Strings) Additional configuration files given with the --conf command-line option. Default is [].

:debug

(true or false) True, if the -d or --debug command-line option was given. Default is false.

:verbose

(true or false) True, if the -v or --verbose command-line option was given. Default is false.

:log_fg

(true or false) True, if the -f or --log-fg command-line option was given. Default is false.

:trace_js

(true or false) True, if the --trace-js command-line option was given. Default is false.

:trace_delegate

(true or false) True, if the --trace-delegate command-line option was given. Default is false.

:port

(String or nil) The TCP port number given with the --port command-line option. Default is nil.

:addr

(String or nil) The TCP bind address given with the --addr command-line option. Default is nil.

:server

(String or nil) The Rack http server handler given with the --server command-line option. Default is nil.

:reset_ses

(true or false) True, if the -r or --reset-sessions command-line option was given. Default is false.

:autoupdate

(true or false) True, if the -a or --auto-update command-line option was given. Default is false.

:latency

(Number) Amount of milliseconds to sleep in each request given with the --latency command-line option. Default is 0.

:say

(true or false) True, if the -S or --say command-line option was given. Default is false.

Returns:

  • (Hash)

    Parsed command-line options:



70
# File 'lib/rsence.rb', line 70

def self.args; @@argv_parser.args; end

.configHash

RSence runtime configuration data

Returns:

  • (Hash)

    the active configuration structure as defined by the default configuration and overridden by local configuration files.



89
90
91
# File 'lib/rsence.rb', line 89

def self.config
  @@config
end

.env_pathObject



72
# File 'lib/rsence.rb', line 72

def self.env_path; @@argv_parser.args[:env_path]; end

.plugin_managerObject



106
107
108
109
# File 'lib/rsence.rb', line 106

def self.plugin_manager
  return nil unless class_variable_defined?(:'@@plugin_manager')
  @@plugin_manager
end

.plugin_manager=(plugin_manager) ⇒ Object



110
111
112
113
114
115
116
117
# File 'lib/rsence.rb', line 110

def self.plugin_manager=(plugin_manager)
  if class_variable_defined?(:'@@plugin_manager')
    warn "WARN: @@plugin_manager already set."
    return
  else
    @@plugin_manager = plugin_manager
  end
end

.session_managerObject



132
133
134
135
# File 'lib/rsence.rb', line 132

def self.session_manager
  return nil unless class_variable_defined?(:'@@session_manager')
  @@session_manager
end

.session_manager=(session_manager) ⇒ Object



136
137
138
139
140
141
142
143
# File 'lib/rsence.rb', line 136

def self.session_manager=(session_manager)
  if class_variable_defined?(:'@@session_manager')
    warn "WARN: @@session_manager already set."
    return
  else
    @@session_manager = session_manager
  end
end

.transporterObject



93
94
95
96
# File 'lib/rsence.rb', line 93

def self.transporter
  return nil unless class_variable_defined?(:'@@transporter')
  @@transporter
end

.transporter=(transporter) ⇒ Object



97
98
99
100
101
102
103
104
# File 'lib/rsence.rb', line 97

def self.transporter=(transporter)
  if class_variable_defined?(:'@@transporter')
    warn "WARN: Transporter already set."
    return
  else
    @@transporter = transporter
  end
end

.value_managerObject



119
120
121
122
# File 'lib/rsence.rb', line 119

def self.value_manager
  return nil unless class_variable_defined?(:'@@value_manager')
  @@value_manager
end

.value_manager=(value_manager) ⇒ Object



123
124
125
126
127
128
129
130
# File 'lib/rsence.rb', line 123

def self.value_manager=(value_manager)
  if class_variable_defined?(:'@@value_manager')
    warn "WARN: @@value_manager already set."
    return
  else
    @@value_manager = value_manager
  end
end

.versionString

Returns The version of RSence.

Returns:

  • (String)

    The version of RSence



78
# File 'lib/rsence.rb', line 78

def self.version; @@argv_parser.version; end

Instance Method Details

#randgenObject

Unique random number generator:



11
# File 'lib/rsence/sessionmanager.rb', line 11

require 'randgen'