~travis-plummer/openstack-cli-powershell/master

« back to all changes in this revision

Viewing changes to Openstack.Client.Powershell/Providers/Compute/ServersUIContainer.cs

  • Committer: Monty Taylor
  • Date: 2015-10-17 20:03:56 UTC
  • Revision ID: git-v1:803406e7e09f6f4199f7a92f11f2904ad1d6cc15
Retire stackforge/openstack-cli-powershell

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ============================================================================
2
 
Copyright 2014 Hewlett Packard
3
 
 
4
 
Licensed under the Apache License, Version 2.0 (the "License");
5
 
you may not use this file except in compliance with the License.
6
 
You may obtain a copy of the License at
7
 
 
8
 
    http://www.apache.org/licenses/LICENSE-2.0
9
 
 
10
 
Unless required by applicable law or agreed to in writing, software
11
 
distributed under the License is distributed on an "AS IS" BASIS,
12
 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 
See the License for the specific language governing permissions and
14
 
limitations under the License.
15
 
============================================================================ */
16
 
using System.Collections.Generic;
17
 
using Openstack.Administration.Domain;
18
 
using System.Collections;
19
 
using Openstack.Client.Powershell.Providers.Common;
20
 
using Openstack.Objects.Domain.Compute;
21
 
using Openstack.Objects.Domain;
22
 
using System;
23
 
using System.Collections.ObjectModel;
24
 
using Openstack.Objects;
25
 
using System.Xml.Serialization;
26
 
using System.IO;
27
 
 
28
 
namespace Openstack.Client.Powershell.Providers.Compute
29
 
{
30
 
    [RequiredServiceIdentifierAttribute("Openstack-ComputeDrive")]
31
 
    public class ServersUIContainer : BaseUIContainer
32
 
    {
33
 
//=========================================================================================================
34
 
/// <summary>
35
 
/// 
36
 
/// </summary>
37
 
/// <param name="name"></param>
38
 
/// <param name="description"></param>
39
 
/// <param name="path"></param>
40
 
//=========================================================================================================
41
 
        public ServersUIContainer() {  }
42
 
//=========================================================================================================
43
 
/// <summary>
44
 
/// 
45
 
/// </summary>
46
 
/// <param name="name"></param>
47
 
/// <param name="description"></param>
48
 
/// <param name="path"></param>
49
 
//=========================================================================================================
50
 
        public ServersUIContainer(BaseUIContainer parentContainer, 
51
 
                              string name, 
52
 
                              string description,
53
 
                              string path)
54
 
                              : base(parentContainer, name, description, path)
55
 
        {
56
 
            this.ObjectType =  Common.ObjectType.Container;
57
 
        }
58
 
 
59
 
        #region Methods
60
 
//=========================================================================================================
61
 
/// <summary>
62
 
/// 
63
 
/// </summary>
64
 
//=========================================================================================================
65
 
        public override void Load()
66
 
        {
67
 
            this.LoadEntities();
68
 
        }
69
 
//=========================================================================================================
70
 
/// <summary>
71
 
/// 
72
 
/// </summary>
73
 
/// <typeparam name="T"></typeparam>
74
 
/// <returns></returns>
75
 
//=========================================================================================================
76
 
        private void LoadEntities() 
77
 
        {           
78
 
           IList servers = this.RepositoryFactory.CreateServerRepository().GetServers(null, null, null, null, ServerStatus.Unknown);
79
 
           if (servers != null && servers.Count > 0)
80
 
           {
81
 
               this.SetUIContainers<ServerUIContainer>(servers);
82
 
               this.Entities = servers;
83
 
           }
84
 
           else
85
 
           {
86
 
               this.Containers.Clear();
87
 
               this.Entities.Clear();
88
 
           }
89
 
        }
90
 
//=========================================================================================================
91
 
/// <summary>
92
 
/// 
93
 
/// </summary>
94
 
/// <param name="id"></param>
95
 
/// <returns></returns>
96
 
//=========================================================================================================
97
 
        public override BaseUIContainer CreateContainer(string id)
98
 
        {
99
 
            return null;
100
 
        }
101
 
        #endregion
102
 
    }
103
 
}