本文整理汇总了Java中org.opendaylight.controller.md.sal.binding.api.DataObjectModification.getDataBefore方法的典型用法代码示例。如果您正苦于以下问题:Java DataObjectModification.getDataBefore方法的具体用法?Java DataObjectModification.getDataBefore怎么用?Java DataObjectModification.getDataBefore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.md.sal.binding.api.DataObjectModification
的用法示例。
在下文中一共展示了DataObjectModification.getDataBefore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ouputChanges
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private static void ouputChanges(final DataTreeModification<Cars> change) {
final DataObjectModification<Cars> rootNode = change.getRootNode();
final ModificationType modificationType = rootNode.getModificationType();
final InstanceIdentifier<Cars> rootIdentifier = change.getRootPath().getRootIdentifier();
switch (modificationType) {
case WRITE:
case SUBTREE_MODIFIED: {
final Cars dataBefore = rootNode.getDataBefore();
final Cars dataAfter = rootNode.getDataAfter();
LOG.trace("onDataTreeChanged - Cars config with path {} was added or changed from {} to {}",
rootIdentifier, dataBefore, dataAfter);
break;
}
case DELETE: {
LOG.trace("onDataTreeChanged - Cars config with path {} was deleted", rootIdentifier);
break;
}
default: {
LOG.trace("onDataTreeChanged called with unknown modificationType: {}", modificationType);
break;
}
}
}
示例2: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
/**
* Implemented from the DataTreeChangeListener interface.
*/
@Override
public void onDataTreeChanged(Collection<DataTreeModification<Toaster>> changes) {
for (DataTreeModification<Toaster> change: changes) {
DataObjectModification<Toaster> rootNode = change.getRootNode();
if (rootNode.getModificationType() == WRITE) {
Toaster oldToaster = rootNode.getDataBefore();
Toaster newToaster = rootNode.getDataAfter();
LOG.info("onDataTreeChanged - Toaster config with path {} was added or replaced: "
+ "old Toaster: {}, new Toaster: {}", change.getRootPath().getRootIdentifier(),
oldToaster, newToaster);
Long darkness = newToaster.getDarknessFactor();
if (darkness != null) {
darknessFactor.set(darkness);
}
} else if (rootNode.getModificationType() == DELETE) {
LOG.info("onDataTreeChanged - Toaster config with path {} was deleted: old Toaster: {}",
change.getRootPath().getRootIdentifier(), rootNode.getDataBefore());
}
}
}
示例3: processChanges
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private void processChanges(Collection<DataTreeModification<T>> changes) {
LOG.info("onDataTreeChanged: Received Data Tree Changed {}", changes);
for (DataTreeModification<T> change : changes) {
final InstanceIdentifier<T> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<T> mod = change.getRootNode();
LOG.info("onDataTreeChanged: Received Data Tree Changed Update of Type={} for Key={}",
mod.getModificationType(), key);
switch (mod.getModificationType()) {
case DELETE:
dataProcessor.remove(key, mod.getDataBefore());
break;
case SUBTREE_MODIFIED:
dataProcessor.update(key, mod.getDataBefore(), mod.getDataAfter());
break;
case WRITE:
if (mod.getDataBefore() == null) {
dataProcessor.add(key, mod.getDataAfter());
} else {
dataProcessor.update(key, mod.getDataBefore(), mod.getDataAfter());
}
break;
default:
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
}
}
}
示例4: onPodInterfacesChanged
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void onPodInterfacesChanged(final DataObjectModification<Interface> dataObjectModification,
final InstanceIdentifier<Pods> rootIdentifier,
DataObjectModification<Pods> rootNode) {
Pods pods = rootNode.getDataAfter();
Pods podsBefore = rootNode.getDataBefore();
Interface podInterfaceBefore = dataObjectModification.getDataBefore();
Interface podInterfaceAfter = dataObjectModification.getDataAfter();
switch (dataObjectModification.getModificationType()) {
case DELETE:
remove(podsBefore, podInterfaceBefore);
break;
case SUBTREE_MODIFIED:
update(pods, podsBefore, podInterfaceBefore, podInterfaceAfter);
break;
case WRITE:
if (podInterfaceBefore == null) {
add(pods, podInterfaceAfter);
} else {
update(pods, podsBefore, podInterfaceBefore, podInterfaceAfter);
}
break;
default:
LOG.error("Unhandled Modificiation Type{} for {}", dataObjectModification.getModificationType(),
rootIdentifier);
}
}
示例5: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
@Override
public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Services>> changes) {
for (DataTreeModification<Services> change : changes) {
final DataObjectModification<Services> mod = change.getRootNode();
switch (mod.getModificationType()) {
case DELETE:
LOG.info("Service deleted {}", mod.getDataBefore());
break;
case SUBTREE_MODIFIED:
LOG.info("Service updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
break;
case WRITE:
if (mod.getDataBefore() == null) {
LOG.info("Service added {}", mod.getDataAfter());
} else {
LOG.info("Service updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
}
break;
default:
// FIXME: May be not a good idea to throw.
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
}
}
}
示例6: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeModification<VrfEntry>> changes) {
for (DataTreeModification<VrfEntry> change : changes) {
final InstanceIdentifier<VrfEntry> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<VrfEntry> mod = change.getRootNode();
switch (mod.getModificationType()) {
case DELETE:
numFibEntries -= 1;
break;
case WRITE:
if (mod.getDataBefore() == null) {
numFibEntries += 1;
} else {
// UPDATE COUNT UNCHANGED
}
break;
default:
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
}
}
}
示例7: getOriginal
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public static Node getOriginal(DataObjectModification<Node> mod) {
Node node = null;
switch (mod.getModificationType()) {
case SUBTREE_MODIFIED:
case DELETE:
node = mod.getDataBefore();
break;
case WRITE:
if (mod.getDataBefore() != null) {
node = mod.getDataBefore();
}
break;
default:
break;
}
return node;
}
示例8: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<LogicalRouter>> changes) {
for (DataTreeModification<LogicalRouter> change: changes) {
DataObjectModification<LogicalRouter> rootNode = change.getRootNode();
final LogicalRouter originalRouter = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final LogicalRouter updatedRouter = rootNode.getDataAfter();
if (originalRouter == null) {
LOG.debug("FABMGR: Create Logical Router event: {}", updatedRouter.getUuid().getValue());
ulnMappingEngine.handleLrCreateEvent(updatedRouter);
} else {
LOG.debug("FABMGR: Logical Router Switch event: {}", updatedRouter.getUuid().getValue());
ulnMappingEngine.handleLrUpdateEvent(updatedRouter);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove Logical Router event: {}", originalRouter.getUuid().getValue());
ulnMappingEngine.handleLrRemoveEvent(originalRouter);
break;
default:
break;
}
}
}
示例9: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<LogicalSwitch>> changes) {
for (DataTreeModification<LogicalSwitch> change: changes) {
DataObjectModification<LogicalSwitch> rootNode = change.getRootNode();
final LogicalSwitch originalSwitch = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final LogicalSwitch updatedSwitch = rootNode.getDataAfter();
if (originalSwitch == null) {
LOG.debug("FABMGR: Create Switch event: {}", updatedSwitch.getUuid().getValue());
ulnMappingEngine.handleLswCreateEvent(updatedSwitch);
} else {
LOG.debug("FABMGR: Update Switch event: {}", updatedSwitch.getUuid().getValue());
ulnMappingEngine.handleLswUpdateEvent(updatedSwitch);
}
break;
case DELETE:
final LogicalSwitch deletedSwitch = rootNode.getDataBefore();
LOG.debug("FABMGR: Remove Switch event: {}", deletedSwitch.getUuid().getValue());
ulnMappingEngine.handleLswRemoveEvent(deletedSwitch);
break;
default:
break;
}
}
}
示例10: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<Subnet>> changes) {
for (DataTreeModification<Subnet> change: changes) {
DataObjectModification<Subnet> rootNode = change.getRootNode();
final Subnet originalSubnet = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final Subnet updatedSubnet = rootNode.getDataAfter();
if (originalSubnet == null) {
LOG.debug("FABMGR: Create Subnet event: {}", updatedSubnet.getUuid().getValue());
ulnMappingEngine.handleSubnetCreateEvent(updatedSubnet);
} else {
LOG.debug("FABMGR: Update Subnet event: {}", updatedSubnet.getUuid().getValue());
ulnMappingEngine.handleSubnetUpdateEvent(updatedSubnet);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove Subnet event: {}", originalSubnet.getUuid().getValue());
ulnMappingEngine.handleSubnetRemoveEvent(originalSubnet);
break;
default:
break;
}
}
}
示例11: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<EndpointLocation>> changes) {
for (DataTreeModification<EndpointLocation> change: changes) {
DataObjectModification<EndpointLocation> rootNode = change.getRootNode();
final EndpointLocation originalEPL = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final EndpointLocation updatedEPL = rootNode.getDataAfter();
if (originalEPL == null) {
LOG.debug("FABMGR: Create EndpointLocation event: {}", updatedEPL.getUuid().getValue());
ulnMappingEngine.handleEndpointLocationCreateEvent(updatedEPL);
} else {
LOG.debug("FABMGR: Update EndpointLocation event: {}", updatedEPL.getUuid().getValue());
ulnMappingEngine.handleEndpointLocationUpdateEvent(updatedEPL);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove EndpointLocation event: {}", originalEPL.getUuid().getValue());
ulnMappingEngine.handleEndpointLocationRemoveEvent(originalEPL);
break;
default:
break;
}
}
}
示例12: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<Port>> changes) {
for (DataTreeModification<Port> change: changes) {
DataObjectModification<Port> rootNode = change.getRootNode();
final Port originalPort = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final Port updatedPort = rootNode.getDataAfter();
if (originalPort == null) {
LOG.debug("FABMGR: Create Port event: {}", updatedPort.getUuid().getValue());
ulnMappingEngine.handlePortCreateEvent(updatedPort);
} else {
LOG.debug("FABMGR: Update Port event: {}", updatedPort.getUuid().getValue());
ulnMappingEngine.handlePortUpdateEvent(updatedPort);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove Port event: {}", originalPort.getUuid().getValue());
ulnMappingEngine.handlePortRemoveEvent(originalPort);
break;
default:
break;
}
}
}
示例13: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<Edge>> changes) {
for (DataTreeModification<Edge> change: changes) {
DataObjectModification<Edge> rootNode = change.getRootNode();
final Edge originalEdge = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final Edge updatedEdge = rootNode.getDataAfter();
if (originalEdge == null) {
LOG.debug("FABMGR: Create Edge event: {}", updatedEdge.getUuid().getValue());
ulnMappingEngine.handleEdgeCreateEvent(updatedEdge);
} else {
LOG.debug("FABMGR: Update Edge event: {}", updatedEdge.getUuid().getValue());
ulnMappingEngine.handleEdgeUpdateEvent(updatedEdge);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove Edge event: {}", originalEdge.getUuid().getValue());
ulnMappingEngine.handleEdgeRemoveEvent(originalEdge);
break;
default:
break;
}
}
}
示例14: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<SecurityRuleGroups>> changes) {
for (DataTreeModification<SecurityRuleGroups> change: changes) {
DataObjectModification<SecurityRuleGroups> rootNode = change.getRootNode();
final SecurityRuleGroups originalGroups = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final SecurityRuleGroups updatedGroups = rootNode.getDataAfter();
if (rootNode.getDataBefore() == null) {
LOG.debug("FABMGR: Create SecurityRuleGroups event: {}", updatedGroups.getUuid().getValue());
ulnMappingEngine.handleSecurityRuleGroupsCreateEvent(updatedGroups);
} else {
LOG.debug("FABMGR: Update SecurityRuleGroups event: {}", updatedGroups.getUuid().getValue());
updateRules(updatedGroups, originalGroups);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove SecurityRuleGroups event: {}", originalGroups.getUuid().getValue());
ulnMappingEngine.handleSecurityRuleGroupsRemoveEvent(originalGroups);
break;
default:
break;
}
}
}
示例15: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private <T extends DataObject> void onDataTreeChanged(Collection<DataTreeModification<T>> changes,
BiConsumer<InstanceIdentifier<T>, T> onCreated, BiConsumer<InstanceIdentifier<T>, T> onRemoved) {
for (DataTreeModification<T> change: changes) {
DataObjectModification<T> rootNode = change.getRootNode();
final InstanceIdentifier<T> identifier = change.getRootPath().getRootIdentifier();
switch (rootNode.getModificationType()) {
case WRITE:
if (rootNode.getDataBefore() == null) {
onCreated.accept(identifier, rootNode.getDataAfter());
} else {
LOG.error("No need to support modify!!!");
}
break;
case DELETE:
onRemoved.accept(identifier, rootNode.getDataBefore());
break;
default:
break;
}
}
}