Subversion Info

Rev
423
Last Checked In
2007-08-15 18:50:16 (6 months ago)
Checked in by
deveiant

Parent

Namespace

Class Index

Quicksearch

Arrow::Applet

An abstract base class for Arrow applets. Provides execution logic, argument-parsing/untainting/validation, and templating through an injected factory.

Constants

SVNRev
SVN Revision
SVNId
SVN Id
SignatureStruct
Applet signature struct. The fields are as follows:
name
The name of the applet; used for introspection and reports.
description
The description of the applet; used for introspection.
maintainer
The name of the maintainer for reports and introspection.
version
The version or revision number of the applet, which can be any object that has a #to_s method.
default_action
The action that will be run if no action is specified.
templates
A hash of templates used by the applet. The keys are Symbol identifiers which will be used for lookup, and the values are the paths to template files.
validator_profiles
A hash containing profiles for the built in form validator, one per action. See the documentation for FormValidator for the format of each profile hash.
SignatureStructDefaults
Default-generators for Signatures which are missing one or more of the optional pairs.

Attributes

actions[R]
The list of all valid actions on the applet
config[RW]
The Arrow::Config object which contains the system‘s configuration.
derivatives[R]
The Array of loaded applet classes (derivatives)
filename[RW]
The file containing the applet‘s class definition
newly_loaded[R]
The Array of applet classes that were loaded by the most recent call to .load.
run_count[R]
The number of times this particular applet object has been run
signature[R]
The Struct that contains the configuration values for this applet
template_factory[R]
The Arrow::TemplateFactory object used to load templates for the applet.
total_stime[R]
The number of system seconds spent in this applet‘s #run method.
total_utime[R]
The number of user seconds spent in this applet‘s #run method.
uri[R]
The URI the applet answers to

Public Class Methods

appicon( imgfile ) click to toggle source

Set the appicon for the applet to imgfile.

     # File lib/arrow/applet.rb, line 264
264:     def self::appicon( imgfile )
265:         self.signature.appicon = imgfile
266:     end
applet_description( desc ) click to toggle source

Set the description of the applet to desc.

     # File lib/arrow/applet.rb, line 233
233:     def self::applet_description( desc )
234:         self.signature.description = desc     
235:     end
applet_maintainer( info ) click to toggle source

Set the contact information for the maintainer of the applet to info.

     # File lib/arrow/applet.rb, line 239
239:     def self::applet_maintainer( info )
240:         self.signature.maintainer = info
241:     end
applet_name( name ) click to toggle source

Set the name of the applet to name.

     # File lib/arrow/applet.rb, line 227
227:     def self::applet_name( name )
228:         self.signature.name = name
229:     end
applet_version( ver ) click to toggle source

Set the contact information for the maintainer of the applet to info.

     # File lib/arrow/applet.rb, line 245
245:     def self::applet_version( ver )
246:         self.signature.version = ver
247:     end
def_action( name, &block ) click to toggle source

Define an action for the applet. Transactions which include the specified name as the first directory of the uri after the one the applet is assigned to will be passed to the given block. The return value from this method is an Arrow::Applet::SigProxy which can be used to set associated values in the applet‘s Signature; see the Synopsis in lib/arrow/applet.rb for examples of how to use this.

     # File lib/arrow/applet.rb, line 405
405:     def self::def_action( name, &block )
406:         name = '_default' if name.to_s.empty?
407:         
408:         # Action must accept at least a transaction argument
409:         unless block.arity.nonzero?
410:             raise ScriptError,
411:                 "Malformed action #{name}: must accept at least one argument"
412:         end
413: 
414:         methodName = "#{name}_action"
415:         define_method( methodName, &block )
416:         SigProxy.new( name, self )
417:     end
default_action( action ) click to toggle source

Set the default action for the applet to action.

     # File lib/arrow/applet.rb, line 251
251:     def self::default_action( action )
252:         self.signature.default_action = action.to_s
253:     end
inherited( klass ) click to toggle source

Inheritance callback: register any derivative classes so they can be looked up later.

     # File lib/arrow/applet.rb, line 271
271:     def self::inherited( klass )
272:         @inherited_from = true
273:         if defined?( @newly_loaded )
274:             @newly_loaded.push( klass )
275:             super
276:         else
277:             Arrow::Applet.inherited( klass )
278:         end
279:     end
inherited_from?() click to toggle source

Have any subclasses of this class been created?

     # File lib/arrow/applet.rb, line 283
283:     def self::inherited_from?
284:         @inherited_from
285:     end
load( filename, include_base_classes=false ) click to toggle source

Load any applet classes in the given file and return them. Ignores any class which has a subclass in the file unless include_base_classes is set false

     # File lib/arrow/applet.rb, line 301
301:     def self::load( filename, include_base_classes=false )
302:         self.newly_loaded.clear
303: 
304:         # Load the applet file in an anonymous module. Any applet classes get
305:         # collected via the ::inherited hook into @newly_loaded
306:         Kernel.load( filename, true )
307: 
308:         newderivatives = @newly_loaded.dup
309:         @derivatives -= @newly_loaded
310:         @derivatives.push( *@newly_loaded )
311: 
312:         newderivatives.each do |applet|
313:             applet.filename = filename
314:         end
315: 
316:         unless include_base_classes
317:             newderivatives.delete_if do |applet|
318:                 applet.inherited_from?
319:             end
320:         end
321:         
322:         return newderivatives
323:     end
make_signature() click to toggle source

Signature lookup: look for either a constant or an instance variable of the class that contains the raw signature hash, and convert it to an Arrow::Applet::SignatureStruct object.

     # File lib/arrow/applet.rb, line 349
349:     def self::make_signature
350:         rawsig = nil
351:         if self.instance_variables.include?( "@signature" )
352:             rawsig = self.instance_variable_get( :@signature )
353:         elsif self.constants.include?( "Signature" )
354:             rawsig = self.const_get( :Signature )
355:         elsif self.constants.include?( "SIGNATURE" )
356:             rawsig = self.const_get( :SIGNATURE )
357:         else
358:             rawsig = {}
359:         end
360: 
361:         # Backward-compatibility: Rewrite the 'vargs' member as
362:         # 'validator_profiles' if 'vargs' exists and 'validator_profiles'
363:         # doesn't. 'vargs' member will be deleted regardless.
364:         rawsig[ :validator_profiles ] ||= rawsig.delete( :vargs ) if
365:             rawsig.key?( :vargs )
366: 
367:         # If the superclass has a signature, inherit values from it for
368:         # pairs that are missing.
369:         if self.superclass < Arrow::Applet && self.superclass.signature?
370:             self.superclass.signature.each_pair do |member,value|
371:                 next if [:name, :description, :version].include?( member )
372:                 if rawsig[member].nil?
373:                     rawsig[ member ] = value.dup rescue value
374:                 end
375:             end
376:         end
377: 
378:         # Apply sensible defaults for members that aren't defined
379:         SignatureStructDefaults.each do |key,val|
380:             next if rawsig[ key ]
381:             case val
382:             when Proc, Method
383:                 rawsig[ key ] = val.call( rawsig, self )
384:             when Numeric, NilClass, FalseClass, TrueClass
385:                 rawsig[ key ] = val
386:             else
387:                 rawsig[ key ] = val.dup
388:             end
389:         end
390: 
391:         # Signature = Struct.new( :name, :description, :maintainer,
392:         #     :version, :config, :default_action, :templates, :validatorArgs,
393:         #     :monitors )
394:         members = SignatureStruct.members.collect {|m| m.intern}
395:         return SignatureStruct.new( *rawsig.values_at(*members) )
396:     end
method_added( sym ) click to toggle source

Method definition callback: Check newly-defined action methods for appropriate arity.

     # File lib/arrow/applet.rb, line 290
290:     def self::method_added( sym )
291:         if /^(\w+)_action$/.match( sym.to_s ) &&
292:                 self.instance_method( sym ).arity.zero?
293:             raise ScriptError, "Inappropriate arity for #{sym}", caller(1)
294:         end
295:     end
new( config, template_factory, uri ) click to toggle source

Create a new Arrow::Applet object with the specified config (an Arrow::Config object), template_factory (an Arrow::TemplateFactory object), and the uri the applet will live under in the appserver (a String).

     # File lib/arrow/applet.rb, line 432
432:     def initialize( config, template_factory, uri )
433:         @config               = config
434:         @template_factory = template_factory
435:         @uri              = uri
436: 
437:         @signature            = self.class.signature.dup
438:         @run_count            = 0
439:         @total_utime      = 0
440:         @total_stime      = 0
441: 
442:         # Make a regexp out of all public <something>_action methods
443:         @actions = self.public_methods( true ).
444:             select {|meth| /^(\w+)_action$/ =~ meth }.
445:             collect {|meth| meth.gsub(/_action/, '') }
446:         @actions_regexp   = Regexp.new( "^(" + actions.join( '|' ) + ")$" )
447:     end
normalized_name() click to toggle source

Return the name of the applet class after stripping off any namespace-safe prefixes.

     # File lib/arrow/applet.rb, line 328
328:     def self::normalized_name
329:         self.name.sub( /#<Module:0x\w+>::/, '' )
330:     end
signature() click to toggle source

Get the applet‘s signature (an Arrow::Applet::SignatureStruct object).

     # File lib/arrow/applet.rb, line 335
335:     def self::signature
336:         @signature ||= make_signature()
337:     end
signature?() click to toggle source

Returns true if the applet class has a signature.

     # File lib/arrow/applet.rb, line 341
341:     def self::signature?
342:         !self.signature.nil?
343:     end
template( sym, path=nil ) click to toggle source

Set the path for the template specified by sym to path.

     # File lib/arrow/applet.rb, line 212
212:     def self::template( sym, path=nil )
213:         case sym
214:         when Symbol, String
215:             self.signature.templates[ sym ] = path
216:             
217:         when Hash
218:             self.signature.templates.merge!( sym )
219:             
220:         else
221:             raise ArgumentError, "cannot convert %s to Symbol" % [ sym ]
222:         end
223:     end
validator( action, rules={} ) click to toggle source

Set the validator rules for the specified action.

     # File lib/arrow/applet.rb, line 258
258:     def self::validator( action, rules={} )
259:         self.signature.validator_profiles[ action ] = rules
260:     end

Public Instance Methods

action_missing_action( txn, raction, *args ) click to toggle source

The action invoked if the specified action is not explicitly defined. The default implementation will look for a template with the same key as the action, and if found, will load that and return it.

     # File lib/arrow/applet.rb, line 570
570:     def action_missing_action( txn, raction, *args )
571:         self.log.debug "In action_missing_action with: raction = %p, args = %p" %
572:             [ raction, args ]
573: 
574:         if raction && @signature.templates.key?( raction.to_s.intern )
575:             self.log.debug "Using template sender default action for %s" % raction
576:             txn.vargs = self.make_validator( raction, txn )
577:             tmpl = self.load_template( raction.intern )
578:             tmpl.txn = txn
579:             return tmpl
580:         else
581:             raise Arrow::AppletError, "No such action '%s' in %s" %
582:                 [ raction, self.signature.name ]
583:         end
584:     end
average_usage() click to toggle source

Returns the average number of seconds (user + system) per run.

     # File lib/arrow/applet.rb, line 600
600:     def average_usage
601:         return 0.0 if @run_count.zero?
602:         (@total_utime + @total_stime) / @run_count.to_f
603:     end
chainable?() click to toggle source

Alias for #delegable?

delegable?() click to toggle source

Returns true if the receiver has a #delegate method that is inherited from somewhere other than the base Arrow::Applet class.

     # File lib/arrow/applet.rb, line 561
561:     def delegable?
562:         return self.method(:delegate).to_s !~ /\(Arrow::Applet\)/
563:     end
Also aliased as: chainable?
delegate( txn, chain, *args ) {|chain| ...} click to toggle source

Wrapper method for a delegation (chained) request.

     # File lib/arrow/applet.rb, line 554
554:     def delegate( txn, chain, *args )
555:         yield( chain )
556:     end
inspect() click to toggle source

Return a human-readable String representing the applet.

     # File lib/arrow/applet.rb, line 588
588:     def inspect
589:         "<%s:0x%08x: %s [%s/%s]>" % [
590:             self.class.name,
591:             self.object_id * 2,
592:             @signature.name,
593:             @signature.version,
594:             @signature.maintainer
595:         ]
596:     end
lookup_action_method( txn, action, *args ) click to toggle source

Given an action name (or nil for the default action), return a Method for the action method which should be invoked on the specified txn.

     # File lib/arrow/applet.rb, line 533
533:     def lookup_action_method( txn, action, *args )
534:         self.log.debug "Mapping %s( %p ) to an action" % [ action, args ]
535: 
536:         # Look up the Method object that needs to be called
537:         if (( match = @actions_regexp.match(action.to_s) ))
538:             action = match.captures[0]
539:             action.untaint
540:             self.log.debug "Matched action = #{action}"
541:         else
542:             self.log.info "Couldn't find specified action %p. "\
543:                 "Defaulting to the 'action_missing' action." % action
544:             args.unshift( action )
545:             action = "action_missing"
546:         end
547: 
548:         return self.method( "#{action}_action" ), *args
549:     end
run( txn, action=nil, *args ) {|meth, txn, *args| ...} click to toggle source

Run the specified action for the given txn and the specified args.

     # File lib/arrow/applet.rb, line 481
481:     def run( txn, action=nil, *args )
482:         starttimes = Process.times
483:         self.log.debug "Running %s" % [ self.signature.name ]
484: 
485:         action = nil if action.to_s.empty?
486:         action ||= @signature.default_action or
487:             raise Arrow::AppletError, "Missing default handler '#{default}'"
488: 
489:         # Do any initial preparation of the transaction that can be factored out
490:         # of all the actions.
491:         self.prep_transaction( txn )
492:         meth, *args = self.lookup_action_method( txn, action, *args )
493:         self.log.debug "Action method is: %p" % [meth]
494:         txn.vargs = self.make_validator( action, txn )
495:         
496:         # Now either pass control to the block, if given, or invoke the
497:         # action
498:         if block_given?
499:             self.log.debug "Yielding to passed block"
500:             rval = yield( meth, txn, *args )
501:         else
502:             self.log.debug "Applet action arity: %d; args = %p" %
503:                 [ meth.arity, args ]
504: 
505:             # Invoke the action with the right number of arguments.
506:             if meth.arity < 0
507:                 rval = meth.call( txn, *args )
508:             elsif meth.arity >= 1
509:                 args.unshift( txn )
510:                 until args.length >= meth.arity do args << nil end
511:                 rval = meth.call( *(args[0, meth.arity]) )
512:             else
513:                 raise Arrow::AppletError,
514:                     "Malformed action: Must accept at least a transaction argument"
515:             end
516:         end
517: 
518:         # Calculate CPU times
519:         runtimes = Process.times
520:         @run_count += 1
521:         @total_utime += utime = (runtimes.utime - starttimes.utime)
522:         @total_stime += stime = (runtimes.stime - starttimes.stime)
523:         self.log.info \
524:             "[PID %d] Runcount: %d, User: %0.2f/%0.2f, System: %0.2f/%0.2f" %
525:             [ Process.pid, @run_count, utime, @total_utime, stime, @total_stime ]
526: 
527:         return rval
528:     end

Protected Instance Methods

get_validator_profile_for_action( action, txn ) click to toggle source

Return the validator profile that corresponds to the action which will be executed by the specified txn. Returns the default profile if no more-specific one is available.

     # File lib/arrow/applet.rb, line 657
657:     def get_validator_profile_for_action( action, txn )
658:         if action.to_s =~ /^(\w+)$/
659:             action = $1
660:             action.untaint
661:         else
662:             self.log.warning "Invalid action '#{action.inspect}'"
663:             action = :__default__
664:         end
665:         
666:         # Look up the profile for the applet or the default one
667:         profile = @signature.validator_profiles[ action.to_sym ] ||
668:             @signature.validator_profiles[ :__default__ ]
669: 
670:         if profile.nil?
671:             self.log.warning "No validator for #{action}, and no __default__. "\
672:                 "Returning nil validator."
673:             return nil
674:         end
675: 
676:         return profile
677:     end
load_template( key ) click to toggle source

Load and return the template associated with the given key according to the applet‘s signature. Returns nil if no such template exists.

     # File lib/arrow/applet.rb, line 640
640:     def load_template( key )
641:         
642:         tname = @signature.templates[key] or
643:             raise Arrow::AppletError, 
644:                 "No such template %p defined in the signature for %s (%s)" %
645:                 [ key, self.signature.name, self.class.filename ]
646: 
647:         tname.untaint
648: 
649:         return @template_factory.get_template( tname )
650:     end
Also aliased as: template
make_validator( action, txn ) click to toggle source

Create a FormValidator object for the specified action which has been given the arguments from the given txn.

     # File lib/arrow/applet.rb, line 682
682:     def make_validator( action, txn )
683:         profile = self.get_validator_profile_for_action( action, txn ) or
684:             return nil
685: 
686:         # Create a new validator object, map the request args into a regular
687:         # hash, and then send them to the validaator with the applicable profile
688:         self.log.debug "Creating form validator for profile: %p" % profile
689: 
690:         params = {}
691: 
692:         # Only try to parse form parameters if there's a form
693:         if txn.form_request?
694:             txn.request.paramtable.each do |key,val|
695:                 # Multi-valued vs. single params
696:                 params[key] = val.to_a.length > 1 ? val.to_a : val.to_s
697:             end
698:         end
699:         validator = Arrow::FormValidator.new( profile, params )
700: 
701:         self.log.debug "Validator: %p" % validator
702:         return validator
703:     end
prep_transaction( txn ) click to toggle source

Prepares the transaction (txn) for applet execution. By default, this method sets the content type of the response to ‘text/html’ and turns off buffering for the header.

     # File lib/arrow/applet.rb, line 632
632:     def prep_transaction( txn )
633:         txn.request.content_type = "text/html"
634:         txn.request.sync_header = true
635:     end
subrun( action, txn, *args ) click to toggle source

Run an action with a duped transaction (e.g., from another action)

     # File lib/arrow/applet.rb, line 611
611:     def subrun( action, txn, *args )
612:         action, txn = txn, action if action.is_a?( Arrow::Transaction )
613:         self.log.debug "Running subordinate action '%s' from '%s'" %
614:             [ action, caller[0] ]
615: 
616:         # Make sure the transaction has stuff loaded. This is necessary when
617:         # #subrun is called without going through #run first (e.g., via 
618:         # #delegate)
619:         if txn.vargs.nil?
620:             self.prep_transaction( txn )
621:             txn.vargs = self.make_validator( action, txn )
622:         end
623: 
624:         meth, *args = self.lookup_action_method( txn, action, *args )
625:         return meth.call( txn, *args )
626:     end
template( key ) click to toggle source

Alias for #load_template

secsequence

--- SEC00016

seccomment

--- ""

classlist

--- |
Class <a href="Applet/SigProxy.html" class="link">Arrow::Applet::SigProxy</a><br />

attributes

--- 
- name: actions
  rw: R
  a_desc: |+
    
    The list of all valid actions on the applet
    
- name: config
  rw: RW
  a_desc: |+
    
    The <a href="Config.html">Arrow::Config</a> object which contains the
    system&#8216;s configuration.
    
- name: derivatives
  rw: R
  a_desc: |+
    
    The Array of loaded applet classes (derivatives)
    
- name: filename
  rw: RW
  a_desc: |+
    
    The file containing the applet&#8216;s class definition
    
- name: newly_loaded
  rw: R
  a_desc: |+
    
    The Array of applet classes that were loaded by the most recent call to .<a
    href="Applet.html#M000557">load</a>.
    
- name: run_count
  rw: R
  a_desc: |+
    
    The number of times this particular applet object has been <a
    href="Applet.html#M000564">run</a>
    
- name: signature
  rw: R
  a_desc: |+
    
    The Struct that contains the configuration values for this applet
    
- name: template_factory
  rw: R
  a_desc: |+
    
    The <a href="TemplateFactory.html">Arrow::TemplateFactory</a> object used
    to <a href="Applet.html#M000557">load</a> templates for the applet.
    
- name: total_stime
  rw: R
  a_desc: |+
    
    The number of system seconds spent in this applet&#8216;s <a
    href="Applet.html#M000564">#run</a> method.
    
- name: total_utime
  rw: R
  a_desc: |+
    
    The number of user seconds spent in this applet&#8216;s <a
    href="Applet.html#M000564">#run</a> method.
    
- name: uri
  rw: R
  a_desc: |+
    
    The URI the applet answers to
    

method_list

--- 
- methods: 
  - visibility: public
    aref: M000553
    name: appicon
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 264</span>\n\
      264:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">appicon</span>( <span class=\"ruby-identifier\">imgfile</span> )\n\
      265:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">appicon</span> = <span class=\"ruby-identifier\">imgfile</span>\n\
      266:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the <a href="Applet.html#M000553">appicon</a> for the applet to
      <tt>imgfile</tt>.
      </p>
    params: ( imgfile )
  - visibility: public
    aref: M000548
    name: applet_description
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 233</span>\n\
      233:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">applet_description</span>( <span class=\"ruby-identifier\">desc</span> )\n\
      234:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">description</span> = <span class=\"ruby-identifier\">desc</span>     \n\
      235:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the description of the applet to <tt>desc</tt>.
      </p>
    params: ( desc )
  - visibility: public
    aref: M000549
    name: applet_maintainer
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 239</span>\n\
      239:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">applet_maintainer</span>( <span class=\"ruby-identifier\">info</span> )\n\
      240:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">maintainer</span> = <span class=\"ruby-identifier\">info</span>\n\
      241:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the contact information for the maintainer of the applet to
      <tt>info</tt>.
      </p>
    params: ( info )
  - visibility: public
    aref: M000547
    name: applet_name
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 227</span>\n\
      227:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">applet_name</span>( <span class=\"ruby-identifier\">name</span> )\n\
      228:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">name</span> = <span class=\"ruby-identifier\">name</span>\n\
      229:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the name of the applet to <tt>name</tt>.
      </p>
    params: ( name )
  - visibility: public
    aref: M000550
    name: applet_version
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 245</span>\n\
      245:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">applet_version</span>( <span class=\"ruby-identifier\">ver</span> )\n\
      246:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">version</span> = <span class=\"ruby-identifier\">ver</span>\n\
      247:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the contact information for the maintainer of the applet to
      <tt>info</tt>.
      </p>
    params: ( ver )
  - visibility: public
    aref: M000562
    name: def_action
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 405</span>\n\
      405:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">def_action</span>( <span class=\"ruby-identifier\">name</span>, <span class=\"ruby-operator\">&amp;</span><span class=\"ruby-identifier\">block</span> )\n\
      406:         <span class=\"ruby-identifier\">name</span> = <span class=\"ruby-value str\">'_default'</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">name</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      407:         \n\
      408:         <span class=\"ruby-comment cmt\"># Action must accept at least a transaction argument</span>\n\
      409:         <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">block</span>.<span class=\"ruby-identifier\">arity</span>.<span class=\"ruby-identifier\">nonzero?</span>\n\
      410:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ScriptError</span>,\n\
      411:                 <span class=\"ruby-node\">&quot;Malformed action #{name}: must accept at least one argument&quot;</span>\n\
      412:         <span class=\"ruby-keyword kw\">end</span>\n\
      413: \n\
      414:         <span class=\"ruby-identifier\">methodName</span> = <span class=\"ruby-node\">&quot;#{name}_action&quot;</span>\n\
      415:         <span class=\"ruby-identifier\">define_method</span>( <span class=\"ruby-identifier\">methodName</span>, <span class=\"ruby-operator\">&amp;</span><span class=\"ruby-identifier\">block</span> )\n\
      416:         <span class=\"ruby-constant\">SigProxy</span>.<span class=\"ruby-identifier\">new</span>( <span class=\"ruby-identifier\">name</span>, <span class=\"ruby-keyword kw\">self</span> )\n\
      417:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Define an action for the applet. Transactions which include the specified
      <tt>name</tt> as the first directory of the uri after the one the applet is
      assigned to will be passed to the given <tt>block</tt>. The return value
      from this method is an <a
      href="Applet/SigProxy.html">Arrow::Applet::SigProxy</a> which can be used
      to set associated values in the applet&#8216;s Signature; see the Synopsis
      in lib/arrow/applet.rb for examples of how to use this.
      </p>
    params: ( name, &amp;block )
  - visibility: public
    aref: M000551
    name: default_action
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 251</span>\n\
      251:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">default_action</span>( <span class=\"ruby-identifier\">action</span> )\n\
      252:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">default_action</span> = <span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">to_s</span>\n\
      253:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the default action for the applet to <tt>action</tt>.
      </p>
    params: ( action )
  - visibility: public
    aref: M000554
    name: inherited
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 271</span>\n\
      271:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">inherited</span>( <span class=\"ruby-identifier\">klass</span> )\n\
      272:         <span class=\"ruby-ivar\">@inherited_from</span> = <span class=\"ruby-keyword kw\">true</span>\n\
      273:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">defined?</span>( <span class=\"ruby-ivar\">@newly_loaded</span> )\n\
      274:             <span class=\"ruby-ivar\">@newly_loaded</span>.<span class=\"ruby-identifier\">push</span>( <span class=\"ruby-identifier\">klass</span> )\n\
      275:             <span class=\"ruby-keyword kw\">super</span>\n\
      276:         <span class=\"ruby-keyword kw\">else</span>\n\
      277:             <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Applet</span>.<span class=\"ruby-identifier\">inherited</span>( <span class=\"ruby-identifier\">klass</span> )\n\
      278:         <span class=\"ruby-keyword kw\">end</span>\n\
      279:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Inheritance callback: register any derivative classes so they can be looked
      up later.
      </p>
    params: ( klass )
  - visibility: public
    aref: M000555
    name: inherited_from?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 283</span>\n\
      283:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">inherited_from?</span>\n\
      284:         <span class=\"ruby-ivar\">@inherited_from</span>\n\
      285:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Have any subclasses of this class been created?
      </p>
    params: ()
  - visibility: public
    aref: M000557
    name: load
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 301</span>\n\
      301:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">load</span>( <span class=\"ruby-identifier\">filename</span>, <span class=\"ruby-identifier\">include_base_classes</span>=<span class=\"ruby-keyword kw\">false</span> )\n\
      302:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">newly_loaded</span>.<span class=\"ruby-identifier\">clear</span>\n\
      303: \n\
      304:         <span class=\"ruby-comment cmt\"># Load the applet file in an anonymous module. Any applet classes get</span>\n\
      305:         <span class=\"ruby-comment cmt\"># collected via the ::inherited hook into @newly_loaded</span>\n\
      306:         <span class=\"ruby-constant\">Kernel</span>.<span class=\"ruby-identifier\">load</span>( <span class=\"ruby-identifier\">filename</span>, <span class=\"ruby-keyword kw\">true</span> )\n\
      307: \n\
      308:         <span class=\"ruby-identifier\">newderivatives</span> = <span class=\"ruby-ivar\">@newly_loaded</span>.<span class=\"ruby-identifier\">dup</span>\n\
      309:         <span class=\"ruby-ivar\">@derivatives</span> <span class=\"ruby-operator\">-=</span> <span class=\"ruby-ivar\">@newly_loaded</span>\n\
      310:         <span class=\"ruby-ivar\">@derivatives</span>.<span class=\"ruby-identifier\">push</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-ivar\">@newly_loaded</span> )\n\
      311: \n\
      312:         <span class=\"ruby-identifier\">newderivatives</span>.<span class=\"ruby-identifier\">each</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">applet</span><span class=\"ruby-operator\">|</span>\n\
      313:             <span class=\"ruby-identifier\">applet</span>.<span class=\"ruby-identifier\">filename</span> = <span class=\"ruby-identifier\">filename</span>\n\
      314:         <span class=\"ruby-keyword kw\">end</span>\n\
      315: \n\
      316:         <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">include_base_classes</span>\n\
      317:             <span class=\"ruby-identifier\">newderivatives</span>.<span class=\"ruby-identifier\">delete_if</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">applet</span><span class=\"ruby-operator\">|</span>\n\
      318:                 <span class=\"ruby-identifier\">applet</span>.<span class=\"ruby-identifier\">inherited_from?</span>\n\
      319:             <span class=\"ruby-keyword kw\">end</span>\n\
      320:         <span class=\"ruby-keyword kw\">end</span>\n\
      321:         \n\
      322:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">newderivatives</span>\n\
      323:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Load any applet classes in the given file and return them. Ignores any
      class which has a subclass in the file unless <tt>include_base_classes</tt>
      is set false
      </p>
    params: ( filename, include_base_classes=false )
  - visibility: public
    aref: M000561
    name: make_signature
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 349</span>\n\
      349:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">make_signature</span>\n\
      350:         <span class=\"ruby-identifier\">rawsig</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      351:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">instance_variables</span>.<span class=\"ruby-identifier\">include?</span>( <span class=\"ruby-value str\">&quot;@signature&quot;</span> )\n\
      352:             <span class=\"ruby-identifier\">rawsig</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">instance_variable_get</span>( <span class=\"ruby-identifier\">:@signature</span> )\n\
      353:         <span class=\"ruby-keyword kw\">elsif</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">constants</span>.<span class=\"ruby-identifier\">include?</span>( <span class=\"ruby-value str\">&quot;Signature&quot;</span> )\n\
      354:             <span class=\"ruby-identifier\">rawsig</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">const_get</span>( <span class=\"ruby-identifier\">:Signature</span> )\n\
      355:         <span class=\"ruby-keyword kw\">elsif</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">constants</span>.<span class=\"ruby-identifier\">include?</span>( <span class=\"ruby-value str\">&quot;SIGNATURE&quot;</span> )\n\
      356:             <span class=\"ruby-identifier\">rawsig</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">const_get</span>( <span class=\"ruby-identifier\">:SIGNATURE</span> )\n\
      357:         <span class=\"ruby-keyword kw\">else</span>\n\
      358:             <span class=\"ruby-identifier\">rawsig</span> = {}\n\
      359:         <span class=\"ruby-keyword kw\">end</span>\n\
      360: \n\
      361:         <span class=\"ruby-comment cmt\"># Backward-compatibility: Rewrite the 'vargs' member as</span>\n\
      362:         <span class=\"ruby-comment cmt\"># 'validator_profiles' if 'vargs' exists and 'validator_profiles'</span>\n\
      363:         <span class=\"ruby-comment cmt\"># doesn't. 'vargs' member will be deleted regardless.</span>\n\
      364:         <span class=\"ruby-identifier\">rawsig</span>[ <span class=\"ruby-identifier\">:validator_profiles</span> ] <span class=\"ruby-operator\">||=</span> <span class=\"ruby-identifier\">rawsig</span>.<span class=\"ruby-identifier\">delete</span>( <span class=\"ruby-identifier\">:vargs</span> ) <span class=\"ruby-keyword kw\">if</span>\n\
      365:             <span class=\"ruby-identifier\">rawsig</span>.<span class=\"ruby-identifier\">key?</span>( <span class=\"ruby-identifier\">:vargs</span> )\n\
      366: \n\
      367:         <span class=\"ruby-comment cmt\"># If the superclass has a signature, inherit values from it for</span>\n\
      368:         <span class=\"ruby-comment cmt\"># pairs that are missing.</span>\n\
      369:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">superclass</span> <span class=\"ruby-operator\">&lt;</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Applet</span> <span class=\"ruby-operator\">&amp;&amp;</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">superclass</span>.<span class=\"ruby-identifier\">signature?</span>\n\
      370:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">superclass</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">each_pair</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">member</span>,<span class=\"ruby-identifier\">value</span><span class=\"ruby-operator\">|</span>\n\
      371:                 <span class=\"ruby-keyword kw\">next</span> <span class=\"ruby-keyword kw\">if</span> [<span class=\"ruby-identifier\">:name</span>, <span class=\"ruby-identifier\">:description</span>, <span class=\"ruby-identifier\">:version</span>].<span class=\"ruby-identifier\">include?</span>( <span class=\"ruby-identifier\">member</span> )\n\
      372:                 <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">rawsig</span>[<span class=\"ruby-identifier\">member</span>].<span class=\"ruby-identifier\">nil?</span>\n\
      373:                     <span class=\"ruby-identifier\">rawsig</span>[ <span class=\"ruby-identifier\">member</span> ] = <span class=\"ruby-identifier\">value</span>.<span class=\"ruby-identifier\">dup</span> <span class=\"ruby-keyword kw\">rescue</span> <span class=\"ruby-identifier\">value</span>\n\
      374:                 <span class=\"ruby-keyword kw\">end</span>\n\
      375:             <span class=\"ruby-keyword kw\">end</span>\n\
      376:         <span class=\"ruby-keyword kw\">end</span>\n\
      377: \n\
      378:         <span class=\"ruby-comment cmt\"># Apply sensible defaults for members that aren't defined</span>\n\
      379:         <span class=\"ruby-constant\">SignatureStructDefaults</span>.<span class=\"ruby-identifier\">each</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">key</span>,<span class=\"ruby-identifier\">val</span><span class=\"ruby-operator\">|</span>\n\
      380:             <span class=\"ruby-keyword kw\">next</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">rawsig</span>[ <span class=\"ruby-identifier\">key</span> ]\n\
      381:             <span class=\"ruby-keyword kw\">case</span> <span class=\"ruby-identifier\">val</span>\n\
      382:             <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-constant\">Proc</span>, <span class=\"ruby-constant\">Method</span>\n\
      383:                 <span class=\"ruby-identifier\">rawsig</span>[ <span class=\"ruby-identifier\">key</span> ] = <span class=\"ruby-identifier\">val</span>.<span class=\"ruby-identifier\">call</span>( <span class=\"ruby-identifier\">rawsig</span>, <span class=\"ruby-keyword kw\">self</span> )\n\
      384:             <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-constant\">Numeric</span>, <span class=\"ruby-constant\">NilClass</span>, <span class=\"ruby-constant\">FalseClass</span>, <span class=\"ruby-constant\">TrueClass</span>\n\
      385:                 <span class=\"ruby-identifier\">rawsig</span>[ <span class=\"ruby-identifier\">key</span> ] = <span class=\"ruby-identifier\">val</span>\n\
      386:             <span class=\"ruby-keyword kw\">else</span>\n\
      387:                 <span class=\"ruby-identifier\">rawsig</span>[ <span class=\"ruby-identifier\">key</span> ] = <span class=\"ruby-identifier\">val</span>.<span class=\"ruby-identifier\">dup</span>\n\
      388:             <span class=\"ruby-keyword kw\">end</span>\n\
      389:         <span class=\"ruby-keyword kw\">end</span>\n\
      390: \n\
      391:         <span class=\"ruby-comment cmt\"># Signature = Struct.new( :name, :description, :maintainer,</span>\n\
      392:         <span class=\"ruby-comment cmt\">#     :version, :config, :default_action, :templates, :validatorArgs,</span>\n\
      393:         <span class=\"ruby-comment cmt\">#     :monitors )</span>\n\
      394:         <span class=\"ruby-identifier\">members</span> = <span class=\"ruby-constant\">SignatureStruct</span>.<span class=\"ruby-identifier\">members</span>.<span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">m</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-identifier\">m</span>.<span class=\"ruby-identifier\">intern</span>}\n\
      395:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-constant\">SignatureStruct</span>.<span class=\"ruby-identifier\">new</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">rawsig</span>.<span class=\"ruby-identifier\">values_at</span>(<span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">members</span>) )\n\
      396:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Signature lookup: look for either a constant or an instance variable of the
      class that contains the raw <a href="Applet.html#M000559">signature</a>
      hash, and convert it to an Arrow::Applet::SignatureStruct object.
      </p>
    params: ()
  - visibility: public
    aref: M000556
    name: method_added
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 290</span>\n\
      290:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">method_added</span>( <span class=\"ruby-identifier\">sym</span> )\n\
      291:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-regexp re\">/^(\\w+)_action$/</span>.<span class=\"ruby-identifier\">match</span>( <span class=\"ruby-identifier\">sym</span>.<span class=\"ruby-identifier\">to_s</span> ) <span class=\"ruby-operator\">&amp;&amp;</span>\n\
      292:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">instance_method</span>( <span class=\"ruby-identifier\">sym</span> ).<span class=\"ruby-identifier\">arity</span>.<span class=\"ruby-identifier\">zero?</span>\n\
      293:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ScriptError</span>, <span class=\"ruby-node\">&quot;Inappropriate arity for #{sym}&quot;</span>, <span class=\"ruby-identifier\">caller</span>(<span class=\"ruby-value\">1</span>)\n\
      294:         <span class=\"ruby-keyword kw\">end</span>\n\
      295:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Method definition callback: Check newly-defined action methods for
      appropriate arity.
      </p>
    params: ( sym )
  - visibility: public
    aref: M000563
    name: new
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 432</span>\n\
      432:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">config</span>, <span class=\"ruby-identifier\">template_factory</span>, <span class=\"ruby-identifier\">uri</span> )\n\
      433:         <span class=\"ruby-ivar\">@config</span>               = <span class=\"ruby-identifier\">config</span>\n\
      434:         <span class=\"ruby-ivar\">@template_factory</span> = <span class=\"ruby-identifier\">template_factory</span>\n\
      435:         <span class=\"ruby-ivar\">@uri</span>              = <span class=\"ruby-identifier\">uri</span>\n\
      436: \n\
      437:         <span class=\"ruby-ivar\">@signature</span>            = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">dup</span>\n\
      438:         <span class=\"ruby-ivar\">@run_count</span>            = <span class=\"ruby-value\">0</span>\n\
      439:         <span class=\"ruby-ivar\">@total_utime</span>      = <span class=\"ruby-value\">0</span>\n\
      440:         <span class=\"ruby-ivar\">@total_stime</span>      = <span class=\"ruby-value\">0</span>\n\
      441: \n\
      442:         <span class=\"ruby-comment cmt\"># Make a regexp out of all public &lt;something&gt;_action methods</span>\n\
      443:         <span class=\"ruby-ivar\">@actions</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">public_methods</span>( <span class=\"ruby-keyword kw\">true</span> ).\n\
      444:             <span class=\"ruby-identifier\">select</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">meth</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-regexp re\">/^(\\w+)_action$/</span> <span class=\"ruby-operator\">=~</span> <span class=\"ruby-identifier\">meth</span> }.\n\
      445:             <span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">meth</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">gsub</span>(<span class=\"ruby-regexp re\">/_action/</span>, <span class=\"ruby-value str\">''</span>) }\n\
      446:         <span class=\"ruby-ivar\">@actions_regexp</span>   = <span class=\"ruby-constant\">Regexp</span>.<span class=\"ruby-identifier\">new</span>( <span class=\"ruby-value str\">&quot;^(&quot;</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-identifier\">actions</span>.<span class=\"ruby-identifier\">join</span>( <span class=\"ruby-value str\">'|'</span> ) <span class=\"ruby-operator\">+</span> <span class=\"ruby-value str\">&quot;)$&quot;</span> )\n\
      447:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Create a <a href="Applet.html#M000563">new</a> <a
      href="Applet.html">Arrow::Applet</a> object with the specified
      <tt>config</tt> (an <a href="Config.html">Arrow::Config</a> object),
      <tt>template_factory</tt> (an <a
      href="TemplateFactory.html">Arrow::TemplateFactory</a> object), and the
      <tt>uri</tt> the applet will live under in the appserver (a <a
      href="../String.html">String</a>).
      </p>
    params: ( config, template_factory, uri )
  - visibility: public
    aref: M000558
    name: normalized_name
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 328</span>\n\
      328:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">normalized_name</span>\n\
      329:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span>.<span class=\"ruby-identifier\">sub</span>( <span class=\"ruby-regexp re\">/#&lt;Module:0x\\w+&gt;::/</span>, <span class=\"ruby-value str\">''</span> )\n\
      330:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the name of the applet class after stripping off any namespace-safe
      prefixes.
      </p>
    params: ()
  - visibility: public
    aref: M000559
    name: signature
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 335</span>\n\
      335:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">signature</span>\n\
      336:         <span class=\"ruby-ivar\">@signature</span> <span class=\"ruby-operator\">||=</span> <span class=\"ruby-identifier\">make_signature</span>()\n\
      337:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Get the applet&#8216;s <a href="Applet.html#M000559">signature</a> (an
      Arrow::Applet::SignatureStruct object).
      </p>
    params: ()
  - visibility: public
    aref: M000560
    name: signature?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 341</span>\n\
      341:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">signature?</span>\n\
      342:         <span class=\"ruby-operator\">!</span><span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">nil?</span>\n\
      343:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns <tt>true</tt> if the applet class has a <a
      href="Applet.html#M000559">signature</a>.
      </p>
    params: ()
  - visibility: public
    aref: M000546
    name: template
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 212</span>\n\
      212:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">template</span>( <span class=\"ruby-identifier\">sym</span>, <span class=\"ruby-identifier\">path</span>=<span class=\"ruby-keyword kw\">nil</span> )\n\
      213:         <span class=\"ruby-keyword kw\">case</span> <span class=\"ruby-identifier\">sym</span>\n\
      214:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-constant\">Symbol</span>, <span class=\"ruby-constant\">String</span>\n\
      215:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">templates</span>[ <span class=\"ruby-identifier\">sym</span> ] = <span class=\"ruby-identifier\">path</span>\n\
      216:             \n\
      217:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-constant\">Hash</span>\n\
      218:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">templates</span>.<span class=\"ruby-identifier\">merge!</span>( <span class=\"ruby-identifier\">sym</span> )\n\
      219:             \n\
      220:         <span class=\"ruby-keyword kw\">else</span>\n\
      221:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;cannot convert %s to Symbol&quot;</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-identifier\">sym</span> ]\n\
      222:         <span class=\"ruby-keyword kw\">end</span>\n\
      223:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the path for the <a href="Applet.html#M000546">template</a> specified
      by <tt>sym</tt> to <tt>path</tt>.
      </p>
    params: ( sym, path=nil )
  - visibility: public
    aref: M000552
    name: validator
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 258</span>\n\
      258:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">validator</span>( <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">rules</span>={} )\n\
      259:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">validator_profiles</span>[ <span class=\"ruby-identifier\">action</span> ] = <span class=\"ruby-identifier\">rules</span>\n\
      260:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the <a href="Applet.html#M000552">validator</a> <tt>rules</tt> for the
      specified <tt>action</tt>.
      </p>
    params: ( action, rules={} )
  category: Class
  type: Public
- methods: 
  - visibility: public
    aref: M000569
    name: action_missing_action
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 570</span>\n\
      570:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">action_missing_action</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-identifier\">raction</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      571:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;In action_missing_action with: raction = %p, args = %p&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      572:             [ <span class=\"ruby-identifier\">raction</span>, <span class=\"ruby-identifier\">args</span> ]\n\
      573: \n\
      574:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">raction</span> <span class=\"ruby-operator\">&amp;&amp;</span> <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">templates</span>.<span class=\"ruby-identifier\">key?</span>( <span class=\"ruby-identifier\">raction</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">intern</span> )\n\
      575:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Using template sender default action for %s&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">raction</span>\n\
      576:             <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">vargs</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">make_validator</span>( <span class=\"ruby-identifier\">raction</span>, <span class=\"ruby-identifier\">txn</span> )\n\
      577:             <span class=\"ruby-identifier\">tmpl</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">load_template</span>( <span class=\"ruby-identifier\">raction</span>.<span class=\"ruby-identifier\">intern</span> )\n\
      578:             <span class=\"ruby-identifier\">tmpl</span>.<span class=\"ruby-identifier\">txn</span> = <span class=\"ruby-identifier\">txn</span>\n\
      579:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">tmpl</span>\n\
      580:         <span class=\"ruby-keyword kw\">else</span>\n\
      581:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">AppletError</span>, <span class=\"ruby-value str\">&quot;No such action '%s' in %s&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      582:                 [ <span class=\"ruby-identifier\">raction</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">name</span> ]\n\
      583:         <span class=\"ruby-keyword kw\">end</span>\n\
      584:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      The action invoked if the specified action is not explicitly defined. The
      default implementation will look for a <a
      href="Applet.html#M000546">template</a> with the same key as the action,
      and if found, will <a href="Applet.html#M000557">load</a> that and return
      it.
      </p>
    params: ( txn, raction, *args )
  - visibility: public
    aref: M000571
    name: average_usage
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 600</span>\n\
      600:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">average_usage</span>\n\
      601:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-value\">0</span><span class=\"ruby-value\">.0</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@run_count</span>.<span class=\"ruby-identifier\">zero?</span>\n\
      602:         (<span class=\"ruby-ivar\">@total_utime</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-ivar\">@total_stime</span>) <span class=\"ruby-operator\">/</span> <span class=\"ruby-ivar\">@run_count</span>.<span class=\"ruby-identifier\">to_f</span>\n\
      603:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the average number of seconds (user + system) per <a
      href="Applet.html#M000564">run</a>.
      </p>
    params: ()
  - visibility: public
    aref: M000568
    name: chainable?
    m_desc: |-
      <p>
      Alias for #delegable?
      </p>
    params: ()
  - visibility: public
    aref: M000567
    name: delegable?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 561</span>\n\
      561:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">delegable?</span>\n\
      562:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">method</span>(<span class=\"ruby-identifier\">:delegate</span>).<span class=\"ruby-identifier\">to_s</span> <span class=\"ruby-operator\">!~</span> <span class=\"ruby-regexp re\">/\\(Arrow::Applet\\)/</span>\n\
      563:     <span class=\"ruby-keyword kw\">end</span>"
    aka: 
    - aref: Applet.html#M000568
      name: chainable?
    m_desc: |-
      <p>
      Returns <tt>true</tt> if the receiver has a <a
      href="Applet.html#M000566">#delegate</a> method that is <a
      href="Applet.html#M000554">inherited</a> from somewhere other than the base
      <a href="Applet.html">Arrow::Applet</a> class.
      </p>
    params: ()
  - visibility: public
    aref: M000566
    name: delegate
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 554</span>\n\
      554:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">delegate</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-identifier\">chain</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      555:         <span class=\"ruby-keyword kw\">yield</span>( <span class=\"ruby-identifier\">chain</span> )\n\
      556:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Wrapper method for a delegation (chained) request.
      </p>
    params: ( txn, chain, *args ) {|chain| ...}
  - visibility: public
    aref: M000570
    name: inspect
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 588</span>\n\
      588:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
      589:         <span class=\"ruby-value str\">&quot;&lt;%s:0x%08x: %s [%s/%s]&gt;&quot;</span> <span class=\"ruby-operator\">%</span> [\n\
      590:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>,\n\
      591:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">object_id</span> <span class=\"ruby-operator\">*</span> <span class=\"ruby-value\">2</span>,\n\
      592:             <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">name</span>,\n\
      593:             <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">version</span>,\n\
      594:             <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">maintainer</span>\n\
      595:         ]\n\
      596:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return a human-readable <a href="../String.html">String</a> representing
      the applet.
      </p>
    params: ()
  - visibility: public
    aref: M000565
    name: lookup_action_method
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 533</span>\n\
      533:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">lookup_action_method</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      534:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Mapping %s( %p ) to an action&quot;</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">args</span> ]\n\
      535: \n\
      536:         <span class=\"ruby-comment cmt\"># Look up the Method object that needs to be called</span>\n\
      537:         <span class=\"ruby-keyword kw\">if</span> (( <span class=\"ruby-identifier\">match</span> = <span class=\"ruby-ivar\">@actions_regexp</span>.<span class=\"ruby-identifier\">match</span>(<span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">to_s</span>) ))\n\
      538:             <span class=\"ruby-identifier\">action</span> = <span class=\"ruby-identifier\">match</span>.<span class=\"ruby-identifier\">captures</span>[<span class=\"ruby-value\">0</span>]\n\
      539:             <span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">untaint</span>\n\
      540:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-node\">&quot;Matched action = #{action}&quot;</span>\n\
      541:         <span class=\"ruby-keyword kw\">else</span>\n\
      542:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">info</span> <span class=\"ruby-value str\">&quot;Couldn't find specified action %p. &quot;</span>\\\n\
      543:                 <span class=\"ruby-value str\">&quot;Defaulting to the 'action_missing' action.&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">action</span>\n\
      544:             <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">unshift</span>( <span class=\"ruby-identifier\">action</span> )\n\
      545:             <span class=\"ruby-identifier\">action</span> = <span class=\"ruby-value str\">&quot;action_missing&quot;</span>\n\
      546:         <span class=\"ruby-keyword kw\">end</span>\n\
      547: \n\
      548:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">method</span>( <span class=\"ruby-node\">&quot;#{action}_action&quot;</span> ), <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span>\n\
      549:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Given an <tt>action</tt> name (or <tt>nil</tt> for the default action),
      return a Method for the action method which should be invoked on the
      specified <tt>txn</tt>.
      </p>
    params: ( txn, action, *args )
  - visibility: public
    aref: M000564
    name: run
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 481</span>\n\
      481:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">run</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-identifier\">action</span>=<span class=\"ruby-keyword kw\">nil</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      482:         <span class=\"ruby-identifier\">starttimes</span> = <span class=\"ruby-constant\">Process</span>.<span class=\"ruby-identifier\">times</span>\n\
      483:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Running %s&quot;</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">name</span> ]\n\
      484: \n\
      485:         <span class=\"ruby-identifier\">action</span> = <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      486:         <span class=\"ruby-identifier\">action</span> <span class=\"ruby-operator\">||=</span> <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">default_action</span> <span class=\"ruby-keyword kw\">or</span>\n\
      487:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">AppletError</span>, <span class=\"ruby-node\">&quot;Missing default handler '#{default}'&quot;</span>\n\
      488: \n\
      489:         <span class=\"ruby-comment cmt\"># Do any initial preparation of the transaction that can be factored out</span>\n\
      490:         <span class=\"ruby-comment cmt\"># of all the actions.</span>\n\
      491:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">prep_transaction</span>( <span class=\"ruby-identifier\">txn</span> )\n\
      492:         <span class=\"ruby-identifier\">meth</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">lookup_action_method</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      493:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Action method is: %p&quot;</span> <span class=\"ruby-operator\">%</span> [<span class=\"ruby-identifier\">meth</span>]\n\
      494:         <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">vargs</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">make_validator</span>( <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">txn</span> )\n\
      495:         \n\
      496:         <span class=\"ruby-comment cmt\"># Now either pass control to the block, if given, or invoke the</span>\n\
      497:         <span class=\"ruby-comment cmt\"># action</span>\n\
      498:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span>\n\
      499:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Yielding to passed block&quot;</span>\n\
      500:             <span class=\"ruby-identifier\">rval</span> = <span class=\"ruby-keyword kw\">yield</span>( <span class=\"ruby-identifier\">meth</span>, <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      501:         <span class=\"ruby-keyword kw\">else</span>\n\
      502:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Applet action arity: %d; args = %p&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      503:                 [ <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">arity</span>, <span class=\"ruby-identifier\">args</span> ]\n\
      504: \n\
      505:             <span class=\"ruby-comment cmt\"># Invoke the action with the right number of arguments.</span>\n\
      506:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">arity</span> <span class=\"ruby-operator\">&lt;</span> <span class=\"ruby-value\">0</span>\n\
      507:                 <span class=\"ruby-identifier\">rval</span> = <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">call</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      508:             <span class=\"ruby-keyword kw\">elsif</span> <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">arity</span> <span class=\"ruby-operator\">&gt;=</span> <span class=\"ruby-value\">1</span>\n\
      509:                 <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">unshift</span>( <span class=\"ruby-identifier\">txn</span> )\n\
      510:                 <span class=\"ruby-keyword kw\">until</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">length</span> <span class=\"ruby-operator\">&gt;=</span> <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">arity</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-identifier\">args</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">end</span>\n\
      511:                 <span class=\"ruby-identifier\">rval</span> = <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">call</span>( <span class=\"ruby-operator\">*</span>(<span class=\"ruby-identifier\">args</span>[<span class=\"ruby-value\">0</span>, <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">arity</span>]) )\n\
      512:             <span class=\"ruby-keyword kw\">else</span>\n\
      513:                 <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">AppletError</span>,\n\
      514:                     <span class=\"ruby-value str\">&quot;Malformed action: Must accept at least a transaction argument&quot;</span>\n\
      515:             <span class=\"ruby-keyword kw\">end</span>\n\
      516:         <span class=\"ruby-keyword kw\">end</span>\n\
      517: \n\
      518:         <span class=\"ruby-comment cmt\"># Calculate CPU times</span>\n\
      519:         <span class=\"ruby-identifier\">runtimes</span> = <span class=\"ruby-constant\">Process</span>.<span class=\"ruby-identifier\">times</span>\n\
      520:         <span class=\"ruby-ivar\">@run_count</span> <span class=\"ruby-operator\">+=</span> <span class=\"ruby-value\">1</span>\n\
      521:         <span class=\"ruby-ivar\">@total_utime</span> <span class=\"ruby-operator\">+=</span> <span class=\"ruby-identifier\">utime</span> = (<span class=\"ruby-identifier\">runtimes</span>.<span class=\"ruby-identifier\">utime</span> <span class=\"ruby-operator\">-</span> <span class=\"ruby-identifier\">starttimes</span>.<span class=\"ruby-identifier\">utime</span>)\n\
      522:         <span class=\"ruby-ivar\">@total_stime</span> <span class=\"ruby-operator\">+=</span> <span class=\"ruby-identifier\">stime</span> = (<span class=\"ruby-identifier\">runtimes</span>.<span class=\"ruby-identifier\">stime</span> <span class=\"ruby-operator\">-</span> <span class=\"ruby-identifier\">starttimes</span>.<span class=\"ruby-identifier\">stime</span>)\n\
      523:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">info</span> \\\n\
      524:             <span class=\"ruby-value str\">&quot;[PID %d] Runcount: %d, User: %0.2f/%0.2f, System: %0.2f/%0.2f&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      525:             [ <span class=\"ruby-constant\">Process</span>.<span class=\"ruby-identifier\">pid</span>, <span class=\"ruby-ivar\">@run_count</span>, <span class=\"ruby-identifier\">utime</span>, <span class=\"ruby-ivar\">@total_utime</span>, <span class=\"ruby-identifier\">stime</span>, <span class=\"ruby-ivar\">@total_stime</span> ]\n\
      526: \n\
      527:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">rval</span>\n\
      528:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Run the specified <tt>action</tt> for the given <tt>txn</tt> and the
      specified <tt>args</tt>.
      </p>
    params: ( txn, action=nil, *args ) {|meth, txn, *args| ...}
  category: Instance
  type: Public
- methods: 
  - visibility: protected
    aref: M000576
    name: get_validator_profile_for_action
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 657</span>\n\
      657:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">get_validator_profile_for_action</span>( <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">txn</span> )\n\
      658:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">to_s</span> <span class=\"ruby-operator\">=~</span> <span class=\"ruby-regexp re\">/^(\\w+)$/</span>\n\
      659:             <span class=\"ruby-identifier\">action</span> = <span class=\"ruby-identifier\">$1</span>\n\
      660:             <span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">untaint</span>\n\
      661:         <span class=\"ruby-keyword kw\">else</span>\n\
      662:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">warning</span> <span class=\"ruby-node\">&quot;Invalid action '#{action.inspect}'&quot;</span>\n\
      663:             <span class=\"ruby-identifier\">action</span> = <span class=\"ruby-identifier\">:__default__</span>\n\
      664:         <span class=\"ruby-keyword kw\">end</span>\n\
      665:         \n\
      666:         <span class=\"ruby-comment cmt\"># Look up the profile for the applet or the default one</span>\n\
      667:         <span class=\"ruby-identifier\">profile</span> = <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">validator_profiles</span>[ <span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">to_sym</span> ] <span class=\"ruby-operator\">||</span>\n\
      668:             <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">validator_profiles</span>[ <span class=\"ruby-identifier\">:__default__</span> ]\n\
      669: \n\
      670:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">profile</span>.<span class=\"ruby-identifier\">nil?</span>\n\
      671:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">warning</span> <span class=\"ruby-node\">&quot;No validator for #{action}, and no __default__. &quot;</span>\\\n\
      672:                 <span class=\"ruby-value str\">&quot;Returning nil validator.&quot;</span>\n\
      673:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span>\n\
      674:         <span class=\"ruby-keyword kw\">end</span>\n\
      675: \n\
      676:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">profile</span>\n\
      677:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the <a href="Applet.html#M000552">validator</a> profile that
      corresponds to the <tt>action</tt> which will be executed by the specified
      <tt>txn</tt>. Returns the <em>default</em> profile if no more-specific one
      is available.
      </p>
    params: ( action, txn )
  - visibility: protected
    aref: M000574
    name: load_template
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 640</span>\n\
      640:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">load_template</span>( <span class=\"ruby-identifier\">key</span> )\n\
      641:         \n\
      642:         <span class=\"ruby-identifier\">tname</span> = <span class=\"ruby-ivar\">@signature</span>.<span class=\"ruby-identifier\">templates</span>[<span class=\"ruby-identifier\">key</span>] <span class=\"ruby-keyword kw\">or</span>\n\
      643:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">AppletError</span>, \n\
      644:                 <span class=\"ruby-value str\">&quot;No such template %p defined in the signature for %s (%s)&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      645:                 [ <span class=\"ruby-identifier\">key</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">signature</span>.<span class=\"ruby-identifier\">name</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">filename</span> ]\n\
      646: \n\
      647:         <span class=\"ruby-identifier\">tname</span>.<span class=\"ruby-identifier\">untaint</span>\n\
      648: \n\
      649:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-ivar\">@template_factory</span>.<span class=\"ruby-identifier\">get_template</span>( <span class=\"ruby-identifier\">tname</span> )\n\
      650:     <span class=\"ruby-keyword kw\">end</span>"
    aka: 
    - aref: Applet.html#M000575
      name: template
    m_desc: |-
      <p>
      Load and return the <a href="Applet.html#M000546">template</a> associated
      with the given <tt>key</tt> according to the applet&#8216;s <a
      href="Applet.html#M000559">signature</a>. Returns <tt>nil</tt> if no such
      <a href="Applet.html#M000546">template</a> exists.
      </p>
    params: ( key )
  - visibility: protected
    aref: M000577
    name: make_validator
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 682</span>\n\
      682:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">make_validator</span>( <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">txn</span> )\n\
      683:         <span class=\"ruby-identifier\">profile</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">get_validator_profile_for_action</span>( <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">txn</span> ) <span class=\"ruby-keyword kw\">or</span>\n\
      684:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span>\n\
      685: \n\
      686:         <span class=\"ruby-comment cmt\"># Create a new validator object, map the request args into a regular</span>\n\
      687:         <span class=\"ruby-comment cmt\"># hash, and then send them to the validaator with the applicable profile</span>\n\
      688:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Creating form validator for profile: %p&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">profile</span>\n\
      689: \n\
      690:         <span class=\"ruby-identifier\">params</span> = {}\n\
      691: \n\
      692:         <span class=\"ruby-comment cmt\"># Only try to parse form parameters if there's a form</span>\n\
      693:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">form_request?</span>\n\
      694:             <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">request</span>.<span class=\"ruby-identifier\">paramtable</span>.<span class=\"ruby-identifier\">each</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">key</span>,<span class=\"ruby-identifier\">val</span><span class=\"ruby-operator\">|</span>\n\
      695:                 <span class=\"ruby-comment cmt\"># Multi-valued vs. single params</span>\n\
      696:                 <span class=\"ruby-identifier\">params</span>[<span class=\"ruby-identifier\">key</span>] = <span class=\"ruby-identifier\">val</span>.<span class=\"ruby-identifier\">to_a</span>.<span class=\"ruby-identifier\">length</span> <span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value\">1</span> <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">val</span>.<span class=\"ruby-identifier\">to_a</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-identifier\">val</span>.<span class=\"ruby-identifier\">to_s</span>\n\
      697:             <span class=\"ruby-keyword kw\">end</span>\n\
      698:         <span class=\"ruby-keyword kw\">end</span>\n\
      699:         <span class=\"ruby-identifier\">validator</span> = <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">FormValidator</span>.<span class=\"ruby-identifier\">new</span>( <span class=\"ruby-identifier\">profile</span>, <span class=\"ruby-identifier\">params</span> )\n\
      700: \n\
      701:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Validator: %p&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">validator</span>\n\
      702:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">validator</span>\n\
      703:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Create a <a href="FormValidator.html">FormValidator</a> object for the
      specified <tt>action</tt> which has been given the arguments from the given
      <tt>txn</tt>.
      </p>
    params: ( action, txn )
  - visibility: protected
    aref: M000573
    name: prep_transaction
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 632</span>\n\
      632:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">prep_transaction</span>( <span class=\"ruby-identifier\">txn</span> )\n\
      633:         <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">request</span>.<span class=\"ruby-identifier\">content_type</span> = <span class=\"ruby-value str\">&quot;text/html&quot;</span>\n\
      634:         <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">request</span>.<span class=\"ruby-identifier\">sync_header</span> = <span class=\"ruby-keyword kw\">true</span>\n\
      635:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Prepares the transaction (<tt>txn</tt>) for applet execution. By default,
      this method sets the content type of the response to
      &#8216;text/html&#8217; and turns off buffering for the header.
      </p>
    params: ( txn )
  - visibility: protected
    aref: M000572
    name: subrun
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/arrow/applet.rb, line 611</span>\n\
      611:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">subrun</span>( <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      612:         <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">txn</span> = <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-identifier\">action</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">action</span>.<span class=\"ruby-identifier\">is_a?</span>( <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Transaction</span> )\n\
      613:         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">log</span>.<span class=\"ruby-identifier\">debug</span> <span class=\"ruby-value str\">&quot;Running subordinate action '%s' from '%s'&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      614:             [ <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">caller</span>[<span class=\"ruby-value\">0</span>] ]\n\
      615: \n\
      616:         <span class=\"ruby-comment cmt\"># Make sure the transaction has stuff loaded. This is necessary when</span>\n\
      617:         <span class=\"ruby-comment cmt\"># #subrun is called without going through #run first (e.g., via </span>\n\
      618:         <span class=\"ruby-comment cmt\"># #delegate)</span>\n\
      619:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">vargs</span>.<span class=\"ruby-identifier\">nil?</span>\n\
      620:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">prep_transaction</span>( <span class=\"ruby-identifier\">txn</span> )\n\
      621:             <span class=\"ruby-identifier\">txn</span>.<span class=\"ruby-identifier\">vargs</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">make_validator</span>( <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-identifier\">txn</span> )\n\
      622:         <span class=\"ruby-keyword kw\">end</span>\n\
      623: \n\
      624:         <span class=\"ruby-identifier\">meth</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">lookup_action_method</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-identifier\">action</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      625:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">meth</span>.<span class=\"ruby-identifier\">call</span>( <span class=\"ruby-identifier\">txn</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      626:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Run an action with a duped transaction (e.g., from another action)
      </p>
    params: ( action, txn, *args )
  - visibility: protected
    aref: M000575
    name: template
    m_desc: |-
      <p>
      Alias for <a href="Applet.html#M000574">#load_template</a>
      </p>
    params: ( key )
  category: Instance
  type: Protected

sectitle

--- 

constants

--- 
- name: SVNRev
  desc: |+
    
    SVN Revision
    
  value: "%q$Rev: 423 $"
- name: SVNId
  desc: |+
    
    SVN Id
    
  value: "%q$Id: applet.rb 423 2007-08-15 18:50:16Z deveiant $"
- name: SignatureStruct
  desc: |
    
    <a href="Applet.html">Applet</a> <a
    href="Applet.html#M000559">signature</a> struct. The fields are as follows:
    
    <dl>
    <dt><b>name</b></dt><dd>The name of the applet; used for introspection and reports.
    
    </dd>
    <dt><b>description</b></dt><dd>The description of the applet; used for introspection.
    
    </dd>
    <dt><b>maintainer</b></dt><dd>The name of the maintainer for reports and introspection.
    
    </dd>
    <dt><b>version</b></dt><dd>The version or revision number of the applet, which can be any object that
    has a #to_s method.
    
    </dd>
    <dt><b><a href="Applet.html#M000551">default_action</a></b></dt><dd>The action that will be <a href="Applet.html#M000564">run</a> if no action
    is specified.
    
    </dd>
    <dt><b>templates</b></dt><dd>A hash of templates used by the applet. The keys are Symbol identifiers
    which will be used for lookup, and the values are the paths to <a
    href="Applet.html#M000546">template</a> files.
    
    </dd>
    <dt><b>validator_profiles</b></dt><dd>A hash containing profiles for the built in form <a
    href="Applet.html#M000552">validator</a>, one per action. See the
    documentation for <a href="FormValidator.html">FormValidator</a> for the
    format of each profile hash.
    
    </dd>
    </dl>

  value: Struct.new( :name, :description, :maintainer,         :version, :config, :default_action, :templates, :validator_profiles,         :appicon )
- name: SignatureStructDefaults
  desc: |+
    
    Default-generators for Signatures which are missing one or more of the
    optional pairs.
    
  value: "{         :name             =&gt; proc {|rawsig, klass| klass.name},         :description      =&gt; &quot;(none)&quot;,         :maintainer           =&gt; &quot;&quot;, # Workaround for RDoc         :version          =&gt; nil, # Wordaround for RDoc         :default_action       =&gt; '_default',         :config               =&gt; {},         :templates            =&gt; {},         :validator_profiles   =&gt; {             :__default__     =&gt; {                 :optional           =&gt; [:action],                 :constraints        =&gt; {                     :action =&gt; /^\\w+$/,                 },             },         },         :appicon          =&gt; 'application-x-executable.png',     }"

[Validate]

Generated with the Darkfish Rdoc Generator.