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.capture.admin.api;
23
24 import java.util.Properties;
25
26 /**
27 * An in-memory construct to represent the state of a capture agent, and when it was last heard from.
28 */
29 public interface Agent {
30
31 /**
32 * Gets the name of the agent.
33 *
34 * @return The name of the agent.
35 */
36 String getName();
37
38 /**
39 * Sets the state of the agent, and updates the time it was last heard from.
40 *
41 * @param newState
42 * The new state of the agent. This should defined from the constants in
43 * {@link org.opencastproject.capture.admin.api.AgentState}. This can be equal to the current one if the goal
44 * is to update the timestamp.
45 * @see AgentState
46 */
47 void setState(String newState);
48
49 /**
50 * Gets the state of the agent.
51 *
52 * @return The state of the agent. This should be defined from the constants in
53 * {@link org.opencastproject.capture.admin.api.AgentState}.
54 * @see AgentState
55 */
56 String getState();
57
58 /**
59 * Sets the url of the agent.
60 *
61 * @param agentUrl
62 * The url of the agent as determined by the referer header field of its request while registering
63 */
64 void setUrl(String agentUrl);
65
66 /**
67 * Gets the url of the agent.
68 *
69 * @return the url of the agent.
70 */
71 String getUrl();
72
73 /**
74 * Sets the time at which the agent last checked in.
75 *
76 * @param time
77 * The number of milliseconds since 1970 when the agent last checked in.
78 */
79 void setLastHeardFrom(Long time);
80
81 /**
82 * Gets the time at which the agent last checked in.
83 *
84 * @return The number of milliseconds since 1970 when the agent last checked in.
85 */
86 Long getLastHeardFrom();
87
88 /**
89 * Gets the capture agent's capability list.
90 *
91 * @return The agent's capabilities, or null if there is an error.
92 */
93 Properties getCapabilities();
94
95 /**
96 * Gets the capture agent's full configuration list.
97 *
98 * @return The agent's configuration, or null if there is an error.
99 */
100 Properties getConfiguration();
101
102 /**
103 * Sets the capture agent's configuration list.
104 *
105 * @param configuration
106 * The agent's configuration.
107 */
108 void setConfiguration(Properties configuration);
109 }