Delete netconf
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / RestconfImpl.java
index 38d41ddb2e664e5e018b73bc2f8c46aeaf05ad45..bc84832b78f638a975d167ac8a1e520306ea8982 100644 (file)
@@ -1,11 +1,11 @@
 /**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- * Copyright (c) 2014 Brocade Communication Systems, Inc.
+ * Copyright (c) 2014, 2015 Brocade Communication Systems, Inc., Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
+
 package org.opendaylight.controller.sal.restconf.impl;
 
 import com.google.common.base.Optional;
@@ -194,7 +194,7 @@ public class RestconfImpl implements RestconfService {
 
         return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, modulesSchemaNode,
                 null, schemaContext), moduleContainerBuilder.build(),
-                QueryParametersParser.parseKnownWriterParameters(uriInfo));
+                QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     /**
@@ -226,7 +226,7 @@ public class RestconfImpl implements RestconfService {
 
         return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, modulesSchemaNode,
                 mountPoint, controllerContext.getGlobalSchema()), moduleContainerBuilder.build(),
-                QueryParametersParser.parseKnownWriterParameters(uriInfo));
+                QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     @Override
@@ -262,7 +262,7 @@ public class RestconfImpl implements RestconfService {
         Preconditions.checkState(moduleSchemaNode instanceof ListSchemaNode);
 
         return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, moduleSchemaNode, mountPoint,
-                schemaContext), moduleMap, QueryParametersParser.parseKnownWriterParameters(uriInfo));
+                schemaContext), moduleMap, QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     @Override
@@ -291,7 +291,7 @@ public class RestconfImpl implements RestconfService {
 
 
         return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, streamsContainerSchemaNode, null,
-                schemaContext), streamsContainerBuilder.build(), QueryParametersParser.parseKnownWriterParameters(uriInfo));
+                schemaContext), streamsContainerBuilder.build(), QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     @Override
@@ -462,7 +462,7 @@ public class RestconfImpl implements RestconfService {
 
         return new NormalizedNodeContext(new InstanceIdentifierContext<RpcDefinition>(null,
                 resultNodeSchema, mountPoint, schemaContext), resultData,
-                QueryParametersParser.parseKnownWriterParameters(uriInfo));
+                QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     private DOMRpcResult checkRpcResponse(final CheckedFuture<DOMRpcResult, DOMRpcException> response) {
@@ -640,7 +640,7 @@ public class RestconfImpl implements RestconfService {
         }
 
         return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, resultNodeSchema, mountPoint,
-                schemaContext), resultData, QueryParametersParser.parseKnownWriterParameters(uriInfo));
+                schemaContext), resultData, QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     private RpcDefinition findRpc(final SchemaContext schemaContext, final String identifierDecoded) {
@@ -678,7 +678,7 @@ public class RestconfImpl implements RestconfService {
             LOG.debug(errMsg + identifier);
             throw new RestconfDocumentedException(errMsg, ErrorType.APPLICATION, ErrorTag.DATA_MISSING);
         }
-        return new NormalizedNodeContext(iiWithData, data, QueryParametersParser.parseKnownWriterParameters(uriInfo));
+        return new NormalizedNodeContext(iiWithData, data, QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     @Override
@@ -697,7 +697,7 @@ public class RestconfImpl implements RestconfService {
             LOG.debug(errMsg + identifier);
             throw new RestconfDocumentedException(errMsg , ErrorType.APPLICATION, ErrorTag.DATA_MISSING);
         }
-        return new NormalizedNodeContext(iiWithData, data, QueryParametersParser.parseKnownWriterParameters(uriInfo));
+        return new NormalizedNodeContext(iiWithData, data, QueryParametersParser.parseWriterParameters(uriInfo));
     }
 
     @Override
@@ -747,6 +747,10 @@ public class RestconfImpl implements RestconfService {
                     LOG.debug("Update ConfigDataStore fail " + identifier, e);
                     throw new RestconfDocumentedException(e.getMessage(), e, e.getErrorList());
                 }
+            } catch (Exception e) {
+                final String errMsg = "Error updating data ";
+                LOG.debug(errMsg + identifier, e);
+                throw new RestconfDocumentedException(errMsg, e);
             }
         }
 
@@ -881,7 +885,7 @@ public class RestconfImpl implements RestconfService {
             throw e;
         } catch (final Exception e) {
             final String errMsg = "Error creating data ";
-            LOG.info(errMsg + uriInfo.getPath(), e);
+            LOG.info(errMsg + (uriInfo != null ? uriInfo.getPath() : ""), e);
             throw new RestconfDocumentedException(errMsg, e);
         }