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.job.api;
23
24 import org.opencastproject.util.data.Tuple;
25
26 import java.util.Date;
27 import java.util.List;
28 import java.util.Map;
29
30 /** Describes an incident relating to a {@link Job}. */
31 public interface Incident {
32 enum Severity {
33 INFO,
34 WARNING,
35
36 /**
37 * An incident of type FAILURE shall only be recorded when a job fails, i.e. enters the
38 * {@link org.opencastproject.job.api.Job.Status#FAILED} state. That implies that there
39 * can be at most one FAILURE incident per job.
40 */
41 FAILURE
42 }
43
44 /** Return the incident id. */
45 long getId();
46
47 /**
48 * The job related to this incident.
49 *
50 * @return the job id
51 */
52 long getJobId();
53
54 /**
55 * The service type on which the incident was occurring.
56 *
57 * @return the service type
58 */
59 String getServiceType();
60
61 /**
62 * The processing host running the job where the incident was occurring.
63 *
64 * @return the processing host
65 */
66 String getProcessingHost();
67
68 /**
69 * The date where the incident was happening.
70 *
71 * @return the date
72 */
73 Date getTimestamp();
74
75 /**
76 * The severity of this incident.
77 *
78 * @return the severity
79 */
80 Severity getSeverity();
81
82 /**
83 * The unique code of this incident. Incident codes may be mapped to plain text, possibly localized.
84 * It is recommended to create codes after the schema <code>service_type.number</code>,
85 * e.g. <code>org.opencastproject.service.1511</code>
86 *
87 * @return the incident code
88 * @see org.opencastproject.job.api.Job#getJobType()
89 */
90 String getCode();
91
92 /**
93 * List of additional technical information having a name and a text <code>[(name, text)]</code>.
94 * This may be an exception, an ffmpeg commandline, memory statistics, etc.
95 *
96 * @return a list of technical background information describing the incident in depth
97 * [(detail_name, detail)]
98 */
99 List<Tuple<String, String>> getDetails();
100
101 /**
102 * Named parameters describing the incident in more detail. These parameters may be used to
103 * construct a description message.
104 *
105 * @return the message parameters; parameter_name -> parameter_value
106 */
107 Map<String, String> getDescriptionParameters();
108 }