本文整理汇总了Java中org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService类的典型用法代码示例。如果您正苦于以下问题:Java DOMDataTreeChangeService类的具体用法?Java DOMDataTreeChangeService怎么用?Java DOMDataTreeChangeService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DOMDataTreeChangeService类属于org.opendaylight.controller.md.sal.dom.api包,在下文中一共展示了DOMDataTreeChangeService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractDOMDataBroker
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
protected AbstractDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores) {
super(datastores);
boolean treeChange = true;
for (DOMStore ds : datastores.values()) {
if (!(ds instanceof DOMStoreTreeChangePublisher)) {
treeChange = false;
break;
}
}
if (treeChange) {
extensions = ImmutableMap.<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension>of(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
@Nonnull
@Override
public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(@Nonnull final DOMDataTreeIdentifier treeId, @Nonnull final L listener) {
DOMStore publisher = getTxFactories().get(treeId.getDatastoreType());
checkState(publisher != null, "Requested logical data store is not available.");
return ((DOMStoreTreeChangePublisher)publisher).registerTreeChangeListener(treeId.getRootIdentifier(), listener);
}
});
} else {
extensions = Collections.emptyMap();
}
}
示例2: testExtensions
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Test
public void testExtensions() {
DistributedDataStore mockConfigStore = mock(DistributedDataStore.class);
DistributedDataStore mockOperStore = mock(DistributedDataStore.class);
try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of(
LogicalDatastoreType.OPERATIONAL, mockOperStore,
LogicalDatastoreType.CONFIGURATION, mockConfigStore), futureExecutor)) {
Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> supportedExtensions =
dataBroker.getSupportedExtensions();
assertNotNull(supportedExtensions.get(DOMDataTreeChangeService.class));
DOMDataTreeCommitCohortRegistry cohortRegistry =
(DOMDataTreeCommitCohortRegistry) supportedExtensions.get(DOMDataTreeCommitCohortRegistry.class);
assertNotNull(cohortRegistry);
DOMDataTreeCommitCohort mockCohort = mock(DOMDataTreeCommitCohort.class);
DOMDataTreeIdentifier path = new DOMDataTreeIdentifier(
org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION,
YangInstanceIdentifier.EMPTY);
cohortRegistry.registerCommitCohort(path, mockCohort);
verify(mockConfigStore).registerCommitCohort(path, mockCohort);
}
}
示例3: LocRibWriter
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
private LocRibWriter(final RIBSupportContextRegistry registry, final DOMTransactionChain chain,
final YangInstanceIdentifier target, final Long ourAs, final DOMDataTreeChangeService service,
final ExportPolicyPeerTracker exportPolicyPeerTracker, final TablesKey tablesKey,
final PathSelectionMode pathSelectionMode) {
this.chain = requireNonNull(chain);
this.target = requireNonNull(target);
this.tableKey = RibSupportUtils.toYangTablesKey(tablesKey);
this.localTablesKey = tablesKey;
this.locRibTarget = YangInstanceIdentifier.create(target.node(LocRib.QNAME).node(Tables.QNAME)
.node(this.tableKey).getPathArguments());
this.ourAs = requireNonNull(ourAs);
this.service = requireNonNull(service);
this.ribSupport = registry.getRIBSupportContext(tablesKey).getRibSupport();
this.attributesIdentifier = this.ribSupport.routeAttributesIdentifier();
this.exportPolicyPeerTracker = exportPolicyPeerTracker;
this.pathSelectionMode = pathSelectionMode;
init();
}
示例4: setUp
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Mockito.doReturn(mock(GeneratedClassLoadingStrategy.class)).when(this.extension).getClassLoadingStrategy();
Mockito.doReturn(this.ribSupport).when(this.extension).getRIBSupport(any(TablesKey.class));
final NodeIdentifier nii = new NodeIdentifier(QName.create("", "test").intern());
Mockito.doReturn(nii).when(this.ribSupport).routeAttributesIdentifier();
Mockito.doReturn(ImmutableSet.of()).when(this.ribSupport).cacheableAttributeObjects();
final ChoiceNode choiceNode = mock(ChoiceNode.class);
Mockito.doReturn(choiceNode).when(this.ribSupport).emptyRoutes();
Mockito.doReturn(nii).when(choiceNode).getIdentifier();
Mockito.doReturn(QName.create("", "test").intern()).when(choiceNode).getNodeType();
Mockito.doReturn(this.domTx).when(this.domDataBroker).createTransactionChain(any());
final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
Mockito.doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService))
.when(this.domDataBroker).getSupportedExtensions();
Mockito.doReturn(this.dataTreeRegistration).when(this.domSchemaService).registerSchemaContextListener(any());
Mockito.doNothing().when(this.dataTreeRegistration).close();
Mockito.doReturn(mock(ListenerRegistration.class)).when(dOMDataTreeChangeService)
.registerDataTreeChangeListener(any(), any());
Mockito.doNothing().when(this.serviceRegistration).unregister();
}
示例5: registerDataTreeChangeListener
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Override
public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(final DOMDataTreeIdentifier treeId, final L listener) {
final DOMDataTreeChangeService treeService =
(DOMDataTreeChangeService) delegate.getSupportedExtensions().get(DOMDataTreeChangeService.class);
if (treeService != null) {
return treeService.registerDataTreeChangeListener(treeId, listener);
}
throw new UnsupportedOperationException("Delegate " + delegate + " does not support required functionality");
}
示例6: writeContainerEmptyTreeTest
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Test
public void writeContainerEmptyTreeTest() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
assertNotNull("DOMDataTreeChangeService not found, cannot continue with test!",
dataTreeChangeService);
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg =
dataTreeChangeService.registerDataTreeChangeListener(ROOT_DATA_TREE_ID, listener);
final DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
writeTx.submit();
latch.await(5, TimeUnit.SECONDS);
assertEquals(1, listener.getReceivedChanges().size());
final Collection<DataTreeCandidate> changes = listener.getReceivedChanges().get(0);
assertEquals(1, changes.size());
DataTreeCandidate candidate = changes.iterator().next();
assertNotNull(candidate);
DataTreeCandidateNode candidateRoot = candidate.getRootNode();
checkChange(null, TEST_CONTAINER, ModificationType.WRITE, candidateRoot);
listenerReg.close();
}
示例7: replaceContainerContainerInTreeTest
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Test
public void replaceContainerContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
assertNotNull("DOMDataTreeChangeService not found, cannot continue with test!",
dataTreeChangeService);
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
writeTx.submit().checkedGet();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg =
dataTreeChangeService.registerDataTreeChangeListener(ROOT_DATA_TREE_ID, listener);
writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER_2);
writeTx.submit();
latch.await(5, TimeUnit.SECONDS);
assertEquals(2, listener.getReceivedChanges().size());
Collection<DataTreeCandidate> changes = listener.getReceivedChanges().get(0);
assertEquals(1, changes.size());
DataTreeCandidate candidate = changes.iterator().next();
assertNotNull(candidate);
DataTreeCandidateNode candidateRoot = candidate.getRootNode();
checkChange(null, TEST_CONTAINER, ModificationType.WRITE, candidateRoot);
changes = listener.getReceivedChanges().get(1);
assertEquals(1, changes.size());
candidate = changes.iterator().next();
assertNotNull(candidate);
candidateRoot = candidate.getRootNode();
checkChange(TEST_CONTAINER, TEST_CONTAINER_2, ModificationType.WRITE, candidateRoot);
listenerReg.close();
}
示例8: deleteContainerContainerInTreeTest
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Test
public void deleteContainerContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
assertNotNull("DOMDataTreeChangeService not found, cannot continue with test!",
dataTreeChangeService);
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
writeTx.submit().checkedGet();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg =
dataTreeChangeService.registerDataTreeChangeListener(ROOT_DATA_TREE_ID, listener);
writeTx = domBroker.newWriteOnlyTransaction();
writeTx.delete(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH);
writeTx.submit();
latch.await(5, TimeUnit.SECONDS);
assertEquals(2, listener.getReceivedChanges().size());
Collection<DataTreeCandidate> changes = listener.getReceivedChanges().get(0);
assertEquals(1, changes.size());
DataTreeCandidate candidate = changes.iterator().next();
assertNotNull(candidate);
DataTreeCandidateNode candidateRoot = candidate.getRootNode();
checkChange(null, TEST_CONTAINER, ModificationType.WRITE, candidateRoot);
changes = listener.getReceivedChanges().get(1);
assertEquals(1, changes.size());
candidate = changes.iterator().next();
assertNotNull(candidate);
candidateRoot = candidate.getRootNode();
checkChange(TEST_CONTAINER, null, ModificationType.DELETE, candidateRoot);
listenerReg.close();
}
示例9: rootModificationChildListenerTest
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Test
public void rootModificationChildListenerTest() throws InterruptedException, TransactionCommitFailedException {
CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
assertNotNull("DOMDataTreeChangeService not found, cannot continue with test!",
dataTreeChangeService);
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
writeTx.submit().checkedGet();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg =
dataTreeChangeService.registerDataTreeChangeListener(OUTER_LIST_DATA_TREE_ID, listener);
writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER_2);
writeTx.submit().checkedGet();
latch.await(1, TimeUnit.SECONDS);
assertEquals(2, listener.getReceivedChanges().size());
Collection<DataTreeCandidate> changes = listener.getReceivedChanges().get(0);
assertEquals(1, changes.size());
DataTreeCandidate candidate = changes.iterator().next();
assertNotNull(candidate);
DataTreeCandidateNode candidateRoot = candidate.getRootNode();
checkChange(null, OUTER_LIST, ModificationType.WRITE, candidateRoot);
changes = listener.getReceivedChanges().get(1);
assertEquals(1, changes.size());
candidate = changes.iterator().next();
assertNotNull(candidate);
candidateRoot = candidate.getRootNode();
checkChange(OUTER_LIST, OUTER_LIST_2, ModificationType.WRITE, candidateRoot);
listenerReg.close();
}
示例10: getSupportedExtensions
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
@Nonnull
@Override
public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> res = delegate.getSupportedExtensions();
DOMDataTreeChangeService treeChangeSvc = (DOMDataTreeChangeService) res.get(DOMDataTreeChangeService.class);
if (treeChangeSvc == null) {
return res;
}
res = new HashMap<>(res);
res.put(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
@Nonnull
@Override
public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
@Nonnull DOMDataTreeIdentifier domDataTreeIdentifier, @Nonnull L listener) {
if (isRegistrationWatched(domDataTreeIdentifier.getRootIdentifier(),
domDataTreeIdentifier.getDatastoreType(), DataChangeScope.SUBTREE)) {
LOG.warn("Registration (registerDataTreeChangeListener) for {} from {}",
toPathString(domDataTreeIdentifier.getRootIdentifier()), getStackSummary());
}
return treeChangeSvc.registerDataTreeChangeListener(domDataTreeIdentifier, listener);
}
});
return res;
}
示例11: BindingDOMDataBrokerAdapter
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
public BindingDOMDataBrokerAdapter(final DOMDataBroker domDataBroker, final BindingToNormalizedNodeCodec codec) {
super(domDataBroker, codec);
final DOMDataTreeChangeService domTreeChange = (DOMDataTreeChangeService) domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class);
if(domTreeChange != null) {
treeChangeService = BindingDOMDataTreeChangeServiceAdapter.create(codec, domTreeChange);
} else {
treeChangeService = null;
}
}
示例12: MdsalLowLevelTestProvider
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
public MdsalLowLevelTestProvider(final RpcProviderRegistry rpcRegistry,
final DOMRpcProviderService domRpcService,
final ClusterSingletonServiceProvider singletonService,
final SchemaService schemaService,
final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer,
final NotificationPublishService notificationPublishService,
final NotificationService notificationService,
final DOMDataBroker domDataBroker,
final DOMDataTreeService domDataTreeService,
final DistributedShardFactory distributedShardFactory,
final DistributedDataStoreInterface configDataStore,
final ActorSystemProvider actorSystemProvider) {
this.rpcRegistry = rpcRegistry;
this.domRpcService = domRpcService;
this.singletonService = singletonService;
this.schemaService = schemaService;
this.bindingNormalizedNodeSerializer = bindingNormalizedNodeSerializer;
this.notificationPublishService = notificationPublishService;
this.notificationService = notificationService;
this.domDataBroker = domDataBroker;
this.domDataTreeService = domDataTreeService;
this.distributedShardFactory = distributedShardFactory;
this.configDataStore = configDataStore;
this.actorSystem = actorSystemProvider.getActorSystem();
this.prefixLeaderHandler = new PrefixLeaderHandler(domDataTreeService, bindingNormalizedNodeSerializer);
domDataTreeChangeService =
(DOMDataTreeChangeService) domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class);
registration = rpcRegistry.addRpcImplementation(OdlMdsalLowlevelControlService.class, this);
prefixShardHandler = new PrefixShardHandler(distributedShardFactory, domDataTreeService,
bindingNormalizedNodeSerializer);
}
示例13: instantiateServiceInstance
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
public synchronized void instantiateServiceInstance(final DOMDataTreeChangeService dataTreeChangeService,
final DOMDataTreeIdentifier appPeerDOMId) {
setActive(true);
this.chain = this.rib.createPeerChain(this);
this.writerChain = this.rib.createPeerChain(this);
final Optional<SimpleRoutingPolicy> simpleRoutingPolicy = Optional.of(SimpleRoutingPolicy.AnnounceNone);
final PeerId peerId = RouterIds.createPeerId(this.ipAddress);
final Set<TablesKey> localTables = this.rib.getLocalTablesKeys();
localTables.forEach(tablesKey -> {
final ExportPolicyPeerTracker exportTracker = this.rib.getExportPolicyPeerTracker(tablesKey);
if (exportTracker != null) {
exportTracker.registerPeer(peerId, null, this.peerIId, PeerRole.Internal, simpleRoutingPolicy);
}
this.supportedTables.add(RibSupportUtils.toYangTablesKey(tablesKey));
});
setAdvertizedGracefulRestartTableTypes(Collections.emptyList());
this.adjRibInWriter = AdjRibInWriter.create(this.rib.getYangRibId(), PeerRole.Internal, simpleRoutingPolicy,
this.writerChain);
final RIBSupportContextRegistry context = this.rib.getRibSupportContext();
final RegisterAppPeerListener registerAppPeerListener = () -> {
synchronized (this) {
if (this.chain != null) {
this.registration = dataTreeChangeService.registerDataTreeChangeListener(appPeerDOMId, this);
}
}
};
this.adjRibInWriter = this.adjRibInWriter.transform(peerId, context, localTables, Collections.emptyMap(),
registerAppPeerListener);
this.effectiveRibInWriter = EffectiveRibInWriter
.create(this.rib.getService(), this.rib.createPeerChain(this), this.peerIId,
this.rib.getImportPolicyPeerTracker(), context, PeerRole.Internal,
localTables);
this.bgpSessionState.registerMessagesCounter(this);
}
示例14: create
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
public static LocRibWriter create(@Nonnull final RIBSupportContextRegistry registry,
@Nonnull final TablesKey tablesKey,
@Nonnull final DOMTransactionChain chain,
@Nonnull final YangInstanceIdentifier target,
@Nonnull final AsNumber ourAs,
@Nonnull final DOMDataTreeChangeService service,
@Nonnull final ExportPolicyPeerTracker ep,
@Nonnull final PathSelectionMode pathSelectionStrategy) {
return new LocRibWriter(registry, chain, target, ourAs.getValue(), service, ep, tablesKey,
pathSelectionStrategy);
}
示例15: RIBImpl
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; //导入依赖的package包/类
public RIBImpl(final RibId ribId, final AsNumber localAs, final BgpId localBgpId,
final ClusterIdentifier clusterId, final RIBExtensionConsumerContext extensions, final BGPDispatcher dispatcher,
final BindingCodecTreeFactory codecFactory, final DOMDataBroker domDataBroker, final List<BgpTableType> localTables,
@Nonnull final Map<TablesKey, PathSelectionMode> bestPathSelectionStrategies, final GeneratedClassLoadingStrategy classStrategy) {
super(InstanceIdentifier.create(BgpRib.class).child(Rib.class, new RibKey(requireNonNull(ribId))),
localBgpId, localAs);
this.localAs = requireNonNull(localAs);
this.bgpIdentifier = requireNonNull(localBgpId);
this.dispatcher = requireNonNull(dispatcher);
this.localTables = ImmutableSet.copyOf(localTables);
this.localTablesKeys = new HashSet<>();
this.domDataBroker = requireNonNull(domDataBroker);
this.service = this.domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class);
this.extensions = requireNonNull(extensions);
this.codecsRegistry = CodecsRegistryImpl.create(codecFactory, classStrategy);
this.ribContextRegistry = RIBSupportContextRegistryImpl.create(extensions, this.codecsRegistry);
final InstanceIdentifierBuilder yangRibIdBuilder = YangInstanceIdentifier.builder().node(BgpRib.QNAME).node(Rib.QNAME);
this.yangRibId = yangRibIdBuilder.nodeWithKey(Rib.QNAME, RIB_ID_QNAME, ribId.getValue()).build();
this.bestPathSelectionStrategies = requireNonNull(bestPathSelectionStrategies);
final ClusterIdentifier cId = clusterId == null ? new ClusterIdentifier(localBgpId) : clusterId;
this.ribId = ribId;
final PolicyDatabase policyDatabase = new PolicyDatabase(this.localAs.getValue(), localBgpId, cId);
this.importPolicyPeerTracker = new ImportPolicyPeerTrackerImpl(policyDatabase);
final ImmutableMap.Builder<TablesKey, ExportPolicyPeerTracker> exportPolicies = new ImmutableMap.Builder<>();
for (final BgpTableType t : this.localTables) {
final TablesKey key = new TablesKey(t.getAfi(), t.getSafi());
this.localTablesKeys.add(key);
exportPolicies.put(key, new ExportPolicyPeerTrackerImpl(policyDatabase, key));
}
this.exportPolicyPeerTrackerMap = exportPolicies.build();
}