Merge "BUG 1839 - HTTP delete of non existing data"
authorTony Tkacik <ttkacik@cisco.com>
Mon, 27 Oct 2014 10:22:29 +0000 (10:22 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 27 Oct 2014 10:22:29 +0000 (10:22 +0000)
1  2 
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.java

@@@ -7,9 -7,18 +7,18 @@@
   */
  package org.opendaylight.controller.sal.restconf.impl;
  
+ import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
+ import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
  import com.google.common.base.Optional;
  import com.google.common.util.concurrent.CheckedFuture;
  import com.google.common.util.concurrent.ListenableFuture;
+ import java.util.ArrayList;
+ import java.util.Iterator;
+ import java.util.List;
+ import java.util.concurrent.ExecutionException;
+ import java.util.concurrent.Future;
+ import javax.ws.rs.core.Response.Status;
  import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
  import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
  import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@@ -37,16 -46,6 +46,6 @@@ import org.opendaylight.yangtools.yang.
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
- import javax.ws.rs.core.Response.Status;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- import java.util.concurrent.ExecutionException;
- import java.util.concurrent.Future;
- import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
- import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
  public class BrokerFacade {
      private final static Logger LOG = LoggerFactory.getLogger(BrokerFacade.class);
  
      private CheckedFuture<Void, TransactionCommitFailedException> deleteDataViaTransaction(
              final DOMDataWriteTransaction writeTransaction, final LogicalDatastoreType datastore,
              YangInstanceIdentifier path) {
 -        LOG.info("Delete " + datastore.name() + " via Restconf: {}", path);
 +        LOG.trace("Delete " + datastore.name() + " via Restconf: {}", path);
          writeTransaction.delete(datastore, path);
          return writeTransaction.submit();
      }
  
              try {
  
-                 CheckedFuture<Boolean, ReadFailedException> future =
-                     rwTx.exists(store, currentPath);
+                 CheckedFuture<Boolean, ReadFailedException> future = rwTx.exists(store, currentPath);
                  exists = future.checkedGet();
              } catch (ReadFailedException e) {
                  LOG.error("Failed to read pre-existing data from store {} path {}", store, currentPath, e);
                  throw new IllegalStateException("Failed to read pre-existing data", e);
              }
  
              if (!exists && iterator.hasNext()) {
                  rwTx.merge(store, currentPath, currentOp.createDefault(currentArg));
              }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.