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 */
018package org.apache.hadoop.hbase.tool.coprocessor;
019
020import org.apache.yetus.audience.InterfaceAudience;
021
022import org.apache.hbase.thirdparty.com.google.common.base.MoreObjects;
023
024@InterfaceAudience.Private
025public class CoprocessorViolation {
026  public enum Severity {
027    WARNING,
028    ERROR
029  }
030
031  private final String className;
032  private final Severity severity;
033  private final String message;
034  private final Throwable throwable;
035
036  public CoprocessorViolation(String className, Severity severity, String message) {
037    this(className, severity, message, null);
038  }
039
040  public CoprocessorViolation(String className, Severity severity, String message, Throwable t) {
041    this.className = className;
042    this.severity = severity;
043    this.message = message;
044    this.throwable = t;
045  }
046
047  public String getClassName() {
048    return className;
049  }
050
051  public Severity getSeverity() {
052    return severity;
053  }
054
055  public String getMessage() {
056    return message;
057  }
058
059  public Throwable getThrowable() {
060    return throwable;
061  }
062
063  @Override
064  public String toString() {
065    return MoreObjects.toStringHelper(this).add("className", className).add("severity", severity)
066      .add("message", message).add("throwable", throwable).toString();
067  }
068}