[907] | 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;
|
---|
[800] | 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;
|
---|
[902] | 28 | using HeuristicLab.Hive.Contracts;
|
---|
[800] | 29 |
|
---|
| 30 | namespace HeuristicLab.Hive.Server.Core {
|
---|
| 31 | public class ServerConsoleFacade: IServerConsoleFacade {
|
---|
[1099] | 32 | private IClientManager clientManager =
|
---|
| 33 | ServiceLocator.GetClientManager();
|
---|
[1084] | 34 |
|
---|
[1099] | 35 | private IJobManager jobManager =
|
---|
| 36 | ServiceLocator.GetJobManager();
|
---|
| 37 |
|
---|
| 38 | private IUserRoleManager userRoleManager =
|
---|
| 39 | ServiceLocator.GetUserRoleManager();
|
---|
| 40 |
|
---|
[1084] | 41 | private String loginName = null;
|
---|
| 42 |
|
---|
| 43 | #region IServerConsoleFacade Members
|
---|
| 44 |
|
---|
[1086] | 45 | public Response Login(string username, string password) {
|
---|
| 46 | Response resp = new Response();
|
---|
| 47 |
|
---|
[1084] | 48 | loginName = username;
|
---|
| 49 |
|
---|
[1086] | 50 | resp.Success = true;
|
---|
| 51 | resp.StatusMessage =
|
---|
| 52 | ApplicationConstants.RESPONSE_SERVERCONSOLE_LOGIN_SUCCESS;
|
---|
| 53 |
|
---|
| 54 | return resp;
|
---|
[1084] | 55 | }
|
---|
| 56 |
|
---|
| 57 | #endregion
|
---|
| 58 |
|
---|
[800] | 59 | #region IClientManager Members
|
---|
| 60 |
|
---|
[902] | 61 | public ResponseList<ClientInfo> GetAllClients() {
|
---|
[800] | 62 | return clientManager.GetAllClients();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
[902] | 65 | public ResponseList<ClientGroup> GetAllClientGroups() {
|
---|
[800] | 66 | return clientManager.GetAllClientGroups();
|
---|
| 67 | }
|
---|
| 68 |
|
---|
[902] | 69 | public ResponseList<UpTimeStatistics> GetAllUpTimeStatistics() {
|
---|
[800] | 70 | return clientManager.GetAllUpTimeStatistics();
|
---|
| 71 | }
|
---|
| 72 |
|
---|
[934] | 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 |
|
---|
[800] | 85 | #endregion
|
---|
| 86 |
|
---|
| 87 | #region IJobManager Members
|
---|
| 88 |
|
---|
[902] | 89 | public ResponseList<HeuristicLab.Hive.Contracts.BusinessObjects.Job> GetAllJobs() {
|
---|
[821] | 90 | return jobManager.GetAllJobs();
|
---|
[800] | 91 | }
|
---|
[967] | 92 | public ResponseObject<Job> AddNewJob(Job job) {
|
---|
[1012] | 93 | return jobManager.AddNewJob(job);
|
---|
[967] | 94 | }
|
---|
[800] | 95 |
|
---|
[1172] | 96 | public ResponseObject<JobResult> GetLastJobResultOf(long jobId) {
|
---|
| 97 | return jobManager.GetLastJobResultOf(jobId);
|
---|
[1171] | 98 | }
|
---|
| 99 |
|
---|
[967] | 100 | public Response RemoveJob(long jobId) {
|
---|
[1012] | 101 | return jobManager.RemoveJob(jobId);
|
---|
[967] | 102 | }
|
---|
| 103 |
|
---|
[800] | 104 | #endregion
|
---|
| 105 |
|
---|
| 106 | #region IUserRoleManager Members
|
---|
| 107 |
|
---|
[902] | 108 | public ResponseList<HeuristicLab.Hive.Contracts.BusinessObjects.User> GetAllUsers() {
|
---|
[821] | 109 | return userRoleManager.GetAllUsers();
|
---|
[800] | 110 | }
|
---|
| 111 |
|
---|
[952] | 112 | public ResponseObject<User> AddNewUser(User user) {
|
---|
[902] | 113 | return userRoleManager.AddNewUser(user);
|
---|
[842] | 114 | }
|
---|
| 115 |
|
---|
[952] | 116 | public ResponseList<UserGroup> GetAllUserGroups() {
|
---|
[821] | 117 | return userRoleManager.GetAllUserGroups();
|
---|
[800] | 118 | }
|
---|
| 119 |
|
---|
[902] | 120 | public Response RemoveUser(long userId) {
|
---|
[934] | 121 | return userRoleManager.RemoveUser(userId);
|
---|
[902] | 122 | }
|
---|
| 123 |
|
---|
[952] | 124 | public ResponseObject<UserGroup> AddNewUserGroup(UserGroup userGroup) {
|
---|
[934] | 125 | return userRoleManager.AddNewUserGroup(userGroup);
|
---|
[902] | 126 | }
|
---|
| 127 |
|
---|
| 128 | public Response RemoveUserGroup(long groupId) {
|
---|
[934] | 129 | return userRoleManager.RemoveUserGroup(groupId);
|
---|
[902] | 130 | }
|
---|
| 131 |
|
---|
[945] | 132 | public Response AddUserToGroup(long groupId, long userId) {
|
---|
| 133 | return userRoleManager.AddUserToGroup(groupId, userId);
|
---|
[902] | 134 | }
|
---|
| 135 |
|
---|
[945] | 136 | public Response AddUserGroupToGroup(long groupId, long groupToAddId) {
|
---|
| 137 | return userRoleManager.AddUserGroupToGroup(groupId, groupToAddId);
|
---|
| 138 | }
|
---|
| 139 |
|
---|
[934] | 140 | public Response RemovePermissionOwnerFromGroup(long groupId, long userId) {
|
---|
| 141 | return userRoleManager.RemovePermissionOwnerFromGroup(groupId, userId);
|
---|
[902] | 142 | }
|
---|
| 143 |
|
---|
[800] | 144 | #endregion
|
---|
[1171] | 145 |
|
---|
[800] | 146 | }
|
---|
| 147 | }
|
---|