Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Server.Core/ServerConsoleFacade.cs @ 1171

Last change on this file since 1171 was 1171, checked in by msteinbi, 15 years ago

Implementing Lifecycle Management (#453)

File size: 4.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26using HeuristicLab.Hive.Contracts.Interfaces;
27using HeuristicLab.Hive.Contracts.BusinessObjects;
28using HeuristicLab.Hive.Contracts;
29
30namespace HeuristicLab.Hive.Server.Core {
31  public class ServerConsoleFacade: IServerConsoleFacade {
32    private IClientManager clientManager =
33      ServiceLocator.GetClientManager();
34
35    private IJobManager jobManager =
36      ServiceLocator.GetJobManager();
37
38    private IUserRoleManager userRoleManager =
39      ServiceLocator.GetUserRoleManager();
40
41    private String loginName = null;
42
43    #region IServerConsoleFacade Members
44
45    public Response Login(string username, string password) {
46      Response resp = new Response();
47
48      loginName = username;
49
50      resp.Success = true;
51      resp.StatusMessage =
52        ApplicationConstants.RESPONSE_SERVERCONSOLE_LOGIN_SUCCESS;
53
54      return resp;
55    }
56
57    #endregion
58
59    #region IClientManager Members
60
61    public ResponseList<ClientInfo> GetAllClients() {
62      return clientManager.GetAllClients();
63    }
64
65    public ResponseList<ClientGroup> GetAllClientGroups() {
66      return clientManager.GetAllClientGroups();
67    }
68
69    public ResponseList<UpTimeStatistics> GetAllUpTimeStatistics() {
70      return clientManager.GetAllUpTimeStatistics();
71    }
72
73    public Response AddClientGroup(ClientGroup clientGroup) {
74      return clientManager.AddClientGroup(clientGroup);
75    }
76
77    public Response AddResourceToGroup(long clientGroupId, Resource resource) {
78      return clientManager.AddResourceToGroup(clientGroupId, resource);
79    }
80
81    public Response DeleteResourceFromGroup(long clientGroupId, long resourceId) {
82      return clientManager.DeleteResourceFromGroup(clientGroupId, resourceId);
83    }
84
85    #endregion
86
87    #region IJobManager Members
88
89    public ResponseList<HeuristicLab.Hive.Contracts.BusinessObjects.Job> GetAllJobs() {
90      return jobManager.GetAllJobs();
91    }
92    public ResponseObject<Job> AddNewJob(Job job) {
93      return jobManager.AddNewJob(job);
94    }
95
96    public ResponseObject<JobResult> GetLasJobResultOf(long jobId) {
97      return jobManager.GetLasJobResultOf(jobId);
98    }
99
100    public Response RemoveJob(long jobId) {
101      return jobManager.RemoveJob(jobId);
102    }
103
104    #endregion
105
106    #region IUserRoleManager Members
107
108    public ResponseList<HeuristicLab.Hive.Contracts.BusinessObjects.User> GetAllUsers() {
109      return userRoleManager.GetAllUsers();
110    }
111
112    public ResponseObject<User> AddNewUser(User user) {
113      return userRoleManager.AddNewUser(user);
114    }
115
116    public ResponseList<UserGroup> GetAllUserGroups() {
117      return userRoleManager.GetAllUserGroups();
118    }
119
120    public Response RemoveUser(long userId) {
121      return userRoleManager.RemoveUser(userId);
122    }
123
124    public ResponseObject<UserGroup> AddNewUserGroup(UserGroup userGroup) {
125      return userRoleManager.AddNewUserGroup(userGroup);
126    }
127
128    public Response RemoveUserGroup(long groupId) {
129      return userRoleManager.RemoveUserGroup(groupId);
130    }
131
132    public Response AddUserToGroup(long groupId, long userId) {
133      return userRoleManager.AddUserToGroup(groupId, userId);
134    }
135
136    public Response AddUserGroupToGroup(long groupId, long groupToAddId) {
137      return userRoleManager.AddUserGroupToGroup(groupId, groupToAddId);
138    }
139
140    public Response RemovePermissionOwnerFromGroup(long groupId, long userId) {
141      return userRoleManager.RemovePermissionOwnerFromGroup(groupId, userId);
142    }
143
144    #endregion
145
146  }
147}
Note: See TracBrowser for help on using the repository browser.