X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-restconf-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fbroker%2Ftools%2FRemoteStreamTools.java;fp=opendaylight%2Fmd-sal%2Fsal-restconf-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fbroker%2Ftools%2FRemoteStreamTools.java;h=0000000000000000000000000000000000000000;hp=726f7f0649b256fb856c4abc848e10b00b294877;hb=89b8b59cd26fd4810293ff14386eb29a71da9fac;hpb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4 diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java deleted file mode 100644 index 726f7f0649..0000000000 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.controller.sal.restconf.broker.tools; - -import com.google.common.util.concurrent.ListenableFuture; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamInputBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService; -import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; -import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo; -import org.opendaylight.yangtools.yang.common.RpcResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RemoteStreamTools { - private static final Logger logger = LoggerFactory.getLogger(RemoteStreamTools.class.toString()); - - public static String createNotificationStream(SalRemoteService salRemoteService,List notifications){ - CreateNotificationStreamInputBuilder notificationStreamInputBuilder = new CreateNotificationStreamInputBuilder(); - - if (null == notifications){ - notificationStreamInputBuilder.setNotifications(notifications); - } - - Future> notificationStream = salRemoteService.createNotificationStream(notificationStreamInputBuilder.build()); - - String nofiticationStreamIdentifier = ""; - try { - if (notificationStream.get().isSuccessful()){ - nofiticationStreamIdentifier = notificationStream.get().getResult().getNotificationStreamIdentifier(); - } - } catch (InterruptedException e) { - logger.trace("Interrupted while resolving notification stream identifier due to {}",e); - } catch (ExecutionException e) { - logger.trace("Execution exception while resolving notification stream identifier due to {}",e); - } - return nofiticationStreamIdentifier; - } - - public static Map createEventStream(RestconfClientContext restconfClientContext, String desiredStreamName){ - ListenableFuture> availableEventStreams = restconfClientContext.getAvailableEventStreams(); - final Map desiredEventStream = new HashMap(); - - try { - Iterator it = availableEventStreams.get().iterator(); - while (it.hasNext()){ - if (it.next().getIdentifier().equals(desiredStreamName)){ - desiredEventStream.put(desiredStreamName,it.next()); - } - } - } catch (InterruptedException e) { - logger.trace("Resolving of event stream interrupted due to {}",e); - } catch (ExecutionException e) { - logger.trace("Resolving of event stream failed due to {}",e); - } - return desiredEventStream; - } -}