def self.init( cfg, flush = true )
@@registry = Needle::Registry.new() if flush
STDERR.puts( "cfg starts as #{cfg}")
case cfg.class.to_s
when 'String'
if cfg =~ /^file:\/\//
cfg.gsub!( /^file:\/\//, '' )
STDERR.puts( "cfg is now #{cfg}")
config_hash = YAML::load( File.open( cfg ) )
else
STDERR.puts( "cfg is #{cfg}")
config_hash = YAML::load( cfg )
end
when 'Hash'
config_hash = cfg
else
raise "init was given unusable configuration data [ #{cfg.class}]: #{$!}"
end
config_hash.each do |src_file, class_list|
require src_file
class_list.each do |klass|
@@registry.register( klass ) { new_from_name( klass ) }
end
end
@@registry.register( :System ) { System.new }
@@registry.register( :system ) { System.new }
$roy_logger.debug( "@@registry now has \n" + @@registry.keys.inspect )
end