Remove dependency on controller config-util
[netconf.git] / netconf / netconf-api / src / main / java / org / opendaylight / netconf / api / NetconfDocumentedException.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.netconf.api;
10
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import java.util.Map;
13 import org.w3c.dom.Document;
14
15 /**
16  * Checked exception to communicate an error that needs to be sent to the netconf client.
17  */
18 public class NetconfDocumentedException extends DocumentedException {
19     private static final long serialVersionUID = 1L;
20
21     public NetconfDocumentedException(final String message) {
22         super(message);
23     }
24
25     public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
26                                       final ErrorSeverity errorSeverity) {
27         super(message, errorType, errorTag, errorSeverity);
28     }
29
30     public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
31                                       final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
32         super(message, errorType, errorTag, errorSeverity, errorInfo);
33     }
34
35     public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
36                                       final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
37         super(message, cause, errorType, errorTag, errorSeverity);
38     }
39
40     public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
41                                       final ErrorTag errorTag, final ErrorSeverity errorSeverity,
42                                       final Map<String, String> errorInfo) {
43         super(message, cause, errorType, errorTag, errorSeverity, errorInfo);
44     }
45
46     @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
47     public NetconfDocumentedException(final DocumentedException exception) {
48         super(exception.getMessage(), (Exception) exception.getCause(), exception.getErrorType(),
49                 exception.getErrorTag(), exception.getErrorSeverity(), exception.getErrorInfo());
50     }
51
52     public static NetconfDocumentedException fromXMLDocument(final Document fromDoc) {
53         return new NetconfDocumentedException(DocumentedException.fromXMLDocument(fromDoc));
54     }
55 }