X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fmessagebus-netconf%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fmessagebus%2Feventsources%2Fnetconf%2FNetconfEventSourceMount.java;h=0524bdfbc62a7866f29bd98eb3d8b6da2e328322;hb=dadb9010c712e92b430b38aa3ab2de250c48947f;hp=1701afea5331b84414f37d7d6069cca007b7f191;hpb=0daed243d5fa216f5274ad9257f9692dd91c77eb;p=netconf.git diff --git a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java index 1701afea53..0524bdfbc6 100644 --- a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java +++ b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceMount.java @@ -49,25 +49,28 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; 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())); + moduleInfoBackedContext.addModuleInfos(Collections.singletonList(org.opendaylight.yang.gen.v1.urn.ietf.params + .xml.ns.netmod.notification.rev080714.$YangModuleInfoImpl.getInstance())); final Optional schemaContextOptional = moduleInfoBackedContext.tryToCreateSchemaContext(); Preconditions.checkState(schemaContextOptional.isPresent()); - SchemaContext NOTIFICATIONS_SCHEMA_CTX = schemaContextOptional.get(); + SchemaContext notificationsSchemaCtx = schemaContextOptional.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; @@ -77,7 +80,7 @@ class NetconfEventSourceMount { 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(); @@ -101,16 +104,19 @@ class NetconfEventSourceMount { } /** - * 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 invokeCreateSubscription(final Stream stream, final Optional lastEventTime) { + CheckedFuture invokeCreateSubscription(final Stream stream, + final Optional 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)); @@ -122,6 +128,7 @@ class NetconfEventSourceMount { /** * Invokes create-subscription rpc on mounted device stream. + * * @param stream stream * @return rpc result */ @@ -130,7 +137,8 @@ class NetconfEventSourceMount { } /** - * Returns list of streams avaliable on device + * Returns list of streams avaliable on device. + * * @return list of streams * @throws ReadFailedException if data read fails */ @@ -140,8 +148,8 @@ class NetconfEventSourceMount { .read(LogicalDatastoreType.OPERATIONAL, STREAMS_PATH); Optional> 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(); } @@ -152,12 +160,14 @@ class NetconfEventSourceMount { /** * 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 registerNotificationListener(DOMNotificationListener listener, SchemaPath notificationPath) { + ListenerRegistration registerNotificationListener(DOMNotificationListener listener, + SchemaPath notificationPath) { return notificationService.registerNotificationListener(listener, notificationPath); }