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.capture.admin.api;
23  
24  import org.opencastproject.util.NotFoundException;
25  
26  import java.util.Map;
27  import java.util.Properties;
28  
29  /**
30   * API for the capture-admin service.
31   */
32  public interface CaptureAgentStateService {
33  
34    /**
35     * Returns an agent by its name
36     *
37     * @param agentName
38     *          The name of the agent.
39     * @return The agent
40     * @throws NotFoundException
41     *           if no agent with the given name has been found
42     */
43    Agent getAgent(String agentName) throws NotFoundException;
44  
45    /**
46     * Returns the last known agent state by its name
47     *
48     * @param agentName
49     *          The name of the agent.
50     * @return The agent state
51     * @throws NotFoundException
52     *           if no agent with the given name has been found
53     */
54    String getAgentState(String agentName) throws NotFoundException;
55  
56    /**
57     * Sets a given agent's state. Note that this will create the agent if it does not already exist. The state should be
58     * defined in {@link org.opencastproject.capture.admin.api.AgentState}.
59     *
60     * @param agentName
61     *          The name of the agent.
62     * @param state
63     *          The current state of the agent.
64     * @see AgentState
65     */
66    boolean setAgentState(String agentName, String state);
67  
68    /**
69     *
70     * @param agentName
71     *          The name of the agent.
72     * @param agentUrl
73     *          The url of the agent.
74     * @throws NotFoundException
75     *           if no agent with the given name has been found
76     */
77    boolean setAgentUrl(String agentName, String agentUrl) throws NotFoundException;
78  
79    /**
80     * Remove an agent from the system, if the agent exists.
81     *
82     * @param agentName
83     *          The name of the agent.
84     * @throws NotFoundException
85     *           if no agent with the given name has been found
86     */
87    void removeAgent(String agentName) throws NotFoundException;
88  
89    /**
90     * Returns the list of known agents that the current user is authorized to schedule.
91     *
92     * @return A {@link java.util.Map} of name-agent pairs.
93     */
94    Map<String, Agent> getKnownAgents();
95  
96    /**
97     * Returns the list of known agent capabilities.
98     *
99     * @return A {@link java.util.Properties} of name-value capability pairs.
100    * @throws NotFoundException
101    *           if no agent with the given name has been found
102    */
103   Properties getAgentCapabilities(String agentName) throws NotFoundException;
104 
105   /**
106    * Returns the list of known agent configurations.
107    *
108    * @return A {@link java.util.Properties} of name-value configuration pairs.
109    * @throws NotFoundException
110    *           if no agent with the given name has been found
111    */
112   Properties getAgentConfiguration(String agentName) throws NotFoundException;
113 
114   /**
115    * Sets the capabilities for the specified agent
116    *
117    * @param agentName
118    * @param capabilities
119    * @return One of the constants defined in this class
120    */
121   boolean setAgentConfiguration(String agentName, Properties capabilities);
122 
123 }