Module: CPEE
- Defined in:
- lib/cpee/callback.rb,
lib/cpee/controller.rb,
lib/cpee/implementation.rb
Overview
This file is part of CPEE.
CPEE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CPEE (file COPYING in the main directory). If not, see <www.gnu.org/licenses/>.
Defined Under Namespace
Classes: Callback, Callbacks, Controller, DeleteInstance, ExCallback, Info, Instances, NewInstance, ValueHelper
Constant Summary collapse
- SERVER =
File.(File.dirname(__FILE__) + '/../cpee.xml')
Class Method Summary collapse
Class Method Details
.implementation(opts) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/cpee/implementation.rb', line 26 def self::implementation(opts) opts[:instances] ||= File.(File.dirname(__FILE__) + '/../../server/instances') opts[:handlerwrappers] ||= File.(File.dirname(__FILE__) + '/../../server/handlerwrappers') opts[:topics] ||= File.(File.dirname(__FILE__) + '/../../server/resources/topics.xml') opts[:properties_init] ||= File.(File.dirname(__FILE__) + '/../../server/resources/properties.init') opts[:properties_schema_active] ||= File.(File.dirname(__FILE__) + '/../../server/resources/properties.schema.active') opts[:properties_schema_finished] ||= File.(File.dirname(__FILE__) + '/../../server/resources/properties.schema.finished') opts[:properties_schema_inactive] ||= File.(File.dirname(__FILE__) + '/../../server/resources/properties.schema.inactive') opts[:transformation_dslx] ||= File.(File.dirname(__FILE__) + '/../../server/resources/transformation_dslx.xsl') opts[:transformation_service] ||= File.(File.dirname(__FILE__) + '/../../server/resources/transformation.xml') Proc.new do Dir[opts[:handlerwrappers] + "/*.rb"].each do |h| require h end controller = {} Dir[opts[:instances] + '/*/properties.xml'].map{|e|::File::basename(::File::dirname(e))}.each do |id| controller[id.to_i] = Controller.new(id,opts) end interface 'properties' do |r| id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i 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-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 on resource do run CPEE::ExCallback, controller if get || put || post || delete end end end end interface 'notifications' do |r| id = r[:h]['RIDDL_DECLARATION_PATH'].split('/')[1].to_i use Riddl::Utils::Notifications::Producer::implementation(controller[id].notifications, NotificationsHandler.new(controller[id]), opts[:mode]) if controller[id] end end end |