35 |
plugin.transition(FreeBASE::UNLOADED) |
plugin.transition(FreeBASE::UNLOADED) |
36 |
end |
end |
37 |
end |
end |
38 |
|
|
39 |
|
class SubsystemPlugin |
40 |
|
extend StandardPlugin |
41 |
|
end |
42 |
|
|
43 |
## |
## |
44 |
# The Plugin class is the wrapper for the actual plugin instance |
# The Plugin class is the wrapper for the actual plugin instance |
188 |
transition(LOADING) |
transition(LOADING) |
189 |
self["log/info"] << "Loading" |
self["log/info"] << "Loading" |
190 |
begin |
begin |
191 |
require @require_file |
require @require_file if @require_file |
192 |
rescue => error |
rescue => error |
193 |
puts "Error loading required file (#{require_file}) for plugin: #{@name}" |
puts "Error loading required file (#{require_file}) for plugin: #{@name}" |
194 |
transition_failure |
transition_failure |
301 |
private |
private |
302 |
|
|
303 |
def parse_xml(plugin_element) |
def parse_xml(plugin_element) |
304 |
@name = plugin_element.attributes["name"] |
if plugin_element.name=="subsystem" |
305 |
@version = plugin_element.attributes["version"] |
@name = plugin_element.attributes["name"] |
306 |
@autoload = plugin_element.attributes["autoload"]=="true" ? true : false |
@version = "1.0" |
307 |
@require_file = plugin_element.elements["require"].text |
@autoload=true |
308 |
@startup_module = plugin_element.elements["module"].text |
@startup_module = "FreeBASE::SubsystemPlugin" |
309 |
if plugin_element.elements["resourcePath"] |
@dependencies = {} |
310 |
@resource_path = plugin_element.elements["resourcePath"].text |
dependency = Dependency.new("LOADED", "start") |
311 |
end |
plugin_element.each_element("plugin") do |element| |
312 |
if plugin_element.elements["properties"] |
dependency.add_plugin(element.attributes["name"], "*", "RUNNING") |
313 |
@properties_file = plugin_element.elements["properties"].text |
end |
314 |
end |
@dependencies["LOADED"] = dependency |
315 |
@dependencies = {} |
else |
316 |
plugin_element.each_element("dependency") do |element| |
@name = plugin_element.attributes["name"] |
317 |
dependency = Dependency.new(element.attributes["state"], element.attributes["action"]) |
@version = plugin_element.attributes["version"] |
318 |
element.each_element("when") do |pelement| |
@autoload = plugin_element.attributes["autoload"]=="true" ? true : false |
319 |
attr = pelement.attributes |
@require_file = plugin_element.elements["require"].text |
320 |
dependency.add_plugin(attr["plugin"], attr["version"], attr["state"]) |
@startup_module = plugin_element.elements["module"].text |
321 |
|
if plugin_element.elements["resourcePath"] |
322 |
|
@resource_path = plugin_element.elements["resourcePath"].text |
323 |
|
end |
324 |
|
if plugin_element.elements["properties"] |
325 |
|
@properties_file = plugin_element.elements["properties"].text |
326 |
|
end |
327 |
|
@dependencies = {} |
328 |
|
plugin_element.each_element("dependency") do |element| |
329 |
|
dependency = Dependency.new(element.attributes["state"], element.attributes["action"]) |
330 |
|
element.each_element("when") do |pelement| |
331 |
|
attr = pelement.attributes |
332 |
|
dependency.add_plugin(attr["plugin"], attr["version"], attr["state"]) |
333 |
|
end |
334 |
|
@dependencies[element.attributes["state"]] = dependency |
335 |
end |
end |
|
@dependencies[element.attributes["state"]] = dependency |
|
336 |
end |
end |
337 |
end |
end |
338 |
end |
end |