You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/10/20 13:28:58 UTC

svn commit: r1186741 - /incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb

Author: mfojtik
Date: Thu Oct 20 11:28:58 2011
New Revision: 1186741

URL: http://svn.apache.org/viewvc?rev=1186741&view=rev
Log:
CIMI: Added 'global_collection' method to Rabbit

Modified:
    incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb

Modified: incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb?rev=1186741&r1=1186740&r2=1186741&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb Thu Oct 20 11:28:58 2011
@@ -202,11 +202,11 @@ module Sinatra
     class Collection
       attr_reader :name, :operations, :subcollections
 
-      def initialize(name, &block)
+      def initialize(name, options={}, &block)
         @name = name
         @description = ""
         @operations, @subcollections = {}, {}
-        @global = false
+        @global = options[:global] || false
         instance_eval(&block) if block_given?
         generate_documentation
         generate_head
@@ -392,6 +392,14 @@ module Sinatra
       collections[name] = Collection.new(name, &block)
       collections[name].generate
     end
+
+    # Make sure this collection can be accessed, regardless of whether the
+    # driver supports it or not
+    def global_collection(name, &block)
+      raise DuplicateCollectionException if collections[name]
+      collections[name] = Collection.new(name, :global => true, &block)
+      collections[name].generate
+    end
   end
 
   module RabbitHelper