2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.restconf.restful.utils;
10 import com.google.common.collect.Sets;
12 import java.text.ParseException;
13 import java.text.SimpleDateFormat;
14 import java.util.Date;
15 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
16 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
17 import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
18 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorTag;
19 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
20 import org.opendaylight.restconf.utils.RestconfConstants;
21 import org.opendaylight.restconf.utils.parser.builder.ParserBuilderConstants;
22 import org.opendaylight.yangtools.yang.common.QName;
23 import org.opendaylight.yangtools.yang.common.QNameModule;
24 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
29 * Constants for streams
32 public final class RestconfStreamsConstants {
34 private static final Logger LOG = LoggerFactory.getLogger(RestconfStreamsConstants.class);
36 public static final String SAL_REMOTE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote";
38 public static final String DATASTORE_PARAM_NAME = "datastore";
40 private static final URI NAMESPACE_EVENT_SUBSCRIPTION_AUGMENT = URI.create("urn:sal:restconf:event:subscription");
42 public static final QNameModule SAL_REMOTE_AUGMENT;
44 public static final YangInstanceIdentifier.AugmentationIdentifier SAL_REMOTE_AUG_IDENTIFIER;
46 public static final DataChangeScope DEFAULT_SCOPE = DataChangeScope.BASE;
48 public static final LogicalDatastoreType DEFAULT_DS = LogicalDatastoreType.CONFIGURATION;
50 public static final String SCOPE_PARAM_NAME = "scope";
52 public static final char EQUAL = ParserBuilderConstants.Deserializer.EQUAL;
54 public static final String DS_URI = RestconfConstants.SLASH + DATASTORE_PARAM_NAME + EQUAL;
56 public static final String SCOPE_URI = RestconfConstants.SLASH + SCOPE_PARAM_NAME + EQUAL;
58 public static final int NOTIFICATION_PORT = 8181;
60 public static final String SCHEMA_SUBSCIBRE_URI = "ws";
63 Date eventSubscriptionAugRevision;
65 eventSubscriptionAugRevision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-07-08");
66 } catch (final ParseException e) {
67 final String errMsg = "It wasn't possible to convert revision date of sal-remote-augment to date";
69 throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED);
71 SAL_REMOTE_AUGMENT = QNameModule.create(NAMESPACE_EVENT_SUBSCRIPTION_AUGMENT, eventSubscriptionAugRevision);
72 SAL_REMOTE_AUG_IDENTIFIER = new YangInstanceIdentifier.AugmentationIdentifier(Sets
73 .newHashSet(QName.create(SAL_REMOTE_AUGMENT, "scope"), QName.create(SAL_REMOTE_AUGMENT, "datastore"),
74 QName.create(SAL_REMOTE_AUGMENT, "notification-output-type")));
77 private RestconfStreamsConstants() {
78 throw new UnsupportedOperationException("Util class.");