Merge "Bug 8153: Enforce check-style rules for netconf - netconf-notification-api"
[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 java.util.Map;
12 import org.opendaylight.controller.config.util.xml.DocumentedException;
13 import org.w3c.dom.Document;
14
15 /**
16  * Checked exception to communicate an error that needs to be sent to the
17  * netconf client.
18  */
19 public class NetconfDocumentedException extends DocumentedException {
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     public NetconfDocumentedException(DocumentedException exception) {
47         super(exception.getMessage(), (Exception) exception.getCause(), exception.getErrorType(),
48                 exception.getErrorTag(), exception.getErrorSeverity(), exception.getErrorInfo());
49     }
50
51     public static NetconfDocumentedException fromXMLDocument(Document fromDoc) {
52         return new NetconfDocumentedException(DocumentedException.fromXMLDocument(fromDoc));
53     }
54 }