/*
* Copyright 2014 LinkedIn Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/package azkaban.executor;
publicenum Status {
READY(10),
PREPARING(20),
RUNNING(30),
PAUSED(40),
SUCCEEDED(50),
KILLED(60),
FAILED(70),
FAILED_FINISHING(80),
SKIPPED(90),
DISABLED(100),
QUEUED(110),
FAILED_SUCCEEDED(120),
CANCELLED(130);
privatefinalint numVal;
Status(finalint numVal) {
this.numVal = numVal;
}
publicstatic Status fromInteger(finalint x){
switch (x) {
case10:
return READY;
case20:
return PREPARING;
case30:
return RUNNING;
case40:
return PAUSED;
case50:
return SUCCEEDED;
case60:
return KILLED;
case70:
return FAILED;
case80:
return FAILED_FINISHING;
case90:
return SKIPPED;
case100:
return DISABLED;
case110:
return QUEUED;
case120:
return FAILED_SUCCEEDED;
case130:
return CANCELLED;
default:
return READY;
}
}
publicstaticbooleanisStatusFinished(final Status status){
switch (status) {
case FAILED:
case KILLED:
case SUCCEEDED:
case SKIPPED:
case FAILED_SUCCEEDED:
case CANCELLED:
returntrue;
default:
returnfalse;
}
}
publicstaticbooleanisStatusRunning(final Status status){
switch (status) {
case RUNNING:
case FAILED_FINISHING:
case QUEUED:
returntrue;
default:
returnfalse;
}
}
publicintgetNumVal(){
returnthis.numVal;
}
}