jam-cloud/ruby/lib/jam_ruby/models/icecast_server.rb

77 lines
2.3 KiB
Ruby

module JamRuby
class IcecastServer < ActiveRecord::Base
include JAmXml
self.primary_key = 'id'
has_one :limit, :class_name => "JamRuby::IcecastLimit" , foreign_key: "id"
has_one :adminauth, :class_name => "JamRuby::IcecastAdminAuthentication" , foreign_key: "id"
has_one :directory, :class_name => "JamRuby::IcecastDirectory" , foreign_key: "id"
has_one :misc, :class_name => "JamRuby::IcecastServermisc" , foreign_key: "id"
has_one :master_relay, :class_name => "JamRuby::IcecastMastersvrRelay" , foreign_key: "id"
has_many :smounts, :class_name => "JamRuby::IcecastServermount"
has_many :mounts, :class_name => "JamRuby::IcecastMount", :through => :smounts
has_many :ssockets, :class_name => "JamRuby::IcecastServersocket"
has_many :sockets, :class_name => "JamRuby::IcecastListenSocket" ,:through => :ssockets
has_many :srelays, :class_name => "JamRuby::IcecastServerrelay" , :inverse_of => :server
has_many :relays, :class_name => "JamRuby::IcecastRelay" , :through => :srelays
has_one :path, :class_name => "JamRuby::IcecastPath" , foreign_key: "id"
has_one :logging, :class_name => "JamRuby::IcecastLogging" , foreign_key: "id"
has_one :security, :class_name => "JamRuby::IcecastSecurity" , foreign_key: "id"
def dumpXml (ident=1, output=$stdout)
ident += 1
unless self.limit.nil?
self.limit.dumpXml(ident,output)
end
unless self.adminauth.nil?
self.adminauth.dumpXml(ident,output)
end
unless self.directory.nil?
self.directory.dumpXml(ident,output)
end
unless self.misc.nil?
self.misc.dumpXml(ident,output)
end
unless self.master_relay.nil?
self.master_relay.dumpXml(ident,output)
end
unless self.path.nil?
self.path.dumpXml(ident,output)
end
unless self.logging.nil?
self.logging.dumpXml(ident,output)
end
unless self.security.nil?
self.security.dumpXml(ident,output)
end
self.relays.each do |rl|
sock.rl(ident,output)
end
self.sockets.each do |sock|
sock.dumpXml(ident,output)
end
self.mounts.each do |mount|
mount.dumpXml(ident,output)
end
end
end
end