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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 | using System.Text;
|
---|
26 | using HeuristicLab.Hive.Contracts.Interfaces;
|
---|
27 | using HeuristicLab.Hive.Contracts.BusinessObjects;
|
---|
28 | using HeuristicLab.Hive.Contracts;
|
---|
29 |
|
---|
30 | namespace 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 Response RemoveJob(long jobId) {
|
---|
97 | return jobManager.RemoveJob(jobId);
|
---|
98 | }
|
---|
99 |
|
---|
100 | #endregion
|
---|
101 |
|
---|
102 | #region IUserRoleManager Members
|
---|
103 |
|
---|
104 | public ResponseList<HeuristicLab.Hive.Contracts.BusinessObjects.User> GetAllUsers() {
|
---|
105 | return userRoleManager.GetAllUsers();
|
---|
106 | }
|
---|
107 |
|
---|
108 | public ResponseObject<User> AddNewUser(User user) {
|
---|
109 | return userRoleManager.AddNewUser(user);
|
---|
110 | }
|
---|
111 |
|
---|
112 | public ResponseList<UserGroup> GetAllUserGroups() {
|
---|
113 | return userRoleManager.GetAllUserGroups();
|
---|
114 | }
|
---|
115 |
|
---|
116 | public Response RemoveUser(long userId) {
|
---|
117 | return userRoleManager.RemoveUser(userId);
|
---|
118 | }
|
---|
119 |
|
---|
120 | public ResponseObject<UserGroup> AddNewUserGroup(UserGroup userGroup) {
|
---|
121 | return userRoleManager.AddNewUserGroup(userGroup);
|
---|
122 | }
|
---|
123 |
|
---|
124 | public Response RemoveUserGroup(long groupId) {
|
---|
125 | return userRoleManager.RemoveUserGroup(groupId);
|
---|
126 | }
|
---|
127 |
|
---|
128 | public Response AddUserToGroup(long groupId, long userId) {
|
---|
129 | return userRoleManager.AddUserToGroup(groupId, userId);
|
---|
130 | }
|
---|
131 |
|
---|
132 | public Response AddUserGroupToGroup(long groupId, long groupToAddId) {
|
---|
133 | return userRoleManager.AddUserGroupToGroup(groupId, groupToAddId);
|
---|
134 | }
|
---|
135 |
|
---|
136 | public Response RemovePermissionOwnerFromGroup(long groupId, long userId) {
|
---|
137 | return userRoleManager.RemovePermissionOwnerFromGroup(groupId, userId);
|
---|
138 | }
|
---|
139 |
|
---|
140 | #endregion
|
---|
141 | }
|
---|
142 | }
|
---|