import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
import org.opendaylight.controller.md.sal.dom.api.DOMService;
+import org.opendaylight.mdsal.binding.dom.codec.gen.impl.StreamWriterGenerator;
+import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInputBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.Netconf;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.Streams;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
-import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
-import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
/**
- * Facade of mounted netconf device
+ * Facade of mounted netconf device.
*/
class NetconfEventSourceMount {
private static final BindingNormalizedNodeCodecRegistry CODEC_REGISTRY;
- private static final YangInstanceIdentifier STREAMS_PATH = YangInstanceIdentifier.builder().node(Netconf.QNAME).node(Streams.QNAME).build();
+ private static final YangInstanceIdentifier STREAMS_PATH = YangInstanceIdentifier.builder().node(Netconf.QNAME)
+ .node(Streams.QNAME).build();
private static final SchemaPath CREATE_SUBSCRIPTION = SchemaPath
.create(true, QName.create(CreateSubscriptionInput.QNAME, "create-subscription"));
- static{
+ static {
final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
- moduleInfoBackedContext.addModuleInfos(Collections.singletonList(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.$YangModuleInfoImpl.getInstance()));
- final Optional<SchemaContext> schemaContextOptional = moduleInfoBackedContext.tryToCreateSchemaContext();
- Preconditions.checkState(schemaContextOptional.isPresent());
- SchemaContext NOTIFICATIONS_SCHEMA_CTX = schemaContextOptional.get();
+ moduleInfoBackedContext.addModuleInfos(Collections.singletonList(org.opendaylight.yang.gen.v1.urn.ietf.params
+ .xml.ns.netmod.notification.rev080714.$YangModuleInfoImpl.getInstance()));
+ SchemaContext notificationsSchemaCtx = moduleInfoBackedContext.tryToCreateSchemaContext().get();
final JavassistUtils javassist = JavassistUtils.forClassPool(ClassPool.getDefault());
CODEC_REGISTRY = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(javassist));
- CODEC_REGISTRY.onBindingRuntimeContextUpdated(BindingRuntimeContext.create(moduleInfoBackedContext, NOTIFICATIONS_SCHEMA_CTX));
+ CODEC_REGISTRY.onBindingRuntimeContextUpdated(BindingRuntimeContext.create(moduleInfoBackedContext,
+ notificationsSchemaCtx));
}
private final DOMMountPoint mountPoint;
private final Node node;
private final String nodeId;
- public NetconfEventSourceMount(final Node node, final DOMMountPoint mountPoint) {
+ NetconfEventSourceMount(final Node node, final DOMMountPoint mountPoint) {
this.mountPoint = mountPoint;
this.node = node;
this.nodeId = node.getNodeId().getValue();
this.dataBroker = getService(mountPoint, DOMDataBroker.class);
}
- private static <T extends DOMService> T getService(DOMMountPoint mountPoint, Class<T> service) {
+ private static <T extends DOMService> T getService(final DOMMountPoint mountPoint, final Class<T> service) {
final Optional<T> optional = mountPoint.getService(service);
Preconditions.checkState(optional.isPresent(), "Service not present on mount point: %s", service.getName());
return optional.get();
}
/**
- * Invokes create-subscription rpc on mounted device stream. If lastEventTime is provided and stream supports replay,
+ * Invokes create-subscription rpc on mounted device stream. If lastEventTime is provided and stream supports
+ * replay,
* rpc will be invoked with start time parameter.
- * @param stream stream
+ *
+ * @param stream stream
* @param lastEventTime last event time
* @return rpc result
*/
- CheckedFuture<DOMRpcResult, DOMRpcException> invokeCreateSubscription(final Stream stream, final Optional<Date> lastEventTime) {
+ CheckedFuture<DOMRpcResult, DOMRpcException> invokeCreateSubscription(final Stream stream,
+ final Optional<Date> lastEventTime) {
final CreateSubscriptionInputBuilder inputBuilder = new CreateSubscriptionInputBuilder()
.setStream(stream.getName());
- if(lastEventTime.isPresent() && stream.isReplaySupport()) {
+ if (lastEventTime.isPresent() && stream.isReplaySupport()) {
final ZonedDateTime dateTime = lastEventTime.get().toInstant().atZone(ZoneId.systemDefault());
final String formattedDate = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(dateTime);
inputBuilder.setStartTime(new DateAndTime(formattedDate));
/**
* Invokes create-subscription rpc on mounted device stream.
+ *
* @param stream stream
* @return rpc result
*/
}
/**
- * Returns list of streams avaliable on device
+ * Returns list of streams avaliable on device.
+ *
* @return list of streams
* @throws ReadFailedException if data read fails
*/
.read(LogicalDatastoreType.OPERATIONAL, STREAMS_PATH);
Optional<NormalizedNode<?, ?>> streams = checkFeature.checkedGet();
if (streams.isPresent()) {
- Streams s = (Streams) CODEC_REGISTRY.fromNormalizedNode(STREAMS_PATH, streams.get()).getValue();
- return s.getStream();
+ Streams streams1 = (Streams) CODEC_REGISTRY.fromNormalizedNode(STREAMS_PATH, streams.get()).getValue();
+ return streams1.getStream();
}
return Collections.emptyList();
}
/**
* Registers notification listener to receive a set of notifications.
- * @see DOMNotificationService#registerNotificationListener(DOMNotificationListener, SchemaPath...)
- * @param listener listener
+ *
+ * @param listener listener
* @param notificationPath notification path
- * @return
+ * @return ListenerRegistration
+ * @see DOMNotificationService#registerNotificationListener(DOMNotificationListener, SchemaPath...)
*/
- ListenerRegistration<DOMNotificationListener> registerNotificationListener(DOMNotificationListener listener, SchemaPath notificationPath) {
+ ListenerRegistration<DOMNotificationListener> registerNotificationListener(final DOMNotificationListener listener,
+ final SchemaPath notificationPath) {
return notificationService.registerNotificationListener(listener, notificationPath);
}