def read(definition)
return definition if Ruote.is_tree?(definition)
raise ArgumentError.new(
"cannot read process definitions of class #{definition.class}"
) unless definition.is_a?(String)
if is_uri?(definition)
if
Ruote::Reader.remote?(definition) &&
@context['remote_definition_allowed'] != true
then
raise ArgumentError.new('remote process definitions are not allowed')
end
return read(open(definition).read)
end
tree = nil
error = Error.new(definition)
[
Ruote::RubyReader, Ruote::RadialReader,
Ruote::XmlReader, Ruote::JsonReader
].each do |reader|
next if tree
next unless reader.understands?(definition)
begin
tree = reader.read(definition, @context.treechecker)
rescue => e
error << [ reader, e ]
end
end
tree || raise(error)
end