summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-04-21 18:49:25 +0000
committerLuke Kanies <luke@madstop.com>2005-04-21 18:49:25 +0000
commite452f003d219cc6ee107757b3fa2be0086564460 (patch)
treeb830666b1afc414956435eb213e9ac4c4f665e34
parentcf08be12cc1418b02feb0ae52a54de265e440ea6 (diff)
downloadpuppet-e452f003d219cc6ee107757b3fa2be0086564460.tar.gz
puppet-e452f003d219cc6ee107757b3fa2be0086564460.tar.xz
puppet-e452f003d219cc6ee107757b3fa2be0086564460.zip
preparing to remove elements.rb
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@202 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/blink/elements.rb92
1 files changed, 0 insertions, 92 deletions
diff --git a/lib/blink/elements.rb b/lib/blink/elements.rb
index 64fac9b24..9c4630349 100644
--- a/lib/blink/elements.rb
+++ b/lib/blink/elements.rb
@@ -9,100 +9,8 @@
require 'blink'
require 'blink/statechange'
-#---------------------------------------------------------------
-class Blink::Element
- attr_accessor :noop
-
- #---------------------------------------------------------------
- @@interface_methods = [
- :retrieve, :insync?, :sync, :fqpath, :evaluate, :refresh
- ]
-
- @@interface_methods.each { |method|
- self.send(:define_method,method) {
- raise "%s has not overridden %s" % [self.class,method]
- }
- }
-
- class Blink::Element::Branch
- attr_accessor :children, :parent, :states
-
- #---------------------------------------------------------------
- # iterate across all children, and then iterate across states
- # we do children first so we're sure that all dependent objects
- # are checked first
- def each
- [@children,@states].each { |child|
- yield child
- }
- end
- #---------------------------------------------------------------
-
- #---------------------------------------------------------------
- # this method is responsible for collecting state changes
- # we always descend into the children before we evaluate our current
- # states
- def evaluate(transaction)
- self.each { |child| child.evaluate }
- end
- #---------------------------------------------------------------
-
- #---------------------------------------------------------------
- def initialize
- @childary = []
- @childhash = {}
- @states = []
- @parent = nil
- end
- #---------------------------------------------------------------
-
- #---------------------------------------------------------------
- # this method is responsible for handling changes in dependencies
- # for instance, restarting a service if a config file is changed
- # in general, we just hand the method up to our parent, but for
- # objects that might need to refresh, they'll override this method
- # XXX at this point, if all dependent objects change, then this method
- # might get called for each change
- def refresh(transaction)
- unless @parent.nil?
- @parent.refresh(transaction)
- end
- end
- #---------------------------------------------------------------
- end
-
#---------------------------------------------------------------
class Blink::Element::Leaf
- attr_accessor :is, :should, :parent
-
- #---------------------------------------------------------------
- # this assumes the controlling process will actually execute the change
- # which will demonstrably not work with states that are part of a larger
- # whole, like FileRecordStates
- def evaluate(transaction)
- self.retrieve
- transaction.change(Blink::StateChange.new(state)) unless self.insync?
- end
- #---------------------------------------------------------------
-
- #---------------------------------------------------------------
- def initialize
- @is = nil
- @should = nil
- @parent = nil
- end
- #---------------------------------------------------------------
-
- #---------------------------------------------------------------
- def refresh(transaction)
- self.retrieve
-
- # we definitely need some way to batch these refreshes, so a
- # given object doesn't get refreshed multiple times in a single
- # run
- @parent.refresh
- end
- #---------------------------------------------------------------
end
#---------------------------------------------------------------
end