*/
package org.opendaylight.netconf.messagebus.eventsources.netconf;
-import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
-import java.util.Date;
+import java.time.Instant;
+import java.util.HashSet;
+import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.TopicId;
/**
* Notification topic registration.
*/
+@Deprecated(forRemoval = true)
abstract class NotificationTopicRegistration implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(NotificationTopicRegistration.class);
private final String sourceName;
private final String notificationUrnPrefix;
private boolean replaySupported;
- private Date lastEventTime;
+ private Instant lastEventTime;
protected final ConcurrentHashMap<SchemaPath, Set<TopicId>> notificationTopicMap = new ConcurrentHashMap<>();
- protected NotificationTopicRegistration(NotificationSourceType notificationSourceType, String sourceName,
- String notificationUrnPrefix) {
+ protected NotificationTopicRegistration(final NotificationSourceType notificationSourceType,
+ final String sourceName, final String notificationUrnPrefix) {
this.notificationSourceType = notificationSourceType;
this.sourceName = sourceName;
this.notificationUrnPrefix = notificationUrnPrefix;
return active;
}
- protected void setActive(boolean active) {
+ protected void setActive(final boolean active) {
this.active = active;
}
* @param notificationPath path
* @return topicIds
*/
- Set<TopicId> getTopicsForNotification(SchemaPath notificationPath) {
+ Set<TopicId> getTopicsForNotification(final SchemaPath notificationPath) {
final Set<TopicId> topicIds = notificationTopicMap.get(notificationPath);
- return topicIds != null ? topicIds : Sets.newHashSet();
+ return topicIds != null ? topicIds : new HashSet<>();
}
/**
* @param notificationPath path
* @return true, if notification belongs to registration namespace
*/
- boolean checkNotificationPath(SchemaPath notificationPath) {
+ boolean checkNotificationPath(final SchemaPath notificationPath) {
if (notificationPath == null) {
return false;
}
return nameSpace.startsWith(getNotificationUrnPrefix());
}
- Optional<Date> getLastEventTime() {
- return Optional.fromNullable(lastEventTime);
+ Optional<Instant> getLastEventTime() {
+ return Optional.ofNullable(lastEventTime);
}
- void setLastEventTime(Date lastEventTime) {
+ void setLastEventTime(final Instant lastEventTime) {
this.lastEventTime = lastEventTime;
}
* Registers associated event source notification to topic.
*
* @param topicId topic id
- * @return true, if successful
*/
abstract void unRegisterNotificationTopic(TopicId topicId);
return replaySupported;
}
- protected void setReplaySupported(boolean replaySupported) {
+ protected void setReplaySupported(final boolean replaySupported) {
this.replaySupported = replaySupported;
}