Fix checkstyle violations in test bundles
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowpluginTableFeaturesTestServiceProvider.java
index 2d9df2985772ebe642bf03f05fd304cd5803793b..8150887a7dd13961c90210e763fc28c7a295c58a 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * Copyright (c) 2013 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
@@ -9,7 +9,6 @@
 package org.opendaylight.openflowplugin.test;
 
 import java.util.concurrent.Future;
-
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
@@ -21,8 +20,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
+import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -32,14 +31,14 @@ import org.slf4j.LoggerFactory;
 public class OpenflowpluginTableFeaturesTestServiceProvider implements
         AutoCloseable, SalTableService {
 
-    private final static Logger LOG = LoggerFactory
+    private static final Logger LOG = LoggerFactory
             .getLogger(OpenflowpluginTableFeaturesTestServiceProvider.class);
     private RoutedRpcRegistration<SalTableService> tableRegistration;
     private NotificationProviderService notificationService;
 
     /**
-     * get table registration
-     * 
+     * Get table registration.
+     *
      * @return {@link #tableRegistration}
      */
     public RoutedRpcRegistration<SalTableService> getTableRegistration() {
@@ -47,9 +46,7 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
     }
 
     /**
-     * set {@link #tableRegistration}
-     * 
-     * @param tableRegistration
+     * Set {@link #tableRegistration}.
      */
     public void setTableRegistration(
             final RoutedRpcRegistration<SalTableService> tableRegistration) {
@@ -57,8 +54,8 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
     }
 
     /**
-     * get notification service
-     * 
+     * Get notification service.
+     *
      * @return {@link #notificationService}
      */
     public NotificationProviderService getNotificationService() {
@@ -66,9 +63,7 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
     }
 
     /**
-     * set {@link #notificationService}
-     * 
-     * @param notificationService
+     * Set {@link #notificationService}.
      */
     public void setNotificationService(
             final NotificationProviderService notificationService) {
@@ -82,7 +77,7 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.AutoCloseable#close()
      */
     @Override
@@ -94,7 +89,7 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026
      * .SalTableService
@@ -104,34 +99,27 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
     @Override
     public Future<RpcResult<UpdateTableOutput>> updateTable(
             UpdateTableInput input) {
-        String plus = ("updateTable - " + input);
+        String plus = "updateTable - " + input;
         OpenflowpluginTableFeaturesTestServiceProvider.LOG.info(plus);
         return null;
     }
 
-    /**
-     * @param ctx
-     * @return {@link CompositeObjectRegistrationBuilder #toInstance()}
-     */
-    public CompositeObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider> register(
+    public ObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider> register(
             final ProviderContext ctx) {
-        CompositeObjectRegistrationBuilder<OpenflowpluginTableFeaturesTestServiceProvider> builder = CompositeObjectRegistration
-                .<OpenflowpluginTableFeaturesTestServiceProvider> builderFor(this);
-
         RoutedRpcRegistration<SalTableService> addRoutedRpcImplementation = ctx
-                .<SalTableService> addRoutedRpcImplementation(
+                .<SalTableService>addRoutedRpcImplementation(
                         SalTableService.class, this);
 
         setTableRegistration(addRoutedRpcImplementation);
 
         InstanceIdentifierBuilder<Nodes> builder1 = InstanceIdentifier
-                .<Nodes> builder(Nodes.class);
+                .<Nodes>builder(Nodes.class);
 
         NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID);
         NodeKey nodeKey = new NodeKey(nodeId);
 
         InstanceIdentifierBuilder<Node> nodeIndentifier = builder1
-                .<Node, NodeKey> child(Node.class, nodeKey);
+                .<Node, NodeKey>child(Node.class, nodeKey);
 
         InstanceIdentifier<Node> instance = nodeIndentifier.build();
 
@@ -140,9 +128,11 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
         RoutedRpcRegistration<SalTableService> tableRegistration1 = this
                 .getTableRegistration();
 
-        builder.add(tableRegistration1);
-
-        return builder.build();
+        return new AbstractObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider>(this) {
+            @Override
+            protected void removeRegistration() {
+                tableRegistration1.close();
+            }
+        };
     }
-
 }