From: marios <[email protected]>
Signed-off-by: marios <[email protected]> --- server/lib/cimi/helpers.rb | 3 +- server/lib/deltacloud/drivers/base_driver.rb | 2 +- server/lib/deltacloud/drivers/cimi_features.rb | 48 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 server/lib/deltacloud/drivers/cimi_features.rb diff --git a/server/lib/cimi/helpers.rb b/server/lib/cimi/helpers.rb index ea71cbf..75f9770 100644 --- a/server/lib/cimi/helpers.rb +++ b/server/lib/cimi/helpers.rb @@ -14,12 +14,13 @@ # under the License. require_relative '../deltacloud/drivers/features' - +require_relative '../deltacloud/drivers/cimi_features' module CIMI module Model; end class FakeCollection extend Sinatra::Rabbit::Features include Deltacloud::Features + include CIMI::Features end end diff --git a/server/lib/deltacloud/drivers/base_driver.rb b/server/lib/deltacloud/drivers/base_driver.rb index c63f94f..f488f91 100644 --- a/server/lib/deltacloud/drivers/base_driver.rb +++ b/server/lib/deltacloud/drivers/base_driver.rb @@ -19,6 +19,7 @@ module Deltacloud require_relative '../core_ext.rb' require_relative './exceptions.rb' require_relative './features.rb' + require_relative './cimi_features.rb' require_relative '../models/state_machine.rb' class BaseDriver @@ -38,7 +39,6 @@ module Deltacloud @features ||= {} end - def self.feature(collection, feature_name) return if has_feature?(collection, feature_name) constraints[collection] ||= {} diff --git a/server/lib/deltacloud/drivers/cimi_features.rb b/server/lib/deltacloud/drivers/cimi_features.rb new file mode 100644 index 0000000..adcdcbf --- /dev/null +++ b/server/lib/deltacloud/drivers/cimi_features.rb @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +module CIMI + module Features + + def self.included(k) + current_features = features + k.instance_eval do + features(¤t_features) + end + end + + def self.features(&block) + block_given? ? @features = block : @features || Proc.new{} + end + + + features do + feature :default_initial_state, :for => :machines do + description "Indicates what the default initial state of a new Machine " + operation :create do + param :default_initial_state, :string, :optional, [], "Indicates what the default initial state of a new Machine" + end + end + + feature :initial_states, :for => :machines do + description "Indicates the list of allowable initial states" + operation :create do + param :default_initial_state, :string, :optional, [], "Indicates the list of allowable initial states" + end + end + + end + end +end -- 1.7.11.7
