2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.v3po.translate.read.registry;
19 import com.google.common.annotations.Beta;
20 import com.google.common.base.Optional;
21 import com.google.common.collect.Multimap;
22 import io.fd.honeycomb.v3po.translate.read.ReadContext;
23 import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
24 import javax.annotation.Nonnull;
25 import org.opendaylight.yangtools.yang.binding.DataObject;
26 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
29 * Simple delegating reader suitable as a holder for all other root readers, providing readAll feature.
32 public interface ReaderRegistry {
35 * Performs read on all registered root readers and merges the results into a Multimap. Keys represent identifiers
36 * for root DataObjects from the data tree modeled by YANG.
38 * @param ctx Read context
40 * @return multimap that preserves deterministic iteration order across non-distinct key values
41 * @throws ReadFailedException if read was unsuccessful
44 Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll(@Nonnull final ReadContext ctx)
45 throws ReadFailedException;
48 * Reads data identified by id.
50 * @param id unique identifier of subtree to be read. The subtree must contain managed data object type. For
51 * identifiers pointing below node managed by this reader, it's reader's responsibility to filter out the
52 * right node or to delegate the read to a child reader.
53 * @param ctx Read context
55 * @return List of DataObjects identified by id. If the ID points to a single node, it will be wrapped in a list
56 * @throws ReadFailedException if read was unsuccessful
59 Optional<? extends DataObject> read(@Nonnull InstanceIdentifier<? extends DataObject> id,
60 @Nonnull ReadContext ctx)
61 throws ReadFailedException;