lib/cpee/implementation.rb in cpee-1.3.106 vs lib/cpee/implementation.rb in cpee-1.3.107
- old
+ new
@@ -29,10 +29,12 @@
opts[:topics] ||= File.expand_path(File.dirname(__FILE__) + '/../../server/resources/topics.xml')
opts[:properties_init] ||= File.expand_path(File.dirname(__FILE__) + '/../../server/resources/properties.init')
opts[:properties_schema_active] ||= File.expand_path(File.dirname(__FILE__) + '/../../server/resources/properties.schema.active')
opts[:properties_schema_finished] ||= File.expand_path(File.dirname(__FILE__) + '/../../server/resources/properties.schema.finished')
opts[:properties_schema_inactive] ||= File.expand_path(File.dirname(__FILE__) + '/../../server/resources/properties.schema.inactive')
+ opts[:transformation_dslx] ||= File.expand_path(File.dirname(__FILE__) + '/../../server/resources/transformation_dslx.xsl')
+ opts[:transformation_service] ||= File.expand_path(File.dirname(__FILE__) + '/../../server/resources/transformation.xml')
Proc.new do
controller = {}
Dir[opts[:instances] + '/*/properties.xml'].map{|e|::File::basename(::File::dirname(e))}.each do |id|
controller[id.to_i] = Controller.new(id,opts)
@@ -46,11 +48,11 @@
use Riddl::Utils::Properties::implementation(controller[id].properties, PropertiesHandler.new(controller[id]), opts[:mode]) if controller[id]
end
interface 'main' do
run CPEE::Instances, controller if get '*'
- run CPEE::NewInstance, controller, opts if post 'instance-name'
+ run CPEE::NewInstance, controller, opts if post 'instance-new'
on resource do |r|
run CPEE::Info, controller if get
run CPEE::DeleteInstance, controller, opts if delete
on resource 'callbacks' do
run CPEE::Callbacks, controller, opts if get
@@ -107,31 +109,35 @@
def response
controller = @a[0]
Riddl::Parameter::Complex.new("wis","text/xml") do
ins = XML::Smart::string('<instances/>')
controller.each do |k,v|
- name = v.properties.data.find("string(/p:properties/p:name)")
+ name = v.properties.data.find("string(/p:properties/p:info)")
state = v.properties.data.find("string(/p:properties/p:state)")
ins.root.add('instance',name, 'id' => k, 'state' => state)
end
ins.to_s
end
end
end #}}}
class NewInstance < Riddl::Implementation #{{{
def response
+ p 'rrr'
controller = @a[0]
opts = @a[1]
name = @p[0].value
id = controller.keys.sort.last.to_i
+ p 'rrr'
+ p name
+
while true
id += 1
Dir.mkdir(opts[:instances] + "/#{id}") rescue nil
break
end
controller[id] = Controller.new(id,opts)
- controller[id].properties.data.find("/p:properties/p:name").first.text = name
+ controller[id].properties.data.find("/p:properties/p:info").first.text = name
Riddl::Parameter::Simple.new("id", id)
end
end #}}}