summaryrefslogtreecommitdiffstats
path: root/infra/translate-api
diff options
context:
space:
mode:
Diffstat (limited to 'infra/translate-api')
-rw-r--r--infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModifiableSubtreeManagerRegistryBuilder.java24
-rw-r--r--infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java11
2 files changed, 31 insertions, 4 deletions
diff --git a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModifiableSubtreeManagerRegistryBuilder.java b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModifiableSubtreeManagerRegistryBuilder.java
index 4e6b2d805..ad9cd2b6f 100644
--- a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModifiableSubtreeManagerRegistryBuilder.java
+++ b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModifiableSubtreeManagerRegistryBuilder.java
@@ -16,12 +16,13 @@
package io.fd.honeycomb.translate;
-import java.util.Collection;
-import java.util.Set;
-import javax.annotation.Nonnull;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import javax.annotation.Nonnull;
+import java.util.Collection;
+import java.util.Set;
+
/**
* Registry builder where {@link SubtreeManager}s can be added with or without relationships between them.
* The relationships express what the order of execution should be.
@@ -42,6 +43,11 @@ public interface ModifiableSubtreeManagerRegistryBuilder<S extends SubtreeManage
@Nonnull S handler);
/**
+ * Add a handler responsible for writing all complex nodes within a subtree its responsible for.
+ */
+ ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAdd(@Nonnull S handler);
+
+ /**
* Add a handler and make sure it will be executed before handler identifier by relatedType is executed.
*/
ModifiableSubtreeManagerRegistryBuilder<S> addBefore(@Nonnull S handler,
@@ -50,6 +56,12 @@ public interface ModifiableSubtreeManagerRegistryBuilder<S extends SubtreeManage
ModifiableSubtreeManagerRegistryBuilder<S> addBefore(@Nonnull S handler,
@Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
+ ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddBefore(@Nonnull S handler,
+ @Nonnull InstanceIdentifier<?> relatedType);
+
+ ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddBefore(@Nonnull S handler,
+ @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
+
ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddBefore(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
@Nonnull S handler,
@Nonnull InstanceIdentifier<?> relatedType);
@@ -67,6 +79,12 @@ public interface ModifiableSubtreeManagerRegistryBuilder<S extends SubtreeManage
ModifiableSubtreeManagerRegistryBuilder<S> addAfter(@Nonnull S handler,
@Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
+ ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddAfter(@Nonnull S handler,
+ @Nonnull InstanceIdentifier<?> relatedType);
+
+ ModifiableSubtreeManagerRegistryBuilder<S> wildcardedSubtreeAddAfter(@Nonnull S handler,
+ @Nonnull Collection<InstanceIdentifier<?>> relatedTypes);
+
ModifiableSubtreeManagerRegistryBuilder<S> subtreeAddAfter(@Nonnull Set<InstanceIdentifier<?>> handledChildren,
@Nonnull S handler,
@Nonnull InstanceIdentifier<?> relatedType);
diff --git a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java
index 1a16b72e6..18573e58a 100644
--- a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java
+++ b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/write/Writer.java
@@ -47,8 +47,17 @@ public interface Writer<D extends DataObject> extends SubtreeManager<D> {
@Nonnull final WriteContext ctx) throws WriteFailedException;
/**
- * Indicates whether there is direct support for updating nodes handled by this writer,
+ * Indicates whether there is direct support for updating nodes handled by writer,
* or they must be broken up to individual deletes and creates.
*/
boolean supportsDirectUpdate();
+
+ /**
+ * Returns true if node identified by this identifier can be processes by this writer
+ *
+ * @param instanceIdentifier identifier to be checked
+ */
+ default boolean canProcess(@Nonnull final InstanceIdentifier<? extends DataObject> instanceIdentifier) {
+ return getManagedDataObjectType().equals(instanceIdentifier);
+ }
}