/**
* 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
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;
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;
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() {
}
/**
- * set {@link #tableRegistration}
- *
- * @param tableRegistration
+ * Set {@link #tableRegistration}.
*/
public void setTableRegistration(
final RoutedRpcRegistration<SalTableService> tableRegistration) {
}
/**
- * get notification service
- *
+ * Get notification service.
+ *
* @return {@link #notificationService}
*/
public NotificationProviderService getNotificationService() {
}
/**
- * set {@link #notificationService}
- *
- * @param notificationService
+ * Set {@link #notificationService}.
*/
public void setNotificationService(
final NotificationProviderService notificationService) {
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.AutoCloseable#close()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see
* org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026
* .SalTableService
@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();
RoutedRpcRegistration<SalTableService> tableRegistration1 = this
.getTableRegistration();
- builder.add(tableRegistration1);
-
- return builder.build();
+ return new AbstractObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider>(this) {
+ @Override
+ protected void removeRegistration() {
+ tableRegistration1.close();
+ }
+ };
}
-
}