You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Michal Fojtik <mf...@redhat.com> on 2011/10/04 13:36:17 UTC
Re: [PATCH 2/2] dmtf reference implementation coding style changes
On Sep 30, 2011, at 6:27 PM, email4tong@gmail.com wrote:
Hi,
The subject line indicates that this patch is 2/2 but I can't see the patch 1/2.
So I cannot apply this patch against master. Do I miss something?
A small nits I found meanwhile:
1.
> %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
It's better to use to avoid one extra space at beginning on text area:
%textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" }=#{@dmtfitem['description']}
2. Could you please move all :javascript to a separate .js files and then include them?
-- Michal
> From: Tong Li <li...@us.ibm.com>
>
> ---
> server/lib/cimi/data/collections/event.col.xml | 9 -
> server/lib/cimi/data/collections/eventLog.col.xml | 9 -
> server/lib/cimi/data/collections/job.col.xml | 9 -
> server/lib/cimi/data/collections/machine.col.xml | 4 +-
> .../lib/cimi/data/collections/machineAdmin.col.xml | 9 -
> .../data/collections/machineConfiguration.col.xml | 12 -
> .../lib/cimi/data/collections/machineImage.col.xml | 11 -
> .../cimi/data/collections/machineTemplate.col.xml | 8 -
> .../data/collections/machine_configuration.col.xml | 8 +
> .../cimi/data/collections/machine_image.col.xml | 8 +
> server/lib/cimi/data/collections/meter.col.xml | 10 -
> .../cimi/data/collections/meterTemplate.col.xml | 10 -
> server/lib/cimi/data/collections/network.col.xml | 10 -
> .../cimi/data/collections/networkConfig.col.xml | 10 -
> .../cimi/data/collections/networkTemplate.col.xml | 10 -
> server/lib/cimi/data/collections/system.col.xml | 11 -
> .../cimi/data/collections/systemTemplate.col.xml | 10 -
> server/lib/cimi/data/collections/volume.col.xml | 4 +-
> .../data/collections/volumeConfiguration.col.xml | 10 -
> .../lib/cimi/data/collections/volumeImage.col.xml | 11 -
> .../cimi/data/collections/volumeTemplate.col.xml | 9 -
> server/lib/cimi/data/collections/vsp.col.xml | 10 -
> server/lib/cimi/data/collections/vspConfig.col.xml | 10 -
> .../lib/cimi/data/collections/vspTemplate.col.xml | 10 -
> server/lib/cimi/data/defaultRes/machine.col.xml | 35 --
> .../lib/cimi/data/defaultRes/machineAdmin.col.xml | 11 -
> .../data/defaultRes/machineConfiguration.col.xml | 17 -
> .../lib/cimi/data/defaultRes/machineImage.col.xml | 11 -
> .../cimi/data/defaultRes/machineTemplate.col.xml | 12 -
> server/lib/cimi/data/defaultRes/system.col.xml | 12 -
> .../cimi/data/defaultRes/systemTemplate.col.xml | 10 -
> .../data/defaultRes/volumeConfiguration.col.xml | 14 -
> server/lib/cimi/data/default_res/machine.col.xml | 35 ++
> .../data/default_res/machine_configuration.col.xml | 17 +
> .../cimi/data/default_res/machine_image.col.xml | 11 +
> server/lib/cimi/data/default_res/volume.col.xml | 14 +
> server/lib/cimi/helpers/cmwgapp_helper.rb | 364 ++++----------------
> server/lib/cimi/helpers/cmwgres_helper.rb | 134 -------
> server/lib/cimi/helpers/dmtfdep.rb | 4 +-
> server/lib/cimi/server.rb | 312 +++++++++--------
> server/public/javascripts/cmwgapp.js | 4 +-
> server/views/cimi/cloudEntryPoint/index.html.haml | 8 +-
> server/views/cimi/cloudEntryPoint/index.xml.haml | 6 +-
> server/views/cimi/collection/index.html.haml | 55 +---
> server/views/cimi/machine/new.html.haml | 183 ----------
> server/views/cimi/machine/show.html.haml | 30 +-
> server/views/cimi/machineAdmin/new.html.haml | 46 ---
> server/views/cimi/machineAdmin/show.html.haml | 46 ---
> .../views/cimi/machineConfiguration/new.html.haml | 172 ---------
> .../views/cimi/machineConfiguration/show.html.haml | 167 ---------
> server/views/cimi/machineImage/new.html.haml | 80 -----
> server/views/cimi/machineImage/show.html.haml | 82 -----
> server/views/cimi/machineTemplate/new.html.haml | 78 -----
> server/views/cimi/machineTemplate/show.html.haml | 78 -----
> .../cimi/machine_configuration/show.html.haml | 159 +++++++++
> server/views/cimi/machine_image/show.html.haml | 79 +++++
> server/views/cimi/system/new.html.haml | 79 -----
> server/views/cimi/system/show.html.haml | 79 -----
> server/views/cimi/system/show.xml.haml | 11 -
> server/views/cimi/systemTemplate/new.html.haml | 68 ----
> server/views/cimi/systemTemplate/show.html.haml | 70 ----
> server/views/cimi/volume/show.html.haml | 68 ++++
> .../views/cimi/volumeConfiguration/new.html.haml | 75 ----
> .../views/cimi/volumeConfiguration/show.html.haml | 77 ----
> 64 files changed, 681 insertions(+), 2354 deletions(-)
> delete mode 100644 server/lib/cimi/data/collections/event.col.xml
> delete mode 100644 server/lib/cimi/data/collections/eventLog.col.xml
> delete mode 100644 server/lib/cimi/data/collections/job.col.xml
> delete mode 100644 server/lib/cimi/data/collections/machineAdmin.col.xml
> delete mode 100644 server/lib/cimi/data/collections/machineConfiguration.col.xml
> delete mode 100644 server/lib/cimi/data/collections/machineImage.col.xml
> delete mode 100644 server/lib/cimi/data/collections/machineTemplate.col.xml
> create mode 100644 server/lib/cimi/data/collections/machine_configuration.col.xml
> create mode 100644 server/lib/cimi/data/collections/machine_image.col.xml
> delete mode 100644 server/lib/cimi/data/collections/meter.col.xml
> delete mode 100644 server/lib/cimi/data/collections/meterTemplate.col.xml
> delete mode 100644 server/lib/cimi/data/collections/network.col.xml
> delete mode 100644 server/lib/cimi/data/collections/networkConfig.col.xml
> delete mode 100644 server/lib/cimi/data/collections/networkTemplate.col.xml
> delete mode 100644 server/lib/cimi/data/collections/system.col.xml
> delete mode 100644 server/lib/cimi/data/collections/systemTemplate.col.xml
> delete mode 100644 server/lib/cimi/data/collections/volumeConfiguration.col.xml
> delete mode 100644 server/lib/cimi/data/collections/volumeImage.col.xml
> delete mode 100644 server/lib/cimi/data/collections/volumeTemplate.col.xml
> delete mode 100644 server/lib/cimi/data/collections/vsp.col.xml
> delete mode 100644 server/lib/cimi/data/collections/vspConfig.col.xml
> delete mode 100644 server/lib/cimi/data/collections/vspTemplate.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/machine.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/machineAdmin.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/machineConfiguration.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/machineImage.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/machineTemplate.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/system.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/systemTemplate.col.xml
> delete mode 100644 server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml
> create mode 100644 server/lib/cimi/data/default_res/machine.col.xml
> create mode 100644 server/lib/cimi/data/default_res/machine_configuration.col.xml
> create mode 100644 server/lib/cimi/data/default_res/machine_image.col.xml
> create mode 100644 server/lib/cimi/data/default_res/volume.col.xml
> delete mode 100644 server/lib/cimi/helpers/cmwgres_helper.rb
> delete mode 100644 server/views/cimi/machine/new.html.haml
> delete mode 100644 server/views/cimi/machineAdmin/new.html.haml
> delete mode 100644 server/views/cimi/machineAdmin/show.html.haml
> delete mode 100644 server/views/cimi/machineConfiguration/new.html.haml
> delete mode 100644 server/views/cimi/machineConfiguration/show.html.haml
> delete mode 100644 server/views/cimi/machineImage/new.html.haml
> delete mode 100644 server/views/cimi/machineImage/show.html.haml
> delete mode 100644 server/views/cimi/machineTemplate/new.html.haml
> delete mode 100644 server/views/cimi/machineTemplate/show.html.haml
> create mode 100644 server/views/cimi/machine_configuration/show.html.haml
> create mode 100644 server/views/cimi/machine_image/show.html.haml
> delete mode 100644 server/views/cimi/system/new.html.haml
> delete mode 100644 server/views/cimi/system/show.html.haml
> delete mode 100644 server/views/cimi/system/show.xml.haml
> delete mode 100644 server/views/cimi/systemTemplate/new.html.haml
> delete mode 100644 server/views/cimi/systemTemplate/show.html.haml
> create mode 100644 server/views/cimi/volume/show.html.haml
> delete mode 100644 server/views/cimi/volumeConfiguration/new.html.haml
> delete mode 100644 server/views/cimi/volumeConfiguration/show.html.haml
>
> diff --git a/server/lib/cimi/data/collections/event.col.xml b/server/lib/cimi/data/collections/event.col.xml
> deleted file mode 100644
> index b4e772f..0000000
> --- a/server/lib/cimi/data/collections/event.col.xml
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<EventCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>event</uri>
> - <name>event collection </name>
> - <description>The event collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="event prop">400</property>
> - <operation rel="edit" href="/collection/event" />
> -</EventCollection>
> diff --git a/server/lib/cimi/data/collections/eventLog.col.xml b/server/lib/cimi/data/collections/eventLog.col.xml
> deleted file mode 100644
> index df42085..0000000
> --- a/server/lib/cimi/data/collections/eventLog.col.xml
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<EventLogCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>eventLog</uri>
> - <name>Event log collection </name>
> - <description>The event log collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="event log prop">event log</property>
> - <operation rel="edit" href="/collection/eventLog" />
> -</EventLogCollection>
> diff --git a/server/lib/cimi/data/collections/job.col.xml b/server/lib/cimi/data/collections/job.col.xml
> deleted file mode 100644
> index 0c306e1..0000000
> --- a/server/lib/cimi/data/collections/job.col.xml
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<JobCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>job</uri>
> - <name>Job collection </name>
> - <description>The job collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="job">2000</property>
> - <operation rel="edit" href="/collection/eventLog" />
> -</JobCollection>
> diff --git a/server/lib/cimi/data/collections/machine.col.xml b/server/lib/cimi/data/collections/machine.col.xml
> index 6f8af15..622a6fe 100644
> --- a/server/lib/cimi/data/collections/machine.col.xml
> +++ b/server/lib/cimi/data/collections/machine.col.xml
> @@ -4,7 +4,5 @@
> <name>Machine collection </name>
> <description>The machine collection</description>
> <created>2011-09-12 11:37:28 UTC</created>
> - <property name="machine prop">machine prop value</property>
> - <operation rel="add" href="/machine" />
> - <operation rel="edit" href="/collection/machine" />
> + <operation rel="add" href="/machines" />
> </MachineCollection>
> diff --git a/server/lib/cimi/data/collections/machineAdmin.col.xml b/server/lib/cimi/data/collections/machineAdmin.col.xml
> deleted file mode 100644
> index e4f674b..0000000
> --- a/server/lib/cimi/data/collections/machineAdmin.col.xml
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineAdminCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>machineAdmin</uri>
> - <name>Machine admin collection </name>
> - <description>The machine admin what a pity!</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <operation rel="add" href="/machineAdmin" />
> - <operation rel="edit" href="/collection/machineAdmin" />
> -</MachineAdminCollection>
> diff --git a/server/lib/cimi/data/collections/machineConfiguration.col.xml b/server/lib/cimi/data/collections/machineConfiguration.col.xml
> deleted file mode 100644
> index 89e8aa1..0000000
> --- a/server/lib/cimi/data/collections/machineConfiguration.col.xml
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineConfigurationCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>machineConfiguration</uri>
> - <name>Machine Configuration collection </name>
> - <description>That is jsut a test</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="machineCgfPrp">propValue</property>
> - <property name="new property">test</property>
> - <property name="tytyty">0513</property>
> - <operation rel="add" href="/machineConfiguration" />
> - <operation rel="edit" href="/collection/machineConfiguration" />
> -</MachineConfigurationCollection>
> diff --git a/server/lib/cimi/data/collections/machineImage.col.xml b/server/lib/cimi/data/collections/machineImage.col.xml
> deleted file mode 100644
> index bebe097..0000000
> --- a/server/lib/cimi/data/collections/machineImage.col.xml
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineImageCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>machineImage</uri>
> - <name>Machine Config collection </name>
> - <description>The machine config collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="creator">Tong Li</property>
> - <property name="targetPlanet">earth</property>
> - <operation rel="add" href="/machineImage" />
> - <operation rel="edit" href="/collection/machineImage" />
> -</MachineImageCollection>
> diff --git a/server/lib/cimi/data/collections/machineTemplate.col.xml b/server/lib/cimi/data/collections/machineTemplate.col.xml
> deleted file mode 100644
> index bfed664..0000000
> --- a/server/lib/cimi/data/collections/machineTemplate.col.xml
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineTemplateCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>machineTemplate</uri>
> - <name>Machine template collection </name>
> - <description>The machine template collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="machinetmp prop1">the value</property>
> -</MachineTemplateCollection>
> diff --git a/server/lib/cimi/data/collections/machine_configuration.col.xml b/server/lib/cimi/data/collections/machine_configuration.col.xml
> new file mode 100644
> index 0000000..99af7fb
> --- /dev/null
> +++ b/server/lib/cimi/data/collections/machine_configuration.col.xml
> @@ -0,0 +1,8 @@
> +<?xml version='1.0' encoding='utf-8' ?>
> +<MachineConfigurationCollection xmlns="http://www.dmtf.org/cimi">
> + <uri>machineConfiguration</uri>
> + <name>Machine Configuration collection </name>
> + <description>That is jsut a test</description>
> + <created>2011-09-12 11:37:28 UTC</created>
> + <operation rel="add" href="/machine_configurations" />
> +</MachineConfigurationCollection>
> diff --git a/server/lib/cimi/data/collections/machine_image.col.xml b/server/lib/cimi/data/collections/machine_image.col.xml
> new file mode 100644
> index 0000000..2c27075
> --- /dev/null
> +++ b/server/lib/cimi/data/collections/machine_image.col.xml
> @@ -0,0 +1,8 @@
> +<?xml version='1.0' encoding='utf-8' ?>
> +<MachineImageCollection xmlns="http://www.dmtf.org/cimi">
> + <uri>machineImage</uri>
> + <name>Machine Config collection </name>
> + <description>The machine config collection</description>
> + <created>2011-09-12 11:37:28 UTC</created>
> + <operation rel="add" href="/machine_images" />
> +</MachineImageCollection>
> diff --git a/server/lib/cimi/data/collections/meter.col.xml b/server/lib/cimi/data/collections/meter.col.xml
> deleted file mode 100644
> index 24b5820..0000000
> --- a/server/lib/cimi/data/collections/meter.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MeterCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>meter</uri>
> - <name>Meter collection </name>
> - <description>The meter collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="meter">300</property>
> - <operation rel="add" href="/meter" />
> - <operation rel="edit" href="/collection/meter" />
> -</MeterCollection>
> diff --git a/server/lib/cimi/data/collections/meterTemplate.col.xml b/server/lib/cimi/data/collections/meterTemplate.col.xml
> deleted file mode 100644
> index 0271fc4..0000000
> --- a/server/lib/cimi/data/collections/meterTemplate.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MeterTemplateCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>meterTemplate</uri>
> - <name>Meter template collection </name>
> - <description>The meter template collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="meter template">meter</property>
> - <operation rel="add" href="/meterTemplate" />
> - <operation rel="edit" href="/collection/meterTemplate" />
> -</MeterTemplateCollection>
> diff --git a/server/lib/cimi/data/collections/network.col.xml b/server/lib/cimi/data/collections/network.col.xml
> deleted file mode 100644
> index 1059d3a..0000000
> --- a/server/lib/cimi/data/collections/network.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<NetworkCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>network</uri>
> - <name>Network collection </name>
> - <description>The network config collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="network">network cool</property>
> - <operation rel="add" href="/network" />
> - <operation rel="edit" href="/collection/network" />
> -</NetworkCollection>
> diff --git a/server/lib/cimi/data/collections/networkConfig.col.xml b/server/lib/cimi/data/collections/networkConfig.col.xml
> deleted file mode 100644
> index 25c2402..0000000
> --- a/server/lib/cimi/data/collections/networkConfig.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<NetworkConfigCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>networkConfig</uri>
> - <name>Network config collection </name>
> - <description>The network config collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="network config">value</property>
> - <operation rel="add" href="/networkConfig" />
> - <operation rel="edit" href="/collection/networkConfig" />
> -</NetworkConfigCollection>
> diff --git a/server/lib/cimi/data/collections/networkTemplate.col.xml b/server/lib/cimi/data/collections/networkTemplate.col.xml
> deleted file mode 100644
> index 6af563a..0000000
> --- a/server/lib/cimi/data/collections/networkTemplate.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<NetworkTemplateCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>networkTemplate</uri>
> - <name>Network template collection </name>
> - <description>The network template collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="network comp">comp</property>
> - <operation rel="add" href="/networkTemplate" />
> - <operation rel="edit" href="/collection/networkTemplate" />
> -</NetworkTemplateCollection>
> diff --git a/server/lib/cimi/data/collections/system.col.xml b/server/lib/cimi/data/collections/system.col.xml
> deleted file mode 100644
> index fd74232..0000000
> --- a/server/lib/cimi/data/collections/system.col.xml
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<SystemCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>system</uri>
> - <name>system collection </name>
> - <description>the system collection change 01</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="creator">Tong Li</property>
> - <property name="systemCollectionProp">whhhooo</property>
> - <operation rel="add" href="/system" />
> - <operation rel="edit" href="/collection/system" />
> -</SystemCollection>
> diff --git a/server/lib/cimi/data/collections/systemTemplate.col.xml b/server/lib/cimi/data/collections/systemTemplate.col.xml
> deleted file mode 100644
> index 691f50a..0000000
> --- a/server/lib/cimi/data/collections/systemTemplate.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<SystemTemplateCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>systemTemplate</uri>
> - <name>system template collection asas</name>
> - <description>the system templatyytyuyuuhghjg</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="DC Creator">developers</property>
> - <operation rel="add" href="/systemTemplate" />
> - <operation rel="edit" href="/collection/systemTemplate" />
> -</SystemTemplateCollection>
> diff --git a/server/lib/cimi/data/collections/volume.col.xml b/server/lib/cimi/data/collections/volume.col.xml
> index 5231e42..e2d2b4a 100644
> --- a/server/lib/cimi/data/collections/volume.col.xml
> +++ b/server/lib/cimi/data/collections/volume.col.xml
> @@ -4,7 +4,5 @@
> <name>Volume collection </name>
> <description>The volume collection</description>
> <created>2011-09-12 11:37:28 UTC</created>
> - <property name="volume prop">volume value</property>
> - <operation rel="add" href="/volume" />
> - <operation rel="edit" href="/collection/volume" />
> + <operation rel="add" href="/volumes" />
> </VolumeCollection>
> diff --git a/server/lib/cimi/data/collections/volumeConfiguration.col.xml b/server/lib/cimi/data/collections/volumeConfiguration.col.xml
> deleted file mode 100644
> index f186a3a..0000000
> --- a/server/lib/cimi/data/collections/volumeConfiguration.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<VolumeConfigurationCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>volumeConfiguration</uri>
> - <name>Volume configuration collection </name>
> - <description>The volume config</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="volume prop">volume value</property>
> - <operation rel="add" href="/volumeConfiguration" />
> - <operation rel="edit" href="/collection/volumeConfiguration" />
> -</VolumeConfigurationCollection>
> diff --git a/server/lib/cimi/data/collections/volumeImage.col.xml b/server/lib/cimi/data/collections/volumeImage.col.xml
> deleted file mode 100644
> index 1f18566..0000000
> --- a/server/lib/cimi/data/collections/volumeImage.col.xml
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<VolumeImageCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>volumeImage</uri>
> - <name>Volume image collection </name>
> - <description>The volume image collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="creator">Tong Li</property>
> - <property name="dayOfYear">56</property>
> - <operation rel="add" href="/volumeImage" />
> - <operation rel="edit" href="/collection/volumeImage" />
> -</VolumeImageCollection>
> diff --git a/server/lib/cimi/data/collections/volumeTemplate.col.xml b/server/lib/cimi/data/collections/volumeTemplate.col.xml
> deleted file mode 100644
> index fec2e4c..0000000
> --- a/server/lib/cimi/data/collections/volumeTemplate.col.xml
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<VolumeTemplateCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>volumeTemplate</uri>
> - <name>Volume template collection </name>
> - <description>The volume template collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <operation rel="add" href="/volumeTemplate" />
> - <operation rel="edit" href="/collection/volumeTemplate" />
> -</VolumeTemplateCollection>
> diff --git a/server/lib/cimi/data/collections/vsp.col.xml b/server/lib/cimi/data/collections/vsp.col.xml
> deleted file mode 100644
> index 6a7e092..0000000
> --- a/server/lib/cimi/data/collections/vsp.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<VspCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>vsp</uri>
> - <name>Vsp collection </name>
> - <description>The vsp collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="vsp">200</property>
> - <operation rel="add" href="/vsp" />
> - <operation rel="edit" href="/collection/vsp" />
> -</VspCollection>
> diff --git a/server/lib/cimi/data/collections/vspConfig.col.xml b/server/lib/cimi/data/collections/vspConfig.col.xml
> deleted file mode 100644
> index 258b7d7..0000000
> --- a/server/lib/cimi/data/collections/vspConfig.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<VspConfigCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>vspConfig</uri>
> - <name>Vsp collection </name>
> - <description>The vsp collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="vsp config">value</property>
> - <operation rel="add" href="/vspConfig" />
> - <operation rel="edit" href="/collection/vspConfig" />
> -</VspConfigCollection>
> diff --git a/server/lib/cimi/data/collections/vspTemplate.col.xml b/server/lib/cimi/data/collections/vspTemplate.col.xml
> deleted file mode 100644
> index 912fe9d..0000000
> --- a/server/lib/cimi/data/collections/vspTemplate.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<VspTemplateCollection xmlns="http://www.dmtf.org/cimi">
> - <uri>vspTemplate</uri>
> - <name>Vsp template collection </name>
> - <description>The vsp template collection</description>
> - <created>2011-09-12 11:37:28 UTC</created>
> - <property name="vsp propqqq">vsp value</property>
> - <operation rel="add" href="/vspTemplate" />
> - <operation rel="edit" href="/collection/vspTemplate" />
> -</VspTemplateCollection>
> diff --git a/server/lib/cimi/data/defaultRes/machine.col.xml b/server/lib/cimi/data/defaultRes/machine.col.xml
> deleted file mode 100644
> index 7c2bab1..0000000
> --- a/server/lib/cimi/data/defaultRes/machine.col.xml
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<Machine xmlns="http://www.dmtf.org/cimi">
> - <uri>machine</uri>
> - <name>Default machine name </name>
> - <description>Default machine description</description>
> - <created>2011-01-01 00:00:01 UTC</created>
> - <property name="prop1" content="prop1 value" />
> - <status>Started</status>
> - <cpu>Intel</cpu>
> - <memory quantity="4" units="gigabyte" />
> - <disk>
> - <capacity quantity="200" units="gigabyte" />
> - <format>ntgs</format>
> - <attachmentPoint>/dev/sdb0</attachmentPoint>
> - <guestInterface>SATA</guestInterface>
> - </disk>
> - <volume href="http://host:port/volume/vol01" attachmentPoint="/dev/sdc01" protocol="NFS" />
> - <networkInterface>
> - <vsp href="http://host:port/vsp/vsp01" />
> - <hostname>example host name</hostname>
> - <macAddress>00:00:00:00:00:00</macAddress>
> - <state>Active</state>
> - <protocol>IPv6</protocol>
> - <allocation>Dynamic</allocation>
> - <address>10.10.10.1</address>
> - <defaultGateway>10.10.0.1</defaultGateway>
> - <dns>10.10.0.1</dns>
> - <maxTransmissionUnit>512</maxTransmissionUnit>
> - </networkInterface>
> - <meter href="/meter" />
> - <eventLog href="eventLog" />
> - <operation rel="edit" href="/machine"/>
> - <operation rel="delete" href="/machine"/>
> - <operation rel="http://www.dmtf.org/cimi/stop" href="/machine/stop"/>
> -</Machine>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/defaultRes/machineAdmin.col.xml b/server/lib/cimi/data/defaultRes/machineAdmin.col.xml
> deleted file mode 100644
> index a507f80..0000000
> --- a/server/lib/cimi/data/defaultRes/machineAdmin.col.xml
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineAdmin xmlns="http://www.dmtf.org/cimi">
> - <uri>machineAdmin</uri>
> - <name>Default machine admin name </name>
> - <description>Default machine admin description</description>
> - <created>2011-01-01 11:37:28 UTC</created>
> - <property name="username" content="tongli@creators.com" />
> - <property name="password" content="secret" />
> - <operation rel="edit" href="/machineAdmin"/>
> - <operation rel="delete" href="/machineAdmin"/>
> -</MachineAdmin>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/defaultRes/machineConfiguration.col.xml b/server/lib/cimi/data/defaultRes/machineConfiguration.col.xml
> deleted file mode 100644
> index 871f4b4..0000000
> --- a/server/lib/cimi/data/defaultRes/machineConfiguration.col.xml
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineConfiguration xmlns="http://www.dmtf.org/cimi">
> - <uri>machineConfiguration</uri>
> - <name>Default machine configuration name </name>
> - <description>Default machine onfiguration description</description>
> - <created>2011-01-01 00:00:01 UTC</created>
> - <cpu>i386</cpu>
> - <memory quantity="4" units="gigabyte" />
> - <disk>
> - <capacity quantity="200" units="gigabyte"/>
> - <guestInterface>SATA</guestInterface>
> - </disk>
> - <supportsSnapshots>false</supportsSnapshots>
> - <guestInterface>http://www.ibm.com</guestInterface>
> - <operation rel="edit" href="/machineConfiguration"/>
> - <operation rel="delete" href="/machinieConfiguration"/>
> -</MachineConfiguration>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/defaultRes/machineImage.col.xml b/server/lib/cimi/data/defaultRes/machineImage.col.xml
> deleted file mode 100644
> index 9e3b4d5..0000000
> --- a/server/lib/cimi/data/defaultRes/machineImage.col.xml
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineImage xmlns="http://www.dmtf.org/cimi">
> - <uri>machineImage</uri>
> - <name>Default machine image name </name>
> - <description>Default machine image description</description>
> - <created>2011-01-01 00:00:01 UTC</created>
> - <imageLocation>http://hostname:port</imageLocation>
> - <imageData></imageData>
> - <operation rel="edit" href="/machineConfiguration"/>
> - <operation rel="delete" href="/machinieConfiguration"/>
> -</MachineImage>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/defaultRes/machineTemplate.col.xml b/server/lib/cimi/data/defaultRes/machineTemplate.col.xml
> deleted file mode 100644
> index feaffec..0000000
> --- a/server/lib/cimi/data/defaultRes/machineTemplate.col.xml
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<MachineTemplate xmlns="http://www.dmtf.org/cimi">
> - <uri>machineTemplate</uri>
> - <name>Default machine template name </name>
> - <description>Default machine template description</description>
> - <created>2011-01-01 00:00:01 UTC</created>
> - <property name="prop1" content="prop1 value" />
> - <machineConfig href="machineConfig_id" />
> - <machineImage href="machineImage_id" />
> - <operation rel="edit" href="/machineTemplate"/>
> - <operation rel="delete" href="/machineTemplate"/>
> -</MachineTemplate>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/defaultRes/system.col.xml b/server/lib/cimi/data/defaultRes/system.col.xml
> deleted file mode 100644
> index d3c7a1a..0000000
> --- a/server/lib/cimi/data/defaultRes/system.col.xml
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<System xmlns="http://www.dmtf.org/cimi">
> - <uri>system</uri>
> - <name>Default system name </name>
> - <description>Default system description</description>
> - <created>2011-01-01 00:00:01 UTC</created>
> - <property name="prop1" content="prop value" />
> - <state>INITIATED</state>
> - <status>STOPPED</status>
> - <operation rel="edit" href="/system"/>
> - <operation rel="delete" href="/system"/>
> -</System>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/defaultRes/systemTemplate.col.xml b/server/lib/cimi/data/defaultRes/systemTemplate.col.xml
> deleted file mode 100644
> index 0f6be07..0000000
> --- a/server/lib/cimi/data/defaultRes/systemTemplate.col.xml
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<SystemTemplate xmlns="http://www.dmtf.org/cimi">
> - <uri>systemTemplate</uri>
> - <name>Default system template name </name>
> - <description>Default system template description</description>
> - <created>2011-01-01 00:00:01 UTC</created>
> - <property name="username" content="tongli@creators.com" />
> - <operation rel="edit" href="/systemTemplate"/>
> - <operation rel="delete" href="/systemTemplate"/>
> -</SystemTemplate>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml b/server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml
> deleted file mode 100644
> index 97d240c..0000000
> --- a/server/lib/cimi/data/defaultRes/volumeConfiguration.col.xml
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -<?xml version='1.0' encoding='utf-8' ?>
> -<VolumeConfiguration xmlns="http://www.dmtf.org/cimi">
> - <uri>volumeConfiguration</uri>
> - <name>Default volume configuration name </name>
> - <description>Default volume configuration description</description>
> - <created>2011-01-01 00:00:01 UTC</created>
> - <property name="username" content="tongli@creators.com" />
> - <format>ext4</format>
> - <capacity quantity="200" units="gigabyte"/>
> - <supportsSnapshots> xs:boolean </supportsSnapshots>
> - <guestInterface>http://www.ibm.com</guestInterface>
> - <operation rel="edit" href="/volumeConfiguration"/>
> - <operation rel="delete" href="/volumeConfiguration"/>
> -</VolumeConfiguration>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/default_res/machine.col.xml b/server/lib/cimi/data/default_res/machine.col.xml
> new file mode 100644
> index 0000000..7c2bab1
> --- /dev/null
> +++ b/server/lib/cimi/data/default_res/machine.col.xml
> @@ -0,0 +1,35 @@
> +<?xml version='1.0' encoding='utf-8' ?>
> +<Machine xmlns="http://www.dmtf.org/cimi">
> + <uri>machine</uri>
> + <name>Default machine name </name>
> + <description>Default machine description</description>
> + <created>2011-01-01 00:00:01 UTC</created>
> + <property name="prop1" content="prop1 value" />
> + <status>Started</status>
> + <cpu>Intel</cpu>
> + <memory quantity="4" units="gigabyte" />
> + <disk>
> + <capacity quantity="200" units="gigabyte" />
> + <format>ntgs</format>
> + <attachmentPoint>/dev/sdb0</attachmentPoint>
> + <guestInterface>SATA</guestInterface>
> + </disk>
> + <volume href="http://host:port/volume/vol01" attachmentPoint="/dev/sdc01" protocol="NFS" />
> + <networkInterface>
> + <vsp href="http://host:port/vsp/vsp01" />
> + <hostname>example host name</hostname>
> + <macAddress>00:00:00:00:00:00</macAddress>
> + <state>Active</state>
> + <protocol>IPv6</protocol>
> + <allocation>Dynamic</allocation>
> + <address>10.10.10.1</address>
> + <defaultGateway>10.10.0.1</defaultGateway>
> + <dns>10.10.0.1</dns>
> + <maxTransmissionUnit>512</maxTransmissionUnit>
> + </networkInterface>
> + <meter href="/meter" />
> + <eventLog href="eventLog" />
> + <operation rel="edit" href="/machine"/>
> + <operation rel="delete" href="/machine"/>
> + <operation rel="http://www.dmtf.org/cimi/stop" href="/machine/stop"/>
> +</Machine>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/default_res/machine_configuration.col.xml b/server/lib/cimi/data/default_res/machine_configuration.col.xml
> new file mode 100644
> index 0000000..564b378
> --- /dev/null
> +++ b/server/lib/cimi/data/default_res/machine_configuration.col.xml
> @@ -0,0 +1,17 @@
> +<?xml version='1.0' encoding='utf-8' ?>
> +<MachineConfiguration xmlns="http://www.dmtf.org/cimi">
> + <uri>machineConfiguration</uri>
> + <name>Default machine configuration name </name>
> + <description>Default description</description>
> + <created>2011-01-01 00:00:01 UTC</created>
> + <cpu>i386</cpu>
> + <memory quantity="4" units="gigabyte" />
> + <disk>
> + <capacity quantity="200" units="gigabyte"/>
> + <guestInterface>SATA</guestInterface>
> + </disk>
> + <supportsSnapshots>false</supportsSnapshots>
> + <guestInterface>http://www.ibm.com</guestInterface>
> + <operation rel="edit" href="/machine_configuration"/>
> + <operation rel="delete" href="/machinie_configuration"/>
> +</MachineConfiguration>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/default_res/machine_image.col.xml b/server/lib/cimi/data/default_res/machine_image.col.xml
> new file mode 100644
> index 0000000..e7de5e7
> --- /dev/null
> +++ b/server/lib/cimi/data/default_res/machine_image.col.xml
> @@ -0,0 +1,11 @@
> +<?xml version='1.0' encoding='utf-8' ?>
> +<MachineImage xmlns="http://www.dmtf.org/cimi">
> + <uri>machineImage</uri>
> + <name>Default machine image name </name>
> + <description>Default machine image description</description>
> + <created>2011-01-01 00:00:01 UTC</created>
> + <imageLocation>http://</imageLocation>
> + <imageData></imageData>
> + <operation rel="edit" href="/machine_image"/>
> + <operation rel="delete" href="/machinie_image"/>
> +</MachineImage>
> \ No newline at end of file
> diff --git a/server/lib/cimi/data/default_res/volume.col.xml b/server/lib/cimi/data/default_res/volume.col.xml
> new file mode 100644
> index 0000000..21b9d65
> --- /dev/null
> +++ b/server/lib/cimi/data/default_res/volume.col.xml
> @@ -0,0 +1,14 @@
> +<?xml version='1.0' encoding='utf-8' ?>
> +<Volume xmlns="http://www.dmtf.org/cimi">
> + <uri>volume</uri>
> + <name>Default volume name </name>
> + <description>Default volume description</description>
> + <created>2011-01-01 00:00:01 UTC</created>
> + <capacity quantity="200" units="gigabyte"/>
> + <bootable>true</bootable>
> + <format>ext4</format>
> + <supportsSnapshots>true</supportsSnapshots>
> + <guestInterface>SATA</guestInterface>
> + <operation rel="edit" href="/volume"/>
> + <operation rel="delete" href="/volume"/>
> +</Volume>
> \ No newline at end of file
> diff --git a/server/lib/cimi/helpers/cmwgapp_helper.rb b/server/lib/cimi/helpers/cmwgapp_helper.rb
> index a111b33..6565edd 100644
> --- a/server/lib/cimi/helpers/cmwgapp_helper.rb
> +++ b/server/lib/cimi/helpers/cmwgapp_helper.rb
> @@ -17,38 +17,28 @@
>
> # this section defines constants used in the implementation.
>
> -
> -def fixupContent(aHash, keyName="content", attrName="name")
> +#this method is to fixup the hash object to make sure it can be serialized into json
> +#as DMTF spec requires. as the spec keeps changing, this method may need to be revisited
> +#and modified again.
> +def fixup_content(hash_obj, key_name="content", attr_name="name")
> #this check is to make sure we are not handling nil values.
> - if aHash
> - aHash.each_pair do |key, value|
> + if hash_obj
> + hash_obj.each_pair do |key, value|
> if value.kind_of? Hash
> #We can only handle the element without any other attribute,
> #if the element also has other attribute, then we can not do fixups since it will lose information.
> - if value[keyName] && value.size == 1
> - aHash[key] = value[keyName]
> - elsif value[keyName] && value[attrName] && value.size == 2
> - aHash[key] = { "#{value[attrName]}" => value[keyName] }
> + if value[key_name] && value.size == 1
> + hash_obj[key] = value[key_name]
> + elsif value[key_name] && value[attr_name] && value.size == 2
> + hash_obj[key] = { "#{value[attr_name]}" => value[key_name] }
> else
> - fixupContent value, keyName, attrName
> + fixup_content value, key_name, attr_name
> end
> end
> end
> end
> end
>
> -def is_valid? anObj
> - return false unless anObj
> - return false if anObj["uri"].nil? || anObj["name"].nil? || anObj["created"].nil?
> - true
> -end
> -
> -def convert_xml_to_html xml_str
> - if xml_str
> - xml_str.gsub(/</, "<").gsub(/>/, ">").gsub(/\n/, "\r")
> - end
> -end
> -
> module ApplicationHelper
>
> include Deltacloud
> @@ -59,300 +49,98 @@ module ApplicationHelper
> s+="</ul>"
> end
>
> - def machine_action(name)
> - original_instance = driver.instance(credentials, :id => params[:id])
> -
> - @operationParam = { "machineId" => params[:id], "machineOperation" => name}
> + def respond_to_collection(collType)
> + respond_to do |format|
> + format.html do
> + root_hash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + collType),
> + { 'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
>
> - # If original instance doesn't include called action
> - # return with 405 error (Method is not Allowed)
> - if original_instance
> - unless driver.instance_actions_for(original_instance.state).include?(name.to_sym)
> - return report_error(405, 'not_allowed')
> + @xml_root_node = root_hash.first[0]
> + @dmtfitem = root_hash.first[1]
> + haml :"collection/index"
> end
> - end
> + format.xml do
> + root_hash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + collType),
> + { 'ForceArray' => true, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
> + col_item_name = root_hash.first[0]
> + content_type get_response_content_type(col_item_name, 'xml'), :charset => 'utf-8'
> + col_item_name = col_item_name.sub(/Collection/,'') #Remove the Collection at the end.
> + col_item_name = col_item_name[0].downcase + col_item_name[1, col_item_name.length]
>
> - @instance = driver.send(:"#{name}_instance", credentials, params["id"])
> + urls = []
> + @dmtf_col_items.map do |item|
> + urls << {"href" => item["href"]}
> + end
>
> - respond_to do |format|
> - info "the format is " + format.to_s
> - format.html { haml :"machine/operation" }
> - format.xml { haml :"machine/operation" }
> - format.json do
> - responseXML = haml :"machine/operation"
> - hash_response = XmlSimple.xml_in responseXML, {'ForceArray' => true, 'KeepRoot'=>true, 'KeyAttr' => ['name']}
> - hash_response.to_json
> - end
> - end
> - end
> + root_hash.first[1][0]["#{col_item_name}"] = urls
>
> - def link_to_action_ext(action, url, method, params)
> - capture_haml do
> - haml_tag :form, :method => method.to_sym, :action => url, :class => [:link, method] do
> - params.each do |key, value|
> - haml_tag :input, :type => :hidden, :name => key, :value => value
> - end
> - haml_tag :button, :type => :button, :onClick => "return do#{method.capitalize}(this)" do
> - haml_concat action
> - end
> + XmlSimple.xml_out(root_hash, { 'KeyAttr' => 'name', 'KeepRoot' => true, 'ContentKey' => 'content'})
> end
> - end
> - end
> + format.json do
> + root_hash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + collType),
> + { 'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
> + col_item_name = root_hash.first[0]
> + content_type get_response_content_type(col_item_name, 'json'), :charset => 'utf-8'
> + #Remove the Collection at the end.
> + col_item_name = col_item_name.sub(/Collection/,'')
> + col_item_name = col_item_name[0].downcase + col_item_name[1, col_item_name.length]
>
> - def get_collection_item(collType)
> - colItem = []
> - fileList = Dir.glob File.join(STOREROOT,"*." + collType)
> - if fileList && (fileList.empty? == false)
> - fileList.map do |item|
> - #colfile = File.read(item)
> - rootHash = XmlSimple.xml_in item, {'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']}
> - if rootHash.first and rootHash.first[1]
> - newItem = {
> - "name" => rootHash.first[1]["name"],
> - "href" => HOST_API_PATH + "/" + collType + "/" + rootHash.first[1]["uri"]
> - }
> - colItem.insert 0, newItem
> + urls = []
> + @dmtf_col_items.map do |item|
> + urls << {"href" => item["href"]}
> end
> - end
> - end
> - info colItem.inspect
> - colItem
> - end
>
> - def get_collection_item_from_DC(collType, force_array = false)
> - colItem = []
> - case collType
> - when "machineConfiguration"
> - profiles = driver.hardware_profiles(credentials, nil)
> - if profiles
> - profiles.map do |profile|
> - if force_array
> - newItem = { "name" => [profile.name],"uri" => [profile.name],
> - "href" => [HOST_API_PATH + "/" + collType + "/" + profile.name] }
> - else
> - newItem = { "name" => profile.name,"uri" => profile.name,
> - "href" => HOST_API_PATH + "/" + collType + "/" + profile.name }
> - end
> - attr = cimi_get_profile_properties profile
> - if attr
> - newItem["entityMetadata"] = attr
> - end
> - colItem.insert 0, newItem
> - end
> - end
> - when "machineImage"
> - #Retrieve machine images
> - images = driver.send(:images, credentials, {})
> - if images
> - images.map do |image|
> - if force_array
> - newItem = { "name" => [image.name],"description" => [image.description],
> - "uri" => [image.id],"href" => [HOST_API_PATH + "/" + collType + "/" + image.id] }
> - else
> - newItem = { "name" => image.name,"description" => image.description,
> - "uri" => image.id,"href" => HOST_API_PATH + "/" + collType + "/" + image.id }
> - end
> - attr = cimi_get_image_metadata image
> - if attr
> - newItem["entityMetadata"] = attr
> - end
> - colItem.insert 0, newItem
> - end
> - end
> - when "machine"
> - #Retrieve instances
> - instances = driver.send(:instances, credentials, {})
> - if instances
> - instances.map do |instance|
> - puts instance.inspect
> - if force_array
> - newItem = { "name" => [instance.name],"status" => [instance.state],"uri" => [instance.id],
> - "href" => [HOST_API_PATH + "/" + collType + "/" + instance.id] }
> - else
> - newItem = { "name" => instance.name,"status" => instance.state, "uri" => instance.id,
> - "href" => HOST_API_PATH + "/" + collType + "/" + instance.id }
> - end
> - attr = cimi_get_machine_metadata instance
> - if attr
> - newItem["entityMetadata"] = attr
> - end
> - colItem.insert 0, newItem
> - end
> - end
> - when "volume"
> - instances = driver.send(:storage_volumes, credentials, {})
> - if instances
> - instances.map do |instance|
> - info instance.inspect
> - newItem = {
> - "name" => instance.id,
> - "href" => HOST_API_PATH + "/" + collType + "/" + instance.id
> - }
> - colItem.insert 0, newItem
> + root_hash.first[1]["#{col_item_name}"] = urls
> +
> + json_hash = root_hash.first[1]
> + if json_hash.has_key?("xmlns")
> + json_hash.delete "xmlns"
> end
> + fixup_content json_hash
> + res = json_hash.to_json
> end
> end
> - colItem
> end
>
> - def get_response_content_type(collType, format="html")
> + def get_response_content_type(coll_type, format="html")
> case format
> when "text/html"
> - acceptFormat = ""
> + ""
> when "xml"
> - acceptFormat = "application/CIMI-" + collType + "+xml"
> + "application/CIMI-" + coll_type + "+xml"
> when "json"
> - acceptFormat = "application/CIMI-" + collType + "+json"
> + "application/CIMI-" + coll_type + "+json"
> end
> - acceptFormat
> end
>
> - def handle_post
> - raw = request.env["rack.input"].read
> -
> - content_obj = is_valid_xml_input raw
> - if content_obj
> - @xmlRootNode = content_obj.first[0]
> - @dmtfitem = content_obj.first[1][0]
> - info @xmlRootNode.inspect
> - fileId = @dmtfitem["uri"][0]
> - info @dmtfitem["uri"].inspect
> -
> - filePath = File.join(STOREROOT, fileId + '.' + params[:collType])
> - if is_valid?(@dmtfitem) && File.exist?(filePath) == false
> -
> - File.open(filePath, "w") do |file|
> - file.write serialize_object_to_xml(content_obj)
> - end
> - respond_to do |format|
> - format.xml do
> - response.status = 201
> - response['Location'] = HOST_API_PATH + "#{params[:collType]}/#{fileId}"
> - haml :"collection/response"
> - end
> - end
> - else
> - report_error(409)
> - end
> - else
> - #can not accept the content. the request body is not valid.
> - #412 - Precondition Failed.
> - report_error(412)
> - end
> - end
> -
> - def handle_collection_put
> - if RESOURCE_NAMES.include? params[:id]
> - raw = request.env["rack.input"].read
> - content_obj = is_valid_xml_input raw
> - if content_obj
> - filePath = File.join(STOREROOT, 'collections/' + params[:id] + '.col.xml')
> - if File.exist?(filePath)
> - File.open(filePath, "w") do |file|
> - file.write serialize_object_to_xml(content_obj)
> - end
> - status 200
> - respond_to do |format|
> - format.xml { haml :"collection/response"}
> - end
> - else
> - report_error(404)
> - end
> - else
> - report_error(412)
> - end
> - else
> - report_error(404)
> + def get_resource_default(coll_type)
> + file_path = File.join STOREROOT, "default_res/" + coll_type + ".col.xml"
> + if File.exist?(file_path)
> + root_hash = XmlSimple.xml_in(file_path, {'ForceArray'=>false, 'KeepRoot'=>true, 'KeyAttr'=>['name']})
> + { "xml_root_node" => root_hash.first[0], "dmtfitem" => root_hash.first[1]}
> end
> end
>
> - def handle_resource_put
> - raw = request.env["rack.input"].read
> - content_obj = is_valid_xml_input raw
> - if content_obj
> - @xmlRootNode = content_obj.first[0]
> - @dmtfitem = content_obj.first[1][0]
> - info @xmlRootNode.inspect
> - fileId = @dmtfitem["uri"][0]
> - info @dmtfitem["uri"].inspect
> -
> - filePath = File.join(STOREROOT, fileId + '.' + params[:collType])
> - #we want to check if the file exist and if the passed in id is the same as uri in the block passed in
> - if File.exist?(filePath) && fileId == params[:id]
> - File.open(filePath, "w") do |file|
> - file.write serialize_object_to_xml(content_obj)
> - end
> -
> - respond_to do |format|
> - format.xml do
> - response.status = 200
> - response['Location'] = HOST_API_PATH + "#{params[:collType]}/#{fileId}"
> - haml :"collection/response"
> - end
> - end
> - else
> - report_error(404)
> + def show_resource(resource_path, content_type)
> + respond_to do |format|
> + format.xml do
> + content_type "application/CIMI-#{content_type}+xml", :charset => 'utf-8'
> + haml :"#{resource_path}", :layout => false
> end
> - else
> - report_error(412)
> - end
> - end
> -
> - def handle_resource_delete
> - filePath = File.join(STOREROOT, params[:id] + '.' + params[:collType])
> - if File.exist?(filePath)
> - colfile = File.delete(filePath)
> - respond_to do |format|
> - format.xml do
> - response.status = 200
> - response['Location'] = HOST_API_PATH + "#{params[:collType]}/#{params[:id]}"
> - haml :"collection/response"
> - end
> - format.json do
> - engine = Haml::Engine.new(File.read(settings.views + "/collection/response"))
> - responseXML = engine.render self
> - hash_response = XmlSimple.xml_in responseXML, {'ForceArray' => true, 'KeepRoot'=>true, 'KeyAttr' => ['name']}
> - hash_response.to_json
> - end
> + format.html do
> + haml :"#{resource_path}"
> end
> - else
> - report_error(404)
> - end
> - end
> -
> - def handle_resource_get
> - if DC_SUPPORTED_RESOURCES.include? params[:collType]
> - check_DC_Resource!
> - end
> - filePath = File.join STOREROOT, params[:id]+'.'+params[:collType]
> - if File.exist?(filePath)
> - respond_to do |format|
> - format.html do
> - rootHash = XmlSimple.xml_in(filePath, {'ForceArray'=>false, 'KeepRoot'=>true, 'KeyAttr'=>['name']})
> - info rootHash.inspect
> - @xmlRootNode = rootHash.first[0]
> - @dmtfitem = rootHash.first[1]
> - info @dmtfitem
> - pathName = params[:collType] + "/show"
> - haml pathName.to_sym
> - end
> - format.xml do
> - File.read(filePath)
> - end
> - format.json do
> - rootHash = XmlSimple.xml_in(filePath, {'ForceArray'=>false, 'KeepRoot'=>true, 'KeyAttr'=>['name']})
> - info rootHash
> - jsonHash = rootHash.first[1]
> - info jsonHash
> - if jsonHash.has_key?("xmlns")
> - jsonHash.delete "xmlns"
> - end
> - fixupContent jsonHash
> - res = jsonHash.to_json
> + format.json do
> + content_type "application/CIMI-#{content_type}+json", :charset => 'utf-8'
> + engine = Haml::Engine.new(File.read(settings.views + "/#{resource_path}.xml.haml"))
> + responseXML = engine.render self
> + hash_response = XmlSimple.xml_in responseXML, {'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']}
> + hash_response = hash_response.first[1]
> + if hash_response.has_key?("xmlns")
> + hash_response.delete "xmlns"
> end
> + hash_response.to_json
> end
> - else
> - report_error(404)
> end
> end
> -end
> +end
> \ No newline at end of file
> diff --git a/server/lib/cimi/helpers/cmwgres_helper.rb b/server/lib/cimi/helpers/cmwgres_helper.rb
> deleted file mode 100644
> index b00339b..0000000
> --- a/server/lib/cimi/helpers/cmwgres_helper.rb
> +++ /dev/null
> @@ -1,134 +0,0 @@
> -#
> -# 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 ApplicationHelper
> -
> - #This method will check the resource created locally and then mix the attributes from cloud
> - #then transform the data into a format that UI can handle
> - def check_DC_Resource!
> - if DC_SUPPORTED_RESOURCES.include? params[:collType]
> - filePath = File.join(STOREROOT, params[:id] + '.' + params[:collType])
> - allRes = get_collection_item_from_DC params[:collType], true
> - #getting the resource that match the passed in id.
> - aRes = allRes.select { |item| item["uri"][0] == params[:id]}
> - #if the array is not empty
> - if aRes.empty? == false
> - #using driver as part of the file name to have some namespace.
> - filePath = File.join STOREROOT, params[:id] + '.' + params[:collType]
> - #using default value xml
> - defaultFilePath = File.join(STOREROOT, "defaultRes/" + params[:collType] + ".col.xml")
> - #read the default xml file in, then mixin the retrieved value, then save it for further process.
> -
> - rootHash = XmlSimple.xml_in(defaultFilePath, {'ForceArray' => true, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
> - info rootHash.first[0]
> -
> - #handling the merge
> - rootHash = { "#{rootHash.first[0]}" => [rootHash.first[1][0].merge(aRes.first)] }
> -
> - if aRes.first["entityMetadata"]
> - @metadata = XmlSimple.xml_out aRes.first["entityMetadata"],
> - {'Indent'=>" ",'RootName'=>'entityMetadata','KeyAttr'=>'name','KeepRoot'=>true,'ContentKey'=>'content'}
> - end
> -
> - #create a file to represent this resource
> - File.open(filePath, 'w') do |file|
> - file.write XmlSimple.xml_out(rootHash, { 'KeyAttr' => 'name', 'KeepRoot' => true})
> - end
> - end
> - end
> - end
> -
> - #this method will convert each hardware profile property into attribute string
> - def cimi_get_profile_properties profile
> - #check if this profile has properties
> - if profile.properties and profile.properties.length > 0
> - val ='<EntityMetadata xmlns="http://www.dmtf.org/cimi">'
> - val += '<uri>' + HOST_API_PATH + '/types/MC</uri>'
> - val += '<name>MachineConfiguration</name>'
> - val += '<typeURI>http://www.dmtf.org/cimi/MachineConfiguration</typeURI>'
> - profile.each_property do |p|
> - the_value = ''
> - if p.kind == :range
> - the_type = "xs:integer"
> - the_value = '<range low="' + p.first.to_s + '" high="' + p.last.to_s + '" />'
> - else
> - the_type = 'xs:string'
> - if p.kind == :fixed
> - the_value = '<value>' + p.value.to_s + '</value>'
> - elsif p.kind == :enum
> - the_value = '<value>' + p.values.join(',') + '</value>'
> - end
> - end
> - val += '<attribute name="' + p.name.to_s + '" namespace="http://' + ENV["API_HOST"] + '" type="' + the_type
> - val += '" unit="' + p.unit.to_s + '">' + the_value + '</attribute>'
> - end
> - val += '</EntityMetadata>'
> - val = XmlSimple.xml_in(val, {'ForceArray' => true, 'KeepRoot'=>false, 'KeyAttr' => ['name']})
> - return val
> - end
> - return nil
> - end
> -
> - def cimi_get_image_metadata image
> - if image
> - val ='<EntityMetadata xmlns="http://www.dmtf.org/cimi">'
> - val += '<uri>' + HOST_API_PATH + '/types/MI</uri>'
> - val += '<name>MachineImage</name>'
> - val += '<typeURI>http://www.dmtf.org/cimi/MachineImage</typeURI>'
> - val += '<attribute name="state" namespace="http://' + ENV["API_HOST"] + '" type="xs:string"'
> - val += ' required="true"><value>' + image.state + '</value></attribute>'
> - val += '<attribute name="architecture" namespace="http://' + ENV["API_HOST"] + '" type="xs:string"'
> - val += ' required="false"><value>' + image.architecture + '</value></attribute>'
> - val += '</EntityMetadata>'
> - XmlSimple.xml_in(val, {'ForceArray' => true, 'KeepRoot'=>false, 'KeyAttr' => ['name']})
> - end
> - end
> -
> - def cimi_get_machine_metadata instance
> - if instance
> - val ='<EntityMetadata xmlns="http://www.dmtf.org/cimi">'
> - val += '<uri>' + HOST_API_PATH + '/types/M</uri>'
> - val += '<name>Machine</name>'
> - val += '<typeURI>http://www.dmtf.org/cimi/Machine</typeURI>'
> - val += '<attribute name="owner" namespace="http://' + ENV["API_HOST"] + '" type="xs:string"'
> - val += ' required="true"><value>' + instance.owner_id + '</value></attribute>'
> - if instance.keyname
> - val += '<attribute name="keyname" namespace="http://' + ENV["API_HOST"] + '" type="xs:string"'
> - val += ' required="false"><value>' + instance.keyname + '</value></attribute>'
> - end
> - if instance.firewalls
> - val += '<attribute name="firewalls" namespace="http://' + ENV["API_HOST"] + '" type="xs:string"'
> - val += ' required="false"><value>' + instance.firewalls.join(", ") + '</value></attribute>'
> - end
> - val += '<attribute name="public_addresses" namespace="http://' + ENV["API_HOST"] + '" type="xs:string"'
> - val += ' required="false"><value>' + instance.public_addresses.join(',') + '</value></attribute>'
> - val += '<attribute name="private_addresses" namespace="http://' + ENV["API_HOST"] + '" type="xs:string"'
> - val += ' required="false"><value>' + instance.private_addresses.join(',') + '</value></attribute>'
> - val += '</EntityMetadata>'
> - XmlSimple.xml_in(val, {'ForceArray' => true, 'KeepRoot'=>false, 'KeyAttr' => ['name']})
> - end
> - end
> -
> - #this method will check if the xml input is valid by using simple xml.
> - def is_valid_xml_input input
> - XmlSimple.xml_in input, {'ForceArray' => true, 'KeepRoot'=>true, 'KeyAttr' => ['name']}
> - end
> -
> - def serialize_object_to_xml input
> - XmlSimple.xml_out input, {'Indent'=>" ", 'KeyAttr'=>'name','KeepRoot'=>true,'ContentKey'=>'content',
> - 'XmlDeclaration'=>"<?xml version='1.0' encoding='utf-8' ?>"}
> - end
> -end
> \ No newline at end of file
> diff --git a/server/lib/cimi/helpers/dmtfdep.rb b/server/lib/cimi/helpers/dmtfdep.rb
> index a7fab65..19ef1e0 100644
> --- a/server/lib/cimi/helpers/dmtfdep.rb
> +++ b/server/lib/cimi/helpers/dmtfdep.rb
> @@ -70,9 +70,7 @@ XS_NAMESPACE = "http://www.w3.org/2001/XMLSchema"
> HEADER_API_VERSION = "1.0"
> HEADER_CIMI_SPECIFICATION_VERSION = "X-CIMI-Specification-Version" + " :" + HEADER_API_VERSION
>
> -CIMI_RESOURCES = [:cloudEntryPoint, :systemTemplate, :system, :machineTemplate, :machineConfiguration, :machineImage, :machineAdmin,
> - :machine, :volumeTemplate, :volumeConfiguration, :volumeImage, :volume, :networkTemplate, :networkConfig, :network,
> - :vspTemplate, :vspConfig, :vsp, :meterTemplate, :meter, :eventLog, :event, :job ]
> +CIMI_RESOURCES = [:cloudEntryPoint, :machineConfiguration, :machineImage, :machine, :volume]
>
> all_resource_names = ""
> CIMI_RESOURCES.map { |item| all_resource_names += item.to_s + "," unless item == :cloudEntryPoint}
> diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
> index ed406bf..5d60ccb 100644
> --- a/server/lib/cimi/server.rb
> +++ b/server/lib/cimi/server.rb
> @@ -15,16 +15,8 @@
>
>
> require 'cimi/helpers/dmtfdep'
> -require 'cimi/helpers/cmwgres_helper'
> require 'cimi/helpers/cmwgapp_helper'
>
> -
> -# FIXME: Can we get rid of the dependency on active_support ?
> -#require 'active_support'
> -#require 'active_support/inflector'
> -#require 'active_support/core_ext/object/blank'
> -#require 'active_support/core_ext/hash/conversions'
> -
> set :version, '0.1.0'
>
> include Deltacloud::Drivers
> @@ -33,21 +25,6 @@ set :drivers, Proc.new { driver_config }
> # CIMI has different default collections
> DEFAULT_COLLECTIONS = CIMI_RESOURCES
>
> -# FIXME: This contains a mix of static and dynamically modified data. This
> -# needs to be separated out, and only drivers should touch dynamic data
> -
> -# FIXME: There used to be code that created STOREROOT when it doesn't
> -# exist. But not having storeroot leads to an error when requesting the
> -# entry point
> -
> -# here we setup a directory for persistence, everything will be saved as
> -# files the file format will be uuid.resourceTypeName, for example: if
> -# there is a machineTemplte, and its id is
> -# dab4fdae-1451-48f4-b5b6-2b0dcc06bb14, then the file at the storage will
> -# be dab4fdae-1451-48f4-b5b6-2b0dcc06bb14.machineTemplate, each file
> -# content should be in xml format. the root directory of the storage is
> -# <rootDir>/store so we create one if one does not exist yet.
> -
> STOREROOT = File.join($top_srcdir, 'lib', 'cimi', 'data')
> #We would like to know the storage root.
> puts "store root is " + STOREROOT
> @@ -66,7 +43,6 @@ configure do
> set :public, File::join($top_srcdir, 'public')
> # Try to load the driver on startup to fail early if there are issues
> driver
> - # FIXME: Reduce the places that need access to STOREROOT
> set :store, STOREROOT
> end
>
> @@ -99,154 +75,204 @@ puts "application root URL:" + HOST_API_PATH
>
> get '/' do redirect root_url, 301; end
>
> -get "#{Sinatra::UrlForHelper::DEFAULT_URI_PREFIX}\/?" do
> +get "cimi\/?" do
> if params[:force_auth]
> return [401, 'Authentication failed'] unless driver.valid_credentials?(credentials)
> end
>
> - redirect "/api/cloudEntryPoint", 301
> + redirect "/cimi/cloudEntryPoint", 301
> end
>
> -get "/api/cloudEntryPoint" do
> +collection :cloudEntryPoint do
> + description <<EOS
> + cloud entry point
> +EOS
>
> - @allAPIs = CIMI_RESOURCES
> - respond_to do |format|
> - format.xml do
> - content_type 'application/CIMI-CloudEntryPoint+xml', :charset => 'utf-8'
> - haml:"cloudEntryPoint/index"
> - end
> - format.html { haml:"cloudEntryPoint/index" }
> - format.json do
> - content_type 'application/CIMI-CloudEntryPoint+json', :charset => 'utf-8'
> - engine = Haml::Engine.new(File.read(settings.views + "/cloudEntryPoint/index.xml.haml"))
> - responseXML = engine.render self
> - hash_response = XmlSimple.xml_in responseXML, {'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']}
> - info hash_response
> - hash_response = hash_response.first[1]
> - info hash_response
> - if hash_response.has_key?("xmlns")
> - hash_response.delete "xmlns"
> - end
> - res = hash_response.to_json
> + operation :index do
> + description "list all resources of the cloud"
> + control do
> + @all_apis = CIMI_RESOURCES
> + show_resource "cloudEntryPoint/index", "CloudEntryPoint"
> end
> end
> end
>
> -get "/api/collection/:collType" do
> - if RESOURCE_NAMES.include? params[:collType]
> -
> - # here we will handle the update of changing the collection attribute.
> - # no item in the collection will be changed, this will be only used to change properties of a collection.
> - #the resources should be retrieved from DeltaCloud
> - if DC_SUPPORTED_RESOURCES.include? params[:collType]
> - @dmtfColItems = get_collection_item_from_DC params[:collType]
> - else
> - @dmtfColItems = get_collection_item params[:collType]
> +collection :machine_configuration do
> + global!
> +
> + description <<EOS
> +List all machine configurations
> +EOS
> +
> + operation :index do
> + description "List all machine configurations"
> + control do
> + profiles = driver.hardware_profiles(credentials, nil)
> + @dmtf_col_items = []
> + if profiles
> + profiles.map do |profile|
> + new_item = { "name" => profile.name, "href" => HOST_API_PATH + "/machine_configuration/" + profile.name }
> + @dmtf_col_items.insert 0, new_item
> + end
> + end
> + respond_to_collection "machine_configuration.col.xml"
> end
> + end
>
> - respond_to do |format|
> - format.html do
> - rootHash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + params[:collType] + '.col.xml'),
> - { 'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
> -
> - @xmlRootNode = rootHash.first[0]
> - @dmtfitem = rootHash.first[1]
> - info @dmtfitem
> - haml :"collection/index"
> + operation :show do
> + description "Show specific machine configuration."
> + with_capability :hardware_profile
> + param :id, :string, :required
> + control do
> + @profile = driver.hardware_profile(credentials, params[:id])
> + if @profile
> + #setup the default values for a machine configuration
> + resource_default = get_resource_default "machine_configuration"
> + #get the actual values from profile
> + resource_value = { "name" => @profile.name,"uri" => @profile.name,
> + "href" => HOST_API_PATH + "/machine_configuration/" + @profile.name }
> + #mixin actual values get from profile
> + @dmtfitem = resource_default["dmtfitem"].merge resource_value
> + show_resource "machine_configuration/show", "MachineConfiguration"
> + else
> + report_error(404)
> end
> - format.xml do
> - rootHash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + params[:collType] + '.col.xml'),
> - { 'ForceArray' => true, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
> - info rootHash
> - colItemName = rootHash.first[0]
> - content_type get_response_content_type(colItemName, 'xml'), :charset => 'utf-8'
> - colItemName = colItemName.sub(/Collection/,'') #Remove the Collection at the end.
> - colItemName = colItemName[0].downcase + colItemName[1, colItemName.length]
> -
> - #we need to produce the url collection
> - urls = []
> - @dmtfColItems.map do |item|
> - urls << {"href" => item["href"]}
> - end
> + end
> + end
> +end
>
> - rootHash.first[1][0]["#{colItemName}"] = urls
> +collection :machine_image do
> + global!
> +
> + description <<EOS
> +List all machine images
> +EOS
> +
> + operation :index do
> + description "List all machine configurations"
> + control do
> + images = driver.send(:images, credentials, {})
> + @dmtf_col_items = []
> + if images
> + images.map do |image|
> + new_item = { "name" => image.name,"href" => HOST_API_PATH + "/machine_image/" + image.id }
> + @dmtf_col_items.insert 0, new_item
> + end
> + end
> + respond_to_collection "machine_image.col.xml"
> + end
> + end
>
> - XmlSimple.xml_out(rootHash, { 'KeyAttr' => 'name', 'KeepRoot' => true, 'ContentKey' => 'content'})
> + operation :show do
> + description "Show specific machine image."
> + with_capability :image
> + param :id, :string, :required
> + control do
> + @image = driver.send(:image, credentials, { :id => params[:id]} )
> + if @image
> + #setup the default values for a machine imageion
> + resource_default = get_resource_default "machine_image"
> + #get the actual values from image
> + resource_value = { "name" => @image.name,"description" => @image.description,
> + "uri" => @image.id,"href" => HOST_API_PATH + "/machine_image/" + @image.id }
> + #mixin actual values get from the specific image
> + @dmtfitem = resource_default["dmtfitem"].merge resource_value
> + show_resource "machine_image/show", "MachineImage"
> + else
> + report_error(404)
> end
> - format.json do
> - rootHash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + params[:collType] + '.col.xml'),
> - { 'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
> - info rootHash
> - colItemName = rootHash.first[0]
> - content_type get_response_content_type(colItemName, 'json'), :charset => 'utf-8'
> - colItemName = colItemName.sub(/Collection/,'') #Remove the Collection at the end.
> - colItemName = colItemName[0].downcase + colItemName[1, colItemName.length]
> -
> - info colItemName
> - #we need to produce the url collection
> - urls = []
> - @dmtfColItems.map do |item|
> - urls << {"href" => item["href"]}
> - end
> + end
> + end
>
> - rootHash.first[1]["#{colItemName}"] = urls
> +end
>
> - jsonHash = rootHash.first[1]
> - info jsonHash
> - if jsonHash.has_key?("xmlns")
> - jsonHash.delete "xmlns"
> +collection :machine do
> + global!
> +
> + description <<EOS
> +List all machine
> +EOS
> +
> + operation :index do
> + description "List all machines"
> + control do
> + instances = driver.send(:instances, credentials, {})
> + @dmtf_col_items = []
> + if instances
> + instances.map do |instance|
> + new_item = { "name" => instance.name, "href" => HOST_API_PATH + "/machine/" + instance.id }
> + @dmtf_col_items.insert 0, new_item
> end
> - fixupContent jsonHash
> - res = jsonHash.to_json
> end
> + respond_to_collection "machine.col.xml"
> end
> - else
> - "#{params[:collType]} not found!"
> end
> -end
>
> -get "/api/:collType/:id" do
> -
> - info Time.new.to_s + " collType=" + params[:collType] + " id=" + params[:id]
> -
> - if params[:id] == "new"
> - filePath = File.join(STOREROOT, 'defaultRes/' + params[:collType] + '.col.xml')
> - info "loading file at " + filePath
> - if File.exist?(filePath)
> - rootHash = XmlSimple.xml_in(filePath, {'ForceArray'=>false, 'KeepRoot'=>true, 'KeyAttr'=>['name']})
> - info rootHash
> -
> - @xmlRootNode = rootHash.first[0]
> - @dmtfitem = rootHash.first[1]
> - @dmtfitem["uri"] = UUIDTools::UUID.random_create.to_s
> - @dmtfitem["created"] = Time.new.getutc
> - contentPath = params[:collType] + "/new"
> - respond_to do |format|
> - format.html { haml contentPath.to_sym }
> + operation :show do
> + description "Show specific machine."
> + with_capability :instance
> + param :id, :string, :required
> + control do
> + @machine = driver.send(:instance, credentials, { :id => params[:id]} )
> + if @machine
> + #setup the default values for a machine imageion
> + resource_default = get_resource_default "machine"
> + #get the actual values from image
> + resource_value = { "name" => @machine.name,"status" => @machine.state, "uri" => @machine.id,
> + "href" => HOST_API_PATH + "/machine/" + @machine.id }
> + #mixin actual values get from the specific image
> + @dmtfitem = resource_default["dmtfitem"].merge resource_value
> + show_resource "machine/show", "Machine"
> + else
> + report_error(404)
> end
> - else
> - report_error(404)
> end
> - else
> - #We need to first handle special resources which already exist in DC.
> - #then we do the resources defined locally.
> - #TODO
> - handle_resource_get
> end
> -end
>
> -put "/api/collection/:id" do
> - handle_collection_put
> end
>
> -post "/api/:collType" do
> - handle_post
> -end
> +collection :volume do
> + global!
> +
> + description <<EOS
> +List all volumes
> +EOS
> +
> + operation :index do
> + description "List all volumes"
> + control do
> + instances = driver.send(:storage_volumes, credentials, {})
> + @dmtf_col_items = []
> + if instances
> + instances.map do |instance|
> + new_item = { "name" => instance.id, "href" => HOST_API_PATH + "/volume/" + instance.id }
> + @dmtf_col_items.insert 0, new_item
> + end
> + end
> + respond_to_collection "volume.col.xml"
> + end
> + end
>
> -put "/api/:collType/:id" do
> - handle_resource_put
> -end
> + operation :show do
> + description "Show specific machine."
> + with_capability :storage_volume
> + param :id, :string, :required
> + control do
> + @volume = driver.send(:storage_volume, credentials, { :id => params[:id]} )
> + if @volume
> + #setup the default values for a machine imageion
> + resource_default = get_resource_default "volume"
> + #get the actual values from image
> + resource_value = { "name" => @volume.id,"status" => @volume.state, "uri" => @volume.id,
> + "href" => HOST_API_PATH + "/volume/" + @volume.id,
> + "capacity" => { "quantity" => @volume.capacity, "units" => "gigabyte"} }
> + #mixin actual values get from the specific image
> + @dmtfitem = resource_default["dmtfitem"].merge resource_value
> + show_resource "volume/show", "Volume"
> + else
> + report_error(404)
> + end
> + end
> + end
>
> -delete "/api/:collType/:id" do
> - handle_resource_delete
> -end
> +end
> \ No newline at end of file
> diff --git a/server/public/javascripts/cmwgapp.js b/server/public/javascripts/cmwgapp.js
> index 7289eb1..5ec7041 100644
> --- a/server/public/javascripts/cmwgapp.js
> +++ b/server/public/javascripts/cmwgapp.js
> @@ -215,7 +215,7 @@ function AddNewPproperty(tableId)
> el.type = 'text';
> el.name = 'param_name_' + iteration;
> el.id = 'param_name_' + iteration;
> - el.size = 30;
> + el.size = 25;
> cellLeft.appendChild(el);
>
>
> @@ -225,7 +225,7 @@ function AddNewPproperty(tableId)
> em.type = 'text';
> em.name = 'param_value_' + iteration;
> em.id = 'param_value_' + iteration;
> - em.size = 30;
> + em.size = 25;
> cellRight.appendChild(em);
>
> // select cell
> diff --git a/server/views/cimi/cloudEntryPoint/index.html.haml b/server/views/cimi/cloudEntryPoint/index.html.haml
> index 115ac42..f0c1e6f 100644
> --- a/server/views/cimi/cloudEntryPoint/index.html.haml
> +++ b/server/views/cimi/cloudEntryPoint/index.html.haml
> @@ -1,6 +1,6 @@
>
> -- @allAPIs.each do |api|
> +- @all_apis.each do |api|
> - if api != :cloudEntryPoint
> - - newName = api.to_s.pluralize
> - - newName = newName.gsub(/[A-Z]/, ' \0')
> - %a{ :href => '/api/collection/'+api.to_s }= newName.capitalize + '<br/>'
> \ No newline at end of file
> + - display_name = api.to_s.pluralize.gsub(/[A-Z]/, ' \0')
> + - path_name = api.to_s.gsub(/[A-Z]/, '_\0').downcase
> + %a{ :href => '/api/'+path_name }= display_name.capitalize + '<br/>'
> \ No newline at end of file
> diff --git a/server/views/cimi/cloudEntryPoint/index.xml.haml b/server/views/cimi/cloudEntryPoint/index.xml.haml
> index 41da3c3..4643a8c 100644
> --- a/server/views/cimi/cloudEntryPoint/index.xml.haml
> +++ b/server/views/cimi/cloudEntryPoint/index.xml.haml
> @@ -4,7 +4,7 @@
> %name cloud entry point
> %description cloud entry point
> %created= Time.new.getutc.to_s
> - - @allAPIs.each do |api|
> + - @all_apis.each do |api|
> - if api != :cloudEntryPoint
> - = "<#{api.to_s.pluralize} href=\"#{HOST_API_PATH + "/collection/" +api.to_s} \"/>"
> - %operation{ :rel => "edit", :href => HOST_API_PATH + "/cloudEntryPoint" }
> \ No newline at end of file
> + - path_name = api.to_s.gsub(/[A-Z]/, '_\0').downcase
> + = "<#{api.to_s.pluralize} href=\"#{HOST_API_PATH + "/" + path_name}\"/>"
> \ No newline at end of file
> diff --git a/server/views/cimi/collection/index.html.haml b/server/views/cimi/collection/index.html.haml
> index 555d64b..ae747ab 100644
> --- a/server/views/cimi/collection/index.html.haml
> +++ b/server/views/cimi/collection/index.html.haml
> @@ -1,10 +1,10 @@
> -- newName = @dmtfitem["uri"] + " Collection"
> -- newName = newName.gsub(/[A-Z]/, ' \0')
> -%h1 #{newName.capitalize}
> +- new_name = @dmtfitem["uri"] + " Collection"
> +- new_name = new_name.gsub(/[A-Z]/, ' \0')
> +%h1 #{new_name.capitalize}
>
> %form{ :action => HOST_API_PATH + "/collection/" + @dmtfitem["uri"] }
> %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> + %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
> %p
> %label
> Name:
> @@ -18,57 +18,28 @@
> %p
> %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - if @dmtfitem["operation"]
> - if @dmtfitem["operation"].kind_of? (Array)
> - - newPropertyObj = @dmtfitem["operation"]
> + - property_object = @dmtfitem["operation"]
> - else
> - - newPropertyObj = [@dmtfitem["operation"]]
> + - property_object = [@dmtfitem["operation"]]
> - iter = -1
> - - newPropertyObj.map do | operation|
> + - property_object.map do | operation|
> - iter += 1
> %br
> %label
> = operation["rel"].capitalize + ": " + HOST_API_PATH + operation["href"]
> %input{ :name => "operation_"+iter.to_s, :oper_type => operation["rel"], :type => :hidden, :value => operation["href"] }
> %br
> - %input{ :type => :button, :name => "commit", :value => "Submit changes", :onClick => "return doXmlPut(this)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> %p
> %br
> -- newName = @dmtfitem["uri"]
> -- newName = newName.gsub(/[A-Z]/, ' \0')
> -- if @dmtfColItems
> +- new_name = @dmtfitem["uri"]
> +- new_name = new_name.gsub(/[A-Z]/, ' \0')
> +- if @dmtf_col_items
> %label
> - = newName.capitalize.pluralize + ":"
> + = new_name.capitalize.pluralize + ":"
> %table{ :style => "width:52%;"}
> - - @dmtfColItems.map do |template|
> - - puts template.inspect
> + - @dmtf_col_items.map do |template|
> %tr
> %td
> - %a{ :href => template["href"] }= template["name"]
> -%br
> -%a{ :href => HOST_API_PATH + "/" + @dmtfitem["uri"] + "/new"}= "New " + newName.downcase
> \ No newline at end of file
> + %a{ :href => template["href"] }= template["name"]
> \ No newline at end of file
> diff --git a/server/views/cimi/machine/new.html.haml b/server/views/cimi/machine/new.html.haml
> deleted file mode 100644
> index 334eaa3..0000000
> --- a/server/views/cimi/machine/new.html.haml
> +++ /dev/null
> @@ -1,183 +0,0 @@
> -%h1 Create new machine
> -
> -%form{ :action => HOST_API_PATH + "/machine" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machine" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 20, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 20, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - Status:
> - %p
> - %input{ :name => :status, :size => 50, :value => @dmtfitem["status"], :style => "width:50%;" }
> - %p
> - %br
> - %label
> - CPU:
> - %p
> - %input{ :name => :cpu, :size => 50, :value => @dmtfitem["cpu"], :style => "width:50%;" }
> - %br
> - %label
> - Memory:
> - %p
> - %input{ :name => :memory_quantity, :size => 20, :value => @dmtfitem["memory"]["quantity"], :style => "width:10%;" }
> - %input{ :name => :memory_units, :size => 20, :value => @dmtfitem["memory"]["units"], :style => "width:10%;" }
> - %br
> - %label
> - Disk:
> - %p
> - %table{ :style => "width:50%;", :id => "diskTable"}
> - - if @dmtfitem["disk"]
> - - if @dmtfitem["disk"].kind_of?(Array)
> - - newPropertyObj = @dmtfitem["disk"]
> - - else
> - - newPropertyObj = [@dmtfitem["disk"]]
> -
> - - iter = -1
> - %tr
> - %td
> - %label
> - Quantity
> - %td
> - %label
> - Units
> - %td
> - %label
> - GuestInterface
> - %td
> - - newPropertyObj.each do |disk|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "disk_quantity_" + iter.to_s, :size => 10, :value => disk["capacity"]["quantity"] }
> - %td
> - %input{ :name => "disk_units_" + iter.to_s, :size => 10, :value => disk["capacity"]["units"] }
> - %td
> - %input{ :name => "disk_guestInterface_" + iter.to_s, :size => 20, :value => disk["guestInterface"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new disk", :onClick => "return addDiskRow('diskTable')" }
> -
> - %br
> - %label
> - EntityMetadata: (Content must be in valid xml format)
> - %br
> - %textarea{:style=> "width:50%;height:100px;", :name => "entityMetadata"}
> - <entityMetadata xmlns="http://www.dmtf.org/cimi" />
> - %br
> - %br
> - %label
> - TODO Need to handle volumes:
> - %p
> - %br
> - %label
> - TODO Need to handle network interfaces:
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this, fixupXml)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
> - xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
> - xmlData += $(theNode.form).attr("memory_units").value + "' />"
> -
> - var index=0;
> - subDisk = ""
> - while ($(theNode.form).attr("disk_quantity_" + index)) {
> - if ($(theNode.form).attr("disk_quantity_" + index).value != null &&
> - $(theNode.form).attr("disk_quantity_" + index).value.length > 0) {
> - subDisk += "<capacity quantity='" + $(theNode.form).attr("disk_quantity_" + index).value + "' units='" +
> - $(theNode.form).attr("disk_units_" + index).value + "' />";
> - subDisk += "<guestInterface>" + $(theNode.form).attr("disk_guestInterface_" + index).value + "</guestInterface>";
> - }
> - index++;
> - }
> - if (subDisk.length > 0) {
> - xmlData += "<disk>" + subDisk + "</disk>";
> - }
> -
> - //we handle entityMetadata here
> - if ($(theNode.form).attr("entityMetadata").value) {
> - xmlData += $(theNode.form).attr("entityMetadata").value
> - }
> -
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> -
> - function addDiskRow(tableId) {
> - var tbl = document.getElementById(tableId);
> - var lastRow = tbl.rows.length;
> - // if there's no header row in the table, then iteration = lastRow + 1
> - var iteration = lastRow - 1;
> - var row = tbl.insertRow(lastRow);
> -
> - elNames = ['disk_quantity_', 'disk_units_', 'disk_guestInterface_'];
> - elSizes = [10, 10, 50]
> - elValues = ["200", "megabyte", ""]
> -
> - for (var index=0; index<elNames.length; index++) {
> - var aCellTD = row.insertCell(index);
> - var aCell = document.createElement('input');
> - aCell.type = 'text';
> - aCell.name = elNames[index] + iteration;
> - aCell.id = aCell.name;
> - aCell.size = elSizes[index];
> - aCell.value = elValues[index];
> - aCellTD.appendChild(aCell);
> - }
> -
> - // select cell
> - var cellRightBut = row.insertCell(elNames.length);
> - var er = document.createElement('input');
> - er.type = 'button';
> - er.name = 'param_remove' + iteration;
> - er.id = 'param_remove' + iteration;
> - er.value = "Remove";
> - er.tableRow = row
> - $(er).click(function() {
> - removeProperty(this);
> - })
> -
> - cellRightBut.appendChild(er);
> -
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/machine/show.html.haml b/server/views/cimi/machine/show.html.haml
> index 7d99b96..07eb358 100644
> --- a/server/views/cimi/machine/show.html.haml
> +++ b/server/views/cimi/machine/show.html.haml
> @@ -2,8 +2,8 @@
>
> %form{ :action => HOST_API_PATH + "/machine" }
> %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machine" }/
> + %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
> + %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/machine" }/
> %p
> %label
> Name:
> @@ -24,18 +24,18 @@
> %table{ :style => "width:50%;", :id => "propertyTable"}
> - if @dmtfitem["property"]
> - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> + - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - else
> - - newPropertyObj = @dmtfitem["property"]
> + - property_object = @dmtfitem["property"]
>
> - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> + - property_object.each_pair do |key, value|
> - iter += 1
> %tr
> %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 20, :value => key }
> + %input{ :name => "param_name_" + iter.to_s, :size => 25, :value => key }
> %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 20, :value => value["content"] }
> + %input{ :name => "param_value_" + iter.to_s, :size => 25, :value => value["content"] }
> %td
> %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> @@ -64,9 +64,9 @@
> %table{ :style => "width:50%;", :id => "diskTable"}
> - if @dmtfitem["disk"]
> - if @dmtfitem["disk"].kind_of?(Array)
> - - newPropertyObj = @dmtfitem["disk"]
> + - property_object = @dmtfitem["disk"]
> - else
> - - newPropertyObj = [@dmtfitem["disk"]]
> + - property_object = [@dmtfitem["disk"]]
>
> - iter = -1
> %tr
> @@ -80,7 +80,7 @@
> %label
> GuestInterface
> %td
> - - newPropertyObj.each do |disk|
> + - property_object.each do |disk|
> - iter += 1
> %tr
> %td
> @@ -95,11 +95,7 @@
>
> %br
> %label
> - EntityMetadata: (Content must be in valid xml format)
> - %br
> - %textarea{:style=> "width:100%;height:100px;", :name => "entityMetadata"}
> - = convert_xml_to_html @metadata
> - %br
> + EntityMetadata:
> %br
> %label
> TODO Need to handle volumes:
> @@ -107,8 +103,6 @@
> %br
> %label
> TODO Need to handle network interfaces:
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, fixupXml)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
>
> :javascript
> function fixupXml(theNode) {
> @@ -152,7 +146,7 @@
> var row = tbl.insertRow(lastRow);
>
> elNames = ['disk_quantity_', 'disk_units_', 'disk_guestInterface_'];
> - elSizes = [10, 10, 50]
> + elSizes = [10, 10, 20]
> elValues = ["200", "megabyte", ""]
>
> for (var index=0; index<elNames.length; index++) {
> diff --git a/server/views/cimi/machineAdmin/new.html.haml b/server/views/cimi/machineAdmin/new.html.haml
> deleted file mode 100644
> index 1d5d80d..0000000
> --- a/server/views/cimi/machineAdmin/new.html.haml
> +++ /dev/null
> @@ -1,46 +0,0 @@
> -%h1 Create new machine admin
> -
> -%form{ :action => HOST_API_PATH + "/machineAdmin" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineAdmin" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> -
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> \ No newline at end of file
> diff --git a/server/views/cimi/machineAdmin/show.html.haml b/server/views/cimi/machineAdmin/show.html.haml
> deleted file mode 100644
> index fcb3348..0000000
> --- a/server/views/cimi/machineAdmin/show.html.haml
> +++ /dev/null
> @@ -1,46 +0,0 @@
> -%h1 Machine Admin
> -
> -%form{ :action => HOST_API_PATH + "/machineAdmin" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineAdmin" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, true)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> \ No newline at end of file
> diff --git a/server/views/cimi/machineConfiguration/new.html.haml b/server/views/cimi/machineConfiguration/new.html.haml
> deleted file mode 100644
> index c329e25..0000000
> --- a/server/views/cimi/machineConfiguration/new.html.haml
> +++ /dev/null
> @@ -1,172 +0,0 @@
> -%h1 Create new machine configuration
> -
> -%form{ :action => HOST_API_PATH + "/machineConfiguration" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineConfiguration" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - Cpu:
> - %p
> - %input{ :name => :cpu, :size => 50, :value => @dmtfitem["cpu"], :style => "width:50%;" }
> - %br
> - %label
> - Memory:
> - %p
> - %input{ :name => :memory_quantity, :size => 20, :value => @dmtfitem["memory"]["quantity"], :style => "width:10%;" }
> - %input{ :name => :memory_units, :size => 20, :value => @dmtfitem["memory"]["units"], :style => "width:10%;" }
> - %br
> - %label
> - Disk:
> - %p
> - %table{ :style => "width:50%;", :id => "diskTable"}
> - - if @dmtfitem["disk"]
> - - if @dmtfitem["disk"].kind_of?(Array)
> - - newPropertyObj = @dmtfitem["disk"]
> - - else
> - - newPropertyObj = [@dmtfitem["disk"]]
> -
> - - iter = -1
> - %tr
> - %td
> - %label
> - Quantity
> - %td
> - %label
> - Units
> - %td
> - %label
> - GuestInterface
> - %td
> - - newPropertyObj.each do |disk|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "disk_quantity_" + iter.to_s, :size => 10, :value => disk["capacity"]["quantity"] }
> - %td
> - %input{ :name => "disk_units_" + iter.to_s, :size => 10, :value => disk["capacity"]["units"] }
> - %td
> - %input{ :name => "disk_guestInterface_" + iter.to_s, :size => 30, :value => disk["guestInterface"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new disk", :onClick => "return addDiskRow('diskTable')" }
> -
> - %br
> - %label
> - EntityMetadata: (Content must be in valid xml format)
> - %br
> - %textarea{:style=> "width:50%;height:100px;", :name => "entityMetadata"}
> - <entityMetadata xmlns="http://www.dmtf.org/cimi">
> - </entityMetadata>
> - %br
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this, fixupXml)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
> - xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
> - xmlData += $(theNode.form).attr("memory_units").value + "' />"
> -
> - var index=0;
> - subDisk = ""
> - while ($(theNode.form).attr("disk_quantity_" + index)) {
> - if ($(theNode.form).attr("disk_quantity_" + index).value != null &&
> - $(theNode.form).attr("disk_quantity_" + index).value.length > 0) {
> - subDisk += "<capacity quantity='" + $(theNode.form).attr("disk_quantity_" + index).value + "' units='" +
> - $(theNode.form).attr("disk_units_" + index).value + "' />";
> - subDisk += "<guestInterface>" + $(theNode.form).attr("disk_guestInterface_" + index).value + "</guestInterface>";
> - }
> - index++;
> - }
> - if (subDisk.length > 0) {
> - xmlData += "<disk>" + subDisk + "</disk>";
> - }
> -
> - //we handle entityMetadata here
> - if ($(theNode.form).attr("entityMetadata").value) {
> - xmlData += $(theNode.form).attr("entityMetadata").value
> - }
> -
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> -
> - function addDiskRow(tableId) {
> - var tbl = document.getElementById(tableId);
> - var lastRow = tbl.rows.length;
> - // if there's no header row in the table, then iteration = lastRow + 1
> - var iteration = lastRow - 1;
> - var row = tbl.insertRow(lastRow);
> -
> - elNames = ['disk_quantity_', 'disk_units_', 'disk_guestInterface_'];
> - elSizes = [10, 10, 50]
> - elValues = ["200", "megabyte", ""]
> -
> - for (var index=0; index<elNames.length; index++) {
> - var aCellTD = row.insertCell(index);
> - var aCell = document.createElement('input');
> - aCell.type = 'text';
> - aCell.name = elNames[index] + iteration;
> - aCell.id = aCell.name;
> - aCell.size = elSizes[index];
> - aCell.value = elValues[index];
> - aCellTD.appendChild(aCell);
> - }
> -
> - // select cell
> - var cellRightBut = row.insertCell(elNames.length);
> - var er = document.createElement('input');
> - er.type = 'button';
> - er.name = 'param_remove' + iteration;
> - er.id = 'param_remove' + iteration;
> - er.value = "Remove";
> - er.tableRow = row
> - $(er).click(function() {
> - removeProperty(this);
> - })
> -
> - cellRightBut.appendChild(er);
> -
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/machineConfiguration/show.html.haml b/server/views/cimi/machineConfiguration/show.html.haml
> deleted file mode 100644
> index a3b3bda..0000000
> --- a/server/views/cimi/machineConfiguration/show.html.haml
> +++ /dev/null
> @@ -1,167 +0,0 @@
> -%h1 View/Edit machine configuration
> -
> -%form{ :action => HOST_API_PATH + "/machineConfiguration" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineConfiguration" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - Cpu:
> - %p
> - %input{ :name => :cpu, :size => 50, :value => @dmtfitem["cpu"], :style => "width:50%;" }
> - %br
> - %label
> - Memory:
> - %p
> - %input{ :name => :memory_quantity, :size => 20, :value => @dmtfitem["memory"]["quantity"], :style => "width:10%;" }
> - %input{ :name => :memory_units, :size => 20, :value => @dmtfitem["memory"]["units"], :style => "width:10%;" }
> - %br
> - %label
> - Disk:
> - %p
> - %table{ :style => "width:50%;", :id => "diskTable"}
> - - if @dmtfitem["disk"]
> - - if @dmtfitem["disk"].kind_of?(Array)
> - - newPropertyObj = @dmtfitem["disk"]
> - - else
> - - newPropertyObj = [@dmtfitem["disk"]]
> -
> - - iter = -1
> - %tr
> - %td
> - %label
> - Quantity
> - %td
> - %label
> - Units
> - %td
> - %label
> - GuestInterface
> - %td
> - - newPropertyObj.each do |disk|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "disk_quantity_" + iter.to_s, :size => 10, :value => disk["capacity"]["quantity"] }
> - %td
> - %input{ :name => "disk_units_" + iter.to_s, :size => 10, :value => disk["capacity"]["units"] }
> - %td
> - %input{ :name => "disk_guestInterface_" + iter.to_s, :size => 30, :value => disk["guestInterface"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new disk", :onClick => "return addDiskRow('diskTable')" }
> -
> - %br
> - %label
> - EntityMetadata:
> - %br
> - %div{:style => "width:90%;"}
> - %pre
> - - if @metadata
> - = convert_xml_to_html @metadata
> - %br
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, true, fixupXml)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
> - xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
> - xmlData += $(theNode.form).attr("memory_units").value + "' />"
> -
> - var index=0;
> - subDisk = ""
> - while ($(theNode.form).attr("disk_quantity_" + index)) {
> - if ($(theNode.form).attr("disk_quantity_" + index).value != null &&
> - $(theNode.form).attr("disk_quantity_" + index).value.length > 0) {
> - subDisk += "<capacity quantity='" + $(theNode.form).attr("disk_quantity_" + index).value + "' units='" +
> - $(theNode.form).attr("disk_units_" + index).value + "' />";
> - subDisk += "<guestInterface>" + $(theNode.form).attr("disk_guestInterface_" + index).value + "</guestInterface>";
> - }
> - index++;
> - }
> - if (subDisk.length > 0) {
> - xmlData += "<disk>" + subDisk + "</disk>";
> - }
> -
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> -
> - function addDiskRow(tableId) {
> - var tbl = document.getElementById(tableId);
> - var lastRow = tbl.rows.length;
> - // if there's no header row in the table, then iteration = lastRow + 1
> - var iteration = lastRow - 1;
> - var row = tbl.insertRow(lastRow);
> -
> - elNames = ['disk_quantity_', 'disk_units_', 'disk_guestInterface_'];
> - elSizes = [10, 10, 50]
> - elValues = ["200", "megabyte", ""]
> -
> - for (var index=0; index<elNames.length; index++) {
> - var aCellTD = row.insertCell(index);
> - var aCell = document.createElement('input');
> - aCell.type = 'text';
> - aCell.name = elNames[index] + iteration;
> - aCell.id = aCell.name;
> - aCell.size = elSizes[index];
> - aCell.value = elValues[index];
> - aCellTD.appendChild(aCell);
> - }
> -
> - // select cell
> - var cellRightBut = row.insertCell(elNames.length);
> - var er = document.createElement('input');
> - er.type = 'button';
> - er.name = 'param_remove' + iteration;
> - er.id = 'param_remove' + iteration;
> - er.value = "Remove";
> - er.tableRow = row
> - $(er).click(function() {
> - removeProperty(this);
> - })
> -
> - cellRightBut.appendChild(er);
> -
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/machineImage/new.html.haml b/server/views/cimi/machineImage/new.html.haml
> deleted file mode 100644
> index fc4d49d..0000000
> --- a/server/views/cimi/machineImage/new.html.haml
> +++ /dev/null
> @@ -1,80 +0,0 @@
> -%h1 Create new machine image
> -
> -%form{ :action => HOST_API_PATH + "/machineImage" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineImage" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - Image Location:
> - %p
> - %input{ :name => :imageLocation, :size => 50, :value => @dmtfitem["imageLocation"], :style => "width:50%;" }
> - %br
> - %label
> - Image Data:
> - %p
> - %textarea{:style=> "width:50%;height:100px;", :name => "imageData"}
> - %br
> - %label
> - EntityMetadata: (Content must be in valid xml format)
> - %br
> - %textarea{:style=> "width:50%;height:100px;", :name => "entityMetadata"}
> - <entityMetadata xmlns="http://www.dmtf.org/cimi" />
> - %br
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this, fixupXml)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<imageLocation href='" + $(theNode.form).attr("imageLocation").value + "' />";
> - xmlData += "<imageData>" + $(theNode.form).attr("imageData").value + "</imageData>";
> -
> - //we handle entityMetadata here
> - if ($(theNode.form).attr("entityMetadata").value) {
> - xmlData += $(theNode.form).attr("entityMetadata").value
> - }
> -
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/machineImage/show.html.haml b/server/views/cimi/machineImage/show.html.haml
> deleted file mode 100644
> index 13ab375..0000000
> --- a/server/views/cimi/machineImage/show.html.haml
> +++ /dev/null
> @@ -1,82 +0,0 @@
> -%h1 View/Edit machine image
> -
> -%form{ :action => HOST_API_PATH + "/machineImage" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineImage" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - Image Location:
> - %p
> - %input{ :name => :imageLocation, :size => 50, :value => @dmtfitem["imageLocation"], :style => "width:50%;" }
> - %br
> - %label
> - Image Data:
> - %p
> - %textarea{:style=> "width:50%;height:100px;", :name => "imageData"}
> - %br
> - %label
> - EntityMetadata:
> - %br
> - %div{:style => "width:90%;"}
> - %pre
> - - if @metadata
> - = convert_xml_to_html @metadata
> - %br
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, true, fixupXml)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<imageLocation href='" + $(theNode.form).attr("imageLocation").value + "' />";
> - xmlData += "<imageData>" + $(theNode.form).attr("imageData").value + "</imageData>";
> -
> - //we handle entityMetadata here
> - if ($(theNode.form).attr("entityMetadata") != null && $(theNode.form).attr("entityMetadata").value) {
> - xmlData += $(theNode.form).attr("entityMetadata").value
> - }
> -
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/machineTemplate/new.html.haml b/server/views/cimi/machineTemplate/new.html.haml
> deleted file mode 100644
> index 7bffe99..0000000
> --- a/server/views/cimi/machineTemplate/new.html.haml
> +++ /dev/null
> @@ -1,78 +0,0 @@
> -%h1 Create new machine template
> -
> -%form{ :action => HOST_API_PATH + "/machineTemplate" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineTemplate" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - TODO Need to handle machineConfiguration
> - %p
> - %br
> - %label
> - TODO Need to handle machineImage
> - %p
> - %br
> - %label
> - TODO Need to handle machineAdmins
> - %p
> - %br
> - %label
> - TODO Need to handle volums
> - %p
> - %br
> - %label
> - TODO Need to handle volumeTemplates
> - %p
> - %br
> - %label
> - TODO Need to handle networkInterfaces
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this, fixupXml)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/machineTemplate/show.html.haml b/server/views/cimi/machineTemplate/show.html.haml
> deleted file mode 100644
> index f420a9b..0000000
> --- a/server/views/cimi/machineTemplate/show.html.haml
> +++ /dev/null
> @@ -1,78 +0,0 @@
> -%h1 View/Edit machine template
> -
> -%form{ :action => HOST_API_PATH + "/machineTemplate" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineTemplate" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - TODO Need to handle machineConfiguration
> - %p
> - %br
> - %label
> - TODO Need to handle machineImage
> - %p
> - %br
> - %label
> - TODO Need to handle machineAdmins
> - %p
> - %br
> - %label
> - TODO Need to handle volums
> - %p
> - %br
> - %label
> - TODO Need to handle volumeTemplates
> - %p
> - %br
> - %label
> - TODO Need to handle networkInterfaces
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, true, fixupXml)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/machine_configuration/show.html.haml b/server/views/cimi/machine_configuration/show.html.haml
> new file mode 100644
> index 0000000..cb0fbe7
> --- /dev/null
> +++ b/server/views/cimi/machine_configuration/show.html.haml
> @@ -0,0 +1,159 @@
> +%h1 View/Edit machine configuration
> +
> +%form{ :action => HOST_API_PATH + "/machineConfiguration" }
> + %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> + %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
> + %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineConfiguration" }/
> + %p
> + %label
> + Name:
> + %p
> + %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> + %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> + %p
> + %br
> + %label
> + Description:
> + %p
> + %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> + %p
> + %br
> + %label
> + Properties:
> + %p
> + %table{ :style => "width:50%;", :id => "propertyTable"}
> + - if @dmtfitem["property"]
> + - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> + - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> + - else
> + - property_object = @dmtfitem["property"]
> +
> + - iter = -1
> + - property_object.each_pair do |key, value|
> + - iter += 1
> + %tr
> + %td
> + %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> + %td
> + %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> + %td
> + %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> + %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> + %p
> + %br
> + %label
> + Cpu:
> + %p
> + %input{ :name => :cpu, :size => 50, :value => @dmtfitem["cpu"], :style => "width:50%;" }
> + %br
> + %label
> + Memory:
> + %p
> + %input{ :name => :memory_quantity, :size => 20, :value => @dmtfitem["memory"]["quantity"], :style => "width:10%;" }
> + %input{ :name => :memory_units, :size => 20, :value => @dmtfitem["memory"]["units"], :style => "width:10%;" }
> + %br
> + %label
> + Disk:
> + %p
> + %table{ :style => "width:50%;", :id => "diskTable"}
> + - if @dmtfitem["disk"]
> + - if @dmtfitem["disk"].kind_of?(Array)
> + - property_object = @dmtfitem["disk"]
> + - else
> + - property_object = [@dmtfitem["disk"]]
> +
> + - iter = -1
> + %tr
> + %td
> + %label
> + Quantity
> + %td
> + %label
> + Units
> + %td
> + %label
> + GuestInterface
> + %td
> + - property_object.each do |disk|
> + - iter += 1
> + %tr
> + %td
> + %input{ :name => "disk_quantity_" + iter.to_s, :size => 10, :value => disk["capacity"]["quantity"] }
> + %td
> + %input{ :name => "disk_units_" + iter.to_s, :size => 10, :value => disk["capacity"]["units"] }
> + %td
> + %input{ :name => "disk_guestInterface_" + iter.to_s, :size => 30, :value => disk["guestInterface"] }
> + %td
> + %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> + %input{ :type => :button, :name => "commit", :value => "Add new disk", :onClick => "return addDiskRow('diskTable')" }
> +
> + %br
> + %label
> + EntityMetadata:
> + %br
> +
> +:javascript
> + function fixupXml(theNode) {
> + var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> + xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> + xmlData += getStandardData(theNode);
> + xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
> + xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
> + xmlData += $(theNode.form).attr("memory_units").value + "' />"
> +
> + var index=0;
> + subDisk = ""
> + while ($(theNode.form).attr("disk_quantity_" + index)) {
> + if ($(theNode.form).attr("disk_quantity_" + index).value != null &&
> + $(theNode.form).attr("disk_quantity_" + index).value.length > 0) {
> + subDisk += "<capacity quantity='" + $(theNode.form).attr("disk_quantity_" + index).value + "' units='" +
> + $(theNode.form).attr("disk_units_" + index).value + "' />";
> + subDisk += "<guestInterface>" + $(theNode.form).attr("disk_guestInterface_" + index).value + "</guestInterface>";
> + }
> + index++;
> + }
> + if (subDisk.length > 0) {
> + xmlData += "<disk>" + subDisk + "</disk>";
> + }
> +
> + xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> +
> + return xmlData;
> + }
> +
> + function addDiskRow(tableId) {
> + var tbl = document.getElementById(tableId);
> + var lastRow = tbl.rows.length;
> + // if there's no header row in the table, then iteration = lastRow + 1
> + var iteration = lastRow - 1;
> + var row = tbl.insertRow(lastRow);
> +
> + elNames = ['disk_quantity_', 'disk_units_', 'disk_guestInterface_'];
> + elSizes = [10, 10, 30]
> + elValues = ["200", "megabyte", ""]
> +
> + for (var index=0; index<elNames.length; index++) {
> + var aCellTD = row.insertCell(index);
> + var aCell = document.createElement('input');
> + aCell.type = 'text';
> + aCell.name = elNames[index] + iteration;
> + aCell.id = aCell.name;
> + aCell.size = elSizes[index];
> + aCell.value = elValues[index];
> + aCellTD.appendChild(aCell);
> + }
> +
> + // select cell
> + var cellRightBut = row.insertCell(elNames.length);
> + var er = document.createElement('input');
> + er.type = 'button';
> + er.name = 'param_remove' + iteration;
> + er.id = 'param_remove' + iteration;
> + er.value = "Remove";
> + er.tableRow = row
> + $(er).click(function() {
> + removeProperty(this);
> + })
> +
> + cellRightBut.appendChild(er);
> + }
> \ No newline at end of file
> diff --git a/server/views/cimi/machine_image/show.html.haml b/server/views/cimi/machine_image/show.html.haml
> new file mode 100644
> index 0000000..5fdbca8
> --- /dev/null
> +++ b/server/views/cimi/machine_image/show.html.haml
> @@ -0,0 +1,79 @@
> +%h1 View/Edit machine image
> +
> +%form{ :action => HOST_API_PATH + "/machineImage" }
> + %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> + %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
> + %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/machineImage" }/
> + %p
> + %label
> + Name:
> + %p
> + %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> + %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> + %p
> + %br
> + %label
> + Description:
> + %p
> + %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> + %p
> + %br
> + %label
> + Properties:
> + %p
> + %table{ :style => "width:50%;", :id => "propertyTable"}
> + - if @dmtfitem["property"]
> + - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> + - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> + - else
> + - property_object = @dmtfitem["property"]
> +
> + - iter = -1
> + - property_object.each_pair do |key, value|
> + - iter += 1
> + %tr
> + %td
> + %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> + %td
> + %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> + %td
> + %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> + %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> + %p
> + %br
> + %label
> + Image Location:
> + %p
> + %input{ :name => :imageLocation, :size => 50, :value => @dmtfitem["imageLocation"], :style => "width:50%;" }
> + %br
> + %label
> + Image Data:
> + %p
> + %textarea{:style=> "width:50%;height:100px;", :name => "imageData"}
> + %br
> + %label
> + EntityMetadata:
> + %br
> + %div{:style => "width:90%;"}
> + %pre
> + - if @metadata
> + = convert_xml_to_html @metadata
> + %br
> +
> +:javascript
> + function fixupXml(theNode) {
> + var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> + xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> + xmlData += getStandardData(theNode);
> + xmlData += "<imageLocation href='" + $(theNode.form).attr("imageLocation").value + "' />";
> + xmlData += "<imageData>" + $(theNode.form).attr("imageData").value + "</imageData>";
> +
> + //we handle entityMetadata here
> + if ($(theNode.form).attr("entityMetadata") != null && $(theNode.form).attr("entityMetadata").value) {
> + xmlData += $(theNode.form).attr("entityMetadata").value
> + }
> +
> + xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> +
> + return xmlData;
> + }
> \ No newline at end of file
> diff --git a/server/views/cimi/system/new.html.haml b/server/views/cimi/system/new.html.haml
> deleted file mode 100644
> index 9e7840e..0000000
> --- a/server/views/cimi/system/new.html.haml
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -%h1 Create new system
> -
> -%form{ :action => HOST_API_PATH + "/system" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/system" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - State:
> - %p
> - = @dmtfitem["state"]
> - %input{ :name => "state", :type => :hidden, :value => @dmtfitem["state"] }
> - %br
> - %label
> - Status:
> - %p
> - %input{ :name => :status, :size => 20, :value => @dmtfitem["status"], :style => "width:50%;" }
> - %p
> - %br
> - %label
> - TODO Need to handle machines
> - %p
> - %br
> - %label
> - TODO Need to handle meters
> - %p
> - %br
> - %label
> - TODO Need to handle eventLog
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this, fixupXml)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<state>" + $(theNode.form).attr("state").value + "</state>";
> - xmlData += "<status>" + $(theNode.form).attr("status").value + "</status>";
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/system/show.html.haml b/server/views/cimi/system/show.html.haml
> deleted file mode 100644
> index 812f1a5..0000000
> --- a/server/views/cimi/system/show.html.haml
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -%h1 View/Edit system
> -
> -%form{ :action => HOST_API_PATH + "/system" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/system" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - State:
> - %p
> - = @dmtfitem["state"]
> - %input{ :name => "state", :type => :hidden, :value => @dmtfitem["state"] }
> - %br
> - %label
> - Status:
> - %p
> - %input{ :name => :status, :size => 20, :value => @dmtfitem["status"], :style => "width:50%;" }
> - %p
> - %br
> - %label
> - TODO Need to handle machines
> - %p
> - %br
> - %label
> - TODO Need to handle meters
> - %p
> - %br
> - %label
> - TODO Need to handle eventLog
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, true, fixupXml)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<state>" + $(theNode.form).attr("state").value + "</state>";
> - xmlData += "<status>" + $(theNode.form).attr("status").value + "</status>";
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/system/show.xml.haml b/server/views/cimi/system/show.xml.haml
> deleted file mode 100644
> index 0d9425f..0000000
> --- a/server/views/cimi/system/show.xml.haml
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -!!!XML
> -%System{ :xmlns => "http://www.dmtf.org/cmp", :"xmlns:atom" => "http://atom.org"}
> - %uri= HOST_API_PATH + "/system/" + @system.id
> - %name= @system.name
> - %timestamp= Time.new.to_i.to_s
> - %properties
> - %state= @system.state
> - %limit= @system.limit
> - %atom:link{ :rel => "Machines", :href => HOST_API_PATH + "/machine?system=" + @system.id }
> - %atom:link{ :rel => "Meters", :href => HOST_API_PATH + "/meter?system=" + @system.id }
> - %atom:link{ :rel => "EventLog", :href => HOST_API_PATH + "/eventLog?system=" + @system.id }
> diff --git a/server/views/cimi/systemTemplate/new.html.haml b/server/views/cimi/systemTemplate/new.html.haml
> deleted file mode 100644
> index 788cfd2..0000000
> --- a/server/views/cimi/systemTemplate/new.html.haml
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -%h1 Create new system template
> -
> -%form{ :action => HOST_API_PATH + "/systemTemplate" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/systemTemplate" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - TODO Need to handle volumeTemplates:
> - %p
> - %br
> - %label
> - TODO Need to handle machineTemplates:
> - %p
> - %br
> - %label
> - TODO Need to handle networkTemplates:
> -
> - %br
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this, fixupXml)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/systemTemplate/show.html.haml b/server/views/cimi/systemTemplate/show.html.haml
> deleted file mode 100644
> index ef44754..0000000
> --- a/server/views/cimi/systemTemplate/show.html.haml
> +++ /dev/null
> @@ -1,70 +0,0 @@
> -%h1 View/Edit system template
> -
> -%form{ :action => HOST_API_PATH + "/systemTemplate" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/systemTemplate" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - TODO Need to handle volumeTemplates:
> - %p
> - %br
> - %label
> - TODO Need to handle machineTemplates:
> - %p
> - %br
> - %label
> - TODO Need to handle networkTemplates:
> -
> - %br
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, fixupXml)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> -
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/volume/show.html.haml b/server/views/cimi/volume/show.html.haml
> new file mode 100644
> index 0000000..9c688ab
> --- /dev/null
> +++ b/server/views/cimi/volume/show.html.haml
> @@ -0,0 +1,68 @@
> +%h1 View/Edit volume
> +
> +%form{ :action => HOST_API_PATH + "/volume" }
> + %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> + %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
> + %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/volume" }/
> + %p
> + %label
> + Name:
> + %p
> + %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> + %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> + %p
> + %br
> + %label
> + Description:
> + %p
> + %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> + %p
> + %br
> + %label
> + Properties:
> + %p
> + %table{ :style => "width:50%;", :id => "propertyTable"}
> + - if @dmtfitem["property"]
> + - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> + - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> + - else
> + - property_object = @dmtfitem["property"]
> +
> + - iter = -1
> + - property_object.each_pair do |key, value|
> + - iter += 1
> + %tr
> + %td
> + %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> + %td
> + %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> + %td
> + %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> + %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> + %p
> + %br
> + %label
> + Capacity:
> + %p
> + %input{ :name => :capacity_quantity, :size => 20, :value => @dmtfitem["capacity"]["quantity"], :style => "width:10%;" }
> + %input{ :name => :capacity_units, :size => 20, :value => @dmtfitem["capacity"]["units"], :style => "width:10%;" }
> + %br
> + %label
> + EntityMetadata:
> + %br
> +
> +:javascript
> + function fixupXml(theNode) {
> + var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> + xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> + xmlData += getStandardData(theNode);
> + xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
> + xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
> + xmlData += $(theNode.form).attr("memory_units").value + "' />"
> +
> + var index=0;
> +
> + xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> +
> + return xmlData;
> + }
> \ No newline at end of file
> diff --git a/server/views/cimi/volumeConfiguration/new.html.haml b/server/views/cimi/volumeConfiguration/new.html.haml
> deleted file mode 100644
> index ed3566a..0000000
> --- a/server/views/cimi/volumeConfiguration/new.html.haml
> +++ /dev/null
> @@ -1,75 +0,0 @@
> -%h1 Create new volume configuration
> -
> -%form{ :action => HOST_API_PATH + "/volumeConfiguration" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/columeConfiguration" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - Format:
> - %p
> - %input{ :name => :format, :size => 50, :value => @dmtfitem["format"], :style => "width:50%;" }
> - %br
> - %label
> - Capacity:
> - %p
> - %input{ :name => :quantity, :size => 20, :value => @dmtfitem["capacity"]["quantity"], :style => "width:10%;" }
> - %input{ :name => :units, :size => 20, :value => @dmtfitem["capacity"]["units"], :style => "width:10%;" }
> - %br
> - %label
> - Guest Interface:
> - %p
> - %input{ :name => :guestInterface, :size => 50, :value => @dmtfitem["guestInterface"], :style => "width:50%;" }
> - %br
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPost(this, fixupXml)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<format>" + $(theNode.form).attr("format").value + "</format>";
> - xmlData += "<capacity quantity='" + $(theNode.form).attr("quantity").value + "' units='" + $(theNode.form).attr("units").value + "' />";
> - xmlData += "<guestInterface>" + $(theNode.form).attr("guestInterface").value + "</guestInterface>";
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> diff --git a/server/views/cimi/volumeConfiguration/show.html.haml b/server/views/cimi/volumeConfiguration/show.html.haml
> deleted file mode 100644
> index 041e2b7..0000000
> --- a/server/views/cimi/volumeConfiguration/show.html.haml
> +++ /dev/null
> @@ -1,77 +0,0 @@
> -%h1 View/Edit Volume configuration
> -
> -%form{ :action => HOST_API_PATH + "/volumeConfiguration" }
> - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
> - %input{ :name => :xmlRootNode, :type => :hidden, :value => @xmlRootNode }/
> - %input{ :name => :refreshURI, :type => :hidden, :value => HOST_API_PATH + "/collection/columeConfiguration" }/
> - %p
> - %label
> - Name:
> - %p
> - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
> - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
> - %p
> - %br
> - %label
> - Description:
> - %p
> - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
> - %p
> - %br
> - %label
> - Properties:
> - %p
> - %table{ :style => "width:50%;", :id => "propertyTable"}
> - - if @dmtfitem["property"]
> - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
> - - newPropertyObj = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
> - - else
> - - newPropertyObj = @dmtfitem["property"]
> -
> - - iter = -1
> - - newPropertyObj.each_pair do |key, value|
> - - iter += 1
> - %tr
> - %td
> - %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
> - %td
> - %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
> - %td
> - %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
> -
> - %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
> - %p
> - %br
> - %label
> - Format:
> - %p
> - %input{ :name => :format, :size => 50, :value => @dmtfitem["format"], :style => "width:50%;" }
> - %br
> - %label
> - Capacity:
> - %p
> - %input{ :name => :quantity, :size => 20, :value => @dmtfitem["capacity"]["quantity"], :style => "width:10%;" }
> - %input{ :name => :units, :size => 20, :value => @dmtfitem["capacity"]["units"], :style => "width:10%;" }
> - %br
> - %label
> - Guest Interface:
> - %p
> - %input{ :name => :guestInterface, :size => 50, :value => @dmtfitem["guestInterface"], :style => "width:50%;" }
> - %br
> -
> - %input{ :type => :button, :name => "commit", :value => "Submit", :onClick => "return doXmlPut(this, true, fixupXml)" }/
> - %input{ :type => :button, :name => "commit", :value => "Delete", :onClick => "return doXmlDelete(this, true)" }/
> - %input{ :name => "refresh", :value => false, :type => :hidden}
> -
> -:javascript
> - function fixupXml(theNode) {
> - var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
> - xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
> - xmlData += getStandardData(theNode);
> - xmlData += "<format>" + $(theNode.form).attr("format").value + "</format>";
> - xmlData += "<capacity quantity='" + $(theNode.form).attr("quantity").value + "' units='" + $(theNode.form).attr("units").value + "' />";
> - xmlData += "<guestInterface>" + $(theNode.form).attr("guestInterface").value + "</guestInterface>";
> - xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
> -
> - return xmlData;
> - }
> \ No newline at end of file
> --
> 1.7.4.1
>
------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org