Deprecate Broker and related APIs
[controller.git] / opendaylight / md-sal / sal-common-util / src / main / java / org / opendaylight / controller / sal / common / util / RpcErrors.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 package org.opendaylight.controller.sal.common.util;
9
10 import org.opendaylight.yangtools.yang.common.RpcError;
11 import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
12 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
13
14 /**
15  * Deprecated.
16  *
17  * @deprecated Use {@link org.opendaylight.yangtools.yang.common.RpcResultBuilder}
18  */
19 @Deprecated
20 public final class RpcErrors {
21     private RpcErrors() {
22     }
23
24     /**
25      * Creates an RpcError.
26      *
27      * @return {@link RpcError} implementation
28      */
29     public static RpcError getRpcError(String applicationTag, String tag, String info,
30             ErrorSeverity severity, String message, ErrorType errorType, Throwable cause) {
31         RpcErrorTO ret = new RpcErrorTO(applicationTag, tag, info, severity, message,
32                 errorType, cause);
33         return ret;
34     }
35
36     private static class RpcErrorTO implements RpcError {
37
38         private final String applicationTag;
39         private final String tag;
40         private final String info;
41         private final ErrorSeverity severity;
42         private final String message;
43         private final ErrorType errorType;
44         private final Throwable cause;
45
46         protected RpcErrorTO(String applicationTag, String tag, String info,
47                 ErrorSeverity severity, String message, ErrorType errorType, Throwable cause) {
48             this.applicationTag = applicationTag;
49             this.tag = tag;
50             this.info = info;
51             this.severity = severity;
52             this.message = message;
53             this.errorType = errorType;
54             this.cause = cause;
55         }
56
57         @Override
58         public String getApplicationTag() {
59             return applicationTag;
60         }
61
62         @Override
63         public String getInfo() {
64             return info;
65         }
66
67         @Override
68         public String getMessage() {
69             return message;
70         }
71
72         @Override
73         public ErrorSeverity getSeverity() {
74             return severity;
75         }
76
77         @Override
78         public String getTag() {
79             return tag;
80         }
81
82         @Override
83         public Throwable getCause() {
84             return cause;
85         }
86
87         @Override
88         public ErrorType getErrorType() {
89             return errorType;
90         }
91     }
92 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.