deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/4] git commit: CIMI: Added driver and provider to CEP using resourceMetadata
Date Thu, 10 Jan 2013 10:12:31 GMT
CIMI: Added driver and provider to CEP using resourceMetadata


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/04e3142c
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/04e3142c
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/04e3142c

Branch: refs/heads/master
Commit: 04e3142ccddd721b8c66a4e88a8a35551b090f24
Parents: 8b60c60
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Tue Jan 8 13:09:27 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Thu Jan 10 11:12:12 2013 +0100

----------------------------------------------------------------------
 server/lib/cimi/models.rb                   |    2 +-
 server/lib/cimi/models/base.rb              |    2 +-
 server/lib/cimi/models/cloud_entry_point.rb |    5 +++++
 server/lib/cimi/models/collection.rb        |    1 +
 server/lib/cimi/models/resource_metadata.rb |    2 --
 5 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/04e3142c/server/lib/cimi/models.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models.rb b/server/lib/cimi/models.rb
index 3e7027d..7eda960 100644
--- a/server/lib/cimi/models.rb
+++ b/server/lib/cimi/models.rb
@@ -27,8 +27,8 @@ require_relative './models/action'
 require_relative './models/machine_volume'
 require_relative './models/disk'
 
-require_relative './models/cloud_entry_point'
 require_relative './models/resource_metadata'
+require_relative './models/cloud_entry_point'
 require_relative './models/volume'
 require_relative './models/volume_template'
 require_relative './models/volume_configuration'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/04e3142c/server/lib/cimi/models/base.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
index 33bd842..5fdb69a 100644
--- a/server/lib/cimi/models/base.rb
+++ b/server/lib/cimi/models/base.rb
@@ -72,7 +72,7 @@ require 'xmlsimple'
 module CIMI::Model
 
   def self.register_as_root_entity!(klass, opts = {})
-    @root_entities ||= []
+    @root_entities ||= [CIMI::Model::CloudEntryPoint]
     @root_entities << klass
     name = klass.name.split("::").last.pluralize
     unless CIMI::Model::CloudEntryPoint.href_defined?(name)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/04e3142c/server/lib/cimi/models/cloud_entry_point.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/cloud_entry_point.rb b/server/lib/cimi/models/cloud_entry_point.rb
index 52a3015..7f274e9 100644
--- a/server/lib/cimi/models/cloud_entry_point.rb
+++ b/server/lib/cimi/models/cloud_entry_point.rb
@@ -15,6 +15,9 @@
 
 class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
 
+  resource_attr :driver, :required => true
+  resource_attr :provider, :required => true
+
   # All possible CIMI collections, in the order in which they should appear
   # in the CEP
   COLLECTIONS = [ "resourceMetadata", "systems", "systemTemplates",
@@ -38,6 +41,8 @@ class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
     self.new(entities(context).merge({
       :name => context.driver.name,
       :description => "Cloud Entry Point for the Deltacloud #{context.driver.name} driver",
+      :driver => context.driver.name,
+      :provider => context.current_provider,
       :id => context.cloudEntryPoint_url,
       :base_uri => context.base_uri + "/",
       :created => Time.now.xmlschema

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/04e3142c/server/lib/cimi/models/collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/collection.rb b/server/lib/cimi/models/collection.rb
index 0587264..1836449 100644
--- a/server/lib/cimi/models/collection.rb
+++ b/server/lib/cimi/models/collection.rb
@@ -116,6 +116,7 @@ module CIMI::Model
       def list(context)
         entries = find(:all, context)
         desc = "#{self.name.split("::").last} Collection for the #{context.driver.name.capitalize}
driver"
+        acts_as_root_entity unless collection_class
         id = context.send("#{collection_class.entry_name}_url")
         ops = []
         cimi_entity = collection_class.entry_name.to_s.singularize

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/04e3142c/server/lib/cimi/models/resource_metadata.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/resource_metadata.rb b/server/lib/cimi/models/resource_metadata.rb
index 30e65d6..3ed88db 100644
--- a/server/lib/cimi/models/resource_metadata.rb
+++ b/server/lib/cimi/models/resource_metadata.rb
@@ -16,8 +16,6 @@
 
 class CIMI::Model::ResourceMetadata < CIMI::Model::Base
 
-  acts_as_root_entity
-
   text :name
 
   text :type_uri


Mime
View raw message