rsence 2.0.0.5.pre → 2.0.0.6.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/bin/rsence +4 -1
- data/conf/default_conf.yaml +1 -1
- data/conf/rsence_command_strings.yaml +444 -0
- data/js/comm/comm/autosync/autosync.js +1 -1
- data/js/comm/comm/comm.js +1 -1
- data/js/comm/comm/queue/queue.js +1 -1
- data/js/comm/comm/session/session.js +1 -1
- data/js/comm/comm/sessionwatcher/sessionwatcher.js +1 -1
- data/js/comm/comm/transporter/transporter.js +1 -1
- data/js/comm/comm/urlresponder/urlresponder.js +1 -1
- data/js/comm/comm/values/values.js +1 -1
- data/js/comm/jsloader/jsloader.js +1 -1
- data/js/comm/reloadapp/reloadapp.js +1 -1
- data/js/comm/sha/sha.js +1 -1
- data/js/comm/values/value/value.js +1 -1
- data/js/comm/values/valuematrix/valuematrix.js +1 -1
- data/js/controls/button/button.js +1 -1
- data/js/controls/checkbox/checkbox.js +1 -1
- data/js/controls/datetime/calendar/calendar.js +1 -1
- data/js/controls/datetime/datetimevalue/datetimevalue.js +1 -1
- data/js/controls/datetime/timesheet/timesheet.js +1 -1
- data/js/controls/datetime/timesheet_item/timesheet_item.js +1 -1
- data/js/controls/datetime/timesheet_item_edit/timesheet_item_edit.js +1 -1
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +1 -1
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +1 -1
- data/js/controls/dialogs/sheet/sheet.js +1 -1
- data/js/controls/imageview/imageview.js +1 -1
- data/js/controls/lists/checkboxlist/checkboxlist.js +1 -1
- data/js/controls/lists/listitems/listitems.js +1 -1
- data/js/controls/lists/radiobuttonlist/radiobuttonlist.js +1 -1
- data/js/controls/passwordcontrol/passwordcontrol.js +1 -1
- data/js/controls/progress/progressbar/progressbar.js +1 -1
- data/js/controls/progress/progressindicator/progressindicator.js +1 -1
- data/js/controls/radiobutton/radiobutton.js +1 -1
- data/js/controls/sliders/slider/slider.js +1 -1
- data/js/controls/sliders/vslider/vslider.js +1 -1
- data/js/controls/stepper/stepper.js +1 -1
- data/js/controls/stringview/stringview.js +1 -1
- data/js/controls/tab/tab.js +1 -1
- data/js/controls/textarea/textarea.js +1 -1
- data/js/controls/textcontrol/textcontrol.js +1 -1
- data/js/controls/uploader/uploader.js +1 -1
- data/js/controls/validatorview/validatorview.js +6 -2
- data/js/controls/window/window.js +1 -1
- data/js/core/class/class.js +1 -1
- data/js/core/elem/elem.js +1 -1
- data/js/core/event/event.js +1 -1
- data/js/core/iefix/iefix.js +1 -1
- data/js/foundation/application/application.js +1 -1
- data/js/foundation/control/control.js +1 -1
- data/js/foundation/control/controldefaults/controldefaults.js +1 -1
- data/js/foundation/control/dummyvalue/dummyvalue.js +1 -1
- data/js/foundation/control/dyncontrol/dyncontrol.js +1 -1
- data/js/foundation/control/eventresponder/eventresponder.js +1 -1
- data/js/foundation/control/valueresponder/valueresponder.js +1 -1
- data/js/foundation/geom/point/point.js +1 -1
- data/js/foundation/geom/rect/rect.js +1 -1
- data/js/foundation/json_renderer/json_renderer.js +1 -1
- data/js/foundation/system/system.js +1 -1
- data/js/foundation/thememanager/thememanager.js +1 -1
- data/js/foundation/view/markupview/markupview.js +1 -1
- data/js/foundation/view/morphanimation/morphanimation.js +1 -1
- data/js/foundation/view/view.js +1 -1
- data/js/foundation/view/viewdefaults/viewdefaults.js +1 -1
- data/js/views/centerview/centerview.js +1 -1
- data/js/views/inlineview/inlineview.js +1 -1
- data/js/views/scrollview/scrollview.js +1 -1
- data/lib/conf/argv.rb +719 -1006
- data/lib/conf/default.rb +14 -3
- data/lib/daemon/daemon.rb +1 -1
- data/lib/daemon/sigcomm.rb +1 -1
- data/lib/http/broker.rb +5 -1
- data/lib/http/rackup.rb +1 -1
- data/lib/http/request.rb +1 -1
- data/lib/http/response.rb +2 -2
- data/lib/plugins/dependencies.rb +36 -0
- data/lib/plugins/gui_plugin.rb +83 -80
- data/lib/plugins/guiparser.rb +7 -3
- data/lib/plugins/plugin.rb +308 -307
- data/lib/plugins/plugin_plugins.rb +5 -1
- data/lib/plugins/plugin_sqlite_db.rb +5 -1
- data/lib/plugins/plugin_util.rb +22 -0
- data/lib/plugins/pluginmanager.rb +95 -95
- data/lib/plugins/plugins.rb +117 -0
- data/lib/plugins/servlet.rb +47 -57
- data/lib/session/msg.rb +1 -1
- data/lib/session/sessionmanager.rb +1 -1
- data/lib/session/sessionstorage.rb +2 -2
- data/lib/transporter/transporter.rb +1 -2
- data/lib/values/hvalue.rb +7 -3
- data/lib/values/valuemanager.rb +7 -1
- data/plugins/client_pkg/client_pkg.rb +15 -48
- data/plugins/client_pkg/info.yaml +1 -1
- data/plugins/client_pkg/lib/client_pkg_build.rb +1 -1
- data/plugins/client_pkg/lib/client_pkg_cache.rb +1 -1
- data/plugins/index_html/index_html.rb +5 -6
- data/plugins/index_html/info.yaml +21 -0
- data/plugins/index_html/tmpl/index.html +1 -1
- data/plugins/index_html/tmpl/startup_index.html +1 -1
- data/plugins/main/info.yaml +21 -0
- data/plugins/main/main.rb +1 -5
- data/plugins/{ticketservices → ticket}/lib/common.rb +92 -2
- data/plugins/{ticketservices → ticket}/lib/favicon.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/file.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/img.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/objblob.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/rsrc.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/upload.rb +60 -31
- data/plugins/{ticketservices/ticketservices.rb → ticket/ticket.rb} +50 -118
- data/{plugins → setup}/legacy/info.yaml +0 -0
- data/{plugins → setup}/legacy/legacy.rb +2 -0
- data/setup/welcome/welcome.rb +1 -1
- metadata +27 -21
- data/conf/config.yaml +0 -4
- data/conf/local_conf.yaml.devel +0 -14
- data/lib/conf/wizard.rb +0 -303
- data/plugins/client_pkg/log/build_log +0 -0
- data/plugins/legacy/disabled +0 -0
- data/plugins/legacy/disabled- +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2010 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -6,6 +6,8 @@
|
|
6
6
|
# with this software package. If not, contact licensing@riassence.com
|
7
7
|
##
|
8
8
|
|
9
|
+
module ::RSence
|
10
|
+
module Plugins
|
9
11
|
## Interface to enable plugins in a plugin. Just include this in your subclass of Plugin.
|
10
12
|
module PluginPlugins
|
11
13
|
def init
|
@@ -45,3 +47,5 @@ module PluginPlugins
|
|
45
47
|
@plugin_plugins.delegate(:cloned_source,msg,target_session)
|
46
48
|
end
|
47
49
|
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2009 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -6,6 +6,8 @@
|
|
6
6
|
# with this software package. If not, contact licensing@riassence.com
|
7
7
|
##
|
8
8
|
|
9
|
+
module ::RSence
|
10
|
+
module Plugins
|
9
11
|
# Include this module in your plugin class to automatically
|
10
12
|
# create and connect/disconnect an sqllite database.
|
11
13
|
# The plugin instance will have a @db Sequel object refering
|
@@ -70,3 +72,5 @@ module PluginSqliteDB
|
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
75
|
+
end
|
76
|
+
end
|
data/lib/plugins/plugin_util.rb
CHANGED
@@ -1,8 +1,28 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2010 Riassence Inc.
|
3
|
+
# http://riassence.com/
|
4
|
+
#
|
5
|
+
# You should have received a copy of the GNU General Public License along
|
6
|
+
# with this software package. If not, contact licensing@riassence.com
|
7
|
+
##
|
1
8
|
|
9
|
+
module ::RSence
|
10
|
+
module Plugins
|
2
11
|
module PluginUtil
|
3
12
|
|
4
13
|
include RSence
|
5
14
|
|
15
|
+
#
|
16
|
+
# def self.method_missing( name, *args, &block )
|
17
|
+
# puts "method_missing:"
|
18
|
+
# puts " name: #{name.inspect}"
|
19
|
+
# puts " args: #{args.inspect}"
|
20
|
+
# puts " block: #{block.inspect}"
|
21
|
+
# if name == :bundle_path
|
22
|
+
# return Info.new( Module.nesting ).bundle_path
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
6
26
|
# Extend to do any initial configuration. Not doing anything by default.
|
7
27
|
def init
|
8
28
|
end
|
@@ -92,3 +112,5 @@ module PluginUtil
|
|
92
112
|
end
|
93
113
|
|
94
114
|
end
|
115
|
+
end
|
116
|
+
end
|
@@ -1,65 +1,69 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2006 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
5
5
|
# You should have received a copy of the GNU General Public License along
|
6
6
|
# with this software package. If not, contact licensing@riassence.com
|
7
7
|
##
|
8
|
+
# if RUBY_VERSION.to_f >= 1.9
|
9
|
+
# # with_module comes from:
|
10
|
+
# # http://coderrr.wordpress.com/2009/05/18/dynamically-adding-a-constant-nesting-in-ruby-1-9/
|
11
|
+
# module Kernel
|
12
|
+
# def with_module(*consts, &blk)
|
13
|
+
# slf = blk.binding.eval('self')
|
14
|
+
# l = lambda { slf.instance_eval(&blk) }
|
15
|
+
# consts.reverse.inject(l) {|l, k| lambda { k.class_eval(&l) } }.call
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
# end
|
8
19
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
20
|
+
# def bundle_loader( params )
|
21
|
+
# src_path = params[:src_path]
|
22
|
+
# mod = Module.new do |m|
|
23
|
+
# @@bundle_path = params[:bundle_path ]
|
24
|
+
# @@bundle_name = params[:bundle_name ]
|
25
|
+
# @@bundle_info = params[:bundle_info ]
|
26
|
+
# @@plugin_manager = params[:plugin_manager]
|
27
|
+
# def m.bundle_path; @@bundle_path; end
|
28
|
+
# def m.bundle_name; @@bundle_name; end
|
29
|
+
# def m.bundle_info; @@bundle_info; end
|
30
|
+
# def m.bundle_manager; @@bundle_manager; end
|
31
|
+
# begin
|
32
|
+
# # if RUBY_VERSION.to_f >= 1.9
|
33
|
+
# # # with_module(m) do
|
34
|
+
# # src = File.read(src_path)
|
35
|
+
# # self.module_eval(
|
36
|
+
# # <<-SRC
|
37
|
+
# # puts %{--- bundle_path: #{bundle_path.inspect}}
|
38
|
+
# # #{src}
|
39
|
+
# # SRC
|
40
|
+
# # )
|
41
|
+
# # # end
|
42
|
+
# # else
|
43
|
+
# if params[:bundle_info][:inits_self] == false or RUBY_VERSION.to_f >= 1.9
|
44
|
+
# m::module_eval( File.read(src_path) )
|
45
|
+
# elsif params[:bundle_info][:reloadable] == false
|
46
|
+
# require src_path[0..-4]
|
47
|
+
# else
|
48
|
+
# load src_path
|
49
|
+
# end
|
50
|
+
# # end
|
51
|
+
# rescue => e
|
52
|
+
# @@plugin_manager.plugin_error(
|
53
|
+
# e,
|
54
|
+
# 'BundleLoaderError',
|
55
|
+
# "An error occurred while loading the plugin bundle #{@@bundle_name}.",
|
56
|
+
# @@bundle_path
|
57
|
+
# )
|
58
|
+
# end
|
59
|
+
# end
|
60
|
+
# return mod
|
61
|
+
# end
|
62
|
+
#
|
37
63
|
|
38
64
|
module RSence
|
39
65
|
|
40
|
-
|
41
|
-
require 'plugins/plugin_util'
|
42
|
-
|
43
|
-
# plugin.rb contains the Plugin skeleton class
|
44
|
-
require 'plugins/plugin'
|
45
|
-
|
46
|
-
# guiparser.rb contains the Yaml serializer for gui trees.
|
47
|
-
# It uses JSONRenderer on the client to build user interfaces.
|
48
|
-
require 'plugins/guiparser'
|
49
|
-
|
50
|
-
# gui_plugin.rb is an extension of Plugin that uses
|
51
|
-
# GUIParser to init the gui automatically.
|
52
|
-
require 'plugins/gui_plugin'
|
53
|
-
|
54
|
-
# plugin_sqlite_db.rb contains automatic local sqlite database
|
55
|
-
# creation for a plugin that includes it.
|
56
|
-
require 'plugins/plugin_sqlite_db'
|
57
|
-
|
58
|
-
# servlet includes the Servlet class, for handling any requests / responses
|
59
|
-
require 'plugins/servlet'
|
60
|
-
|
61
|
-
# Interface for plugins in a plugin bundle
|
62
|
-
require 'plugins/plugin_plugins'
|
66
|
+
require 'plugins/plugins'
|
63
67
|
|
64
68
|
## = Abstract
|
65
69
|
## PluginManager is the service that loads and provides method delegation
|
@@ -280,7 +284,7 @@ class PluginManager
|
|
280
284
|
|
281
285
|
# A flag (when false) enables automatic construction
|
282
286
|
# of the Plugin and Servlet classes contained.
|
283
|
-
:inits_self =>
|
287
|
+
:inits_self => false,
|
284
288
|
|
285
289
|
# System version requirement.
|
286
290
|
:sys_version => '>= 1.0.0',
|
@@ -323,47 +327,32 @@ class PluginManager
|
|
323
327
|
|
324
328
|
bundle_src = File.read( bundle_file_path )
|
325
329
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
plugin_manager
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
@@bundle_info = bundle_info
|
335
|
-
@@plugin_manager = plugin_manager
|
336
|
-
def m.bundle_path; @@bundle_path; end
|
337
|
-
puts "using load"
|
338
|
-
load src_path
|
339
|
-
end
|
340
|
-
else
|
341
|
-
module_ns = bundle_loader( {
|
342
|
-
:bundle_path => bundle_path,
|
343
|
-
:bundle_name => bundle_name,
|
344
|
-
:bundle_info => bundle_info,
|
345
|
-
:plugin_manager => self,
|
346
|
-
:src_path => bundle_file_path,
|
347
|
-
:src => bundle_src
|
348
|
-
} )
|
349
|
-
end
|
330
|
+
module_ns = Plugins.bundle_loader( {
|
331
|
+
:bundle_path => bundle_path,
|
332
|
+
:bundle_name => bundle_name,
|
333
|
+
:bundle_info => bundle_info,
|
334
|
+
:plugin_manager => self,
|
335
|
+
:src_path => bundle_file_path,
|
336
|
+
:src => bundle_src
|
337
|
+
} )
|
350
338
|
|
351
|
-
|
339
|
+
if bundle_info[:inits_self]
|
340
|
+
warn "Plugins can't init them self anymore. Please fix plugin: #{bundle_name.inspect}"
|
341
|
+
else
|
352
342
|
module_ns.constants.each do |module_const_name|
|
353
343
|
module_const = module_ns.const_get( module_const_name )
|
354
344
|
if module_const.class == Class
|
355
|
-
module_const.
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
puts "Can't init class: #{module_const.to_s}"
|
364
|
-
break
|
365
|
-
end
|
345
|
+
bundle_type = module_const.bundle_type
|
346
|
+
if [:Servlet, :Plugin, :GUIPlugin].include? bundle_type
|
347
|
+
bundle_inst = module_const.new( bundle_name, bundle_info, bundle_path, self )
|
348
|
+
bundle_inst.register( bundle_name ) if [ :Plugin, :GUIPlugin ].include?( bundle_type )
|
349
|
+
break
|
350
|
+
else
|
351
|
+
warn "Can't init class: #{module_const.to_s}"
|
352
|
+
break
|
366
353
|
end
|
354
|
+
else
|
355
|
+
warn "module_const.class: #{module_const.class.inspect}"
|
367
356
|
end
|
368
357
|
end
|
369
358
|
end
|
@@ -381,7 +370,8 @@ class PluginManager
|
|
381
370
|
else
|
382
371
|
inst.init if inst.respond_to? :init and not inst.inited
|
383
372
|
@registry[ bundle_name ] = inst
|
384
|
-
if inst.respond_to?( :match )
|
373
|
+
if inst.respond_to?( :match ) and ( inst.respond_to?( :get ) or inst.respond_to?( :post ) )
|
374
|
+
puts " --- servlet: #{bundle_name.inspect}, #{inst.respond_to?(:match)}, #{inst.post}" if bundle_name == :welcome
|
385
375
|
@servlets.push( bundle_name )
|
386
376
|
end
|
387
377
|
end
|
@@ -405,11 +395,11 @@ class PluginManager
|
|
405
395
|
"\t"+e.backtrace.join("\n\t"),
|
406
396
|
"*"*40
|
407
397
|
].join("\n")+"\n"
|
408
|
-
puts
|
409
|
-
puts "eval repl: #{eval_repl}"
|
410
|
-
puts
|
411
398
|
if eval_repl
|
412
|
-
|
399
|
+
puts
|
400
|
+
puts "plugin: #{eval_repl}"
|
401
|
+
puts
|
402
|
+
err_msg = err_msg.gsub(/^\t\(eval\)\:/s,"\t#{eval_repl}:")
|
413
403
|
end
|
414
404
|
$stderr.write( err_msg )
|
415
405
|
end
|
@@ -458,7 +448,16 @@ class PluginManager
|
|
458
448
|
def delegate( method_name, *args )
|
459
449
|
@registry.each do | plugin_name, plugin |
|
460
450
|
if plugin.respond_to?( method_name )
|
461
|
-
|
451
|
+
begin
|
452
|
+
plugin.send( method_name, *args )
|
453
|
+
rescue => e
|
454
|
+
plugin_error(
|
455
|
+
e,
|
456
|
+
"RSence::PluginManager.delegate error",
|
457
|
+
"plugin_name: #{plugin_name.inspect}, method_name: #{method_name.inspect}",
|
458
|
+
plugin_name
|
459
|
+
)
|
460
|
+
end
|
462
461
|
end
|
463
462
|
end
|
464
463
|
end
|
@@ -490,6 +489,7 @@ class PluginManager
|
|
490
489
|
matches_order = match_servlet_uri( req_uri, req_type )
|
491
490
|
return false unless matches_order
|
492
491
|
matches_order.each do |servlet_name|
|
492
|
+
# puts "servlet name: #{servlet_name.inspect}" if RSence.args[:debug]
|
493
493
|
begin
|
494
494
|
@registry[servlet_name].send( req_type, req, resp, session )
|
495
495
|
return true
|
@@ -0,0 +1,117 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2009 Riassence Inc.
|
3
|
+
# http://riassence.com/
|
4
|
+
#
|
5
|
+
# You should have received a copy of the GNU General Public License along
|
6
|
+
# with this software package. If not, contact licensing@riassence.com
|
7
|
+
##
|
8
|
+
|
9
|
+
# Contains the PluginUtil module which has common methods for the bundle classes
|
10
|
+
require 'plugins/plugin_util'
|
11
|
+
|
12
|
+
# guiparser.rb contains the Yaml serializer for gui trees.
|
13
|
+
# It uses JSONRenderer on the client to build user interfaces.
|
14
|
+
require 'plugins/guiparser'
|
15
|
+
|
16
|
+
# plugin_sqlite_db.rb contains automatic local sqlite database
|
17
|
+
# creation for a plugin that includes it.
|
18
|
+
require 'plugins/plugin_sqlite_db'
|
19
|
+
|
20
|
+
# Interface for plugins in a plugin bundle
|
21
|
+
require 'plugins/plugin_plugins'
|
22
|
+
|
23
|
+
module ::RSence
|
24
|
+
module Plugins
|
25
|
+
|
26
|
+
# plugin.rb contains the Plugin skeleton class
|
27
|
+
require 'plugins/plugin'
|
28
|
+
def self.PluginMaker
|
29
|
+
lambda do |ns|
|
30
|
+
klass = Class.new( PluginTemplate ) do
|
31
|
+
def self.ns=(ns)
|
32
|
+
define_method( :bundle_info ) do
|
33
|
+
ns.bundle_info
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
klass.ns = ns if ns
|
38
|
+
klass
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# gui_plugin.rb is an extension of Plugin that uses
|
43
|
+
# GUIParser to init the gui automatically.
|
44
|
+
require 'plugins/gui_plugin'
|
45
|
+
def self.GUIPluginMaker
|
46
|
+
lambda do |ns|
|
47
|
+
klass = Class.new( GUIPluginTemplate ) do
|
48
|
+
def self.ns=(ns)
|
49
|
+
define_method( :bundle_info ) do
|
50
|
+
ns.bundle_info
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
klass.ns = ns if ns
|
55
|
+
klass
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# servlet includes the Servlet class, for handling any requests / responses
|
60
|
+
require 'plugins/servlet'
|
61
|
+
def self.ServletMaker
|
62
|
+
lambda do |ns|
|
63
|
+
klass = Class.new( ServletTemplate ) do
|
64
|
+
def self.ns=(ns)
|
65
|
+
define_method( :bundle_info ) do
|
66
|
+
ns.bundle_info
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
klass.ns = ns if ns
|
71
|
+
klass
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.bundle_loader( params )
|
76
|
+
src_path = params[:src_path]
|
77
|
+
begin
|
78
|
+
mod = Module.new do |m|
|
79
|
+
if RUBY_VERSION.to_f >= 1.9
|
80
|
+
m.define_singleton_method( :bundle_path ) do
|
81
|
+
params[:bundle_path]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
def self.inspect; "#<module BundleWrapper of #{@@bundle_name}}>"; end
|
85
|
+
def self.const_missing( name )
|
86
|
+
if name == :Servlet
|
87
|
+
return Plugins.ServletMaker.call( self )
|
88
|
+
elsif name == :ServletPlugin
|
89
|
+
warn "'ServletPlugin' is deprecated, use 'Servlet' instead."
|
90
|
+
return Plugins.ServletMaker.call( self )
|
91
|
+
elsif name == :Plugin
|
92
|
+
return Plugins.PluginMaker.call( self )
|
93
|
+
elsif name == :GUIPlugin
|
94
|
+
return Plugins.GUIPluginMaker.call( self )
|
95
|
+
else
|
96
|
+
warn "Known const missing: #{name.inspect}"
|
97
|
+
super
|
98
|
+
end
|
99
|
+
end
|
100
|
+
plugin_src = File.read( src_path )
|
101
|
+
unless RUBY_VERSION.to_f >= 1.9
|
102
|
+
plugin_src = ["bundle_path = #{params[:bundle_path].inspect}", plugin_src].join("\n")
|
103
|
+
end
|
104
|
+
m.module_eval( plugin_src )
|
105
|
+
end
|
106
|
+
return mod
|
107
|
+
rescue => e
|
108
|
+
params[:plugin_manager].plugin_error(
|
109
|
+
e,
|
110
|
+
'BundleLoaderError',
|
111
|
+
"An error occurred while loading the plugin bundle #{params[:bundle_name]}.",
|
112
|
+
src_path
|
113
|
+
)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/lib/plugins/servlet.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2009 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -6,64 +6,54 @@
|
|
6
6
|
# with this software package. If not, contact licensing@riassence.com
|
7
7
|
##
|
8
8
|
|
9
|
-
## Register the
|
9
|
+
## Register the Servlet with a regular expression that
|
10
10
|
## should match its uri. Alternatively just a string, but
|
11
11
|
## that needs to be an exact match.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@name = @@bundle_name
|
27
|
-
end
|
28
|
-
@path = @@bundle_path
|
29
|
-
@plugins = @@plugin_manager
|
30
|
-
register
|
31
|
-
@inited = false
|
32
|
-
end
|
33
|
-
|
34
|
-
# Servlet ID
|
35
|
-
attr_reader :name, :path, :info, :inited
|
36
|
-
def register # :nodoc
|
37
|
-
@plugins.register_bundle( self, @name )
|
38
|
-
@inited = true
|
39
|
-
end
|
40
|
-
|
41
|
-
## Extendables
|
42
|
-
|
43
|
-
# Return true to match, false to not match. Returns false as default if
|
44
|
-
# not extended.
|
45
|
-
def match( uri, request_type=:get )
|
46
|
-
return false
|
47
|
-
end
|
48
|
-
|
49
|
-
# If match, return score (lower is better). Returns 100 by defalt if not
|
50
|
-
# extended
|
51
|
-
def score
|
52
|
-
return 100
|
53
|
-
end
|
54
|
-
|
55
|
-
# Extend to do any GET request processing. Not doing anything by default.
|
56
|
-
def get( req, res, ses )
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
# Extend to do any POST request processing. Not doing anything by default.
|
61
|
-
def post( req, res, ses )
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
12
|
+
module ::RSence
|
13
|
+
module Plugins
|
14
|
+
class ServletTemplate
|
15
|
+
include PluginUtil
|
16
|
+
def self.bundle_type; :Servlet; end
|
17
|
+
# Initializes and registers the ServletPlugin.
|
18
|
+
def initialize( bundle_name, bundle_info, bundle_path, plugin_manager )
|
19
|
+
@info = bundle_info
|
20
|
+
@name = bundle_name
|
21
|
+
@path = bundle_path
|
22
|
+
@plugins = plugin_manager
|
23
|
+
register
|
24
|
+
@inited = false
|
25
|
+
end
|
66
26
|
|
67
|
-
|
27
|
+
# Servlet ID
|
28
|
+
attr_reader :name, :path, :info, :inited
|
29
|
+
def register # :nodoc
|
30
|
+
@plugins.register_bundle( self, @name )
|
31
|
+
@inited = true
|
32
|
+
end
|
68
33
|
|
34
|
+
## Extendables
|
69
35
|
|
36
|
+
# Return true to match, false to not match. Returns false as default if
|
37
|
+
# not extended.
|
38
|
+
def match( uri, request_type=:get )
|
39
|
+
return false
|
40
|
+
end
|
41
|
+
|
42
|
+
# If match, return score (lower is better). Returns 100 by defalt if not
|
43
|
+
# extended
|
44
|
+
def score
|
45
|
+
return 100
|
46
|
+
end
|
47
|
+
|
48
|
+
# Extend to do any GET request processing. Not doing anything by default.
|
49
|
+
def get( req, res, ses )
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
# Extend to do any POST request processing. Not doing anything by default.
|
54
|
+
def post( req, res, ses )
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|