本文整理汇总了Java中org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType方法的典型用法代码示例。如果您正苦于以下问题:Java DataObjectModification.ModificationType方法的具体用法?Java DataObjectModification.ModificationType怎么用?Java DataObjectModification.ModificationType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.md.sal.binding.api.DataObjectModification
的用法示例。
在下文中一共展示了DataObjectModification.ModificationType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModificationType
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
@Override
public DataObjectModification.ModificationType getModificationType() {
switch(domData.getModificationType()) {
case WRITE:
return DataObjectModification.ModificationType.WRITE;
case APPEARED:
case SUBTREE_MODIFIED:
return DataObjectModification.ModificationType.SUBTREE_MODIFIED;
case DISAPPEARED:
case DELETE:
return DataObjectModification.ModificationType.DELETE;
default:
// TODO: Should we lie about modification type instead of exception?
throw new IllegalStateException("Unsupported DOM Modification type " + domData.getModificationType());
}
}
示例2: extractDataChanged
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
/**
* Only when Subtree modification happen this is called .
* @param key - IID of child data
* @param parentModification - Modified data
* @param updatedMacsGrouped - Subtree updated data
* @param deletedMacsGrouped - Subtree deleted datas
*/
private void extractDataChanged(final InstanceIdentifier<P> key,
final DataObjectModification<P> parentModification,
final Map<G, Map<InstanceIdentifier, C>> updatedMacsGrouped,
final Map<G, Map<InstanceIdentifier, C>> deletedMacsGrouped) {
Map<InstanceIdentifier<C>, DataObjectModification<C>> children = getChildMod(key, parentModification);
for (Map.Entry<InstanceIdentifier<C>, DataObjectModification<C>> entry : children.entrySet()) {
DataObjectModification<C> childMod = entry.getValue();
InstanceIdentifier<C> childIid = entry.getKey();
DataObjectModification.ModificationType modificationType = getModificationType(childMod);
G group;
C dataBefore = childMod.getDataBefore();
C dataAfter = childMod.getDataAfter();
switch (modificationType) {
case WRITE:
case SUBTREE_MODIFIED:
group = getGroup(childIid, dataAfter);
updatedMacsGrouped.computeIfAbsent(group, (grp) -> new ConcurrentHashMap<>());
updatedMacsGrouped.get(group).put(childIid, dataAfter);
break;
case DELETE:
group = getGroup(childIid, dataBefore);
deletedMacsGrouped.computeIfAbsent(group, (grp) -> new ConcurrentHashMap<>());
deletedMacsGrouped.get(group).put(childIid, dataBefore);
break;
default:
break;
}
}
}
示例3: getModificationType
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
protected DataObjectModification.ModificationType getModificationType(
final DataObjectModification<? extends DataObject> mod) {
try {
return mod.getModificationType();
} catch (IllegalStateException e) {
//LOG.warn("Failed to get the modification type for mod {}", mod);
}
return null;
}
示例4: getModificationType
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private DataObjectModification.ModificationType getModificationType(
DataObjectModification<? extends DataObject> mod) {
try {
return mod.getModificationType();
} catch (IllegalStateException e) {
//not sure why this getter throws this exception, could be some mdsal bug
LOG.warn("Failed to get the modification type for mod {}", mod);
}
return null;
}
示例5: extractDataChanged
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; //导入方法依赖的package包/类
private void extractDataChanged(final Collection<DataObjectModification<? extends DataObject>> children,
final Map<Class<? extends Identifiable>, List<Identifiable>> updatedData,
final Map<Class<? extends Identifiable>, List<Identifiable>> deletedData) {
if (children == null) {
return;
}
for (DataObjectModification<? extends DataObject> child : children) {
DataObjectModification.ModificationType type = getModificationType(child);
if (type == null) {
continue;
}
InstanceIdentifier instanceIdentifier = null;
Class<? extends Identifiable> childClass = (Class<? extends Identifiable>) child.getDataType();
InstanceIdentifier.PathArgument pathArgument = child.getIdentifier();
switch (type) {
case WRITE:
case SUBTREE_MODIFIED:
DataObject dataAfter = child.getDataAfter();
if (!(dataAfter instanceof Identifiable)) {
continue;
}
DataObject before = child.getDataBefore();
if (Objects.equals(dataAfter, before)) {
/*
in cluster reboot scenarios,
application rewrites the data tx.put( logicalswitchiid, logicalswitch )
that time it fires the update again ignoring such updates here
*/
continue;
}
Identifiable identifiable = (Identifiable) dataAfter;
addToUpdatedData(updatedData, childClass, identifiable);
break;
case DELETE:
DataObject dataBefore = child.getDataBefore();
if (!(dataBefore instanceof Identifiable)) {
continue;
}
addToUpdatedData(deletedData, childClass, (Identifiable)dataBefore);
break;
}
}
}