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.lcmapi;
19 import io.fd.honeycomb.translate.read.ReadFailedException;
20 import io.fd.honeycomb.translate.write.WriteFailedException;
21 import java.util.List;
22 import javax.annotation.Nonnull;
23 import org.opendaylight.yangtools.yang.binding.DataObject;
24 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
27 * Example of an aggregated access interface.
29 * Shared by all the customizers hiding the ugly details of our data management.
33 public interface CrudService<T extends DataObject> {
36 * Perform write of provided data.
38 void writeData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
39 throws WriteFailedException;
43 * Perform delete of existing data.
45 void deleteData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
46 throws WriteFailedException;
49 * Perform update of existing data.
51 void updateData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T dataOld,
52 @Nonnull final T dataNew)
53 throws WriteFailedException;
56 * Read data identified by provided identifier.
58 T readSpecific(@Nonnull final InstanceIdentifier<T> identifier) throws ReadFailedException;
61 * Read all nodes of type {@link T}.
63 List<T> readAll() throws ReadFailedException;