001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.oozie.client.event; 020 021import java.util.Date; 022import org.apache.oozie.AppType; 023 024/** 025 * A sub-class of the Event interface, related to 026 * notification events after SLA mets/misses 027 */ 028public abstract class SLAEvent extends Event { 029 030 public static enum EventStatus { 031 START_MET, START_MISS, DURATION_MET, DURATION_MISS, END_MET, END_MISS 032 } 033 034 public static enum SLAStatus { 035 NOT_STARTED, IN_PROCESS, MET, MISS 036 } 037 038 /** 039 * Get the SLA status 040 * 041 * @return SLAEvent.SLAStatus 042 */ 043 public abstract SLAStatus getSLAStatus(); 044 045 /** 046 * Get the SLA event status 047 * 048 * @return SLAEvent.EventStatus 049 */ 050 public abstract EventStatus getEventStatus(); 051 052 @Override 053 public MessageType getMsgType() { 054 return msgType; 055 } 056 057 /** 058 * Get the job-id 059 * 060 * @return String job-id 061 */ 062 public abstract String getId(); 063 064 /** 065 * Get the id of the parent job 066 * 067 * @return String parent-id 068 */ 069 public abstract String getParentId(); 070 071 /** 072 * Get the AppType of the event 073 * 074 * @return AppType 075 */ 076 public abstract AppType getAppType(); 077 078 /** 079 * Get the app-name of the job generating this event 080 * 081 * @return String app-name 082 */ 083 public abstract String getAppName(); 084 085 /** 086 * Get the job's nominal time 087 * 088 * @return Date nominal time 089 */ 090 public abstract Date getNominalTime(); 091 092 /** 093 * Get the expected start-time for this job 094 * 095 * @return Date expected start-time 096 */ 097 public abstract Date getExpectedStart(); // nominal time + should-start 098 099 /** 100 * Get the expected end-time for this job 101 * 102 * @return Date expected end-time 103 */ 104 public abstract Date getExpectedEnd(); // nominal time + should-end 105 106 /** 107 * Get the expected duration for this job 108 * 109 * @return Date expected duration 110 */ 111 public abstract long getExpectedDuration(); 112 113 /** 114 * Get the sla notification-message 115 * 116 * @return String notification-message 117 */ 118 public abstract String getNotificationMsg(); 119 120 /** 121 * Get the SLA alert-events 122 * 123 * @return String alert-events 124 */ 125 public abstract String getAlertEvents(); 126 127 /** 128 * Get the SLA alert-contact 129 * 130 * @return String alert-contact 131 */ 132 public abstract String getAlertContact(); 133 134 /** 135 * Get the dependent upstream apps 136 * 137 * @return String upstream-apps 138 */ 139 public abstract String getUpstreamApps(); 140 141 /** 142 * Get job related data or configuration 143 * 144 * @return String job-data 145 */ 146 public abstract String getJobData(); 147 148 /** 149 * Get the user for this job sla 150 * 151 * @return String user 152 */ 153 public abstract String getUser(); 154 155 /** 156 * Get the miscellaneous key-value configs 157 * 158 * @return String slaConfig 159 */ 160 public abstract String getSLAConfig(); 161 162 /** 163 * Get the actual start time of job for SLA 164 * 165 * @return Date actual-start 166 */ 167 public abstract Date getActualStart(); 168 169 /** 170 * Get the actual end time of job for SLA 171 * 172 * @return Date actual-end 173 */ 174 public abstract Date getActualEnd(); 175 176 /** 177 * Get the actual duration of job for SLA 178 * 179 * @return long duration 180 */ 181 public abstract long getActualDuration(); 182 183 /** 184 * Get the job status 185 * 186 * @return String job-status 187 */ 188 public abstract String getJobStatus(); 189 190 /** 191 * Get the last modified time 192 * 193 * @return Date last modified time 194 */ 195 public abstract Date getLastModifiedTime(); 196 197 @Override 198 public String toString() { 199 return "ID: " + getId() + ", MsgType:" + getMsgType() + ", SLAStatus: " + getSLAStatus() + ", EventStatus: " 200 + getEventStatus() + " AppType " + getAppType(); 201 } 202 203}