7c2b1c198f5a1070e135e26ae765e19e1f4b1c7c
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / restconf / restful / utils / RestconfDataServiceConstant.java
1 /*
2  * Copyright (c) 2016 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.restconf.restful.utils;
9
10 import java.net.URI;
11 import java.net.URISyntaxException;
12 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
13 import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
14 import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.common.QNameModule;
17
18 /**
19  * Constants for RestconfDataService.
20  *
21  * @deprecated move to splitted module restconf-nb-rfc8040
22  */
23 @Deprecated
24 public final class RestconfDataServiceConstant {
25
26     public static final QName NETCONF_BASE_QNAME;
27
28     static {
29         try {
30             NETCONF_BASE_QNAME = QName.create(
31                     QNameModule.create(new URI(PutData.NETCONF_BASE), null), PutData.NETCONF_BASE_PAYLOAD_NAME);
32         } catch (final URISyntaxException e) {
33             final String errMsg = "It wasn't possible to create instance of URI class with " + PutData.NETCONF_BASE
34                     + " URI";
35             throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED);
36         }
37     }
38
39     private RestconfDataServiceConstant() {
40         throw new UnsupportedOperationException("Util class.");
41     }
42
43     /**
44      * Constants for read data.
45      *
46      */
47     public final class ReadData {
48         // URI parameters
49         public static final String CONTENT = "content";
50         public static final String DEPTH = "depth";
51         public static final String FIELDS = "fields";
52
53         // content values
54         public static final String CONFIG = "config";
55         public static final String ALL = "all";
56         public static final String NONCONFIG = "nonconfig";
57
58         // depth values
59         public static final String UNBOUNDED = "unbounded";
60         public static final int MIN_DEPTH = 1;
61         public static final int MAX_DEPTH = 65535;
62
63         public static final String READ_TYPE_TX = "READ";
64         public static final String WITH_DEFAULTS = "with-defaults";
65
66         private ReadData() {
67             throw new UnsupportedOperationException("Util class.");
68         }
69     }
70
71     /**
72      * Constants for data to put.
73      *
74      */
75     public final class PutData {
76         public static final String NETCONF_BASE = "urn:ietf:params:xml:ns:netconf:base:1.0";
77         public static final String NETCONF_BASE_PAYLOAD_NAME = "data";
78         public static final String PUT_TX_TYPE = "PUT";
79
80         private PutData() {
81             throw new UnsupportedOperationException("Util class.");
82         }
83     }
84
85     /**
86      * Constants for data to post.
87      *
88      */
89     public final class PostData {
90         public static final String POST_TX_TYPE = "POST";
91
92         private PostData() {
93             throw new UnsupportedOperationException("Util class.");
94         }
95     }
96
97     /**
98      * Constants for data to delete.
99      *
100      */
101     public final class DeleteData {
102         public static final String DELETE_TX_TYPE = "DELETE";
103
104         private DeleteData() {
105             throw new UnsupportedOperationException("Util class.");
106         }
107     }
108
109     /**
110      * Constants for data to yang patch.
111      *
112      */
113     public final class PatchData {
114         public static final String PATCH_TX_TYPE = "Patch";
115
116         private PatchData() {
117             throw new UnsupportedOperationException("Util class.");
118         }
119     }
120 }