View Javadoc
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.serviceregistry.api;
23  
24  public class HostRegistrationInMemory implements HostRegistration {
25  
26    private String baseUrl;
27  
28    private float maxLoad;
29  
30    private int cores;
31  
32    private long memory;
33  
34    private boolean online;
35  
36    private boolean active;
37  
38    private boolean maintenanceMode;
39  
40    private String address;
41  
42    private String nodeName;
43  
44    public HostRegistrationInMemory(String baseUrl, String address, String nodeName, float maxLoad, int cores, long memory) {
45      this.baseUrl = baseUrl;
46      this.address = address;
47      this.nodeName = nodeName;
48      this.maxLoad = maxLoad;
49      this.online = true;
50      this.active = true;
51      this.maintenanceMode = false;
52      this.cores = cores;
53      this.memory = memory;
54    }
55  
56    @Override
57    public Long getId() {
58      return (long) baseUrl.hashCode();
59    }
60  
61    @Override
62    public String getBaseUrl() {
63      return baseUrl;
64    }
65  
66    @Override
67    public void setBaseUrl(String baseUrl) {
68      this.baseUrl = baseUrl;
69    }
70  
71    @Override
72    public float getMaxLoad() {
73      return maxLoad;
74    }
75  
76    @Override
77    public void setMaxLoad(float maxLoad) {
78      this.maxLoad = maxLoad;
79    }
80  
81    @Override
82    public boolean isActive() {
83      return active;
84    }
85  
86    @Override
87    public void setActive(boolean active) {
88      this.active = active;
89    }
90  
91    @Override
92    public boolean isOnline() {
93      return online;
94    }
95  
96    @Override
97    public void setOnline(boolean online) {
98      this.online = online;
99    }
100 
101   @Override
102   public boolean isMaintenanceMode() {
103     return maintenanceMode;
104   }
105 
106   @Override
107   public void setMaintenanceMode(boolean maintenanceMode) {
108     this.maintenanceMode = maintenanceMode;
109   }
110 
111   @Override
112   public String getIpAddress() {
113     return address;
114   }
115 
116   @Override
117   public void setIpAddress(String address) {
118     this.address = address;
119   }
120 
121   @Override
122   public long getMemory() {
123     return memory;
124   }
125 
126   @Override
127   public void setMemory(long memory) {
128     this.memory = memory;
129   }
130 
131   @Override
132   public int getCores() {
133     return cores;
134   }
135 
136   @Override
137   public void setCores(int cores) {
138     this.cores = cores;
139   }
140 
141   @Override
142   public String getNodeName() {
143     return nodeName;
144   }
145 
146   @Override
147   public void setNodeName(String nodeName) {
148     this.nodeName = nodeName;
149   }
150 }