Add health check to vLBMS
[demo.git] / vnfs / vLBMS / apis / health-vnf-onap-plugin / health-vnf-onap-plugin-impl / src / main / java / org / onap / vnf / health / CrudService.java
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.vnf.health;
18
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;
25
26 /**
27  * Example of an aggregated access interface.
28  * <p/>
29  * Shared by all the customizers hiding the ugly details of our data management.
30  *
31  * TODO update javadoc
32  */
33 public interface CrudService<T extends DataObject> {
34
35     /**
36      * Perform write of provided data.
37      */
38     void writeData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
39             throws WriteFailedException;
40
41
42     /**
43      * Perform delete of existing data.
44      */
45     void deleteData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
46             throws WriteFailedException;
47
48     /**
49      * Perform update of existing data.
50      */
51     void updateData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T dataOld,
52                            @Nonnull final T dataNew)
53             throws WriteFailedException;
54
55     /**
56      * Read data identified by provided identifier.
57      */
58     T readSpecific(@Nonnull final InstanceIdentifier<T> identifier) throws ReadFailedException;
59
60     /**
61      * Read all nodes of type {@link T}.
62      */
63     List<T> readAll() throws ReadFailedException;
64 }