class SatOperator

Satellite Interfacer

Constants

OPS

Operations are ordered - It matters for object dependencies

Attributes

operations[R]
source[R]
target[R]

Public Class Methods

new(options, log) click to toggle source
# File lib/satops.rb, line 240
def initialize(options, log)
  @log=log
  @operations=Array.new

  OPS.each do |klass|
    if options.has_key?(klass.to_s)
      # Populate options (class variables) with their values
      klass.class_eval do
        options[klass.to_s].each do |key, val|
          self.instance_variable_set("@#{key}", val)
        end
      end
      # Create Operation objects
      @operations << klass.class_eval { self.new(log) }
    end
  end
end

Public Instance Methods

context() click to toggle source
# File lib/satops.rb, line 304
def context
  str="\nSatellite Synchronisation Context:\n"
  str << "#{@operations}\n"
end
destroy(target) click to toggle source
# File lib/satops.rb, line 258
def destroy(target)
  @operations.each do |op|
    op.destroy(target)
  end
end
export(type, sat_source, path) click to toggle source
# File lib/satops.rb, line 264
def export(type, sat_source, path)
  @operations.each do |op|
    case type
    when :bin
      op.export(:mrb, sat_source, path)
    when :ascii
      op.export(:yaml, sat_source, path)
    else
      raise "FATAL: No such export format"
    end
  end
end
extra(*args) click to toggle source

Extra objects are only present in destination Delete is default operation unless overloaded by OperationSet subclasses.

# File lib/satops.rb, line 279
def extra(*args)
  @operations.each do |op|
    op.extra(*args)
  end
end
import(type, *args) click to toggle source
# File lib/satops.rb, line 285
def import(type, *args)
  @operations.each do |op|
    case type
    when :bin
      op.import(:mrb, *args)
    when :ascii
      op.import(:yaml, *args)
    else
      raise "FATAL: No such import format"
    end
  end
end
sync(*args) click to toggle source
# File lib/satops.rb, line 298
def sync(*args)
  @operations.each do |op|
    op.sync(*args)
  end
end