arrow 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. data/ChangeLog +1590 -0
  2. data/LICENSE +28 -0
  3. data/README +75 -0
  4. data/Rakefile +366 -0
  5. data/Rakefile.local +63 -0
  6. data/data/arrow/applets/TEMPLATE.rb.tpl +53 -0
  7. data/data/arrow/applets/args.rb +50 -0
  8. data/data/arrow/applets/config.rb +55 -0
  9. data/data/arrow/applets/error.rb +63 -0
  10. data/data/arrow/applets/files.rb +46 -0
  11. data/data/arrow/applets/inspect.rb +46 -0
  12. data/data/arrow/applets/nosuchapplet.rb +31 -0
  13. data/data/arrow/applets/status.rb +92 -0
  14. data/data/arrow/applets/test.rb +133 -0
  15. data/data/arrow/applets/tutorial/counter.rb +96 -0
  16. data/data/arrow/applets/tutorial/dingus.rb +67 -0
  17. data/data/arrow/applets/tutorial/hello.rb +34 -0
  18. data/data/arrow/applets/tutorial/hello2.rb +73 -0
  19. data/data/arrow/applets/tutorial/imgtext.rb +90 -0
  20. data/data/arrow/applets/tutorial/imgtext2.rb +286 -0
  21. data/data/arrow/applets/tutorial/index.rb +36 -0
  22. data/data/arrow/applets/tutorial/logo.rb +98 -0
  23. data/data/arrow/applets/tutorial/memcache.rb +61 -0
  24. data/data/arrow/applets/tutorial/missing.rb +37 -0
  25. data/data/arrow/applets/tutorial/protected.rb +100 -0
  26. data/data/arrow/applets/tutorial/redirector.rb +52 -0
  27. data/data/arrow/applets/tutorial/rndimages.rb +159 -0
  28. data/data/arrow/applets/tutorial/sharenotes.rb +83 -0
  29. data/data/arrow/applets/tutorial/subclassed-hello.rb +32 -0
  30. data/data/arrow/applets/tutorial/superhello.rb +72 -0
  31. data/data/arrow/applets/tutorial/timeclock.rb +78 -0
  32. data/data/arrow/applets/view-applet.rb +123 -0
  33. data/data/arrow/applets/view-template.rb +85 -0
  34. data/data/arrow/applets/wiki.rb +274 -0
  35. data/data/arrow/templates/TEMPLATE.tmpl.tpl +36 -0
  36. data/data/arrow/templates/applet-status.tmpl +153 -0
  37. data/data/arrow/templates/args-display.tmpl +120 -0
  38. data/data/arrow/templates/config/display-table.tmpl +36 -0
  39. data/data/arrow/templates/config/display.tmpl +36 -0
  40. data/data/arrow/templates/counter-deleted.tmpl +33 -0
  41. data/data/arrow/templates/counter.tmpl +59 -0
  42. data/data/arrow/templates/dingus.tmpl +55 -0
  43. data/data/arrow/templates/enumtable.tmpl +8 -0
  44. data/data/arrow/templates/error-display.tmpl +92 -0
  45. data/data/arrow/templates/filemap.tmpl +89 -0
  46. data/data/arrow/templates/hello-world-src.tmpl +34 -0
  47. data/data/arrow/templates/hello-world.tmpl +60 -0
  48. data/data/arrow/templates/imgtext/fontlist.tmpl +46 -0
  49. data/data/arrow/templates/imgtext/form.tmpl +70 -0
  50. data/data/arrow/templates/imgtext/reload-error.tmpl +40 -0
  51. data/data/arrow/templates/imgtext/reload.tmpl +55 -0
  52. data/data/arrow/templates/inspect/display.tmpl +80 -0
  53. data/data/arrow/templates/loginform.tmpl +64 -0
  54. data/data/arrow/templates/logout.tmpl +32 -0
  55. data/data/arrow/templates/memcache/display.tmpl +41 -0
  56. data/data/arrow/templates/navbar.incl +27 -0
  57. data/data/arrow/templates/nosuchapplet.tmpl +32 -0
  58. data/data/arrow/templates/printsource.tmpl +35 -0
  59. data/data/arrow/templates/protected.tmpl +36 -0
  60. data/data/arrow/templates/rndimages.tmpl +38 -0
  61. data/data/arrow/templates/service-response.tmpl +13 -0
  62. data/data/arrow/templates/sharenotes/display.tmpl +38 -0
  63. data/data/arrow/templates/status.tmpl +120 -0
  64. data/data/arrow/templates/templateviewer.tmpl +43 -0
  65. data/data/arrow/templates/test/harness.tmpl +57 -0
  66. data/data/arrow/templates/test/list.tmpl +48 -0
  67. data/data/arrow/templates/test/problem.tmpl +42 -0
  68. data/data/arrow/templates/tutorial/index.tmpl +37 -0
  69. data/data/arrow/templates/tutorial/missingapplet.tmpl +29 -0
  70. data/data/arrow/templates/view-applet-nosuch.tmpl +32 -0
  71. data/data/arrow/templates/view-applet.tmpl +40 -0
  72. data/data/arrow/templates/view-template.tmpl +83 -0
  73. data/data/arrow/templates/wiki/formerror.tmpl +47 -0
  74. data/data/arrow/templates/wiki/markup_help.incl +6 -0
  75. data/data/arrow/templates/wiki/new.tmpl +56 -0
  76. data/data/arrow/templates/wiki/new_system.tmpl +122 -0
  77. data/data/arrow/templates/wiki/sectionlist.tmpl +43 -0
  78. data/data/arrow/templates/wiki/show.tmpl +34 -0
  79. data/docs/manual/layouts/default.page +43 -0
  80. data/docs/manual/lib/api-filter.rb +81 -0
  81. data/docs/manual/lib/editorial-filter.rb +64 -0
  82. data/docs/manual/lib/examples-filter.rb +244 -0
  83. data/docs/manual/lib/links-filter.rb +117 -0
  84. data/lib/apache/fakerequest.rb +448 -0
  85. data/lib/apache/logger.rb +33 -0
  86. data/lib/arrow.rb +51 -0
  87. data/lib/arrow/acceptparam.rb +207 -0
  88. data/lib/arrow/applet.rb +725 -0
  89. data/lib/arrow/appletmixins.rb +218 -0
  90. data/lib/arrow/appletregistry.rb +590 -0
  91. data/lib/arrow/applettestcase.rb +503 -0
  92. data/lib/arrow/broker.rb +255 -0
  93. data/lib/arrow/cache.rb +176 -0
  94. data/lib/arrow/config-loaders/yaml.rb +75 -0
  95. data/lib/arrow/config.rb +615 -0
  96. data/lib/arrow/constants.rb +24 -0
  97. data/lib/arrow/cookie.rb +359 -0
  98. data/lib/arrow/cookieset.rb +108 -0
  99. data/lib/arrow/dispatcher.rb +368 -0
  100. data/lib/arrow/dispatcherloader.rb +50 -0
  101. data/lib/arrow/exceptions.rb +61 -0
  102. data/lib/arrow/fallbackhandler.rb +48 -0
  103. data/lib/arrow/formvalidator.rb +631 -0
  104. data/lib/arrow/htmltokenizer.rb +343 -0
  105. data/lib/arrow/logger.rb +488 -0
  106. data/lib/arrow/logger/apacheoutputter.rb +69 -0
  107. data/lib/arrow/logger/arrayoutputter.rb +63 -0
  108. data/lib/arrow/logger/coloroutputter.rb +111 -0
  109. data/lib/arrow/logger/fileoutputter.rb +96 -0
  110. data/lib/arrow/logger/htmloutputter.rb +54 -0
  111. data/lib/arrow/logger/outputter.rb +123 -0
  112. data/lib/arrow/mixins.rb +425 -0
  113. data/lib/arrow/monkeypatches.rb +94 -0
  114. data/lib/arrow/object.rb +117 -0
  115. data/lib/arrow/path.rb +196 -0
  116. data/lib/arrow/service.rb +447 -0
  117. data/lib/arrow/session.rb +289 -0
  118. data/lib/arrow/session/dbstore.rb +100 -0
  119. data/lib/arrow/session/filelock.rb +160 -0
  120. data/lib/arrow/session/filestore.rb +132 -0
  121. data/lib/arrow/session/id.rb +98 -0
  122. data/lib/arrow/session/lock.rb +253 -0
  123. data/lib/arrow/session/md5id.rb +42 -0
  124. data/lib/arrow/session/nulllock.rb +42 -0
  125. data/lib/arrow/session/posixlock.rb +166 -0
  126. data/lib/arrow/session/sha1id.rb +54 -0
  127. data/lib/arrow/session/store.rb +366 -0
  128. data/lib/arrow/session/usertrackid.rb +52 -0
  129. data/lib/arrow/spechelpers.rb +73 -0
  130. data/lib/arrow/template.rb +713 -0
  131. data/lib/arrow/template/attr.rb +31 -0
  132. data/lib/arrow/template/call.rb +31 -0
  133. data/lib/arrow/template/comment.rb +33 -0
  134. data/lib/arrow/template/container.rb +118 -0
  135. data/lib/arrow/template/else.rb +41 -0
  136. data/lib/arrow/template/elsif.rb +44 -0
  137. data/lib/arrow/template/escape.rb +53 -0
  138. data/lib/arrow/template/export.rb +87 -0
  139. data/lib/arrow/template/for.rb +145 -0
  140. data/lib/arrow/template/if.rb +78 -0
  141. data/lib/arrow/template/import.rb +119 -0
  142. data/lib/arrow/template/include.rb +206 -0
  143. data/lib/arrow/template/iterator.rb +208 -0
  144. data/lib/arrow/template/nodes.rb +734 -0
  145. data/lib/arrow/template/parser.rb +571 -0
  146. data/lib/arrow/template/prettyprint.rb +53 -0
  147. data/lib/arrow/template/render.rb +191 -0
  148. data/lib/arrow/template/selectlist.rb +94 -0
  149. data/lib/arrow/template/set.rb +87 -0
  150. data/lib/arrow/template/timedelta.rb +81 -0
  151. data/lib/arrow/template/unless.rb +78 -0
  152. data/lib/arrow/template/urlencode.rb +51 -0
  153. data/lib/arrow/template/yield.rb +139 -0
  154. data/lib/arrow/templatefactory.rb +125 -0
  155. data/lib/arrow/testcase.rb +567 -0
  156. data/lib/arrow/transaction.rb +608 -0
  157. data/rake/191_compat.rb +26 -0
  158. data/rake/dependencies.rb +76 -0
  159. data/rake/documentation.rb +114 -0
  160. data/rake/helpers.rb +502 -0
  161. data/rake/hg.rb +282 -0
  162. data/rake/manual.rb +787 -0
  163. data/rake/packaging.rb +129 -0
  164. data/rake/publishing.rb +278 -0
  165. data/rake/style.rb +62 -0
  166. data/rake/svn.rb +668 -0
  167. data/rake/testing.rb +187 -0
  168. data/rake/verifytask.rb +64 -0
  169. data/spec/arrow/acceptparam_spec.rb +157 -0
  170. data/spec/arrow/applet_spec.rb +575 -0
  171. data/spec/arrow/appletmixins_spec.rb +409 -0
  172. data/spec/arrow/appletregistry_spec.rb +294 -0
  173. data/spec/arrow/broker_spec.rb +153 -0
  174. data/spec/arrow/config_spec.rb +224 -0
  175. data/spec/arrow/cookieset_spec.rb +164 -0
  176. data/spec/arrow/dispatcher_spec.rb +137 -0
  177. data/spec/arrow/dispatcherloader_spec.rb +65 -0
  178. data/spec/arrow/formvalidator_spec.rb +781 -0
  179. data/spec/arrow/logger_spec.rb +346 -0
  180. data/spec/arrow/mixins_spec.rb +120 -0
  181. data/spec/arrow/service_spec.rb +645 -0
  182. data/spec/arrow/session_spec.rb +121 -0
  183. data/spec/arrow/template/iterator_spec.rb +222 -0
  184. data/spec/arrow/templatefactory_spec.rb +185 -0
  185. data/spec/arrow/transaction_spec.rb +319 -0
  186. data/spec/arrow_spec.rb +37 -0
  187. data/spec/lib/appletmatchers.rb +281 -0
  188. data/spec/lib/constants.rb +77 -0
  189. data/spec/lib/helpers.rb +41 -0
  190. data/spec/lib/matchers.rb +44 -0
  191. data/tests/cookie.tests.rb +310 -0
  192. data/tests/path.tests.rb +157 -0
  193. data/tests/session.tests.rb +111 -0
  194. data/tests/session_id.tests.rb +82 -0
  195. data/tests/session_lock.tests.rb +191 -0
  196. data/tests/session_store.tests.rb +53 -0
  197. data/tests/template.tests.rb +1360 -0
  198. metadata +339 -0
@@ -0,0 +1,63 @@
1
+ #
2
+ # Local project Rakefile tasks
3
+ # $Id$
4
+ #
5
+ #
6
+
7
+ APPLETSDIR = DATADIR + 'applets'
8
+ TEMPLATESDIR = DATADIR + 'templates'
9
+
10
+ DEMO_APPLETS = Pathname.glob( APPLETSDIR + '**/*.rb' )
11
+ DEMO_TEMPLATES = Pathname.glob( TEMPLATESDIR + '**/*.tmpl' )
12
+
13
+ DEMO_APPLETS_NAME = 'arrow-demo-applets'
14
+ DEMO_APPLETS_GEM_NAME = "#{DEMO_APPLETS_NAME}-#{PKG_VERSION}"
15
+ DEMO_APPLETS_GEM = PKGDIR + "#{DEMO_APPLETS_GEM_NAME}.gem"
16
+
17
+ DEMO_APPLETS_PKGDIR = PKGDIR + "#{DEMO_APPLETS_NAME}-#{PKG_VERSION}"
18
+ DEMO_APPLETS_DATADIR = DEMO_APPLETS_PKGDIR + 'data'
19
+ DEMO_APPLETS_GEM_FILES = (DEMO_APPLETS + DEMO_TEMPLATES).collect {|pn|
20
+ DEMO_APPLETS_DATADIR + pn.relative_path_from(BASEDIR)
21
+ }
22
+
23
+
24
+ DEMO_APPLETS_GEMSPEC = Gem::Specification.new do |gem|
25
+ gem.name = DEMO_APPLETS_NAME
26
+ gem.version = PKG_VERSION
27
+
28
+ gem.summary = "A collection of demo applets for Arrow"
29
+ gem.description = <<-EOD
30
+ This is a collection of demo applets for exploring various features of
31
+ Arrow.
32
+ EOD
33
+
34
+ gem.authors = 'Michael Granger'
35
+ gem.email = 'ged@FaerieMUD.org'
36
+ gem.homepage = 'http://deveiate.org/projects/Arrow/'
37
+
38
+ gem.has_rdoc = false
39
+
40
+ gem.files = DEMO_APPLETS + DEMO_TEMPLATES
41
+
42
+ gem.add_runtime_dependency( 'arrow', PKG_VERSION )
43
+ end
44
+
45
+
46
+ desc "Build a gem for the demo applets (#{DEMO_APPLETS_GEM})"
47
+ task :demo_applets_gem => DEMO_APPLETS_GEM.to_s
48
+
49
+ file DEMO_APPLETS_GEM.to_s => [PKGDIR.to_s] + DEMO_APPLETS_GEM_FILES do
50
+ when_writing( "Creating GEM" ) do
51
+ Gem::Builder.new( DEMO_APPLETS_GEMSPEC ).build
52
+ verbose( true ) do
53
+ mv GEM_FILE_NAME, gempath
54
+ end
55
+ end
56
+ end
57
+
58
+
59
+ configlib = LIBDIR + 'arrow/config.rb'
60
+ file 'default.cfg'
61
+ task 'default.cfg' => [configlib.to_s] do
62
+ Arrow::Logger[ self.class ].level = :debug
63
+ end
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # The (>>>class<<<) class, a derivative of Arrow::Applet. (>>>desc<<<)
4
+ #
5
+ # == VCS Id
6
+ #
7
+ # $Id$
8
+ #
9
+ # == Authors
10
+ #
11
+ # * (>>>USER_NAME<<<) <(>>>AUTHOR<<<)>
12
+ #
13
+
14
+ require 'arrow/applet'
15
+
16
+
17
+ ### (>>>desc<<<)
18
+ class (>>>class<<<) < Arrow::Applet
19
+
20
+
21
+ # Applet signature
22
+ Signature = {
23
+ :name => "(>>>name<<<)",
24
+ :description => "(>>>desc<<<)",
25
+ :maintainer => "(>>>AUTHOR<<<)",
26
+ :default_action => 'display',
27
+ }
28
+
29
+
30
+
31
+ ######
32
+ public
33
+ ######
34
+
35
+ def_action :display do |txn, *args|
36
+ self.log.debug "In the 'display' action of the '%s' app." %
37
+ self.signature.name
38
+
39
+ txn.print( "" )
40
+
41
+ return true
42
+ end
43
+
44
+
45
+ end # class (>>>class<<<)
46
+
47
+
48
+ >>>TEMPLATE-DEFINITION-SECTION<<<
49
+ ("class" "App class: ")
50
+ ("name" "App name (for the signature): ")
51
+ ("desc" "Description: ")
52
+
53
+
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby/usr/bin/ruby
2
+ #
3
+ # The ArgumentTester class, a derivative of
4
+ # Arrow::Applet. This applet is for testing/debugging/demonstrating the argument
5
+ # validator.
6
+ #
7
+ # == Authors
8
+ #
9
+ # * Michael Granger <ged@FaerieMUD.org>
10
+ #
11
+
12
+ require 'arrow/applet'
13
+
14
+
15
+ ### An applet for testing/debugging the argument validator.
16
+ class ArgumentTester < Arrow::Applet
17
+
18
+ # Applet signature
19
+ applet_name "Argument Tester"
20
+ applet_description "This app is for testing/debugging the argument validator."
21
+ applet_maintainer "ged@FaerieMUD.org"
22
+
23
+ default_action :display
24
+
25
+
26
+
27
+ ### All of the applet's functionality is handled by the default action
28
+ ### (action_missing_action), which loads the 'display' template and renders
29
+ ### it.
30
+ template :display => 'args-display.tmpl'
31
+ validator :display => {
32
+ :required => :name,
33
+ :optional => [:email, :description],
34
+ :filters => [:strip, :squeeze],
35
+ :untaint_all_constraints => true,
36
+ :descriptions => {
37
+ :email => "Customer Email",
38
+ :description => "Issue Description",
39
+ :name => "Customer Name",
40
+ },
41
+ :constraints => {
42
+ :email => :email,
43
+ :name => /^[\x20-\x7f]+$/,
44
+ :description => /^[\x20-\x7f]+$/,
45
+ },
46
+ }
47
+
48
+ end # class ArgumentTester
49
+
50
+
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # The ConfigApplet class, a derivative of Arrow::Applet. It
4
+ # can be used to view/edit Arrow configurations.
5
+ #
6
+ # == VCS Id
7
+ #
8
+ # $Id$
9
+ #
10
+ # == Authors
11
+ #
12
+ # * Michael Granger <ged@FaerieMUD.org>
13
+ #
14
+
15
+ require 'arrow/applet'
16
+ require 'arrow/config'
17
+
18
+
19
+ ### An Arrow applet class for viewing/editing Arrow configurations.
20
+ class ConfigApplet < Arrow::Applet
21
+
22
+ # Applet signature
23
+ Signature = {
24
+ :name => "ConfigApplet",
25
+ :description => "view/edit Arrow configuration",
26
+ :maintainer => "ged@FaerieMUD.org",
27
+ :default_action => 'display',
28
+ :templates => {
29
+ :display => 'config/display.tmpl',
30
+ :display_table => 'config/display-table.tmpl',
31
+ },
32
+ }
33
+
34
+
35
+
36
+ ######
37
+ public
38
+ ######
39
+
40
+ def display_action( txn, *args )
41
+ templ = self.load_template( :display )
42
+
43
+ templ.txn = txn
44
+ templ.applet = self
45
+ templ.config = @config
46
+
47
+ return templ
48
+ end
49
+
50
+
51
+
52
+
53
+ end # class ConfigApplet
54
+
55
+
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # The ErrorHandler class, a derivative of
4
+ # Arrow::Applet. It's an example of an error-handler applet.
5
+ #
6
+ # == Authors
7
+ #
8
+ # * Michael Granger <ged@FaerieMUD.org>
9
+ #
10
+ # Please see the file LICENSE in the top-level directory for licensing details.
11
+ #
12
+
13
+ require 'arrow/applet'
14
+
15
+
16
+ ### An error-handling applet.
17
+ class ErrorHandler < Arrow::Applet
18
+
19
+
20
+ # Applet signature
21
+ Signature = {
22
+ :name => "Appserver Error Handler",
23
+ :description => "Displays errors which occur in other applets in a "\
24
+ "readable fashion. Cannot be called directly; it is used internally "\
25
+ "by the appserver to handle errors which happen in applets.",
26
+ :maintainer => "ged@FaerieMUD.org",
27
+ :config => {},
28
+ :templates => {
29
+ :display => 'error-display.tmpl',
30
+ },
31
+ :vargs => {},
32
+ :monitors => {},
33
+ :default_action => 'default',
34
+ }
35
+
36
+
37
+
38
+ ######
39
+ public
40
+ ######
41
+
42
+ def_action :default do |*args|
43
+ intentional_undefined_local_variable_or_method
44
+ return "Hmmm... that didn't work"
45
+ end
46
+
47
+ def report_error_action( txn, re, err )
48
+ self.log.debug "Loading 'display' template"
49
+ template = self.load_template( :display )
50
+ self.log.debug "'display' template: %p" % template
51
+
52
+ template.re = re
53
+ template.txn = txn
54
+ template.err = err
55
+
56
+ txn.print( template )
57
+
58
+ return true
59
+ end
60
+
61
+
62
+
63
+ end # class ErrorHandler
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # The LoadedFiles class, a derivative of Arrow::Applet. It
4
+ # displays the disposition of all the files that are being monitored by Arrow.
5
+ #
6
+ # == Authors
7
+ #
8
+ # * Michael Granger <ged@FaerieMUD.org>
9
+ #
10
+
11
+ require 'arrow/applet'
12
+
13
+
14
+ ### It displays the disposition
15
+ class LoadedFiles < Arrow::Applet
16
+
17
+
18
+ # Applet signature
19
+ Signature = {
20
+ :name => "FileMap",
21
+ :description => "It displays the disposition of all the file that are" +
22
+ " being monitored by Arrow.",
23
+ :maintainer => "ged@FaerieMUD.org",
24
+ :default_action => 'filemap',
25
+ :templates => {
26
+ :filemap => 'filemap.tmpl',
27
+ }
28
+ }
29
+
30
+
31
+
32
+ ######
33
+ public
34
+ ######
35
+
36
+ def_action :filemap do |txn, *args|
37
+ templ = self.load_template( :filemap )
38
+ templ.txn = txn
39
+
40
+ return templ
41
+ end
42
+
43
+
44
+ end # class LoadedFiles
45
+
46
+
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # The InspectorApplet class, a derivative of
4
+ # Arrow::Applet. It dumps data that might be useful to applet developers.
5
+ #
6
+ # == VCS Id
7
+ #
8
+ # $Id$
9
+ #
10
+ # == Authors
11
+ #
12
+ # * Michael Granger <ged@FaerieMUD.org>
13
+ #
14
+
15
+ require 'arrow/applet'
16
+
17
+
18
+ ### An applet that displays introspection information that might be useful to
19
+ ### applet developers.
20
+ class InspectorApplet < Arrow::Applet
21
+
22
+
23
+ # Applet signature
24
+ Signature = {
25
+ :name => "Inspector",
26
+ :description => "It dumps data that might be useful to applet developers.",
27
+ :maintainer => "ged@FaerieMUD.org",
28
+ :default_action => 'display',
29
+ :templates => {
30
+ :display => 'inspect/display.tmpl',
31
+ },
32
+ }
33
+
34
+
35
+ def display_action( txn, *args )
36
+ templ = self.load_template( :display )
37
+
38
+ templ.txn = txn
39
+ templ.applet = self
40
+
41
+ return templ
42
+ end
43
+
44
+ end # class InspectorApplet
45
+
46
+
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # The NoSuchAppletHandler class, a derivative of
4
+ # Arrow::Applet. It is an example 'noSuchAppletHandler' applet.
5
+ #
6
+ # == Authors
7
+ #
8
+ # * Michael Granger <ged@FaerieMUD.org>
9
+ #
10
+
11
+ require 'arrow/applet'
12
+
13
+
14
+ ### An example missingApplet applet.
15
+ class NoSuchAppletHandler < Arrow::Applet
16
+
17
+
18
+ # Applet signature
19
+ applet_name "No-such-applet handler"
20
+ applet_description "An example 'noSuchAppletHandler' applet. If Arrow is configured " +
21
+ "with the uri of this applet as the noSuchAppletHandler value, " +
22
+ "it will run this applet instead of declining requests for " +
23
+ "URIs that don't match a registered applet."
24
+ applet_maintainer "ged@FaerieMUD.org"
25
+
26
+ default_action :display
27
+ template :display => 'nosuchapplet.tmpl'
28
+
29
+ end # class NoSuchAppletHandler
30
+
31
+
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # The ServerStatus class, a derivative of Arrow::Applet. An
4
+ # appserver status applet.
5
+ #
6
+ # == Authors
7
+ #
8
+ # * Michael Granger <ged@FaerieMUD.org>
9
+ #
10
+ # Please see the file LICENSE in the top-level directory for licensing details.
11
+ #
12
+
13
+ require 'arrow/applet'
14
+
15
+
16
+ ### An Arrow appserver status applet.
17
+ class ServerStatus < Arrow::Applet
18
+
19
+
20
+ # Applet signature
21
+ Signature = {
22
+ :name => "Appserver Status",
23
+ :description => "Displays a list of all loaded applets or information " +
24
+ "about a particular one.",
25
+ :maintainer => "ged@FaerieMUD.org",
26
+ :config => {},
27
+ :templates => {
28
+ :status => 'status.tmpl',
29
+ :applet => 'applet-status.tmpl',
30
+ },
31
+ :vargs => {},
32
+ :monitors => {},
33
+ :default_action => 'display',
34
+ }
35
+
36
+
37
+ ######
38
+ public
39
+ ######
40
+
41
+ def_action :display do |txn, *args|
42
+ self.log.debug "In the 'display' action of the '%s' applet." %
43
+ self.signature.name
44
+
45
+ templ = self.load_template( :status )
46
+ templ.registry = txn.broker.registry
47
+ templ.transaction = txn
48
+ templ.txn = txn
49
+ templ.pid = Process.pid
50
+ templ.ppid = Process.ppid
51
+ templ.currentApplet = self
52
+
53
+ self.log.debug "About to return from the 'display' action."
54
+ return templ
55
+ end
56
+
57
+
58
+ def_action :applet do |txn, *args|
59
+ self.log.debug "In the 'applet' action of the '%s' applet." %
60
+ self.signature.name
61
+
62
+ applet = txn.broker.registry[ args.join("/") ]
63
+ if applet.nil?
64
+ self.log.error "%s: no such applet to inspect. Registry contains: %p" %
65
+ [ args[0], txn.broker.registry.keys.sort ]
66
+ return self.run( txn, 'display' )
67
+ end
68
+
69
+ templ = self.load_template( :applet )
70
+ templ.uri = args.join("/")
71
+ templ.applet = applet
72
+ templ.txn = txn
73
+ templ.pid = Process.pid
74
+ templ.ppid = Process.ppid
75
+ templ.currentApplet = self
76
+
77
+ return templ
78
+ end
79
+
80
+
81
+ def decline_action( txn, *args )
82
+ return nil
83
+ end
84
+
85
+ alias_method :css_action, :decline_action
86
+ alias_method :images_action, :decline_action
87
+ alias_method :js_action, :decline_action
88
+ alias_method :javascript_action, :decline_action
89
+
90
+ end # class ServerStatus
91
+
92
+