Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / yang-prototype / sal / sal-core-api / src / main / java / org / opendaylight / controller / sal / core / api / data / DataValidator.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.controller.sal.core.api.data;\r
9 \r
10 import java.util.Set;\r
11 \r
12 import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
13 import org.opendaylight.controller.sal.core.api.Provider;\r
14 import org.opendaylight.controller.yang.common.RpcResult;\r
15 import org.opendaylight.controller.yang.data.api.CompositeNode;\r
16 \r
17 \r
18 /**\r
19  * {@link Provider}-supplied Validator of the data.\r
20  * \r
21  * <p>\r
22  * The registration could be done by :\r
23  * <ul>\r
24  * <li>returning an instance of implementation in the return value of\r
25  * {@link Provider#getProviderFunctionality()}\r
26  * <li>passing an instance of implementation and {@link DataStoreIdentifier} rpc\r
27  * as arguments to the\r
28  * {@link DataProviderService#addValidator(DataStoreIdentifier, DataValidator)}\r
29  * </ul>\r
30  * \r
31  **/\r
32 public interface DataValidator extends Provider.ProviderFunctionality {\r
33 \r
34     /**\r
35      * A set of Data Stores supported by implementation.\r
36      * \r
37      * The set of {@link DataStoreIdentifier}s which identifies target data\r
38      * stores which are supported by this implementation. This set is used, when\r
39      * {@link Provider} is registered to the SAL, to register and expose the\r
40      * validation functionality to affected data stores.\r
41      * \r
42      * @return Set of Data Store identifiers\r
43      */\r
44     Set<DataStoreIdentifier> getSupportedDataStores();\r
45 \r
46     /**\r
47      * Performs validation on supplied data.\r
48      * \r
49      * @param toValidate\r
50      *            Data to validate\r
51      * @return Validation result. The\r
52      *         <code>{@link RpcResult#isSuccessful()} == true</code> if the data\r
53      *         passed validation, otherwise contains list of errors.\r
54      */\r
55     RpcResult<Void> validate(CompositeNode toValidate);\r
56 \r
57 }\r