summaryrefslogtreecommitdiffstats
path: root/v3po/vpp-facade-spi/src
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-04-12 10:13:14 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-04-12 10:13:14 +0200
commitc7ca517b00f2682987aef3ac390dfc04155a8aee (patch)
tree662791d6e857234dab467d9cddd55300060ccaca /v3po/vpp-facade-spi/src
parent4a3dce3e0e59df4e091b4f8d4efc3e20831bf22f (diff)
HONEYCOMB-9: Split impl module into smaller parts
Change-Id: I9232e0adfe611cb97951080839b28a7b62ba5484 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/vpp-facade-spi/src')
-rw-r--r--v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ChildVppReaderCustomizer.java41
-rw-r--r--v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ListVppReaderCustomizer.java54
-rw-r--r--v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/RootVppReaderCustomizer.java52
-rw-r--r--v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ChildVppWriterCustomizer.java42
-rw-r--r--v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ListVppWriterCustomizer.java45
-rw-r--r--v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/RootVppWriterCustomizer.java67
6 files changed, 301 insertions, 0 deletions
diff --git a/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ChildVppReaderCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ChildVppReaderCustomizer.java
new file mode 100644
index 000000000..376474301
--- /dev/null
+++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ChildVppReaderCustomizer.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.v3po.vpp.facade.spi.read;
+
+import com.google.common.annotations.Beta;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * CompositeChildVppReader SPI to customize its behavior
+ *
+ * @param <C> Specific DataObject derived type (Identifiable), that is handled by this customizer
+ * @param <B> Specific Builder for handled type (C)
+ */
+@Beta
+public interface ChildVppReaderCustomizer<C extends DataObject, B extends Builder<C>> extends
+ RootVppReaderCustomizer<C, B> {
+
+ // FIXME need to capture parent builder type, but that's inconvenient at best, is it ok to leave it Builder<?> and
+ // cast in specific customizers ? ... probably better than adding another type parameter
+
+ /**
+ * Merge read data into provided parent builder
+ */
+ void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final C readValue);
+}
diff --git a/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ListVppReaderCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ListVppReaderCustomizer.java
new file mode 100644
index 000000000..610b2da8b
--- /dev/null
+++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/ListVppReaderCustomizer.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.v3po.vpp.facade.spi.read;
+
+import com.google.common.annotations.Beta;
+import io.fd.honeycomb.v3po.vpp.facade.Context;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * CompositeListVppReader SPI to customize its behavior
+ *
+ * @param <C> Specific DataObject derived type (Identifiable), that is handled by this customizer
+ * @param <K> Specific Identifier for handled type (C)
+ * @param <B> Specific Builder for handled type (C)
+ */
+@Beta
+public interface ListVppReaderCustomizer<C extends DataObject & Identifiable<K>, K extends Identifier<C>, B extends Builder<C>>
+ extends RootVppReaderCustomizer<C, B> {
+
+ /**
+ * Return list with IDs of all list nodes to be read.
+ *
+ * @param id Wildcarded ID pointing to list node managed by enclosing reader
+ * @param context Read context
+ */
+ @Nonnull
+ List<K> getAllIds(@Nonnull final InstanceIdentifier<C> id, @Nonnull final Context context);
+ // TODO does it make sense with vpp APIs ? Should we replace it with a simple readAll ?
+
+ /**
+ * Merge read data into provided parent builder
+ */
+ void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<C> readData);
+}
diff --git a/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/RootVppReaderCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/RootVppReaderCustomizer.java
new file mode 100644
index 000000000..8035933df
--- /dev/null
+++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/read/RootVppReaderCustomizer.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.v3po.vpp.facade.spi.read;
+
+import com.google.common.annotations.Beta;
+import io.fd.honeycomb.v3po.vpp.facade.Context;
+import io.fd.honeycomb.v3po.vpp.facade.read.ReadFailedException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * CompositeRootVppReader SPI to customize its behavior
+ *
+ * @param <C> Specific DataObject derived type, that is handled by this customizer
+ * @param <B> Specific Builder for handled type (C)
+ */
+@Beta
+public interface RootVppReaderCustomizer<C extends DataObject, B extends Builder<C>> {
+
+ /**
+ * Creates new builder that will be used to build read value.
+ */
+ @Nonnull
+ B getBuilder(@Nonnull final InstanceIdentifier<C> id);
+
+
+ /**
+ * Adds current data (identified by id) to the provided builder.
+ *
+ * @param id id of current data object
+ * @param builder builder for creating read value
+ * @throws ReadFailedException if read was unsuccessful
+ */
+ void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder,
+ @Nonnull final Context ctx) throws ReadFailedException;
+}
diff --git a/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ChildVppWriterCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ChildVppWriterCustomizer.java
new file mode 100644
index 000000000..7b7e257a2
--- /dev/null
+++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ChildVppWriterCustomizer.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.v3po.vpp.facade.spi.write;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Optional;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * CompositeChildVppWriter SPI to customize its behavior
+ *
+ * @param <D> Specific DataObject derived type (Identifiable), that is handled by this customizer
+ */
+@Beta
+public interface ChildVppWriterCustomizer<D extends DataObject> extends RootVppWriterCustomizer<D> {
+
+ /**
+ * Get child of parentData identified by currentId
+ *
+ * @param currentId Identifier(from root) of data being extracted
+ * @param parentData Parent data object from which managed data object must be extracted
+ */
+ @Nonnull
+ Optional<D> extract(@Nonnull final InstanceIdentifier<D> currentId, @Nonnull final DataObject parentData);
+
+}
diff --git a/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ListVppWriterCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ListVppWriterCustomizer.java
new file mode 100644
index 000000000..b4bf1aa41
--- /dev/null
+++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/ListVppWriterCustomizer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.v3po.vpp.facade.spi.write;
+
+import com.google.common.annotations.Beta;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * CompositeListVppWriter SPI to customize its behavior
+ *
+ * @param <C> Specific DataObject derived type (Identifiable), that is handled by this customizer
+ * @param <K> Specific Identifier for handled type (C)
+ */
+@Beta
+public interface ListVppWriterCustomizer<C extends DataObject & Identifiable<K>, K extends Identifier<C>> extends RootVppWriterCustomizer<C> {
+
+ /**
+ * Get children of parentData identified by currentId
+ *
+ * @param currentId Identifier(from root) of data being extracted
+ * @param parentData Parent data object from which managed data object must be extracted
+ */
+ @Nonnull
+ List<C> extract(@Nonnull final InstanceIdentifier<C> currentId, @Nonnull final DataObject parentData);
+
+} \ No newline at end of file
diff --git a/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/RootVppWriterCustomizer.java b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/RootVppWriterCustomizer.java
new file mode 100644
index 000000000..1335e8afb
--- /dev/null
+++ b/v3po/vpp-facade-spi/src/main/java/io/fd/honeycomb/v3po/vpp/facade/spi/write/RootVppWriterCustomizer.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.v3po.vpp.facade.spi.write;
+
+import com.google.common.annotations.Beta;
+import io.fd.honeycomb.v3po.vpp.facade.Context;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * CompositeRootVppReader SPI to customize its behavior
+ *
+ * @param <D> Specific DataObject derived type, that is handled by this customizer
+ */
+@Beta
+public interface RootVppWriterCustomizer<D extends DataObject> {
+
+ /**
+ * Handle write operation. C from CRUD.
+ *
+ * @param id Identifier(from root) of data being written
+ * @param dataAfter New data to be written
+ * @param writeContext Write context can be used to store any useful information and then utilized by other customizers
+ */
+ void writeCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
+ @Nonnull final D dataAfter,
+ @Nonnull final Context writeContext);
+
+ /**
+ * Handle update operation. U from CRUD.
+ *
+ * @param id Identifier(from root) of data being written
+ * @param dataBefore Old data
+ * @param dataAfter New, updated data
+ * @param writeContext Write context can be used to store any useful information and then utilized by other customizers
+ */
+ void updateCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
+ @Nonnull final D dataBefore,
+ @Nonnull final D dataAfter,
+ @Nonnull final Context writeContext);
+
+ /**
+ * Handle delete operation. D from CRUD.
+ *
+ * @param id Identifier(from root) of data being written
+ * @param dataBefore Old data being deleted
+ * @param writeContext Write context can be used to store any useful information and then utilized by other customizers
+ */
+ void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
+ @Nonnull final D dataBefore,
+ @Nonnull final Context writeContext);
+}