X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderers%2Fvpp%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fgroupbasedpolicy%2Frenderer%2Fvpp%2Fiface%2FVppEndpointLocationProvider.java;h=93f770e8ac97eeefda6546e81fee9c354e88465d;hb=35b36cec1f8a386c2dbbba06cb585b21ea1ba7a8;hp=e897ff351f1b06b0a48629a9b3a2cc47f0cabcab;hpb=90dcc8c4d1c0e6b0131dfbf36892ade663d78086;p=groupbasedpolicy.git diff --git a/renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/iface/VppEndpointLocationProvider.java b/renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/iface/VppEndpointLocationProvider.java index e897ff351..93f770e8a 100644 --- a/renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/iface/VppEndpointLocationProvider.java +++ b/renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/iface/VppEndpointLocationProvider.java @@ -11,7 +11,10 @@ package org.opendaylight.groupbasedpolicy.renderer.vpp.iface; import static com.google.common.base.Preconditions.checkNotNull; import javax.annotation.Nonnull; - +import com.google.common.base.Function; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; @@ -37,11 +40,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Function; -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; - public class VppEndpointLocationProvider implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(VppEndpointLocationProvider.class); @@ -74,21 +72,18 @@ public class VppEndpointLocationProvider implements AutoCloseable { }); } - public ListenableFuture createLocationForVppEndpoint(VppEndpoint vppEndpoint) { - ProviderAddressEndpointLocation providerAddressEndpointLocation = createProviderAddressEndpointLocation(vppEndpoint); - WriteTransaction wTx = txChain.newWriteOnlyTransaction(); + ListenableFuture createLocationForVppEndpoint(final VppEndpoint vppEndpoint) { + final ProviderAddressEndpointLocation providerAddressEndpointLocation = + createProviderAddressEndpointLocation(vppEndpoint); + final WriteTransaction wTx = txChain.newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.providerAddressEndpointLocationIid( VPP_ENDPOINT_LOCATION_PROVIDER, providerAddressEndpointLocation.getKey()), providerAddressEndpointLocation); LOG.debug("Creating location for {}", providerAddressEndpointLocation.getKey()); - return Futures.transform(wTx.submit(), new Function() { - - @Override - public Void apply(Void input) { - LOG.debug("{} provided location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(), - providerAddressEndpointLocation); - return null; - } + return Futures.transform(wTx.submit(), (Function) input -> { + LOG.debug("{} provided location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(), + providerAddressEndpointLocation); + return null; }); } @@ -106,19 +101,16 @@ public class VppEndpointLocationProvider implements AutoCloseable { .build(); } - public ListenableFuture deleteLocationForVppEndpoint(VppEndpoint vppEndpoint) { - ProviderAddressEndpointLocationKey provAddrEpLocKey = createProviderAddressEndpointLocationKey(vppEndpoint); - WriteTransaction wTx = txChain.newWriteOnlyTransaction(); + ListenableFuture deleteLocationForVppEndpoint(final VppEndpoint vppEndpoint) { + final ProviderAddressEndpointLocationKey provAddrEpLocKey = + createProviderAddressEndpointLocationKey(vppEndpoint); + final WriteTransaction wTx = txChain.newWriteOnlyTransaction(); wTx.delete(LogicalDatastoreType.CONFIGURATION, IidFactory.providerAddressEndpointLocationIid(VPP_ENDPOINT_LOCATION_PROVIDER, provAddrEpLocKey)); LOG.debug("Deleting location for {}", provAddrEpLocKey); - return Futures.transform(wTx.submit(), new Function() { - - @Override - public Void apply(Void input) { - LOG.debug("{} removed location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(), provAddrEpLocKey); - return null; - } + return Futures.transform(wTx.submit(), (Function) input -> { + LOG.debug("{} removed location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(), provAddrEpLocKey); + return null; }); }