package org.opendaylight.openflowplugin.test;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-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;
private NotificationProviderService notificationProviderService;
/**
- * get data service
+ * Get data service.
*
* @return {@link #dataService}
*/
}
/**
- * set {@link #dataService}
- *
- * @param dataService
+ * Set {@link #dataService}.
*/
public void setDataService(final DataBroker dataService) {
this.dataService = dataService;
}
/**
- * get flow registration
+ * Get flow registration.
*
* @return {@link #flowRegistration}
*/
}
/**
- * set {@link #flowRegistration}
- *
- * @param flowRegistration
+ * Set {@link #flowRegistration}.
*/
public void setFlowRegistration(
final RoutedRpcRegistration<SalFlowService> flowRegistration) {
}
/**
- * get notification service
+ * Get notification service.
*
* @return {@link #notificationProviderService}
*/
}
/**
- * set {@link #notificationProviderService}
- *
- * @param notificationProviderService
+ * Set {@link #notificationProviderService}.
*/
- public void setNotificationService(
- final NotificationProviderService notificationProviderService) {
- this.notificationProviderService = notificationProviderService;
+ public void setNotificationService(final NotificationProviderService service) {
+ this.notificationProviderService = service;
}
public void start() {
* service.rev130819.AddFlowInput)
*/
@Override
- public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
- String plus = ("addFlow - " + input);
+ public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
+ String plus = "addFlow - " + input;
OpenflowpluginTestServiceProvider.LOG.info(plus);
return null;
}
* .service.rev130819.RemoveFlowInput)
*/
@Override
- public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
- String plus = ("removeFlow - " + input);
+ public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
+ String plus = "removeFlow - " + input;
OpenflowpluginTestServiceProvider.LOG.info(plus);
return null;
}
* .service.rev130819.UpdateFlowInput)
*/
@Override
- public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
- String plus = ("updateFlow - " + input);
+ public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
+ String plus = "updateFlow - " + input;
OpenflowpluginTestServiceProvider.LOG.info(plus);
return null;
}
- /**
- * @param ctx
- * @return {@link CompositeObjectRegistrationBuilder #toInstance()}
- */
- public CompositeObjectRegistration<OpenflowpluginTestServiceProvider> register(
+ public ObjectRegistration<OpenflowpluginTestServiceProvider> register(
final ProviderContext ctx) {
- CompositeObjectRegistrationBuilder<OpenflowpluginTestServiceProvider> builder = CompositeObjectRegistration
- .<OpenflowpluginTestServiceProvider> builderFor(this);
-
RoutedRpcRegistration<SalFlowService> addRoutedRpcImplementation = ctx
- .<SalFlowService> addRoutedRpcImplementation(
+ .<SalFlowService>addRoutedRpcImplementation(
SalFlowService.class, this);
setFlowRegistration(addRoutedRpcImplementation);
InstanceIdentifierBuilder<Nodes> builderII = InstanceIdentifier
- .<Nodes> builder(Nodes.class);
+ .<Nodes>builder(Nodes.class);
NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID);
NodeKey nodeKey = new NodeKey(nodeId);
InstanceIdentifierBuilder<Node> nodeIdentifier = builderII
- .<Node, NodeKey> child(Node.class, nodeKey);
+ .<Node, NodeKey>child(Node.class, nodeKey);
InstanceIdentifier<Node> instance = nodeIdentifier.build();
RoutedRpcRegistration<SalFlowService> flowRegistration2 = getFlowRegistration();
- builder.add(flowRegistration2);
-
- return builder.build();
+ return new AbstractObjectRegistration<OpenflowpluginTestServiceProvider>(this) {
+ @Override
+ protected void removeRegistration() {
+ flowRegistration2.close();
+ }
+ };
}
}