Class: TaskJuggler::ProjectRecord
- Includes:
- MessageHandler
- Defined in:
- lib/taskjuggler/daemon/ProjectBroker.rb
Overview
The ProjectRecord objects are used to manage the loaded projects. There is one entry for each project in the @projects list.
Instance Attribute Summary collapse
-
#authKey ⇒ Object
Returns the value of attribute authKey.
-
#files ⇒ Object
Returns the value of attribute files.
-
#id ⇒ Object
Returns the value of attribute id.
-
#modified ⇒ Object
Returns the value of attribute modified.
-
#readySince ⇒ Object
Returns the value of attribute readySince.
-
#reloading ⇒ Object
Returns the value of attribute reloading.
-
#state ⇒ Object
Returns the value of attribute state.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(tag) ⇒ ProjectRecord
constructor
A new instance of ProjectRecord.
- #ping ⇒ Object
-
#terminateServer ⇒ Object
Call this function to terminate the ProjectServer.
-
#to_s(format, index) ⇒ Object
This is used to generate the status table.
Methods included from MessageHandler
#critical, #debug, #error, #fatal, #info, #warning
Constructor Details
#initialize(tag) ⇒ ProjectRecord
Returns a new instance of ProjectRecord.
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 583 def initialize(tag) # Before we know the project ID we use this tag to uniquely identify the # project. @tag = tag # Array of [ workingDir, tjp file, ... tji files ] @files = nil # The authentication key for the ProjectServer process. @authKey = nil # The DRb URI where the ProjectServer process is listening. @uri = nil # The ID of the project. @id = nil # The state of the project. :new, :loading, :ready, :failed # and :obsolete are supported. @state = :new # A time stamp when the project became ready for service. @readySince = nil # True if any of the input files have been modified after the load. @modified = false # True if the reload has already been triggered. @reloading = false @projectServer = nil end |
Instance Attribute Details
#authKey ⇒ Object
Returns the value of attribute authKey.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def authKey @authKey end |
#files ⇒ Object
Returns the value of attribute files.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def files @files end |
#id ⇒ Object
Returns the value of attribute id.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def id @id end |
#modified ⇒ Object
Returns the value of attribute modified.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def modified @modified end |
#readySince ⇒ Object
Returns the value of attribute readySince.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def readySince @readySince end |
#reloading ⇒ Object
Returns the value of attribute reloading.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def reloading @reloading end |
#state ⇒ Object
Returns the value of attribute state.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def state @state end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
581 582 583 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 581 def tag @tag end |
#uri ⇒ Object
Returns the value of attribute uri.
579 580 581 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 579 def uri @uri end |
Instance Method Details
#ping ⇒ Object
608 609 610 611 612 613 614 615 616 617 618 619 620 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 608 def ping return true unless @uri debug('', "Sending ping to ProjectServer #{@uri}") begin @projectServer = DRbObject.new(nil, @uri) unless @projectServer @projectServer.ping(@authKey) rescue warning('ping_failed', "Ping failed: #{$!}") return false end true end |
#terminateServer ⇒ Object
Call this function to terminate the ProjectServer.
623 624 625 626 627 628 629 630 631 632 633 634 635 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 623 def terminateServer return unless @uri begin debug('', "Sending termination request to ProjectServer #{@uri}") @projectServer = DRbObject.new(nil, @uri) unless @projectServer @projectServer.terminate(@authKey) rescue error('proj_serv_term_failed', "Termination of ProjectServer failed: #{$!}") end @uri = nil end |
#to_s(format, index) ⇒ Object
This is used to generate the status table.
638 639 640 641 |
# File 'lib/taskjuggler/daemon/ProjectBroker.rb', line 638 def to_s(format, index) sprintf(format, index, @id, @state, @modified ? '*' : ' ', @readySince ? @readySince.to_s('%Y-%m-%d %H:%M:%S') : '') end |