001 /**
002 * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software
010 * distributed under the License is distributed on an "AS IS" BASIS,
011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 * See the License for the specific language governing permissions and
013 * limitations under the License. See accompanying LICENSE file.
014 */
015 package org.apache.oozie;
016
017 import org.apache.oozie.util.XLog;
018
019 public enum ErrorCode {
020 E0000(XLog.STD, "OOZIE_HOME environment variable not defined"),
021 E0001(XLog.OPS, "Could not create runtime directory, {0}"),
022 E0002(XLog.STD, "System is in safe mode"),
023 E0003(XLog.OPS, "Oozie home directory must be an absolute path [{0}]"),
024 E0004(XLog.OPS, "Oozie home directory does not exist [{0}]"),
025
026 E0010(XLog.OPS, "Could not initialize log service, {0}"),
027 E0011(XLog.OPS, "Log4j file must be a file name [{0}]"),
028 E0012(XLog.OPS, "Log4j file must be a '.properties' file [{0}]"),
029 E0013(XLog.OPS, "Log4j file [{0}] not found in configuration dir [{1}] neither in classpath"),
030
031 E0020(XLog.OPS, "Environment variable {0} not defined"),
032 E0022(XLog.OPS, "Configuration file must be a file name [{0}]"),
033 E0023(XLog.OPS, "Default configuration file [{0}] not found in classpath"),
034 E0024(XLog.OPS, "Oozie configuration directory does not exist [{0}]"),
035 E0025(XLog.OPS, "Configuration service internal error, it should never happen, {0}"),
036 E0026(XLog.OPS, "Missing required configuration property [{0}]"),
037
038 E0100(XLog.OPS, "Could not initialize service [{0}], {1}"),
039 E0110(XLog.OPS, "Could not parse or validate EL definition [{0}], {1}"),
040 E0111(XLog.OPS, "class#method not found [{0}#{1}]"),
041 E0112(XLog.OPS, "class#method does not have PUBLIC or STATIC modifier [{0}#{1}]"),
042 E0113(XLog.OPS, "class not found [{0}]"),
043 E0114(XLog.OPS, "class#constant does not have PUBLIC or STATIC modifier [{0}#{1}]"),
044 E0115(XLog.OPS, "class#constant not found"),
045 E0116(XLog.OPS, "class#constant does not have PUBLIC or STATIC modifier [{0}#{1}]"),
046 E0120(XLog.OPS, "UUID, invalid generator type [{0}]"),
047 E0130(XLog.OPS, "Could not parse workflow schemas file/s, {0}"),
048 E0131(XLog.OPS, "Could not read workflow schemas file/s, {0}"),
049 E0140(XLog.OPS, "Could not access database, {0}"),
050 E0141(XLog.OPS, "Could not create DataSource connection pool, {0}"),
051 E0150(XLog.OPS, "Actionexecutor type already registered [{0}]"),
052 E0160(XLog.OPS, "Could not read admin users file [{0}], {1}"),
053
054 E0300(XLog.STD, "Invalid content-type [{0}]"),
055 E0301(XLog.STD, "Invalid resource [{0}]"),
056 E0302(XLog.STD, "Invalid parameter [{0}]"),
057 E0303(XLog.STD, "Invalid parameter value, [{0}] = [{1}]"),
058 E0304(XLog.STD, "Invalid parameter type, parameter [{0}] expected type [{1}]"),
059 E0305(XLog.STD, "Missing parameter [{0}]"),
060 E0306(XLog.STD, "Invalid parameter"),
061 E0307(XLog.STD, "Runtime error [{0}]"),
062
063
064 E0400(XLog.STD, "User mismatch, request user [{0}] configuration user [{1}]"),
065 E0401(XLog.STD, "Missing configuration property [{0}]"),
066 E0402(XLog.STD, "Invalid callback ID [{0}]"),
067 E0403(XLog.STD, "Invalid callback data, {0}"),
068
069 E0420(XLog.STD, "Invalid jobs filter [{0}], {1}"),
070
071 E0500(XLog.OPS, "Not authorized, {0}"),
072 E0501(XLog.OPS, "Could not perform authorization operation, {0}"),
073 E0502(XLog.OPS, "User [{0}] does not belong to group [{1}]"),
074 E0503(XLog.OPS, "User [{0}] does not have admin privileges"),
075 E0504(XLog.OPS, "Workflow app directory [{0}] does not exist"),
076 E0505(XLog.OPS, "Workflow app definition [{0}] does not exist"),
077 E0506(XLog.OPS, "Workflow app definition [{0}] is not a file"),
078 E0507(XLog.OPS, "Could not access to [{0}], {1}"),
079 E0508(XLog.OPS, "User [{0}] not authorized for WF job [{1}]"),
080 E0509(XLog.OPS, "User [{0}] not authorized for Coord job [{1}]"),
081
082 E0600(XLog.OPS, "Could not get connection, {0}"),
083 E0601(XLog.OPS, "Could not close connection, {0}"),
084 E0602(XLog.OPS, "Could not commit connection, {0}"),
085 E0603(XLog.OPS, "SQL error in operation [{0}], {1}"),
086 E0604(XLog.STD, "Job does not exist [{0}]"),
087 E0605(XLog.STD, "Action does not exist [{0}]"),
088 E0606(XLog.STD, "Could not get lock [{0}]"),
089 E0607(XLog.OPS, "Other error in operation [{0}], {1}"),
090 E0608(XLog.OPS, "JDBC setup error [{0}], {1}"),
091 E0609(XLog.OPS, "Missing [{0}] ORM file [{1}]"),
092
093 E0700(XLog.STD, "XML error, {0}"),
094 E0701(XLog.STD, "XML schema error, {0}"),
095 E0702(XLog.STD, "IO error, {0}"),
096 E0703(XLog.STD, "Invalid workflow element [{0}]"),
097 E0704(XLog.STD, "Definition already complete, application [{0}]"),
098 E0705(XLog.STD, "Nnode already defined, node [{0}]"),
099 E0706(XLog.STD, "Node cannot transition to itself node [{0}]"),
100 E0707(XLog.STD, "Loop detected at parsing, node [{0}]"),
101 E0708(XLog.STD, "Invalid transition, node [{0}] transition [{1}]"),
102 E0709(XLog.STD, "Loop detected at runtime, node [{0}]"),
103 E0710(XLog.STD, "Could not read the workflow definition, {0}"),
104 E0711(XLog.STD, "Invalid application URI [{0}], {1}"),
105 E0712(XLog.STD, "Could not create lib paths list for application [{0}], {1}"),
106 E0713(XLog.OPS, "SQL error, {0}"),
107 E0714(XLog.OPS, "Workflow lib error, {0}"),
108 E0715(XLog.OPS, "Invalid signal value for the start node, signal [{0}]"),
109 E0716(XLog.OPS, "Workflow not running"),
110 E0717(XLog.OPS, "Workflow not suspended"),
111 E0718(XLog.OPS, "Workflow already completed"),
112 E0719(XLog.OPS, "Job already started"),
113 E0720(XLog.OPS, "Fork/join mismatch, node [{0}]"),
114 E0721(XLog.OPS, "Invalid signal/transition, decision node [{0}] signal [{1}]"),
115 E0722(XLog.OPS, "Action signals can only be OK or ERROR, action node [{0}]"),
116 E0723(XLog.STD, "Unsupported action type, node [{0}] type [{1}]"),
117 E0724(XLog.STD, "Invalid node name, {0}"),
118
119 E0800(XLog.STD, "Action it is not running its in [{1}] state, action [{0}]"),
120 E0801(XLog.STD, "Workflow already running, workflow [{0}]"),
121 E0802(XLog.STD, "Invalid action type [{0}]"),
122 E0803(XLog.STD, "IO error, {0}"),
123 E0804(XLog.STD, "Disallowed default property [{0}]"),
124 E0805(XLog.STD, "Workflow job not completed, status [{0}]"),
125 E0806(XLog.STD, "Action did not complete in previous run, action [{0}]"),
126 E0807(XLog.STD, "Some skip actions were not executed [{0}]"),
127 E0808(XLog.STD, "Disallowed user property [{0}]"),
128
129 E0900(XLog.OPS, "Jobtracker [{0}] not allowed, not in Oozie's whitelist"),
130 E0901(XLog.OPS, "Namenode [{0}] not allowed, not in Oozie's whitelist"),
131 E0902(XLog.OPS, "Exception occured: [{0}]"),
132
133 E1001(XLog.STD, "Could not read the coordinator job definition, {0}"),
134 E1002(XLog.STD, "Invalid coordinator application URI [{0}], {1}"),
135 E1003(XLog.STD, "Invalid coordinator application attributes [{0}], {1}"),
136 E1004(XLog.STD, "Expression language evaluation error [{0}], {1}"),
137 E1005(XLog.STD, "Could not read the coordinator job configuration read from DB, {0}"),
138 E1006(XLog.STD, "Invalid coordinator application [{0}], {1}"),
139 E1007(XLog.STD, "Unable to add record to SLA table. [{0}], {1}"),
140 E1008(XLog.STD, "Not implemented. [{0}]"),
141 E1009(XLog.STD, "Unable to parse XML response. [{0}]"),
142 E1010(XLog.STD, "Invalid data in coordinator xml. [{0}]"),
143 E1011(XLog.STD, "Cannot update coordinator job [{0}], {1}"),
144 E1012(XLog.STD, "Coord Job Materialization Error: {0}"),
145 E1013(XLog.STD, "Coord Job Recovery Error: {0}"),
146 E1014(XLog.STD, "Coord job change command not supported"),
147 E1015(XLog.STD, "Invalid coordinator job change value [{0}], {1}"),
148 E1016(XLog.STD, "Cannot change a killed coordinator job"),
149 E1017(XLog.STD, "Cannot change a workflow job"),
150 E1018(XLog.STD, "Coord Job Rerun Error: {0}"),
151
152 ETEST(XLog.STD, "THIS SHOULD HAPPEN ONLY IN TESTING, invalid job id [{0}]"),;
153
154 private String template;
155 private int logMask;
156
157 /**
158 * Create an error code.
159 *
160 * @param template template for the exception message.
161 * @param logMask log mask for the exception.
162 */
163 private ErrorCode(int logMask, String template) {
164 this.logMask = logMask;
165 this.template = template;
166 }
167
168 /**
169 * Return the message (StringFormat) template for the error code.
170 *
171 * @return message template.
172 */
173 public String getTemplate() {
174 return template;
175 }
176
177 /**
178 * Return the log mask (to which log the exception should be logged) of the error.
179 *
180 * @return error log mask.
181 */
182 public int getLogMask() {
183 return logMask;
184 }
185
186 /**
187 * Return a templatized error message for the error code.
188 *
189 * @param args the parameters for the templatized message.
190 * @return error message.
191 */
192 public String format(Object... args) {
193 return XLog.format("{0}: {1}", toString(), XLog.format(getTemplate(), args));
194 }
195
196 }