@Override public Set<NotificationDefinition> getNotifications() { return getCurrentSchema().getNotifications(); }
private Optional<SchemaNode> tryFindNotification(final SchemaContext ctx, final QName qname) { return Optional.<SchemaNode>fromNullable(Iterables.find(ctx.getNotifications(), new SchemaNodePredicate(qname), null)); }
private static Optional<DataNodeContainer> findNotification(final SchemaContext ctx, final QName notificationQName) { for (NotificationDefinition notification : ctx.getNotifications()) { if (notification.getQName().equals(notificationQName)) { return Optional.<DataNodeContainer> of(notification); } } return Optional.absent(); }
@Override public List<SchemaPath> getAvailableNotifications() { final List<SchemaPath> availNotifList = new ArrayList<>(); // add Event Source Connection status notification availNotifList.add(ConnectionNotificationTopicRegistration.EVENT_SOURCE_STATUS_PATH); final Set<NotificationDefinition> availableNotifications = mount.getSchemaContext() .getNotifications(); // add all known notifications from netconf device for (final NotificationDefinition nd : availableNotifications) { availNotifList.add(nd.getPath()); } return availNotifList; }
private static Optional<DataNodeContainer> findNotification(final SchemaContext ctx, final QName notificationQName) { for (NotificationDefinition notification : ctx.getNotifications()) { if (notification.getQName().equals(notificationQName)) { return Optional.of(notification); } } return Optional.empty(); }
private static Optional<DataNodeContainer> findNotification(final SchemaContext ctx, final QName notificationQName) { for (final NotificationDefinition notification : ctx.getNotifications()) { if (notification.getQName().equals(notificationQName)) { return Optional.of(notification); } } return Optional.empty(); }
public NetconfMessageTransformer(final SchemaContext schemaContext, final boolean strictParsing) { this.counter = new MessageCounter(); this.schemaContext = schemaContext; parserFactory = DomToNormalizedNodeParserFactory.getInstance(XmlUtils.DEFAULT_XML_CODEC_PROVIDER, schemaContext, strictParsing); mappedRpcs = Maps.uniqueIndex(schemaContext.getOperations(), QNAME_FUNCTION); mappedNotifications = Multimaps.index(schemaContext.getNotifications(), QNAME_NOREV_FUNCTION); }
/** * Returns NotificationDefinition from Schema Context. * * @param schema SchemaContext in which lookup should be performed. * @param path Schema Path of notification * @return Notification schema or null, if notification is not present in schema context. */ @Beta public static @Nullable NotificationDefinition getNotificationSchema(final @NonNull SchemaContext schema, final @NonNull SchemaPath path) { requireNonNull(schema, "Schema context must not be null."); requireNonNull(path, "Schema path must not be null."); for (final NotificationDefinition potential : schema.getNotifications()) { if (path.equals(potential.getPath())) { return potential; } } return null; }
/** * Returns NotificationDefinition from Schema Context. * * @param schema SchemaContext in which lookup should be performed. * @param path Schema Path of notification * @return Notification schema or null, if notification is not present in schema context. */ @Beta public static @Nullable NotificationDefinition getNotificationSchema(final @NonNull SchemaContext schema, final @NonNull SchemaPath path) { requireNonNull(schema, "Schema context must not be null."); requireNonNull(path, "Schema path must not be null."); for (final NotificationDefinition potential : schema.getNotifications()) { if (path.equals(potential.getPath())) { return potential; } } return null; }
@SuppressWarnings("unchecked") public final Set<Class<? extends Notification>> getNotificationClasses(final Set<SchemaPath> interested) { final Set<Class<? extends Notification>> result = new HashSet<>(); final BindingRuntimeContext runtimeContext = runtimeContext(); for (final NotificationDefinition notification : runtimeContext.getSchemaContext().getNotifications()) { if (interested.contains(notification.getPath())) { try { result.add((Class<? extends Notification>) runtimeContext.getClassForSchema(notification)); } catch (final IllegalStateException e) { // Ignore LOG.warn("Class for {} is currently not known.", notification.getPath(), e); } } } return result; }
/** * Get specific notification classes as Binding objects. * * @param interested * - set of specific notifications paths * @return notification as Binding objects according to input set of their DOM paths */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Set<Class<? extends Notification>> getNotificationClasses(final Set<SchemaPath> interested) { final Set<Class<? extends Notification>> result = new HashSet<>(); final Set<NotificationDefinition> knownNotifications = runtimeContext.getSchemaContext().getNotifications(); for (final NotificationDefinition notification : knownNotifications) { if (interested.contains(notification.getPath())) { try { result.add((Class<? extends Notification>) runtimeContext.getClassForSchema(notification)); } catch (final IllegalStateException e) { // Ignore LOG.warn("Class for {} is currently not known.", notification.getPath(), e); } } } return result; }
@SuppressWarnings("unchecked") public Set<Class<? extends Notification>> getNotificationClasses(final Set<SchemaPath> interested) { final Set<Class<? extends Notification>> result = new HashSet<>(); final Set<NotificationDefinition> knownNotifications = runtimeContext().getSchemaContext().getNotifications(); for (final NotificationDefinition notification : knownNotifications) { if (interested.contains(notification.getPath())) { try { result.add((Class<? extends Notification>) runtimeContext().getClassForSchema(notification)); } catch (final IllegalStateException e) { // Ignore LOG.warn("Class for {} is currently not known.",notification.getPath(),e); } } } return result; }