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 import java.util.Date;
25
26 /**
27 * Manages clustered services and the Jobs they may create to enable asynchronous job handling.
28 */
29 public interface ServiceRegistration {
30
31 /**
32 * @return the type of service
33 */
34 String getServiceType();
35
36 /**
37 * @return the host providing the service endpoint.
38 */
39 String getHost();
40
41 /**
42 * @return The relative path to the service endpoint.
43 */
44 String getPath();
45
46 /**
47 * @return Whether the service performs long running operations using Jobs.
48 */
49 boolean isJobProducer();
50
51 /**
52 * @return Whether the service is active
53 */
54 boolean isActive();
55
56 /**
57 * @return Whether the service is online
58 */
59 boolean isOnline();
60
61 /**
62 * Whether the service is in maintenance mode. If a server was in maintenance mode when shut down, it will remain in
63 * maintenance mode when it comes back online
64 */
65 boolean isInMaintenanceMode();
66
67 /**
68 * Gets the last time the service has been declared online
69 *
70 * @return the onlineFrom
71 */
72 Date getOnlineFrom();
73
74 /**
75 * Gets the current state of the service
76 *
77 * @return current state
78 */
79 ServiceState getServiceState();
80
81 /**
82 * Gets the last date when state was changed
83 *
84 * @return last date when state was changed
85 */
86 Date getStateChanged();
87
88 /**
89 * Gets the job signature which changed last time the service state to error.
90 *
91 * @return the signature from error state trigger job
92 */
93 int getErrorStateTrigger();
94
95 /**
96 * Gets the job signature which changed last time the service state to warning
97 *
98 * @return the signature from warning state trigger job
99 */
100 int getWarningStateTrigger();
101
102 }