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
diff --git a/opendaylight/sal/yang-prototype/sal/sal-core-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataValidator.java b/opendaylight/sal/yang-prototype/sal/sal-core-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataValidator.java
new file mode 100644 (file)
index 0000000..a2105b4
--- /dev/null
@@ -0,0 +1,57 @@
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.controller.sal.core.api.data;\r
+\r
+import java.util.Set;\r
+\r
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
+import org.opendaylight.controller.sal.core.api.Provider;\r
+import org.opendaylight.controller.yang.common.RpcResult;\r
+import org.opendaylight.controller.yang.data.api.CompositeNode;\r
+\r
+\r
+/**\r
+ * {@link Provider}-supplied Validator of the data.\r
+ * \r
+ * <p>\r
+ * The registration could be done by :\r
+ * <ul>\r
+ * <li>returning an instance of implementation in the return value of\r
+ * {@link Provider#getProviderFunctionality()}\r
+ * <li>passing an instance of implementation and {@link DataStoreIdentifier} rpc\r
+ * as arguments to the\r
+ * {@link DataProviderService#addValidator(DataStoreIdentifier, DataValidator)}\r
+ * </ul>\r
+ * \r
+ **/\r
+public interface DataValidator extends Provider.ProviderFunctionality {\r
+\r
+    /**\r
+     * A set of Data Stores supported by implementation.\r
+     * \r
+     * The set of {@link DataStoreIdentifier}s which identifies target data\r
+     * stores which are supported by this implementation. This set is used, when\r
+     * {@link Provider} is registered to the SAL, to register and expose the\r
+     * validation functionality to affected data stores.\r
+     * \r
+     * @return Set of Data Store identifiers\r
+     */\r
+    Set<DataStoreIdentifier> getSupportedDataStores();\r
+\r
+    /**\r
+     * Performs validation on supplied data.\r
+     * \r
+     * @param toValidate\r
+     *            Data to validate\r
+     * @return Validation result. The\r
+     *         <code>{@link RpcResult#isSuccessful()} == true</code> if the data\r
+     *         passed validation, otherwise contains list of errors.\r
+     */\r
+    RpcResult<Void> validate(CompositeNode toValidate);\r
+\r
+}\r