This series of the patches added entities based on Michael's initial work.
so now, other than machineTemplate and volumeTemplate, all other entities
work with new cimi client app. MachineTemplate and has been added in this
series but it fails since the core server is not supporting it yet. Once
the server supports it, the client app will also work.

Thanks.

Tong Li
Emerging Technologies & Standards
Building 501/B205
[email protected]

[email protected] wrote on 12/02/2011 01:32:06 PM:

> From: [email protected]
> To: [email protected]
> Date: 12/02/2011 01:33 PM
> Subject: [PATCH 1/5] CIMI: Added machine support for new cimi client
>
> From: Tong Li <[email protected]>
>
> ---
>  clients/cimi/app.rb                    |    1 +
>  clients/cimi/lib/entities.rb           |    1 +
>  clients/cimi/lib/entities/machine.rb   |   30 ++++++++++++++++++++++++++
++++
>  clients/cimi/views/machines/index.haml |   21 +++++++++++++++++++++
>  clients/cimi/views/machines/show.haml  |   32 +++++++++++++++++++++
> +++++++++++
>  5 files changed, 85 insertions(+), 0 deletions(-)
>  create mode 100644 clients/cimi/lib/entities/machine.rb
>  create mode 100644 clients/cimi/views/machines/index.haml
>  create mode 100644 clients/cimi/views/machines/show.haml
>
> diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
> index 3be0af9..33d187f 100644
> --- a/clients/cimi/app.rb
> +++ b/clients/cimi/app.rb
> @@ -19,6 +19,7 @@ module CIMI::Frontend
>      use CIMI::Frontend::CloudEntryPoint
>      use CIMI::Frontend::MachineConfiguration
>      use CIMI::Frontend::MachineImage
> +    use CIMI::Frontend::Machine
>
>      configure do
>        enable :logging
> diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
> index 0fd1535..7b77be0 100644
> --- a/clients/cimi/lib/entities.rb
> +++ b/clients/cimi/lib/entities.rb
> @@ -22,3 +22,4 @@ require 'entities/base_entity'
>  require 'entities/cloud_entry_point'
>  require 'entities/machine_configuration'
>  require 'entities/machine_image'
> +require 'entities/machine'
> \ No newline at end of file
> diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/
> lib/entities/machine.rb
> new file mode 100644
> index 0000000..6d0d961
> --- /dev/null
> +++ b/clients/cimi/lib/entities/machine.rb
> @@ -0,0 +1,30 @@
> +# 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.
> +
> +class CIMI::Frontend::Machine < CIMI::Frontend::Entity
> +
> +  get '/cimi/machines/:id' do
> +    machine_xml = CIMI::Frontend.get_entity('machines', params
> [:id], credentials)
> +    @machine= CIMI::Model::Machine.from_xml(machine_xml)
> +    haml :'machines/show'
> +  end
> +
> +  get '/cimi/machines' do
> +    machine_xml = CIMI::Frontend.get_entity_collection('machines',
> credentials)
> +    @machines = CIMI::Model::MachineCollection.from_xml(machine_xml)
> +    haml :'machines/index'
> +  end
> +
> +end
> \ No newline at end of file
> diff --git a/clients/cimi/views/machines/index.haml b/clients/cimi/
> views/machines/index.haml
> new file mode 100644
> index 0000000..6359d3a
> --- /dev/null
> +++ b/clients/cimi/views/machines/index.haml
> @@ -0,0 +1,21 @@
> +- @[email protected]
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li.active
> +      MachineCollection
> +
> +
> +%blockquote
> +  %p
> +    A Machine Collection entity represents the collection of Machine
> +    entities within a Provider. This entity can be used to locate and
create
> +    Machines.
> +
> +%ul
> +  - @machines.machines.each do |machine|
> +    %li
> +      %a{ :href => "/cimi/machines/#{machine.href.split
> ('/').last}"}=machine.href.split('/').last
> diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/
> views/machines/show.haml
> new file mode 100644
> index 0000000..088aa80
> --- /dev/null
> +++ b/clients/cimi/views/machines/show.haml
> @@ -0,0 +1,32 @@
> +- @title="#{@machine.name}"
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li
> +      %a{ :href => "/cimi/machines"} MachineCollection
> +      %span.divider="/"
> +    %li.active
> +      = @machine.name
> +
> +%blockquote
> +  %p
> +    This entity represents a
> +    Machine Instance
> +
> +%dl
> +  %dt URI
> +  %dd
> +    %a{ :href => @machine.uri }[email protected]
> +  %dt Description
> +  %[email protected]
> +  %dt Created
> +  %dd #{@machine.created}&nbsp;
> +  %dt State
> +  %[email protected]
> +  %dt Network Interfaces
> +  %[email protected]_interfaces
> +  %dt Details
> +  %[email protected]
> \ No newline at end of file
> --
> 1.7.4.1
>

Reply via email to