deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1209465 - in /deltacloud/trunk/server/lib/cimi: ./ model/
Date Fri, 02 Dec 2011 13:26:38 GMT
Author: mfojtik
Date: Fri Dec  2 13:26:36 2011
New Revision: 1209465

URL: http://svn.apache.org/viewvc?rev=1209465&view=rev
Log:
CIMI: Added Collection models

Signed-off-by: Michal fojtik <mfojtik@redhat.com>

Added:
    deltacloud/trunk/server/lib/cimi/model/machine_admin_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/machine_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/machine_configuration_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_template.rb
    deltacloud/trunk/server/lib/cimi/model/machine_image_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/machine_template_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/volume_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/volume_configuration_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/volume_image_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/volume_template_collection.rb
      - copied, changed from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_template.rb
Modified:
    deltacloud/trunk/server/lib/cimi/model.rb
    deltacloud/trunk/server/lib/cimi/model/base.rb
    deltacloud/trunk/server/lib/cimi/model/machine.rb
    deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
    deltacloud/trunk/server/lib/cimi/model/machine_configuration.rb
    deltacloud/trunk/server/lib/cimi/model/machine_image.rb
    deltacloud/trunk/server/lib/cimi/model/machine_template.rb
    deltacloud/trunk/server/lib/cimi/model/volume.rb
    deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb
    deltacloud/trunk/server/lib/cimi/model/volume_image.rb
    deltacloud/trunk/server/lib/cimi/model/volume_template.rb
    deltacloud/trunk/server/lib/cimi/server.rb

Modified: deltacloud/trunk/server/lib/cimi/model.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model.rb Fri Dec  2 13:26:36 2011
@@ -33,3 +33,12 @@ require 'cimi/model/machine_admin'
 require 'cimi/model/volume_configuration'
 require 'cimi/model/volume_image'
 require 'cimi/model/volume_template'
+require 'cimi/model/machine_template_collection'
+require 'cimi/model/machine_image_collection'
+require 'cimi/model/machine_configuration_collection'
+require 'cimi/model/machine_collection'
+require 'cimi/model/volume_collection'
+require 'cimi/model/machine_admin_collection'
+require 'cimi/model/volume_configuration_collection'
+require 'cimi/model/volume_image_collection'
+require 'cimi/model/volume_template_collection'

Modified: deltacloud/trunk/server/lib/cimi/model/base.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/base.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/base.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/base.rb Fri Dec  2 13:26:36 2011
@@ -204,8 +204,13 @@ class CIMI::Model::Base
     scalar :name
   end
 
-  def self.act_as_root_entity
-    CIMI::Model.register_as_root_entity! xml_tag_name.pluralize.uncapitalize
+  def self.act_as_root_entity(name=nil)
+    if name
+      name = name.to_s.camelize.pluralize
+    else
+      name = xml_tag_name.pluralize.uncapitalize
+    end
+    CIMI::Model.register_as_root_entity! name
   end
 
   def self.all(_self); find(:all, _self); end

Modified: deltacloud/trunk/server/lib/cimi/model/machine.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine.rb Fri Dec  2 13:26:36 2011
@@ -17,8 +17,6 @@ require 'deltacloud/models/instance_addr
 
 class CIMI::Model::Machine < CIMI::Model::Base
 
-  act_as_root_entity
-
   text :state
   text :cpu
 

Modified: deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_admin.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_admin.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::MachineAdmin < CIMI::Model::Base
 
-  act_as_root_entity
-
   text :username
   text :password
   text :key
@@ -25,4 +23,8 @@ class CIMI::Model::MachineAdmin < CIMI::
     scalar :rel, :href
   end
 
+  def self.find(id, context)
+    [] # TODO: Implement this
+  end
+
 end

Copied: deltacloud/trunk/server/lib/cimi/model/machine_admin_collection.rb (from r1208437,
deltacloud/trunk/server/lib/cimi/model/machine_admin.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_admin_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/machine_admin_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_admin_collection.rb Fri Dec  2 13:26:36
2011
@@ -13,16 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineAdmin < CIMI::Model::Base
+class CIMI::Model::MachineAdminCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :machine_admins
 
-  text :username
-  text :password
-  text :key
+  array :machine_admin do
+    scalar :href
+  end
 
-  array :operations do
-    scalar :rel, :href
+  def self.default(context)
+    self.new(
+      :uri => context.machine_admins_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineAdminCollection",
+      :machine_admins => MachineAdmin.all(context).map { |c| { :href => c.uri } }
+    )
   end
 
 end

Copied: deltacloud/trunk/server/lib/cimi/model/machine_collection.rb (from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/machine_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_collection.rb Fri Dec  2 13:26:36 2011
@@ -13,16 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineAdmin < CIMI::Model::Base
+class CIMI::Model::MachineCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :machine
 
-  text :username
-  text :password
-  text :key
+  array :machines do
+    scalar :href
+  end
 
-  array :operations do
-    scalar :rel, :href
+  def self.default(context)
+    self.new(
+      :uri => context.machines_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineCollection",
+      :machines => Machine.all(context).map { |c| { :href => c.uri } }
+    )
   end
 
 end

Modified: deltacloud/trunk/server/lib/cimi/model/machine_configuration.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_configuration.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_configuration.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_configuration.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::MachineConfiguration < CIMI::Model::Base
 
-  act_as_root_entity
-
   struct :memory do
     scalar :quantity
     scalar :units

Copied: deltacloud/trunk/server/lib/cimi/model/machine_configuration_collection.rb (from r1208437,
deltacloud/trunk/server/lib/cimi/model/machine_template.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_configuration_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/machine_configuration_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_template.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_template.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_configuration_collection.rb Fri Dec  2
13:26:36 2011
@@ -13,31 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineTemplate < CIMI::Model::Base
+class CIMI::Model::MachineConfigurationCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :machine_configuration
 
-  href :machine_config
-  href :machine_image
-  href :machine_admin
-
-  array :volumes do
+  array :machine_configurations do
     scalar :href
-    scalar :protocol
-    scalar :attachment_point
-  end
-
-  array :volume_templates do
-    scalar :href, :attachment_point, :protocol
   end
 
-  array :network_interfaces do
-    href :vsp
-    text :hostname, :mac_address, :state, :protocol, :allocation
-    text :address, :default_gateway, :dns, :max_transmission_unit
+  def self.default(context)
+    self.new(
+      :uri => context.machine_configurations_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineConfigurationCollection",
+      :machine_configurations => MachineConfiguration.all(context).map { |c| { :href =>
c.uri } }
+    )
   end
 
-  array :operations do
-    scalar :rel, :href
-  end
 end

Modified: deltacloud/trunk/server/lib/cimi/model/machine_image.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_image.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_image.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_image.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::MachineImage < CIMI::Model::Base
 
-  act_as_root_entity
-
   href :image_location
   text :image_data
 

Copied: deltacloud/trunk/server/lib/cimi/model/machine_image_collection.rb (from r1208437,
deltacloud/trunk/server/lib/cimi/model/machine_admin.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_image_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/machine_image_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_image_collection.rb Fri Dec  2 13:26:36
2011
@@ -13,16 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineAdmin < CIMI::Model::Base
+class CIMI::Model::MachineImageCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :machine_image
 
-  text :username
-  text :password
-  text :key
+  array :machine_images do
+    scalar :href
+  end
 
-  array :operations do
-    scalar :rel, :href
+  def self.default(context)
+    self.new(
+      :uri => context.machine_images_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineImageCollection",
+      :machine_images => MachineImage.all(context).map { |c| { :href => c.uri } }
+    )
   end
 
 end

Modified: deltacloud/trunk/server/lib/cimi/model/machine_template.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_template.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_template.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_template.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::MachineTemplate < CIMI::Model::Base
 
-  act_as_root_entity
-
   href :machine_config
   href :machine_image
   href :machine_admin

Copied: deltacloud/trunk/server/lib/cimi/model/machine_template_collection.rb (from r1208437,
deltacloud/trunk/server/lib/cimi/model/machine_admin.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_template_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/machine_template_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_template_collection.rb Fri Dec  2 13:26:36
2011
@@ -13,16 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineAdmin < CIMI::Model::Base
+class CIMI::Model::MachineTemplateCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :machine_template
 
-  text :username
-  text :password
-  text :key
+  array :machine_templates do
+    scalar :href
+  end
 
-  array :operations do
-    scalar :rel, :href
+  def self.default(context)
+    self.new(
+      :uri => context.machine_template_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineTemplateCollection",
+      :machine_templates => MachineTemplate.all(context).map { |c| { :href => c.uri
} }
+    )
   end
 
 end

Modified: deltacloud/trunk/server/lib/cimi/model/volume.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/volume.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::Volume < CIMI::Model::Base
 
-  act_as_root_entity
-
   struct :capacity do
     scalar :quantity
     scalar :units

Copied: deltacloud/trunk/server/lib/cimi/model/volume_collection.rb (from r1208437, deltacloud/trunk/server/lib/cimi/model/machine_admin.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/volume_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_collection.rb Fri Dec  2 13:26:36 2011
@@ -13,16 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineAdmin < CIMI::Model::Base
+class CIMI::Model::VolumeCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :volume
 
-  text :username
-  text :password
-  text :key
+  array :volumes do
+    scalar :href
+  end
 
-  array :operations do
-    scalar :rel, :href
+  def self.default(context)
+    self.new(
+      :uri => context.volumes_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeCollection",
+      :volumes => Volume.all(context).map { |c| { :href => c.uri } }
+    )
   end
 
 end

Modified: deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
 
-  act_as_root_entity
-
   text :format
   struct :capacity do
     scalar :quantity
@@ -49,7 +47,7 @@ class CIMI::Model::VolumeConfiguration <
 
   def self.create(size, context)
     self.new( {
-                :uri => context.machine_configuration_url(size),
+                :uri => context.volume_configuration_url(size),
                 :name => size,
                 :description => "volume configuration with #{size} GiB",
                 :created => Time.now.to_s,

Copied: deltacloud/trunk/server/lib/cimi/model/volume_configuration_collection.rb (from r1208437,
deltacloud/trunk/server/lib/cimi/model/machine_admin.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_configuration_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/volume_configuration_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_configuration_collection.rb Fri Dec  2 13:26:36
2011
@@ -13,16 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineAdmin < CIMI::Model::Base
+class CIMI::Model::VolumeConfigurationCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :volume_configuration
 
-  text :username
-  text :password
-  text :key
+  array :volume_configurations do
+    scalar :href
+  end
 
-  array :operations do
-    scalar :rel, :href
+  def self.default(context)
+    self.new(
+      :uri => context.volume_configurations_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeConfigurationCollection",
+      :volume_configurations => VolumeConfiguration.all(context).map { |c| { :href =>
c.uri } }
+    )
   end
 
 end

Modified: deltacloud/trunk/server/lib/cimi/model/volume_image.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_image.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/volume_image.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_image.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::VolumeImage < CIMI::Model::Base
 
-  act_as_root_entity
-
   href :image_location
   text :image_data
   text :bootable

Copied: deltacloud/trunk/server/lib/cimi/model/volume_image_collection.rb (from r1208437,
deltacloud/trunk/server/lib/cimi/model/machine_admin.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_image_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/volume_image_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_image_collection.rb Fri Dec  2 13:26:36
2011
@@ -13,16 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineAdmin < CIMI::Model::Base
+class CIMI::Model::VolumeImageCollection < CIMI::Model::Base
 
-  act_as_root_entity
+  act_as_root_entity :volume_image
 
-  text :username
-  text :password
-  text :key
+  array :volume_images do
+    scalar :href
+  end
 
-  array :operations do
-    scalar :rel, :href
+  def self.default(context)
+    self.new(
+      :uri => context.volume_images_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeImageCollection",
+      :volume_images => VolumeImage.all(context).map { |c| { :href => c.uri } }
+    )
   end
 
 end

Modified: deltacloud/trunk/server/lib/cimi/model/volume_template.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_template.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/volume_template.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_template.rb Fri Dec  2 13:26:36 2011
@@ -15,8 +15,6 @@
 
 class CIMI::Model::VolumeTemplate < CIMI::Model::Base
 
-  act_as_root_entity
-
   href :volume_config
   href :volume_image
   array :operations do

Copied: deltacloud/trunk/server/lib/cimi/model/volume_template_collection.rb (from r1208437,
deltacloud/trunk/server/lib/cimi/model/machine_template.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_template_collection.rb?p2=deltacloud/trunk/server/lib/cimi/model/volume_template_collection.rb&p1=deltacloud/trunk/server/lib/cimi/model/machine_template.rb&r1=1208437&r2=1209465&rev=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/machine_template.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_template_collection.rb Fri Dec  2 13:26:36
2011
@@ -13,31 +13,22 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::MachineTemplate < CIMI::Model::Base
+class CIMI::Model::VolumeTemplateCollection < CIMI::Model::Base
 
-  act_as_root_entity
-
-  href :machine_config
-  href :machine_image
-  href :machine_admin
-
-  array :volumes do
-    scalar :href
-    scalar :protocol
-    scalar :attachment_point
-  end
+  act_as_root_entity :volume_template
 
   array :volume_templates do
-    scalar :href, :attachment_point, :protocol
+    scalar :href
   end
 
-  array :network_interfaces do
-    href :vsp
-    text :hostname, :mac_address, :state, :protocol, :allocation
-    text :address, :default_gateway, :dns, :max_transmission_unit
+  def self.default(context)
+    self.new(
+      :uri => context.volume_template_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeTemplateCollection",
+      :volume_templates => VolumeTemplate.all(context).map { |c| { :href => c.uri }
}
+    )
   end
 
-  array :operations do
-    scalar :rel, :href
-  end
 end

Modified: deltacloud/trunk/server/lib/cimi/server.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/server.rb?rev=1209465&r1=1209464&r2=1209465&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/server.rb (original)
+++ deltacloud/trunk/server/lib/cimi/server.rb Fri Dec  2 13:26:36 2011
@@ -94,10 +94,10 @@ global_collection :machine_configuration
   operation :index do
     description "List all machine configurations"
     control do
-      machine_configs = MachineConfiguration.all(self)
+      machine_configs = MachineConfigurationCollection.default(self)
       respond_to do |format|
-        format.xml { machine_configs.to_xml_cimi_collection(self) }
-        format.json { machine_configs.to_json_cimi_collection(self) }
+        format.xml { machine_configs.to_xml }
+        format.json { machine_configs.to_json }
       end
     end
   end
@@ -126,10 +126,10 @@ global_collection :machine_images do
   operation :index do
     description "List all machine configurations"
     control do
-      machine_images = MachineImage.all(self)
+      machine_images = MachineImageCollection.default(self)
       respond_to do |format|
-        format.xml { machine_images.to_xml_cimi_collection(self) }
-        format.json { machine_images.to_json_cimi_collection(self) }
+        format.xml { machine_images.to_xml }
+        format.json { machine_images.to_json }
       end
     end
   end
@@ -155,10 +155,10 @@ global_collection :machines do
   operation :index do
     description "List all machines"
     control do
-      machines = Machine.all(self)
+      machines = MachineCollection.default(self)
       respond_to do |format|
-        format.xml { machines.to_xml_cimi_collection(self) }
-        format.json { machines.to_json_cimi_collection(self) }
+        format.xml { machines.to_xml }
+        format.json { machines.to_json }
       end
     end
   end
@@ -260,10 +260,10 @@ global_collection :volumes do
   operation :index do
     description "List all volumes"
     control do
-      volumes = Volume.all(self)
+      volumes = VolumeCollection.default(self)
       respond_to do |format|
-        format.xml { volumes.to_xml_cimi_collection(self) }
-        format.json { volumes.to_json_cimi_collection(self) }
+        format.xml { volumes.to_xml }
+        format.json { volumes.to_json }
       end
     end
   end
@@ -318,10 +318,10 @@ global_collection :volume_configurations
   operation :index do
     description "Get list all VolumeConfigurations"
     control do
-      volume_configs = VolumeConfiguration.all(self)
+      volume_configuration = VolumeConfigurationCollection.default(self)
       respond_to do |format|
-        format.xml { volume_configs.to_xml_cimi_collection(self) }
-        format.json { volume_configs.to_json_cimi_collection(self) }
+        format.xml { volume_configuration.to_xml }
+        format.json { volume_configuration.to_json }
       end
     end
   end
@@ -344,10 +344,10 @@ global_collection :volume_images do
   operation :index do
     description "List all volumes images"
     control do
-      volume_images = VolumeImage.all(self)
+      volume_images = VolumeImageCollection.default(self)
       respond_to do |format|
-        format.xml { volume_images.to_xml_cimi_collection(self) }
-        format.json { volume_images.to_json_cimi_collection(self) }
+        format.xml { volume_images.to_xml }
+        format.json { volume_images.to_json }
       end
     end
   end



Mime
View raw message