Bug 8879: Migrate controller to the new XML parser
[controller.git] / opendaylight / blueprint / src / main / java / org / opendaylight / controller / blueprint / ext / RoutedRpcMetadata.java
index 4b71d92e57be3b5b03b4f6460cb6061609c577a2..725e568785efd2bf2367335d7d9cc82210dc2417 100644 (file)
@@ -34,7 +34,7 @@ class RoutedRpcMetadata implements ComponentFactoryMetadata {
     private final String implementationRefId;
     private ExtendedBlueprintContainer container;
 
-    RoutedRpcMetadata(String id, String interfaceName, String implementationRefId) {
+    RoutedRpcMetadata(final String id, final String interfaceName, final String implementationRefId) {
         this.id = id;
         this.interfaceName = interfaceName;
         this.implementationRefId = implementationRefId;
@@ -56,12 +56,13 @@ class RoutedRpcMetadata implements ComponentFactoryMetadata {
     }
 
     @Override
-    public void init(ExtendedBlueprintContainer container) {
-        this.container = container;
+    public void init(final ExtendedBlueprintContainer newContainer) {
+        this.container = newContainer;
 
         LOG.debug("{}: In init", logName());
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public Object create() throws ComponentDefinitionException {
         RpcProviderRegistry rpcRegistry = (RpcProviderRegistry) container.getComponentInstance(
@@ -70,7 +71,7 @@ class RoutedRpcMetadata implements ComponentFactoryMetadata {
         Object implementation = container.getComponentInstance(implementationRefId);
 
         try {
-            if(!RpcService.class.isAssignableFrom(implementation.getClass())) {
+            if (!RpcService.class.isAssignableFrom(implementation.getClass())) {
                 throw new ComponentDefinitionException(String.format(
                         "Implementation \"ref\" instance %s for \"%s\" is not an RpcService",
                         implementation.getClass(), ROUTED_RPC_IMPLEMENTATION));
@@ -80,10 +81,10 @@ class RoutedRpcMetadata implements ComponentFactoryMetadata {
                     interfaceName, implementation.getClass(), container.getBundleContext().getBundle(),
                     ROUTED_RPC_IMPLEMENTATION);
 
-            if(rpcInterfaces.size() > 1) {
+            if (rpcInterfaces.size() > 1) {
                 throw new ComponentDefinitionException(String.format(
-                        "Implementation \"ref\" instance %s for \"%s\" implements more than one RpcService " +
-                        "interface (%s). Please specify the exact \"interface\"", implementation.getClass(),
+                        "Implementation \"ref\" instance %s for \"%s\" implements more than one RpcService "
+                        "interface (%s). Please specify the exact \"interface\"", implementation.getClass(),
                         ROUTED_RPC_IMPLEMENTATION, rpcInterfaces));
             }
 
@@ -93,23 +94,22 @@ class RoutedRpcMetadata implements ComponentFactoryMetadata {
                     implementation, rpcInterface);
 
             return rpcRegistry.addRoutedRpcImplementation(rpcInterface, (RpcService)implementation);
-        } catch(ComponentDefinitionException e) {
+        } catch (final ComponentDefinitionException e) {
             throw e;
-        } catch(Exception e) {
+        } catch (final Exception e) {
             throw new ComponentDefinitionException(String.format(
                     "Error processing \"%s\" for %s", ROUTED_RPC_IMPLEMENTATION, implementation.getClass()), e);
         }
     }
 
     @Override
-    public void destroy(Object instance) {
+    public void destroy(final Object instance) {
         LOG.debug("{}: In destroy: instance: {}", logName(), instance);
 
-        (( RoutedRpcRegistration<?>)instance).close();
+        ((RoutedRpcRegistration<?>)instance).close();
     }
 
     private String logName() {
-        return (container != null ? container.getBundleContext().getBundle().getSymbolicName() : "") +
-                " (" + id + ")";
+        return (container != null ? container.getBundleContext().getBundle().getSymbolicName() : "") + " (" + id + ")";
     }
 }