return Optional.of(topicPath.getGroup().getName()); case CHANNEL_PLACEHOLDER: return Optional.of(topicPath.getChannel().getName()); case CRITERION_PLACEHOLDER: return Optional.of(topicPath.getCriterion().getName());
/** * Add any extra information in topic path as Ditto headers. Currently "channel" is the only relevant header. * * @param topicPath the topic path to extract information from. * @return headers containing extra information from topic path. */ private static DittoHeaders mapTopicPathToHeaders(final TopicPath topicPath) { if (topicPath.getChannel() == TopicPath.Channel.LIVE) { return DittoHeaders.newBuilder() .channel(TopicPath.Channel.LIVE.getName()) .build(); } else { return DittoHeaders.empty(); } }
/** * Add any extra information in topic path as Ditto headers. Currently "channel" is the only relevant header. * * @param topicPath the topic path to extract information from. * @return headers containing extra information from topic path. */ private static DittoHeaders mapTopicPathToHeaders(final TopicPath topicPath) { if (topicPath.getChannel() == TopicPath.Channel.LIVE) { return DittoHeaders.newBuilder() .channel(TopicPath.Channel.LIVE.getName()) .build(); } else { return DittoHeaders.empty(); } }
@Override public Signal<?> fromAdaptable(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); if (TopicPath.Group.THINGS.equals(topicPath.getGroup())) { // /things final TopicPath.Channel channel = topicPath.getChannel(); if (channel.equals(TopicPath.Channel.LIVE)) { // /things/live return fromLiveAdaptable(adaptable); } else if (channel.equals(TopicPath.Channel.TWIN)) { // /things/twin return fromTwinAdaptable(adaptable); } } throw UnknownTopicPathException.newBuilder(topicPath).build(); }
@Override public Signal<?> fromAdaptable(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); if (TopicPath.Group.THINGS.equals(topicPath.getGroup())) { // /things final TopicPath.Channel channel = topicPath.getChannel(); if (channel.equals(TopicPath.Channel.LIVE)) { // /things/live return fromLiveAdaptable(adaptable); } else if (channel.equals(TopicPath.Channel.TWIN)) { // /things/twin return fromTwinAdaptable(adaptable); } } throw UnknownTopicPathException.newBuilder(topicPath).build(); }