incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tong Li <liton...@us.ibm.com>
Subject Re: [PATCH] dmtf reference implementation initial checkin
Date Mon, 26 Sep 2011 20:43:01 GMT

please see my response below each question.

Tong Li
Emerging Technologies & Standards
B062/K317
litong01@us.ibm.com



From:	Michal Fojtik <mi@mifo.sk>
To:	deltacloud-dev@incubator.apache.org
Date:	09/26/2011 04:14 PM
Subject:	Re: [PATCH] dmtf reference implementation initial checkin



>On Sep 26, 2011, at 2:28 PM, email4tong@gmail.com wrote:
>
>Hi Tong,
>
>I went through your code and marked some minor/major nits inline.
>Besides this coding glitches I would like to ask some questions before
>ACKing this patch:
>
>1. Why you not choose the current 0.4.0 views/public folder with
JQuery.Mobile.
>   It's because of your browser version? I though you already find out
what
>   caused the slowness of API so there is no reason for UI 'downgrade' I
think.
>
I was using it first, then found the UI was not suited for screens which
requires a lot of input elements. For example, if you have a button, the
button will be styled to take entire row. seems to me that the 0.4.0 UI was
really targeted for mobile devices which requires almost no user input
other than clicks. The DMTF implementation at least the UI part actually
needs a lot of input, if you look new edit, create screen implemented, it
requires a lot of input, when other resources such as networkTemplates,
machineTemplates etc added, the UI will be more complex. I do not think
0.4.0 style will actually work.
>
>2. In your views you're using relative path for operations, like
'/collection/EventLog'.
>   It's possible to use absolute path, like we're using in DC currently?
>
Can you give more specifics on this one? Are you talking about the URLs
used in the persistence layer or the response?

>3. I'm not sure how the DMTF spec currently looks like but it's possible
to remove
>   words like 'collection' from the URI namespace?
>   I think the URI '/events' looks more natural than '/collection/event'.
The problem is that we have event and event collection, these are two
different resources. Unless we have means to differentiate them. Both have
PUT operation (for updating each resource), we have to have something in
the URL to tell which from which. I am open for any suggestion, but I feel,
using word "collection" for collection event is most natural.

>
>4. Again, not sure about DMTF but would it be possible to use
lower-camel-case identifications
>   than using studlycaps?
>
The spec defines these terms, I do not think we can change that. Of course,
we can change the case in the urls if the url is not cloudEntryPoint.
Anything in the content should really not be changed. I was told many times
to stick with the spec even though I think that spec has so many thing to
be improved. The other reason I used these terms in the URLs was to avoid
setting up another maps for URL to resource. But that can be changed if we
really hate it so much. changing it just means writing a little more
program and making it runs a little slower.

>   Example:
>
>   machineConfiguration -> machine_configuration
>   meterTemplate -> meter_template
>
>   etc.
>
as I said above, certainly not in the content. if we are just talking about
changing the URL from /machineConfiguration to /machine_configuration, I
would think that is ok, it just means we need to write little more program
and establish a mapping so when we see machine_configuration, we know it
really wants to deal with machineConfiguration. It can be done. If changing
that really means a lot.

>   In DC we had a long discussions about this a while ago and we decided
to keep the syntax
>   *everywhere* the same. There are many reasons why to do so, like to
avoid 'wrong case'
>   errors, etc.
>
>Regards,
> -- Michal

>
> +
> +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(/</, "&lt;").gsub(/>/, "&gt;").gsub(/\n/, "\r")
> +  end

The 'if' here is not needed. Rather to check the variable when calling this
method than
inside the method.

> +
> +  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 = Hash.from_xml colfile
> +        if rootHash.first and rootHash.first[1]
> +          newItem = {
> +            "name" => rootHash.first[1]["name"],
> +            "href" => HOST_API_PATH + "/" + collType + "/" +
rootHash.first[1]["uri"]


It's better to use 'join' method on places like this:

[HOST_API_PATH, collType, rootHash.first[1]['uri']].join('/')

>
> +  def handle_collection_put
> +    if RESOURCE_NAMES.include? params[:id]
> +
> +      raw = request.env["rack.input"].read
> +
> +      filePath = File.join(STOREROOT, 'collections/' + params[:id] +
'.col.xml')
> +      if File.exist?(filePath)
> +        content_obj = is_valid_xml_input raw

I would suggest to use: 'is_valid_xml_input? raw' (add '?') on method which
are returning booleans.

> +        if content_obj
> +          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(412)
> +        end
> +      else
> +        report_error(404)
> +      end
> +    else
> +      report_error(404)
> +    end
> +  end
> +
> +  def handle_resource_put
> +    raw = request.env["rack.input"].read
> +    rootHash = Hash.from_xml raw
> +
> +    @xmlRootNode = rootHash.first[0]
> +    @dmtfitem = rootHash.first[1]
> +    info @xmlRootNode
> +    fileId = @dmtfitem["uri"]
> +    info @dmtfitem["uri"]
> +
> +    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]
> +
> +      content_obj = is_valid_xml_input raw
> +
> +      if content_obj
> +        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(412)
> +      end
> +    else
> +      report_error(404)
> +    end
> +  end
> +
> +  def handle_resource_delete
> +    filePath = File.join(STOREROOT, params[:id] + '.' + params
[:collType])

This could be very dangerous. Imagine, that someone set params[:collType]
to '../../../etc/passwd'
or some other system file. This file will be immediately deleted once DC
API will be running as root user.

I would suggest to do some sanity checking here.

> +    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
> +          res = Hash.from_xml(responseXML).to_json
> +        end
> +      end
> +    else
> +      report_error(404)
> +    end
> +  end
> +
> +  def handle_resource_get
> +    if DC_SUPPORTED_RESOURCES.include? params[:collType]
> +      check_DC_Resource!
> +    end

In Ruby 'one-line' conditions could be executed like:

check_DC_Resourse! if DC_SUPPORTED_RESOURCES.include? params[:collType]

+ please lower-case the method names.

> +    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

The pathName variable is not needed here:

haml :"#{params[:collType]}/show"


> +        end
> +        format.xml do
> +          File.read(filePath)

Again, filePath = File.join STOREROOT, params[:id]+'.'+params[:collType]

Let's set STOREROOT to '/var/tmp/cimi-storage'. Then someone can set the ID
parameter to '/'
and the 'collType' parameter to '../../../etc/passwd'. The resulting path
will be:

'/var/tmp/cimi-storage/./../../../etc/passwd'

Then File.read(filePath) will immediately flush the content of /etc/passwd
file with list of
all users to browser.


> +        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

You don't need to check if Hash contain key. You can delete the key
immediately:

jsonHash.delete 'xmlns' will return 'nil' when key is not there.

> +          fixupContent jsonHash

Actually I don't think this will will gonna work. I think you want to
modify the jsonHash
object but the method is not returning anything.
If you check the fixupContent method (btw. the proper name should be
'fixup_content') the
return value is the output of .each_key method (which AFAIK will be array).

> +          res = jsonHash.to_json
> +        end
> +      end
> +    else
> +      report_error(404)
> +    end
> +  end
> +end
> diff --git a/server/lib/cimi/helpers/cmwgres_helper.rb
b/server/lib/cimi/helpers/cmwgres_helper.rb
> new file mode 100644
> index 0000000..3f117c1
> --- /dev/null
> +++ b/server/lib/cimi/helpers/cmwgres_helper.rb
> @@ -0,0 +1,94 @@
> +#
> +# 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!

^^ please lower case this method name.

> +    if DC_SUPPORTED_RESOURCES.include? params[:collType]
> +      filePath = File.join(STOREROOT, params[:id] + '.' + params
[:collType])
> +      allRes = get_collection_item_from_DC params[:collType], true

Please avoid using 'boolean' parameters if it's possible. Without looking
into 'get_collection_item_from_DC' method
I don't really know what it is doing.

> +      #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

You don't need to use '== false' here. The .empty() method is safe to use
without condition.

> +        #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'=>"&nbsp;&nbsp;&nbsp;",'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
> +
> +  #this method will check if the xml input is valid by using simple xml.
> +  def is_valid_xml_input input

In Ruby it's common that methods like 'is_valid' are prefixed with question
mark (is_valid?).
In that way all developer will know that they are returning true/false.
>
> +HOST_API_PATH="http://#{ENV["API_HOST"]}:#{ENV["API_PORT"]}/api"
> +CMWG_NAMESPACE = "http://www.dmtf.org/cimi"
> +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 ]

> +
> +all_resource_names = ""
> +CIMI_RESOURCES.map { |item| all_resource_names += item.to_s + "," unless
item == :cloudEntryPoint}

RESOURCE_NAMES = CIMI_RESOURCES.reject { |item| item
== :cloudEntryPoint }.join(',') will work as well :)

> +
> +RESOURCE_NAMES = all_resource_names
> +
>
> +
> +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 ?

Actually we did :-)

> +#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'

Currently the Deltacloud API is version 0.1.0. Is this version meant as
CIMI version tag?
>
> +    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"
> +      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

urls = @dmtfColItems.map { |item| { 'href' => item['href'] }} will do the
same job.

> +
> +        rootHash.first[1][0]["#{colItemName}"] = urls
> +
> +        XmlSimple.xml_out(rootHash, { 'KeyAttr' => 'name', 'KeepRoot' =>
true, 'ContentKey' => 'content'})
> +      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
> +
> +        rootHash.first[1]["#{colItemName}"] = urls
> +
> +        jsonHash = rootHash.first[1]
> +        info jsonHash
> +        if jsonHash.has_key?("xmlns")
> +          jsonHash.delete "xmlns"
> +        end
> +        fixupContent jsonHash

^^ see above.
>
> +++ b/server/views/cimi/cloudEntryPoint/index.xml.haml
> @@ -0,0 +1,10 @@
> +!!!XML
> +%CloudEntryPoint{ :xmlns => CMWG_NAMESPACE }
> +  %uri=HOST_API_PATH + "/cloudEntryPoint"
> +  %name cloud entry point
> +  %description cloud entry point
> +  %created= Time.new.getutc.to_s

To .to_s is not needed here (time should be converted to String
automatically)

> +  - @allAPIs.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" }

Wouldn't be easier to threat '/' as entry point?

> diff --git a/server/views/cimi/collection/index.html.haml
b/server/views/cimi/collection/index.html.haml
> new file mode 100644
> index 0000000..555d64b
> --- /dev/null
> +++ b/server/views/cimi/collection/index.html.haml
> @@ -0,0 +1,74 @@
> +- newName = @dmtfitem["uri"] + " Collection"
> +- newName = newName.gsub(/[A-Z]/, ' \0')
> +%h1 #{newName.capitalize}
> +
> +%form{ :action => HOST_API_PATH + "/collection/" + @dmtfitem["uri"] }

The :method attribute is missing here. AFAIK by default browsers are
sending forms using GET method,
which I think is not what you want.

>
> +        - 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"]
> +      - else
> +        - newPropertyObj = [@dmtfitem["operation"]]

It's usually a good practice to move this sort of code to the helper method
to keep the view clean as possible.

> +      - iter = -1
> +      - newPropertyObj.map do | operation|
> +        - iter += 1
> +        %br
> +        %label
> +          = operation["rel"].capitalize + ":&nbsp;" + 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')

^^ see above.

> +- if @dmtfColItems
> +  %label
> +    = newName.capitalize.pluralize + ":"
> +  %table{ :style => "width:52%;"}
> +    - @dmtfColItems.map do |template|
> +      - puts template.inspect

Could you move this 'puts' into server.rb and use 'info' or 'debug' method
instead?

> +      %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
> diff --git a/server/views/cimi/collection/response.xml.haml
b/server/views/cimi/collection/response.xml.haml
> new file mode 100644
> index 0000000..0b8eb7a
> --- /dev/null
> +++ b/server/views/cimi/collection/response.xml.haml
> @@ -0,0 +1,3 @@
> +!!!XML
> +%ReturnCode{ :xmlns => CMWG_NAMESPACE }
> +  %Status= "Success"
> diff --git a/server/views/cimi/error.html.haml
b/server/views/cimi/error.html.haml
> new file mode 100644
> index 0000000..155180d
> --- /dev/null
> +++ b/server/views/cimi/error.html.haml
> @@ -0,0 +1,31 @@
> +!!!
> +!!! XML
> +
> +%html
> +  %head
> +    = stylesheet_link_tag '/stylesheets/compiled/screen.css', :media =>
'screen, projection'
> +    = stylesheet_link_tag '/stylesheets/compiled/print.css', :media =>
'print'
> +    /[if lt IE 8]
> +      = stylesheet_link_tag '/stylesheets/compiled/ie.css', :media =>
'screen, projection'
> +    = stylesheet_link_tag
'/stylesheets/compiled/application.css', :media => 'screen, projection'
> +    %script{:type => "text/javascript", :src =>
"/javascripts/jquery-1.4.2.min.js" }
> +    %script{:type => "text/javascript", :src =>
"/javascripts/application.js" }
> +  %body
> +    #wrapper
> +      #header
> +        = link_to image_tag( "/images/logo-wide.png" ), root_url
> +      = bread_crumb
> +      #content{:class => :error}
> +        = yield
> +      #footer
> +        #formats
> +          Format:
> +          =link_to_format(:xml)
> +          |
> +          =link_to_format(:json)
> +        #driver_info
> +          Driver: #{driver_symbol} | API version: #{settings.version}
> +        #copyright
> +          Copyright 2009-2011
> +          %a{:href => 'http://incubator.apache.org/deltacloud/'} The
Apache Software Foundation
> +          and individual contributors.
> diff --git a/server/views/cimi/errors/400.html.haml
b/server/views/cimi/errors/400.html.haml
> new file mode 100644
> index 0000000..1a135f9
> --- /dev/null
> +++ b/server/views/cimi/errors/400.html.haml

The code above is using JQuery.mobile framework, however your CSS and
javascript
will not handle it. So result will be not formatted properly.

> @@ -0,0 +1,41 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3=[@error.class.name, @error.message].join(' - ')
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +    %li{ :'data-role' => 'list-divider'} Error details
> +    %li
> +      - if @error.class.method_defined? :details
> +        %p= @error.details
> +      - else
> +        %em No details
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Backtrace
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      %li
> +        %pre=@error.backtrace.join("\n")
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/errors/400.xml.haml
b/server/views/cimi/errors/400.xml.haml
> new file mode 100644
> index 0000000..4f2723f
> --- /dev/null
> +++ b/server/views/cimi/errors/400.xml.haml
> @@ -0,0 +1,4 @@
> +%error{:url => "#{request.env['REQUEST_URI']}", :status =>
"#{response.status}"}
> +  %parameter #{@error.name}
> +  %message< #{cdata @error.message}
> +
> diff --git a/server/views/cimi/errors/401.html.haml
b/server/views/cimi/errors/401.html.haml
> new file mode 100644
> index 0000000..1a135f9
> --- /dev/null
> +++ b/server/views/cimi/errors/401.html.haml
> @@ -0,0 +1,41 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3=[@error.class.name, @error.message].join(' - ')
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +    %li{ :'data-role' => 'list-divider'} Error details
> +    %li
> +      - if @error.class.method_defined? :details
> +        %p= @error.details
> +      - else
> +        %em No details
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Backtrace
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      %li
> +        %pre=@error.backtrace.join("\n")
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/errors/401.xml.haml
b/server/views/cimi/errors/401.xml.haml
> new file mode 100644
> index 0000000..bfa9111
> --- /dev/null
> +++ b/server/views/cimi/errors/401.xml.haml
> @@ -0,0 +1,3 @@
> +%error{:url => "#{request.env['REQUEST_URI']}", :status =>
"#{response.status}"}
> +  %message< #{cdata @error.message}
> +
> diff --git a/server/views/cimi/errors/403.html.haml
b/server/views/cimi/errors/403.html.haml
> new file mode 100644
> index 0000000..781b6ae
> --- /dev/null
> +++ b/server/views/cimi/errors/403.html.haml
> @@ -0,0 +1,42 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3=[@error.class.name, @error.message].join(' - ')
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +    %li{ :'data-role' => 'list-divider'} Error details
> +    %li
> +      - if @error.class.method_defined? :details
> +        %p= @error.details
> +      - else
> +        %em No details
> +
> +  - if @error.backtrace
> +    %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +      %h3 Backtrace
> +      %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +        %li
> +          %pre=@error.backtrace.join("\n")
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/errors/403.xml.haml
b/server/views/cimi/errors/403.xml.haml
> new file mode 100644
> index 0000000..3bad335
> --- /dev/null
> +++ b/server/views/cimi/errors/403.xml.haml
> @@ -0,0 +1,2 @@
> +%error{:url => "#{request.env['REQUEST_URI']}", :status =>
"#{response.status}"}
> +  %message Method not allowed for this resource
> diff --git a/server/views/cimi/errors/404.html.haml
b/server/views/cimi/errors/404.html.haml
> new file mode 100644
> index 0000000..a9bbe34
> --- /dev/null
> +++ b/server/views/cimi/errors/404.html.haml
> @@ -0,0 +1,29 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3 Not Found
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/errors/404.xml.haml
b/server/views/cimi/errors/404.xml.haml
> new file mode 100644
> index 0000000..47aede6
> --- /dev/null
> +++ b/server/views/cimi/errors/404.xml.haml
> @@ -0,0 +1,2 @@
> +%error{:url => "#{request.env['REQUEST_URI']}", :status =>
"#{response.status}"}
> +  %message Resource not found
> diff --git a/server/views/cimi/errors/405.html.haml
b/server/views/cimi/errors/405.html.haml
> new file mode 100644
> index 0000000..12e51b0
> --- /dev/null
> +++ b/server/views/cimi/errors/405.html.haml
> @@ -0,0 +1,29 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3 Method not allowed on given resource
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/errors/405.xml.haml
b/server/views/cimi/errors/405.xml.haml
> new file mode 100644
> index 0000000..e0198f5
> --- /dev/null
> +++ b/server/views/cimi/errors/405.xml.haml
> @@ -0,0 +1,5 @@
> +%error{:url => "#{request.env['REQUEST_URI']}", :status =>
"#{response.status}"}
> +  %message
> +    Requested method not allowed
> +  %method
> +    =request.env['REQUEST_METHOD']
> diff --git a/server/views/cimi/errors/500.html.haml
b/server/views/cimi/errors/500.html.haml
> new file mode 100644
> index 0000000..19cf090
> --- /dev/null
> +++ b/server/views/cimi/errors/500.html.haml
> @@ -0,0 +1,43 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3=[@error.class.name, @error.message].join(' - ')
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +    %li{ :'data-role' => 'list-divider'} Error details
> +    %li
> +      - if @error.class.method_defined? :details
> +        %p= @error.details
> +      - else
> +        %em No details
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Backtrace
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      %li
> +        %pre=@error.backtrace.join("\n")
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        - next if value.inspect.to_s == '#'
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        - next if value.inspect.to_s == '#'
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/errors/500.xml.haml
b/server/views/cimi/errors/500.xml.haml
> new file mode 100644
> index 0000000..69c242e
> --- /dev/null
> +++ b/server/views/cimi/errors/500.xml.haml
> @@ -0,0 +1,5 @@
> +%error{:url => "#{request.env['REQUEST_URI']}", :status =>
"#{response.status}"}
> +  %kind backend_error
> +  %backend{ :driver => driver_symbol }
> +    %code=response.status
> +  %message< #{cdata @error.message}
> diff --git a/server/views/cimi/errors/502.html.haml
b/server/views/cimi/errors/502.html.haml
> new file mode 100644
> index 0000000..19cf090
> --- /dev/null
> +++ b/server/views/cimi/errors/502.html.haml
> @@ -0,0 +1,43 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3=[@error.class.name, @error.message].join(' - ')
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +    %li{ :'data-role' => 'list-divider'} Error details
> +    %li
> +      - if @error.class.method_defined? :details
> +        %p= @error.details
> +      - else
> +        %em No details
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Backtrace
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      %li
> +        %pre=@error.backtrace.join("\n")
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        - next if value.inspect.to_s == '#'
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        - next if value.inspect.to_s == '#'
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/errors/502.xml.haml
b/server/views/cimi/errors/502.xml.haml
> new file mode 100644
> index 0000000..6e7a7b8
> --- /dev/null
> +++ b/server/views/cimi/errors/502.xml.haml
> @@ -0,0 +1,7 @@
> +%error{:url => "#{request.env['REQUEST_URI']}", :status =>
"#{response.status}"}
> +  %kind backend_error
> +  %backend{ :driver => driver_symbol }
> +    %code= @error.code
> +    - if @error.respond_to?(:details) && @error.details
> +      %details< #{cdata @error.details.join("\n")}
> +  %message< #{cdata @error.message}
> diff --git
a/server/views/cimi/errors/backend_capability_failure.html.haml
b/server/views/cimi/errors/backend_capability_failure.html.haml
> new file mode 100644
> index 0000000..3659ac5
> --- /dev/null
> +++ b/server/views/cimi/errors/backend_capability_failure.html.haml
> @@ -0,0 +1,29 @@
> +%div{ :'data-role' => :content, :'data-theme' => 'b'}
> +  %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +    %li{ :'data-role' => 'list-divider'} Server message
> +    %li
> +      %h3 Backend capability failure
> +    %li{ :'data-role' => 'list-divider'} Original request URI
> +    %li
> +      %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
> +        %span=request.env['REQUEST_URI']
> +        %span{ :class => 'ui-li-count'} Retry
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Parameters
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - if params.keys.empty?
> +        %li{ :'data-role' => 'list-divider'} No parameters
> +      - params.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> +
> +
> +  %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +    %h3 Request details
> +    %ul{ :'data-role' => :listview , :'data-inset'
=> :true, :'data-divider-theme' => 'e'}
> +      - request.env.each do |key, value|
> +        %li{ :'data-role' => 'list-divider'}=key
> +        %li
> +          %span{:style => 'font-weight:normal;'}=value.inspect
> diff --git a/server/views/cimi/layout.html.haml
b/server/views/cimi/layout.html.haml
> new file mode 100644
> index 0000000..0b89aaa
> --- /dev/null
> +++ b/server/views/cimi/layout.html.haml
> @@ -0,0 +1,32 @@
> +!!!
> +!!! XML
> +
> +%html
> +  %head
> +    = stylesheet_link_tag '/stylesheets/compiled/screen.css', :media =>
'screen, projection'
> +    = stylesheet_link_tag '/stylesheets/compiled/print.css', :media =>
'print'
> +    /[if lt IE 8]
> +      = stylesheet_link_tag '/stylesheets/compiled/ie.css', :media =>
'screen, projection'
> +    = stylesheet_link_tag
'/stylesheets/compiled/application.css', :media => 'screen, projection'
> +    %script{:type => "text/javascript", :src =>
"/javascripts/jquery-1.4.2.min.js" }
> +    %script{:type => "text/javascript", :src =>
"/javascripts/application.js" }
> +    %script{:type => "text/javascript", :src =>
"/javascripts/cmwgapp.js" }
> +  %body
> +    #wrapper
> +      #header
> +        = link_to image_tag( "/images/logo-wide.png" ), root_url
> +      = bread_crumb_ext
> +      #content
> +        = yield
> +      #footer
> +        #formats
> +          Format:
> +          =link_to_format(:xml)
> +          |
> +          =link_to_format(:json)
> +        #driver_info
> +          Driver: #{driver_symbol} | API version: #{settings.version}
> +        #copyright
> +          Copyright 2009-2011
> +          %a{:href => 'http://incubator.apache.org/deltacloud/'} The
Apache Software Foundation
> +          and individual contributors.
> diff --git a/server/views/cimi/machine/index.html.haml
b/server/views/cimi/machine/index.html.haml
> new file mode 100644
> index 0000000..d72e63e
> --- /dev/null
> +++ b/server/views/cimi/machine/index.html.haml
> @@ -0,0 +1,35 @@
> +%h1 Machines
> +
> +%table.display
> +  %thead
> +    %tr
> +      %th ID
> +      %th Owner
> +      %th Name
> +      %th Machine Image
> +      %th Machine Configuration
> +      %th State
> +      %th Actions
> +  %tbody
> +    - @machines.each do |machine|
> +      %tr
> +        %td
> +          = link_to truncate_words(machine.id), machine_url + "/" +
machine.id
> +        %td
> +          = link_to machine.owner_id,
"#{machine_url}?owner_id=#{machine.owner_id}"
> +        %td
> +          = machine.name
> +        %td
> +          = link_to machine.image_id, HOST_API_PATH + "/machineImage/" +
machine.image_id
> +        %td
> +          = link_to machine.instance_profile.id, HOST_API_PATH +
"/machineConfiguration/" + machine.instance_profile.id
> +        %td
> +          = machine.state.to_s.capitalize
> +        %td
> +          -machine.actions.each do |action|
> +            - if action.to_s == "destroy"
> +              = link_to_action_ext action.to_s.capitalize, HOST_API_PATH
+ "/machine/" + machine.id, "DELETE", {:refresh => "true"}
> +            - else
> +              = link_to_action_ext action.to_s.capitalize, HOST_API_PATH
+ "/machine/" + machine.id, "PUT", {:action => action.to_s, :refresh =>
"true" }
> +
> +
> diff --git a/server/views/cimi/machine/index.json.haml
b/server/views/cimi/machine/index.json.haml
> new file mode 100644
> index 0000000..caccd48
> --- /dev/null
> +++ b/server/views/cimi/machine/index.json.haml
> @@ -0,0 +1,6 @@
> +!!! XML
> +%Machines{:xmlns => "http://www.dmtf.org/cmp", :"xmlns:atom" => "
http://atom.org"}
> +  %uri=machine_url
> +  %timestamp= Time.new.to_i.to_s
> +  - @machines.each do |machine|
> +    %atom:link{ :rel => "machine", :href => machine_url + "/" +
machine.image_id }
> diff --git a/server/views/cimi/machine/index.xml.haml
b/server/views/cimi/machine/index.xml.haml
> new file mode 100644
> index 0000000..08263f7
> --- /dev/null
> +++ b/server/views/cimi/machine/index.xml.haml
> @@ -0,0 +1,6 @@
> +!!! XML
> +%Machines{:xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org"}
> +  %uri=machine_url
> +  %timestamp= Time.new.to_i.to_s
> +  - @machines.each do |machine|
> +    %atom:link{ :rel => "machine", :href => machine_url + "/" +
machine.image_id }
> diff --git a/server/views/cimi/machine/instanceToImage.html.haml
b/server/views/cimi/machine/instanceToImage.html.haml
> new file mode 100644
> index 0000000..6feab80
> --- /dev/null
> +++ b/server/views/cimi/machine/instanceToImage.html.haml
> @@ -0,0 +1,32 @@
> +%h1 Create machine image by using a machine
> +
> +%form{ :action => HOST_API_PATH + "/machineImage" }
> +  %p
> +    %label
> +      Instance ID:
> +  %p
> +    = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
> +    %input{ :name => "instance_id_display", :size => 30, :value =>
@instance.id, :disabled => true }
> +    %input{ :name => :instance_id, :type => :hidden, :value =>
@instance.id }/
> +    =  "<br /><br/>"
> +  %p
> +  %p
> +    %label
> +      Machine Image Name:
> +  %p
> +    = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
> +    %input{ :name => "name", :size => 30, :value => "sample name"}
> +    =  "<br /><br/>"
> +  %p
> +  %p
> +    %label
> +      Machine Image Description:
> +  %p
> +    = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
> +    %textarea{ :name => :description, :cols => 50, :rows => 10}
> +    =  "<br /><br/>"
> +  %p
> +  %p
> +    = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
> +    %input{ :type => :button, :name => "commit", :value => "Create
machine image", :onClick => "return doPost(this)" }/
> +    %input{ :name => "refresh", :value => false, :type => :hidden}
> diff --git a/server/views/cimi/machine/new.html.haml
b/server/views/cimi/machine/new.html.haml
> new file mode 100644
> index 0000000..3b1b667
> --- /dev/null
> +++ b/server/views/cimi/machine/new.html.haml
> @@ -0,0 +1,87 @@
> +=header "Launch new instance"
> +=subheader @image.description
> +
> +%div{ :'data-role' => :content, :'data-theme' => 'c', :class =>
'middle-dialog'}
> +  %form{ :action => instances_url, :method => :post, :class
=> :new_instance }
> +    %input{ :name => :image_id, :type => :hidden, :value =>
@instance.image_id }/
> +
> +    %div{ 'data-role' => :fieldcontain }
> +      %label{ :for => :name} Instance name:
> +      %input{ :type => :text, :id => :name, :name => :name, :value =>
'' }
> +
> +    %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
> +      %h3 Additional parameters
> +
> +      - if driver_has_feature?(:user_data)
> +        %div{ 'data-role' => :fieldcontain }
> +          %label{ :for => :user_data} Base64 encoded user-data:
> +          %textarea{ :id => :user_data, :name => :user_data, :value =>
'' }
> +          %br/
> +          %a{ :href => "", :onclick => 'encodeb64();', :'data-ajax' =>
'false'} Encode data
> +
> +      - if driver_has_feature?(:instance_count)
> +        %div{ 'data-role' => :fieldcontain }
> +          %label{ :for => :instance_count} # of instances to be
launched:
> +          %input{ :type => :text, :id => :instance_count, :name
=> :instance_count, :value => '1' }
> +
> +      - if driver_has_feature?(:authentication_key)
> +        %div{ 'data-role' => :fieldcontain }
> +          %label{ :for => :keyname, :class => 'ui-input-text'} Instance
SSH key:
> +          %select{:name => 'keyname', :'data-native-menu' => "true" }
> +            %option{ :value => ''} None
> +            - @keys.each do |key|
> +              %option{ :value => key.id } #{key.id}
> +
> +      - if driver_has_feature?(:register_to_load_balancer)
> +        %div{ 'data-role' => :fieldcontain }
> +          %label{ :for => :load_balancer_id, :class => 'ui-input-text'}
Register to loadbalancer:
> +          %select{:name => 'load_balancer_id', :'data-native-menu' =>
"true" }
> +            %option{ :value => ''} None
> +            - @load_balancers.each do |load_balancer|
> +              %option{:value => load_balancer.id} #{load_balancer.id}
> +
> +      - if driver_has_feature?(:firewalls)
> +        %div{ 'data-role' => :fieldcontain }
> +          %fieldset{ :'data-role' => 'controlgroup'}
> +            %legend Register to firewall:
> +            - @firewalls.each_index do |i|
> +              - if @firewalls[i].name == 'default'
> +                %input{:type => :checkbox, :value => @firewalls
[i].name, :name => "firewalls#{i}", :checked => :true, :id =>
"firewalls#{i}"}/
> +                %label{:for => "firewalls#{i}"} Default
> +              - else
> +                %input{:type => :checkbox, :value => @firewalls
[i].name, :name => "firewalls#{i}", :id => "firewalls#{i}"}/
> +                %label{:for => "firewalls#{i}"}=@firewalls[i].name
> +
> +    - if !@hardware_profiles.empty?
> +      %div{ 'data-role' => :fieldcontain }
> +        %h3 Instance profile
> +        %fieldset{ :'data-role' => :fieldcontain}
> +          - @hardware_profiles.each do |profile|
> +            %input{ :type => :radio, :name => 'hwp_id', :value =>
profile.name, :id => profile.name, :'data-theme' => 'b'}/
> +            %label{ :for => profile.name}=profile.name
> +            - profile.properties.reject { |prop| prop.fixed? }.each do |
prop|
> +              %div{ :'data-role' => :fieldcontain}
> +                %label{ :for =>
"#{prop.param}_#{profile.name}" }=prop.name
> +                %span.radio-group-details
> +                  - if prop.kind == :enum
> +                    %select{ :size => 1, :name => prop.param }
> +                      - for v in prop.values
> +                        %option= v
> +                    = prop.unit
> +                  - elsif prop.kind == :range
> +                    %input{ :type => :range, :value => prop.first, :min
=> prop.first, :max => prop.last, :name => prop.param}
> +                  - else
> +                    %input{ :name => prop.param, :size => 10, :value =>
"#{prop.default}" }
> +                    = prop.unit
> +
> +    - if !@realms.empty?
> +      %div{ 'data-role' => :fieldcontain }
> +        %h3 Where do you want it?
> +        %fieldset{ :'data-role' => :fieldcontain}
> +          %legend
> +          - @realms.each do |realm|
> +            %div{ :'data-role' => :fieldcontain}
> +              %label{ :for => realm.id }= "#{realm.name},
#{realm.limit}"
> +              %input{ :type => :radio, :name => 'realm_id', :value =>
realm.id, :id => realm.id, :'data-theme' => 'b' }/
> +
> +    %button{ :type => :submit} Create instance
> diff --git a/server/views/cimi/machine/operation.html.haml
b/server/views/cimi/machine/operation.html.haml
> new file mode 100644
> index 0000000..ac372e2
> --- /dev/null
> +++ b/server/views/cimi/machine/operation.html.haml
> @@ -0,0 +1 @@
> +%h1 Command #{@operationParam['machineOperation']} for machine
#{@operationParam['machineId']} has been issued.
> \ No newline at end of file
> diff --git a/server/views/cimi/machine/operation.json.haml
b/server/views/cimi/machine/operation.json.haml
> new file mode 100644
> index 0000000..7f87e57
> --- /dev/null
> +++ b/server/views/cimi/machine/operation.json.haml
> @@ -0,0 +1,3 @@
> +!!! XML
> +%Machine{:xmlns => "http://www.dmtf.org/cmp", :"xmlns:atom" => "
http://atom.org"}
> +  %atom:link{ :rel => "machine #{@operationParam['machineId']}", :href
=> HOST_API_PATH + "/machine/" + @operationParam['machineOperation'] }
> diff --git a/server/views/cimi/machine/operation.xml.haml
b/server/views/cimi/machine/operation.xml.haml
> new file mode 100644
> index 0000000..1768b2b
> --- /dev/null
> +++ b/server/views/cimi/machine/operation.xml.haml
> @@ -0,0 +1,3 @@
> +!!! XML
> +%Machine{:xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org"}
> +  %atom:link{ :rel => "machine #{@operationParam['machineId']}", :href
=> HOST_API_PATH + "/machine/" + @operationParam['machineOperation'] }
> diff --git a/server/views/cimi/machine/show.html.haml
b/server/views/cimi/machine/show.html.haml
> new file mode 100644
> index 0000000..d8741d1
> --- /dev/null
> +++ b/server/views/cimi/machine/show.html.haml
> @@ -0,0 +1,59 @@
> +%h1
> +  = @instance.id
> +
> +%dl
> +  %di
> +    %dt Machine Image
> +    %dd
> +      = link_to @instance.image_id, HOST_API_PATH + "/machineImage/" +
@instance.image_id
> +  %di
> +    %dt Owner
> +    %dd
> +      = @instance.owner_id
> +  %di
> +    %dt Name
> +    %dd
> +      = @instance.name
> +  %di
> +    %dt Machine Configuration
> +    %dd
> +      - prof = @instance.instance_profile
> +      = link_to prof.id, HOST_API_PATH + "/machineConfiguration/" +
prof.id
> +  %di
> +    %dt System (Realm)
> +    %dd
> +      = @instance.realm_id ? link_to(@instance.realm_id, HOST_API_PATH +
"/system/" + @instance.realm_id) : 'default'
> +  %di
> +    %dt State
> +    %dd
> +      = @instance.state.to_s.capitalize
> +  %di
> +    %dt Public Addresses
> +    %dd
> +      = @instance.public_addresses.collect { |address|
"<div>#{address}</div>" }.join
> +  %di
> +    %dt Private Addresses
> +    %dd
> +      = @instance.private_addresses.collect { |address|
"<div>#{address}</div>" }.join
> +  - if @instance.password
> +    %di
> +      %dt Username
> +      %dd
> +        = @instance.username
> +    %di
> +      %dt Password
> +      %dd
> +        = @instance.password
> +  %di
> +    %dt
> +    %dd
> +      -@instance.actions.each do |action|
> +        - if action.to_s == "destroy"
> +          = link_to_action_ext action.to_s.capitalize, HOST_API_PATH +
"/machine/" + @instance.id, "DELETE", { :refresh => "false" }
> +        - else
> +          = link_to_action_ext action.to_s.capitalize, HOST_API_PATH +
"/machine/" + @instance.id, "PUT", {:action => action.to_s, :refresh =>
"true" }
> +    %dt
> +    %dd
> +      - if @instance.can_create_image?
> +        = link_to "Create new Machine Image by using this machine",
HOST_API_PATH + "/machine/#{@instance.id}/createView"
> +
> diff --git a/server/views/cimi/machine/show.json.haml
b/server/views/cimi/machine/show.json.haml
> new file mode 100644
> index 0000000..d41a4c7
> --- /dev/null
> +++ b/server/views/cimi/machine/show.json.haml
> @@ -0,0 +1,24 @@
> +!!! XML
> +%Machine{:xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org"}
> +  %uri= machine_url + "/" + @instance.id
> +  %timestamp= Time.new.to_i.to_s
> +  %id= @instance.id
> +  %owner= @instance.owner_id
> +  %name= @instance.name
> +  %state= @instance.state.to_s.capitalize
> +  %publicAddresses= @instance.public_addresses.collect { |address|
"#{address} " }.join
> +  %privateAddresses= @instance.private_addresses.collect { |address|
"#{address} " }.join
> +  - if @instance.password
> +    %username= @instance.username
> +    %password= @instance.password
> +  %atom:link{ :rel => "machineImage", :href => HOST_API_PATH +
"/machineImage/" + @instance.image_id }
> +  %atom:link{ :rel => "machineConfiguration", :href => HOST_API_PATH +
"/machineConfiguration/" + @instance.instance_profile.id }
> +  %atom:link{ :rel => "system", :href => @instance.realm_id ?
(HOST_API_PATH + "/system/" + @instance.realm_id) : 'default' }
> +  -@instance.actions.each do |action|
> +    - if action.to_s == "destroy"
> +      %atom:link{ :rel => action.to_s, :href => HOST_API_PATH +
"/machine/" + @instance.id, :method => "DELETE" }
> +    - else
> +      %atom:link{ :rel => action.to_s, :href => HOST_API_PATH +
"/machine/" + @instance.id, :method =>"PUT" }
> +  - if @instance.can_create_image?
> +    %atom:link{ :rel => "createMachineImageFromMachine", :href =>
HOST_API_PATH + "/machine", :method => "POST", :instance_id =>
@instance.id }
> +
> diff --git a/server/views/cimi/machine/show.xml.haml
b/server/views/cimi/machine/show.xml.haml
> new file mode 100644
> index 0000000..d41a4c7
> --- /dev/null
> +++ b/server/views/cimi/machine/show.xml.haml
> @@ -0,0 +1,24 @@
> +!!! XML
> +%Machine{:xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org"}
> +  %uri= machine_url + "/" + @instance.id
> +  %timestamp= Time.new.to_i.to_s
> +  %id= @instance.id
> +  %owner= @instance.owner_id
> +  %name= @instance.name
> +  %state= @instance.state.to_s.capitalize
> +  %publicAddresses= @instance.public_addresses.collect { |address|
"#{address} " }.join
> +  %privateAddresses= @instance.private_addresses.collect { |address|
"#{address} " }.join
> +  - if @instance.password
> +    %username= @instance.username
> +    %password= @instance.password
> +  %atom:link{ :rel => "machineImage", :href => HOST_API_PATH +
"/machineImage/" + @instance.image_id }
> +  %atom:link{ :rel => "machineConfiguration", :href => HOST_API_PATH +
"/machineConfiguration/" + @instance.instance_profile.id }
> +  %atom:link{ :rel => "system", :href => @instance.realm_id ?
(HOST_API_PATH + "/system/" + @instance.realm_id) : 'default' }
> +  -@instance.actions.each do |action|
> +    - if action.to_s == "destroy"
> +      %atom:link{ :rel => action.to_s, :href => HOST_API_PATH +
"/machine/" + @instance.id, :method => "DELETE" }
> +    - else
> +      %atom:link{ :rel => action.to_s, :href => HOST_API_PATH +
"/machine/" + @instance.id, :method =>"PUT" }
> +  - if @instance.can_create_image?
> +    %atom:link{ :rel => "createMachineImageFromMachine", :href =>
HOST_API_PATH + "/machine", :method => "POST", :instance_id =>
@instance.id }
> +
> diff --git a/server/views/cimi/machineAdmin/new.html.haml
b/server/views/cimi/machineAdmin/new.html.haml
> new file mode 100644
> index 0000000..ec0c8ec
> --- /dev/null
> +++ b/server/views/cimi/machineAdmin/new.html.haml
> @@ -0,0 +1,47 @@
> +%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}
> +
> diff --git a/server/views/cimi/machineAdmin/show.html.haml
b/server/views/cimi/machineAdmin/show.html.haml
> new file mode 100644
> index 0000000..8cbefca
> --- /dev/null
> +++ b/server/views/cimi/machineAdmin/show.html.haml
> @@ -0,0 +1,47 @@
> +%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}
> +
> diff --git a/server/views/cimi/machineConfiguration/new.html.haml
b/server/views/cimi/machineConfiguration/new.html.haml
> new file mode 100644
> index 0000000..b502486
> --- /dev/null
> +++ b/server/views/cimi/machineConfiguration/new.html.haml
> @@ -0,0 +1,161 @@
> +%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%;" }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> +    %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 &nbsp;
> +        - 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
=> 50, :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
> +
> +  %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>";
> +    }
> +
> +    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);
> +
> +  }
> +
> diff --git a/server/views/cimi/machineConfiguration/show.html.haml
b/server/views/cimi/machineConfiguration/show.html.haml
> new file mode 100644
> index 0000000..db98e92
> --- /dev/null
> +++ b/server/views/cimi/machineConfiguration/show.html.haml
> @@ -0,0 +1,168 @@
> +%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%;" }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> +    %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 &nbsp;
> +        - 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);
> +
> +  }
> +
> diff --git a/server/views/cimi/machineConfiguration/show.xml.haml
b/server/views/cimi/machineConfiguration/show.xml.haml
> new file mode 100644
> index 0000000..285648b
> --- /dev/null
> +++ b/server/views/cimi/machineConfiguration/show.xml.haml
> @@ -0,0 +1,13 @@
> +- unless defined?(partial)
> +  !!! XML
> +%MachineConfiguration{ :xmlns => "http://www.dmtf.org/cimi
", :"xmlns:atom" => "http://atom.org" }
> +  %uri=machineConfiguration_url + "/" + @profile.name
> +  %timestamp=Time.new.to_i.to_s
> +  %name=@profile.name
> +  %properties
> +    - @profile.each_property do |prop|
> +      - attr = { :name => prop.name, :kind => prop.kind, :unit =>
prop.unit }
> +      - if prop.kind == :fixed
> +        %property{ attr, :value => prop.value }/
> +      - else
> +        %property{ attr, :value => prop.default }
> diff --git a/server/views/cimi/machineImage/index.html.haml
b/server/views/cimi/machineImage/index.html.haml
> new file mode 100644
> index 0000000..e5b8d3b
> --- /dev/null
> +++ b/server/views/cimi/machineImage/index.html.haml
> @@ -0,0 +1,25 @@
> +%h1 Machine Images
> +
> +%table.display
> +  %thead
> +    %tr
> +      %th
> +        ID
> +      %th
> +        Name
> +      %th
> +        Owner
> +      %th
> +        Description
> +  %tbody
> +    - @machineImages.each do |image|
> +      %tr
> +        %td
> +          = link_to image.id, machineImage_url+"/"+image.id
> +        %td
> +          = image.name
> +        %td
> +          = link_to image.owner_id, machineImage_url
> +        %td
> +          = image.description
> +
> diff --git a/server/views/cimi/machineImage/index.json.haml
b/server/views/cimi/machineImage/index.json.haml
> new file mode 100644
> index 0000000..c678b5f
> --- /dev/null
> +++ b/server/views/cimi/machineImage/index.json.haml
> @@ -0,0 +1,6 @@
> +!!! XML
> +%MachineImages{:xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org"}
> +  %uri /api/machineImage
> +  %timestamp= Time.new.to_i.to_s
> +  - @elements.each do |image|
> +    %atom:link{ :rel => "MachineImage", :href => machineImage_url + "/"
+ image.id}
> diff --git a/server/views/cimi/machineImage/index.xml.haml
b/server/views/cimi/machineImage/index.xml.haml
> new file mode 100644
> index 0000000..c678b5f
> --- /dev/null
> +++ b/server/views/cimi/machineImage/index.xml.haml
> @@ -0,0 +1,6 @@
> +!!! XML
> +%MachineImages{:xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org"}
> +  %uri /api/machineImage
> +  %timestamp= Time.new.to_i.to_s
> +  - @elements.each do |image|
> +    %atom:link{ :rel => "MachineImage", :href => machineImage_url + "/"
+ image.id}
> diff --git a/server/views/cimi/machineImage/show.html.haml
b/server/views/cimi/machineImage/show.html.haml
> new file mode 100644
> index 0000000..87a5f62
> --- /dev/null
> +++ b/server/views/cimi/machineImage/show.html.haml
> @@ -0,0 +1,21 @@
> +%h1 machineImage
> +%h2
> +  = @machineImage.id
> +
> +%dl
> +  %di
> +    %dt Name
> +    %dd
> +      = @machineImage.id
> +    %dt Owner
> +    %dd
> +      = link_to @machineImage.owner_id, machineImage_url
> +    %dt Architecture
> +    %dd
> +      = @machineImage.architecture
> +    %dt Description
> +    %dd
> +      = @machineImage.description
> +    %dt
> +    %dd
> +      = link_to_action "Launch new machine", HOST_API_PATH +
"/machine?image_id=#{@machineImage.id}", "#{@machineImage.id}"
> diff --git a/server/views/cimi/machineImage/show.json.haml
b/server/views/cimi/machineImage/show.json.haml
> new file mode 100644
> index 0000000..43f710f
> --- /dev/null
> +++ b/server/views/cimi/machineImage/show.json.haml
> @@ -0,0 +1,10 @@
> +- unless defined?(partial)
> +  !!! XML
> +%MachineImage{ :xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org" }
> +  %uri=machineImage_url + "/" + @machineImage.id
> +  %timestamp=Time.new.to_i.to_s
> +  %name=@machineImage.name
> +  %description=@machineImage.description
> +  %architecture=@machineImage.architecture
> +  %created
> +  %properties
> diff --git a/server/views/cimi/machineImage/show.xml.haml
b/server/views/cimi/machineImage/show.xml.haml
> new file mode 100644
> index 0000000..43f710f
> --- /dev/null
> +++ b/server/views/cimi/machineImage/show.xml.haml
> @@ -0,0 +1,10 @@
> +- unless defined?(partial)
> +  !!! XML
> +%MachineImage{ :xmlns => "http://www.dmtf.org/cimi", :"xmlns:atom" => "
http://atom.org" }
> +  %uri=machineImage_url + "/" + @machineImage.id
> +  %timestamp=Time.new.to_i.to_s
> +  %name=@machineImage.name
> +  %description=@machineImage.description
> +  %architecture=@machineImage.architecture
> +  %created
> +  %properties
> diff --git a/server/views/cimi/machineTemplate/new.html.haml
b/server/views/cimi/machineTemplate/new.html.haml
> new file mode 100644
> index 0000000..7190b30
> --- /dev/null
> +++ b/server/views/cimi/machineTemplate/new.html.haml
> @@ -0,0 +1,78 @@
> +%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;
> +  }
> diff --git a/server/views/cimi/machineTemplate/show.html.haml
b/server/views/cimi/machineTemplate/show.html.haml
> new file mode 100644
> index 0000000..02bed8f
> --- /dev/null
> +++ b/server/views/cimi/machineTemplate/show.html.haml
> @@ -0,0 +1,78 @@
> +%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;
> +  }
> diff --git a/server/views/cimi/system/new.html.haml
b/server/views/cimi/system/new.html.haml
> new file mode 100644
> index 0000000..13a17b7
> --- /dev/null
> +++ b/server/views/cimi/system/new.html.haml
> @@ -0,0 +1,79 @@
> +%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;
> +  }
> diff --git a/server/views/cimi/system/show.html.haml
b/server/views/cimi/system/show.html.haml
> new file mode 100644
> index 0000000..0df2ecc
> --- /dev/null
> +++ b/server/views/cimi/system/show.html.haml
> @@ -0,0 +1,79 @@
> +%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;
> +  }
> diff --git a/server/views/cimi/system/show.xml.haml
b/server/views/cimi/system/show.xml.haml
> new file mode 100644
> index 0000000..0d9425f
> --- /dev/null
> +++ b/server/views/cimi/system/show.xml.haml
> @@ -0,0 +1,11 @@
> +!!!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
> new file mode 100644
> index 0000000..2694afe
> --- /dev/null
> +++ b/server/views/cimi/systemTemplate/new.html.haml
> @@ -0,0 +1,70 @@
> +%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;
> +  }
> +
> +
> diff --git a/server/views/cimi/systemTemplate/show.html.haml
b/server/views/cimi/systemTemplate/show.html.haml
> new file mode 100644
> index 0000000..30a6d4d
> --- /dev/null
> +++ b/server/views/cimi/systemTemplate/show.html.haml
> @@ -0,0 +1,70 @@
> +%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;
> +  }
> diff --git a/server/views/cimi/test/index.haml
b/server/views/cimi/test/index.haml
> new file mode 100644
> index 0000000..1acf941
> --- /dev/null
> +++ b/server/views/cimi/test/index.haml
> @@ -0,0 +1,9 @@
> +!!!XML
> +%Systems{ :xmlns => "http://www.dmtf.org/cmp", :"xmlns:atom" => "
http://atom.org"}
> +  %uri whatever
> +  %name systems
> +  %description systems
> +  %properties
> +  %tongli rocks
> +  %timestamp
> +    = Time.new.to_i.to_s
> diff --git a/server/views/cimi/test/index.html.haml
b/server/views/cimi/test/index.html.haml
> new file mode 100644
> index 0000000..c7e6d08
> --- /dev/null
> +++ b/server/views/cimi/test/index.html.haml
> @@ -0,0 +1,20 @@
> +%h1
> +  Systems
> +
> +%table.display
> +  %thead
> +    %tr
> +      %th
> +        ID
> +      %th
> +        Name
> +      %th
> +        State
> +      %th
> +        Limit
> +      %th
> +        Machines
> +      %th
> +        Meters
> +      %th
> +        EventLog
> \ No newline at end of file
> diff --git a/server/views/cimi/volumeConfiguration/new.html.haml
b/server/views/cimi/volumeConfiguration/new.html.haml
> new file mode 100644
> index 0000000..64b9cd7
> --- /dev/null
> +++ b/server/views/cimi/volumeConfiguration/new.html.haml
> @@ -0,0 +1,75 @@
> +%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%;" }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> +    %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;
> +  }
> diff --git a/server/views/cimi/volumeConfiguration/show.html.haml
b/server/views/cimi/volumeConfiguration/show.html.haml
> new file mode 100644
> index 0000000..605257b
> --- /dev/null
> +++ b/server/views/cimi/volumeConfiguration/show.html.haml
> @@ -0,0 +1,77 @@
> +%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%;" }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> +    %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;
> +  }
> --
> 1.7.4.1
>

----------------------------------------------------------------------
Michal Fojtik, Senior Software Engineer
Red Hat (mfojtik@redhat.com)
Deltacloud API: http://deltacloud.org


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message