+++ /dev/null
-/*
- * Copyright (c) 2018 Inocybe Technologies and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.restconf.common.util;
-
-/**
- * Represents the scope of a data change (addition, replacement, deletion) registration.
- *
- * <p>
- * Note: this enum was originally defined in the AsynDataBroker interface but was removed when DataChangeListener
- * et al were removed.
- */
-public enum DataChangeScope {
- /**
- * Represents only a direct change of the node, such as replacement of a node, addition or deletion..
- *
- */
- BASE,
-
- /**
- * Represent a change (addition, replacement, deletion) of the node or one of its direct
- * children.
- *
- * <p>
- * This scope is superset of {@link #BASE}.
- *
- */
- ONE,
-
- /**
- * Represents a change of the node or any of or any of its child nodes, direct and nested.
- *
- * <p>
- * This scope is superset of {@link #ONE} and {@link #BASE}.
- *
- */
- SUBTREE
-}
import org.opendaylight.restconf.common.patch.PatchEntity;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
import org.opendaylight.restconf.common.patch.PatchStatusEntity;
-import org.opendaylight.restconf.common.util.DataChangeScope;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.CreateDataChangeEventSubscriptionInput1.Scope;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.ErrorTag;
import org.opendaylight.yangtools.yang.common.ErrorType;
return this.rpcService.invokeRpc(type, input);
}
- public void registerToListenDataChanges(final LogicalDatastoreType datastore, final DataChangeScope scope,
+ public void registerToListenDataChanges(final LogicalDatastoreType datastore, final Scope scope,
final ListenerAdapter listener) {
if (listener.isListening()) {
return;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
-import org.opendaylight.restconf.common.util.DataChangeScope;
import org.opendaylight.restconf.common.util.OperationsResourceUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.CreateDataChangeEventSubscriptionInput1.Scope;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.common.ErrorTag;
private static final Logger LOG = LoggerFactory.getLogger(RestconfImpl.class);
- private static final DataChangeScope DEFAULT_SCOPE = DataChangeScope.BASE;
-
private static final LogicalDatastoreType DEFAULT_DATASTORE = LogicalDatastoreType.CONFIGURATION;
private static final XMLNamespace NAMESPACE_EVENT_SUBSCRIPTION_AUGMENT =
parseEnumTypeParameter(value, LogicalDatastoreType.class, DATASTORE_PARAM_NAME);
datastore = datastore == null ? DEFAULT_DATASTORE : datastore;
- DataChangeScope scope = parseEnumTypeParameter(value, DataChangeScope.class, SCOPE_PARAM_NAME);
- scope = scope == null ? DEFAULT_SCOPE : scope;
+ Scope scope = parseEnumTypeParameter(value, Scope.class, SCOPE_PARAM_NAME);
+ scope = scope == null ? Scope.BASE : scope;
outputType = parseEnumTypeParameter(value, NotificationOutputType.class, OUTPUT_TYPE_PARAM_NAME);
outputType = outputType == null ? NotificationOutputType.XML : outputType;
* <ul>
* <li>datastore - default CONFIGURATION (other values of
* {@link LogicalDatastoreType} enum type)</li>
- * <li>scope - default BASE (other values of {@link DataChangeScope})</li>
+ * <li>scope - default BASE (other values of {@link Scope})</li>
* </ul>
*/
@Override
throw new RestconfDocumentedException("Stream name doesn't contains datastore value (pattern /datastore=)",
ErrorType.APPLICATION, ErrorTag.MISSING_ATTRIBUTE);
}
- final DataChangeScope scope =
- parserURIEnumParameter(DataChangeScope.class, paramToValues.get(SCOPE_PARAM_NAME));
+ final Scope scope = parserURIEnumParameter(Scope.class, paramToValues.get(SCOPE_PARAM_NAME));
if (scope == null) {
throw new RestconfDocumentedException("Stream name doesn't contains datastore value (pattern /scope=)",
ErrorType.APPLICATION, ErrorTag.MISSING_ATTRIBUTE);
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.common.patch.PatchStatusContext;
-import org.opendaylight.restconf.common.util.DataChangeScope;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.CreateDataChangeEventSubscriptionInput1.Scope;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.ErrorTag;
DOMDataTreeIdentifier loc = new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, this.instanceID);
when(changeService.registerDataTreeChangeListener(eq(loc), eq(listener))).thenReturn(mockRegistration);
- this.brokerFacade.registerToListenDataChanges(
- LogicalDatastoreType.CONFIGURATION, DataChangeScope.BASE, listener);
+ this.brokerFacade.registerToListenDataChanges(LogicalDatastoreType.CONFIGURATION, Scope.BASE, listener);
verify(changeService).registerDataTreeChangeListener(loc, listener);
assertEquals("isListening", true, listener.isListening());
- this.brokerFacade.registerToListenDataChanges(
- LogicalDatastoreType.CONFIGURATION, DataChangeScope.BASE, listener);
+ this.brokerFacade.registerToListenDataChanges(LogicalDatastoreType.CONFIGURATION, Scope.BASE, listener);
verifyNoMoreInteractions(changeService);
}
import org.opendaylight.netconf.sal.streams.listeners.Notificator;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
-import org.opendaylight.restconf.common.util.DataChangeScope;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.CreateDataChangeEventSubscriptionInput1.Scope;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
@Test
public void resolveURIParametersConcreteValues() {
- resolveURIParameters("OPERATIONAL", "SUBTREE", LogicalDatastoreType.OPERATIONAL, DataChangeScope.SUBTREE);
+ resolveURIParameters("OPERATIONAL", "SUBTREE", LogicalDatastoreType.OPERATIONAL, Scope.SUBTREE);
}
@Test
public void resolveURIParametersDefaultValues() {
- resolveURIParameters(null, null, LogicalDatastoreType.CONFIGURATION, DataChangeScope.BASE);
+ resolveURIParameters(null, null, LogicalDatastoreType.CONFIGURATION, Scope.BASE);
}
private void resolveURIParameters(final String datastore, final String scope,
- final LogicalDatastoreType datastoreExpected, final DataChangeScope scopeExpected) {
+ final LogicalDatastoreType datastoreExpected, final Scope scopeExpected) {
final InstanceIdentifierBuilder iiBuilder = YangInstanceIdentifier.builder();
iiBuilder.node(QName.create("", "dummyStreamName"));
import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.restconf.common.util.DataChangeScope;
import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfStreamsConstants;
import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker;
import org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationListenerAdapter;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.CreateDataChangeEventSubscriptionInput1.Scope;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.ErrorTag;
import org.opendaylight.yangtools.yang.common.ErrorType;
final String scopeName = extractStringLeaf(data, SCOPE_NODEID);
// FIXME: this is not really used
- final DataChangeScope scope = scopeName != null ? DataChangeScope.valueOf(scopeName) : DataChangeScope.BASE;
+ final Scope scope = scopeName != null ? Scope.forName(scopeName).orElseThrow() : Scope.BASE;
return RestconfStreamsConstants.DATA_SUBSCRIPTION
+ "/"