1 /**
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * If it is not possible or desirable to put the notice in a particular
7 * file, then You may include the notice in a location (such as a LICENSE
8 * file in a relevant directory) where a recipient would be likely to look
9 * for such a notice.
10
11 *
12 */
13
14 /* ---------------------------------------------------------------------------
15 * U.S. Government, Department of the Army
16 * Army Materiel Command
17 * Research Development Engineering Command
18 * Communications Electronics Research Development and Engineering Center
19 * ---------------------------------------------------------------------------
20 */
21 /* ----------------------------------------------------------------------------
22 * U.S. Government, Department of the Army
23 * Army Materiel Command
24 * Research Development Engineering Command
25 * Communications Electronics Research Development and Engineering Command
26 * Command, Power and Intergration Directorate
27 * ----------------------------------------------------------------------------
28 * fgsms - Government Open Source Software
29 * ----------------------------------------------------------------------------
30 * Author: AO
31 * Website: https://github.com/mil-oss/fgsms
32 * ----------------------------------------------------------------------------
33 */
34 package org.miloss.fgsms.plugins.sla;
35
36 import org.miloss.fgsms.services.interfaces.policyconfiguration.SLAAction;
37 import org.miloss.fgsms.services.interfaces.policyconfiguration.ServicePolicy;
38 import org.oasis_open.docs.wsdm.muws2_2.SituationCategoryType;
39
40 /**
41 * A simple structure to make the processing of alerting
42 * easier fgsms processes alerts asynchronously either via a
43 * Singleton message processor that runs in a separate thread or via Jboss's
44 * Work Manager, depending on what's available. This container specifies
45 * everything necessary for an implementation action class to successfully
46 * process the action.
47 *
48 * @see org.miloss.fgsms.helper.SLACommon
49 * @see org.miloss.fgsms.helper.SLAProcessorSingleton
50 * @see javax.resource.spi.work.WorkManager
51 *
52 * @author AO
53 * @since 6.0
54 */
55 public class AlertContainer {
56
57 /**
58 * creates a new alert container
59 *
60 * @param faultMsg
61 * @param htmlEncodedFaultMessage
62 * @param modifiedurl the policy url
63 * @param relatedMessageId a specific transaction that triggered the action, may be null
64 * @param currentTimeMillis the time it was triggered
65 * @param incidentid this is the id that will or has been recorded in the sla table of the performance database. this is useful for providing web links to get more information
66 * @param pooled whether or not we are running in jboss and using jndi lookups for database connections
67 * @param sendtoAdminsOnly typically only used for email alerts
68 * @param slaActionBaseType this is a reference to the specific action being triggered in the SLA identified by SLAID. This is necessary as some Actions have context parameters
69 * @param SLAID a unique id of the SLA
70 * @param ServicePolicy of the thing this action was triggered on
71 * @param typeofalert This is the type of alert, generally speaking, a AvailabilitySituation or PerformanceReport
72 * report
73 *
74 * @see org.oasis_open.docs.wsdm.muws2_2.PerformanceReport
75 * @see org.oasis_open.docs.wsdm.muws2_2.AvailabilitySituation
76 */
77 public AlertContainer(String faultMsg, String htmlEncodedFaultMessage, String modifiedurl, String relatedMessageId, long currentTimeMillis, String incidentid, boolean pooled, boolean sendtoAdminsOnly, SLAAction slaActionBaseType, String SLAID, ServicePolicy t,
78 SituationCategoryType typeofalert) {
79 this.faultMsg = faultMsg;
80 this.htmlEncodedFaultMessage = htmlEncodedFaultMessage;
81 this.modifiedurl = modifiedurl;
82 this.relatedMessageId = relatedMessageId;
83 this.currentTimeMillis = currentTimeMillis;
84 this.incidentid = incidentid;
85 this.pooled = pooled;
86 this.sendtoAdminsOnly = sendtoAdminsOnly;
87 this.slaActionBaseType = slaActionBaseType;
88 this.SLAID = SLAID;
89 this.t = t;
90 this.alerttype = typeofalert;
91 }
92
93 /**
94 * This is the type of alert, generally speaking, a performance or status
95 * report
96 *
97 * @see org.oasis_open.docs.wsdm.muws2_2.PerformanceReport
98 * @see org.oasis_open.docs.wsdm.muws2_2.AvailabilitySituation
99 */
100 public SituationCategoryType getAlerttype() {
101 return alerttype;
102 }
103
104 /**
105 * The fault message is usually a high readable string
106 */
107 public String getFaultMsg() {
108 return faultMsg;
109 }
110
111 /**
112 * This is an html encoded fault message, usually with formatting for an
113 * email message or something similar.
114 */
115 public String getHtmlEncodedFaultMessage() {
116 return htmlEncodedFaultMessage;
117 }
118
119 /**
120 * The url of the fgsms policy that this alert is related to
121 */
122 public String getModifiedurl() {
123 return modifiedurl;
124 }
125
126 /**
127 * This is the id of the transaction that caused the SLA rule to trigger.
128 * There is no guarantee that this is defined. This ID is a UUID that may
129 * relate to a web service transaction, an availability ID or something
130 * else.
131 */
132 public String getRelatedMessageId() {
133 return relatedMessageId;
134 }
135
136 /**
137 * The time this even occurred. fgsms processes SLAs asynchronously
138 */
139 public long getCurrentTimeMillis() {
140 return currentTimeMillis;
141 }
142
143 /**
144 * a unique UUID of this alert, with is also recorded in the SLA table of
145 * the performance database.
146 */
147 public String getIncidentid() {
148 return incidentid;
149 }
150
151 /**
152 * indicates that the current context is running inside of jboss, useful for
153 * accessing database connections
154 */
155 public boolean isPooled() {
156 return pooled;
157 }
158
159 /**
160 * A reference to the action that will be processed by this alert container.
161 * This is used for asynchronous processes, do not modify
162 */
163 public boolean isSendtoAdminsOnly() {
164 return sendtoAdminsOnly;
165 }
166
167 /**
168 * A reference to the action that will be processed by this alert container.
169 * This is used for asynchronous processes, do not modify
170 */
171 public SLAAction getSlaActionBaseType() {
172 return slaActionBaseType;
173 }
174
175 /**
176 * this is the UUID of the SLA Rule/Action set. use this to find the
177 * corresponding record in the policy for further processing
178 */
179 public String getSLAID() {
180 return SLAID;
181 }
182
183 /**
184 * a reference to the service policy for this object, do not modify it
185 */
186 public ServicePolicy getServicePolicy() {
187 return t;
188 }
189 /**
190 * This is the type of alert, generally speaking, a performance or status
191 * report
192 *
193 * @see org.oasis_open.docs.wsdm.muws2_2.PerformanceReport
194 * @see org.oasis_open.docs.wsdm.muws2_2.AvailabilitySituation
195 */
196 protected SituationCategoryType alerttype;
197 /**
198 * The fault message is usually a high readable string
199 */
200 protected String faultMsg;
201 /**
202 * This is an html encoded fault message, usually with formatting for an
203 * email message or something similar.
204 */
205 protected String htmlEncodedFaultMessage;
206 /**
207 * The url of the fgsms policy that this alert is related to
208 */
209 protected String modifiedurl;
210 /**
211 * This is the id of the transaction that caused the SLA rule to trigger.
212 * There is no guarantee that this is defined. This ID is a UUID that may
213 * relate to a web service transaction, an availability ID or something
214 * else.
215 */
216 protected String relatedMessageId;
217 /**
218 * The time this even occurred. fgsms processes SLAs asynchronously
219 */
220 protected long currentTimeMillis;
221 /**
222 * a unique UUID of this alert, with is also recorded in the SLA table of
223 * the performance database.
224 */
225 protected String incidentid;
226 /**
227 * indicates that the current context is running inside of jboss, useful for
228 * accessing database connections
229 */
230 protected boolean pooled;
231 protected boolean sendtoAdminsOnly;
232 /**
233 * A reference to the action that will be processed by this alert container.
234 * This is used for asynchronous processes, do not modify
235 */
236 protected SLAAction slaActionBaseType;
237 /**
238 * this is the UUID of the SLA Rule/Action set. use this to find the
239 * corresponding record in the policy for further processing
240 */
241 protected String SLAID;
242 /**
243 * a reference to the service policy for this object, do not modify it
244 */
245 protected ServicePolicy t;
246 }