This class is the DRb interface for ProjectBroker. We only want to expose these methods for remote access.
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/taskjuggler/daemon/ProjectBroker.rb, line 495 def apiVersion(authKey, version) return 0 unless @broker.checkKey(authKey, 'apiVersion') version == 1 ? 1 : -1 end
# File lib/taskjuggler/daemon/ProjectBroker.rb, line 525 def command(authKey, cmd, args) return false unless @broker.checkKey(authKey, cmd) trap do case cmd when :status @broker.status when :stop @broker.stop when :addProject # To pass the DRbObject as separate arguments we need to convert it # into a real Array again. @broker.addProject(*Array.new(args)) when :removeProject @broker.removeProject(args) when :getProject @broker.getProject(args) when :update @broker.update else fatal('unknown_command', 'Unknown command #{cmd} called') end end end
# File lib/taskjuggler/daemon/ProjectBroker.rb, line 556 def getProject(authKey, id) return false unless @broker.checkKey(authKey, 'getProject') debug('', "PID: #{id} Class: #{id.class}") trap { @broker.getProject(id) } end
# File lib/taskjuggler/daemon/ProjectBroker.rb, line 550 def getProjectList(authKey) return false unless @broker.checkKey(authKey, 'getProjectList') trap { @broker.getProjectList } end
This function catches all unhandled exceptions in the passed block.
# File lib/taskjuggler/daemon/ProjectBroker.rb, line 502 def trap begin yield rescue => e # TjRuntimeError exceptions are simply passed through. if e.is_a?(TjRuntimeError) raise TjRuntimeError, $! end # Any exception here is a fata error. We try hard to terminate the DRb # thread and then exit the program. begin fatal('pb_crash_trap', "#{e}\n#{e.backtrace.join("\n")}\n\n" + "#{'*' * 79}\nYou have triggered a bug in " + "#{AppConfig.softwareName} version #{AppConfig.version}!\n" + "Please see the user manual on how to get this bug fixed!\n" + "#{'*' * 79}\n") rescue RuntimeError @broker.stop end end end
# File lib/taskjuggler/daemon/ProjectBroker.rb, line 563 def updateState(authKey, projectKey, id, status, modified) return false unless @broker.checkKey(authKey, 'updateState') trap { @broker.updateState(projectKey, id, status, modified) } end
Generated with the Darkfish Rdoc Generator 2.