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 package org.apache.oozie.client.event; 019 020 import java.util.Date; 021 import org.apache.oozie.AppType; 022 023 /** 024 * A sub-class of the Event interface, related to 025 * notification events after SLA mets/misses 026 */ 027 public abstract class SLAEvent extends Event { 028 029 public static enum EventStatus { 030 START_MET, START_MISS, DURATION_MET, DURATION_MISS, END_MET, END_MISS 031 } 032 033 public static enum SLAStatus { 034 NOT_STARTED, IN_PROCESS, MET, MISS 035 } 036 037 /** 038 * Get the SLA status 039 * 040 * @return SLAEvent.SLAStatus 041 */ 042 public abstract SLAStatus getSLAStatus(); 043 044 /** 045 * Get the SLA event status 046 * 047 * @return SLAEvent.EventStatus 048 */ 049 public abstract EventStatus getEventStatus(); 050 051 @Override 052 public MessageType getMsgType() { 053 return msgType; 054 } 055 056 /** 057 * Get the job-id 058 * 059 * @return String job-id 060 */ 061 public abstract String getId(); 062 063 /** 064 * Get the id of the parent job 065 * 066 * @return String parent-id 067 */ 068 public abstract String getParentId(); 069 070 /** 071 * Get the AppType of the event 072 * 073 * @return AppType 074 */ 075 public abstract AppType getAppType(); 076 077 /** 078 * Get the app-name of the job generating this event 079 * 080 * @return String app-name 081 */ 082 public abstract String getAppName(); 083 084 /** 085 * Get the job's nominal time 086 * 087 * @return Date nominal time 088 */ 089 public abstract Date getNominalTime(); 090 091 /** 092 * Get the expected start-time for this job 093 * 094 * @return Date expected start-time 095 */ 096 public abstract Date getExpectedStart(); // nominal time + should-start 097 098 /** 099 * Get the expected end-time for this job 100 * 101 * @return Date expected end-time 102 */ 103 public abstract Date getExpectedEnd(); // nominal time + should-end 104 105 /** 106 * Get the expected duration for this job 107 * 108 * @return Date expected duration 109 */ 110 public abstract long getExpectedDuration(); 111 112 /** 113 * Get the sla notification-message 114 * 115 * @return String notification-message 116 */ 117 public abstract String getNotificationMsg(); 118 119 /** 120 * Get the SLA alert-events 121 * 122 * @return String alert-events 123 */ 124 public abstract String getAlertEvents(); 125 126 /** 127 * Get the SLA alert-contact 128 * 129 * @return String alert-contact 130 */ 131 public abstract String getAlertContact(); 132 133 /** 134 * Get the dependent upstream apps 135 * 136 * @return String upstream-apps 137 */ 138 public abstract String getUpstreamApps(); 139 140 /** 141 * Get job related data or configuration 142 * 143 * @return String job-data 144 */ 145 public abstract String getJobData(); 146 147 /** 148 * Get the user for this job sla 149 * 150 * @return String user 151 */ 152 public abstract String getUser(); 153 154 /** 155 * Get the miscellaneous key-value configs 156 * 157 * @return String slaConfig 158 */ 159 public abstract String getSlaConfig(); 160 161 /** 162 * Get the actual start time of job for SLA 163 * 164 * @return Date actual-start 165 */ 166 public abstract Date getActualStart(); 167 168 /** 169 * Get the actual end time of job for SLA 170 * 171 * @return Date actual-end 172 */ 173 public abstract Date getActualEnd(); 174 175 /** 176 * Get the actual duration of job for SLA 177 * 178 * @return long duration 179 */ 180 public abstract long getActualDuration(); 181 182 /** 183 * Get the job status 184 * 185 * @return String job-status 186 */ 187 public abstract String getJobStatus(); 188 189 /** 190 * Get the last modified time 191 * 192 * @return Date last modified time 193 */ 194 public abstract Date getLastModifiedTime(); 195 196 @Override 197 public String toString() { 198 return "ID: " + getId() + ", MsgType:" + getMsgType() + ", SLAStatus: " + getSLAStatus() + ", EventStatus: " 199 + getEventStatus() + " AppType " + getAppType(); 200 } 201 202 }