Fix HTTP response for duplicate module
[cps.git] / cps-service / src / main / java / org / onap / cps / api / CpService.java
old mode 100644 (file)
new mode 100755 (executable)
index 4d94a46..726ca0f
@@ -21,9 +21,9 @@
 package org.onap.cps.api;
 
 import java.io.File;
-import java.io.IOException;
+import org.onap.cps.api.model.AnchorDetails;
+import org.onap.cps.exceptions.CpsValidationException;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
 
 /**
  * Configuration and persistency service interface which holds methods for parsing and storing yang models and data.
@@ -36,7 +36,7 @@ public interface CpService {
      * @param yangModelContent the input stream
      * @return the schema context
      */
-    SchemaContext parseAndValidateModel(final String yangModelContent);
+    SchemaContext parseAndValidateModel(String yangModelContent);
 
     /**
      * Parse and validate a file representing a yang model to generate a schema context.
@@ -44,15 +44,16 @@ public interface CpService {
      * @param yangModelFile the yang file
      * @return the schema context
      */
-    SchemaContext parseAndValidateModel(final File yangModelFile);
+    SchemaContext parseAndValidateModel(File yangModelFile);
 
     /**
      * Store schema context for a yang model.
      *
      * @param schemaContext the schema context
      * @param dataspaceName the dataspace name
+     * @throws CpsValidationException if input data already exists.
      */
-    void storeSchemaContext(final SchemaContext schemaContext, final String dataspaceName);
+    void storeSchemaContext(SchemaContext schemaContext, String dataspaceName);
 
     /**
      * Store the JSON structure in the database.
@@ -60,7 +61,7 @@ public interface CpService {
      * @param jsonStructure the JSON structure.
      * @return entity ID.
      */
-    Integer storeJsonStructure(final String jsonStructure);
+    Integer storeJsonStructure(String jsonStructure);
 
     /**
      * Read a JSON Object using the object identifier.
@@ -68,12 +69,21 @@ public interface CpService {
      * @param jsonObjectId the JSON object identifier.
      * @return the JSON structure.
      */
-    String getJsonById(final int jsonObjectId);
+    String getJsonById(int jsonObjectId);
 
     /**
      * Delete a JSON Object using the object identifier.
      *
      * @param jsonObjectId the JSON object identifier.
      */
-    void deleteJsonById(final int jsonObjectId);
+    void deleteJsonById(int jsonObjectId);
+
+    /**
+     * Create an anchor using provided anchorDetails object.
+     *
+     * @param anchorDetails the anchor details object.
+     * @return the anchor name.
+     * @throws CpsValidationException if input data is invalid.
+     */
+    String createAnchor(AnchorDetails anchorDetails);
 }