Parent

Class Index [+]

Quicksearch

TaskJuggler::ProjectBrokerIface

This class is the DRb interface for ProjectBroker. We only want to expose these methods for remote access.

Public Class Methods

new(broker) click to toggle source
     # File lib/daemon/ProjectBroker.rb, line 503
503:     def initialize(broker)
504:       @broker = broker
505:     end

Public Instance Methods

apiVersion(authKey, version) click to toggle source

Check the authentication key and the client/server version match. The following return values can be generated: 0 : authKey does not match 1 : client and server versions match -1 : client and server versions don’t match

     # File lib/daemon/ProjectBroker.rb, line 512
512:     def apiVersion(authKey, version)
513:       return 0 unless @broker.checkKey(authKey, 'apiVersion')
514: 
515:       version == 1 ? 1 : 1
516:     end
command(authKey, cmd, args) click to toggle source
     # File lib/daemon/ProjectBroker.rb, line 532
532:     def command(authKey, cmd, args)
533:       return false unless @broker.checkKey(authKey, cmd)
534: 
535:       trap do
536:         case cmd
537:         when :status
538:           @broker.status
539:         when :stop
540:           @broker.stop
541:         when :addProject
542:           # To pass the DRbObject as separate arguments we need to convert it
543:           # into a real Array again.
544:           @broker.addProject(*Array.new(args))
545:         when :removeProject
546:           @broker.removeProject(args)
547:         when :getProject
548:           @broker.getProject(args)
549:         when :update
550:           @broker.update
551:         else
552:           LogFile.instance.fatal('Unknown command #{cmd} called')
553:         end
554:       end
555:     end
trap() click to toggle source

This function catches all unhandled exceptions in the passed block.

     # File lib/daemon/ProjectBroker.rb, line 519
519:     def trap
520:       log = LogFile.instance
521: 
522:       begin
523:         yield
524:       rescue
525:         $stderr.print $!.to_s
526:         $stderr.print $!.backtrace.join("\n")
527:         log.debug($!.backtrace.join("\n"))
528:         log.fatal("Unexpected exception: #{$!}")
529:       end
530:     end
updateState(authKey, projectKey, id, status, modified) click to toggle source
     # File lib/daemon/ProjectBroker.rb, line 557
557:     def updateState(authKey, projectKey, id, status, modified)
558:       return false unless @broker.checkKey(authKey, 'updateState')
559: 
560:       trap { @broker.updateState(projectKey, id, status, modified) }
561:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.