1 /*
2 * Licensed to The Apereo Foundation under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional
4 * information regarding copyright ownership.
5 *
6 *
7 * The Apereo Foundation licenses this file to you under the Educational
8 * Community License, Version 2.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of the License
10 * at:
11 *
12 * http://opensource.org/licenses/ecl2.txt
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 * License for the specific language governing permissions and limitations under
18 * the License.
19 *
20 */
21
22 package org.opencastproject.adopter.registration.dto;
23
24 import org.opencastproject.serviceregistry.api.HostRegistration;
25
26 import com.google.gson.annotations.SerializedName;
27
28 /**
29 * DTO that contains information about a host machine of an adopter. It's a simplified version
30 * of the HostRegistration class {@link org.opencastproject.serviceregistry.api.HostRegistration}.
31 */
32 public class Host {
33
34 /** Amount of cores. */
35 private int cores;
36
37 /** The maximum load this host can run. */
38 @SerializedName("max_load")
39 private float maxLoad;
40
41 /** The allocated memory of this host. */
42 private long memory;
43
44 /** The hostname of this node. */
45 private String hostname;
46
47 @SerializedName("disk_space")
48 private long diskspace;
49
50 private String services;
51
52 public Host(HostRegistration host) {
53 this.cores = host.getCores();
54 this.maxLoad = host.getMaxLoad();
55 this.memory = host.getMemory();
56 this.hostname = host.getBaseUrl();
57 //FIXME: Need disk space
58 }
59
60
61 //================================================================================
62 // Getter and Setter
63 //================================================================================
64
65 public int getCores() {
66 return cores;
67 }
68
69 public void setCores(int cores) {
70 this.cores = cores;
71 }
72
73 public float getMaxLoad() {
74 return maxLoad;
75 }
76
77 public void setMaxLoad(float maxLoad) {
78 this.maxLoad = maxLoad;
79 }
80
81 public long getMemory() {
82 return memory;
83 }
84
85 public void setMemory(long memory) {
86 this.memory = memory;
87 }
88
89 public String getHostname() {
90 return hostname;
91 }
92
93 public void setHostname(String hostname) {
94 this.hostname = hostname;
95 }
96
97 public String getServices() {
98 return this.services;
99 }
100
101 public void setServices(String services) {
102 this.services = services;
103 }
104
105 }