/** * Creates a new {@link Target}. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param headerMapping the {@link HeaderMapping} of the new Target * @param requiredTopic the required FilteredTopic that should be published via this target * @param additionalTopics additional set of FilteredTopics that should be published via this target * @return the created {@link Target} */ public static Target newTarget(final String address, final AuthorizationContext authorizationContext, @Nullable final HeaderMapping headerMapping, final FilteredTopic requiredTopic, final FilteredTopic... additionalTopics) { final HashSet<FilteredTopic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); return newTarget(address, authorizationContext, headerMapping, topics); }
/** * Creates a new {@link Target}. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param headerMapping the {@link HeaderMapping} of the new Target * @param requiredTopic the required FilteredTopic that should be published via this target * @param additionalTopics additional set of FilteredTopics that should be published via this target * @return the created {@link Target} */ public static Target newTarget(final String address, final AuthorizationContext authorizationContext, @Nullable final HeaderMapping headerMapping, final FilteredTopic requiredTopic, final FilteredTopic... additionalTopics) { final HashSet<FilteredTopic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); return newTarget(address, authorizationContext, headerMapping, topics); }
/** * Creates a new {@link Target}. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param headerMapping the {@link HeaderMapping} of the new Target * @param requiredTopic the required topic that should be published via this target * @param additionalTopics additional set of topics that should be published via this target * @return the created {@link Target} */ public static Target newTarget(final String address, final AuthorizationContext authorizationContext, @Nullable final HeaderMapping headerMapping, final Topic requiredTopic, final Topic... additionalTopics) { final HashSet<Topic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); return newTarget(address, authorizationContext, headerMapping, topics.stream() .map(ConnectivityModelFactory::newFilteredTopic) .collect(Collectors.toSet()) ); }
/** * Creates a new {@link Target}. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param headerMapping the {@link HeaderMapping} of the new Target * @param requiredTopic the required topic that should be published via this target * @param additionalTopics additional set of topics that should be published via this target * @return the created {@link Target} */ public static Target newTarget(final String address, final AuthorizationContext authorizationContext, @Nullable final HeaderMapping headerMapping, final Topic requiredTopic, final Topic... additionalTopics) { final HashSet<Topic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); return newTarget(address, authorizationContext, headerMapping, topics.stream() .map(ConnectivityModelFactory::newFilteredTopic) .collect(Collectors.toSet()) ); }
/** * Creates a new {@link MqttTarget} with MQTT specific configuration. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param qos the target qos value * @param requiredTopic the required topic that should be published via this target * @param additionalTopics additional set of topics that should be published via this target * @return the created {@link Target} */ public static MqttTarget newMqttTarget(final String address, final AuthorizationContext authorizationContext, final int qos, final Topic requiredTopic, final Topic... additionalTopics) { final HashSet<Topic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); final Target target = newTarget(address, authorizationContext, null, topics.stream() .map(ConnectivityModelFactory::newFilteredTopic) .collect(Collectors.toSet())); return new ImmutableMqttTarget(target, qos); }
/** * Creates a new {@link MqttTarget} with MQTT specific configuration. * * @param address the address where the signals will be published * @param authorizationContext the authorization context of the new {@link Target} * @param qos the target qos value * @param requiredTopic the required topic that should be published via this target * @param additionalTopics additional set of topics that should be published via this target * @return the created {@link Target} */ public static MqttTarget newMqttTarget(final String address, final AuthorizationContext authorizationContext, final int qos, final Topic requiredTopic, final Topic... additionalTopics) { final HashSet<Topic> topics = new HashSet<>(Collections.singletonList(requiredTopic)); topics.addAll(Arrays.asList(additionalTopics)); final Target target = newTarget(address, authorizationContext, null, topics.stream() .map(ConnectivityModelFactory::newFilteredTopic) .collect(Collectors.toSet())); return new ImmutableMqttTarget(target, qos); }
/** * Creates a new {@link Target} from existing target but different address. * * @param target the target * @param address the address where the signals will be published * @return the created {@link Target} */ public static Target newTarget(final Target target, final String address) { return newTarget(address, target.getAuthorizationContext(), target.getHeaderMapping().orElse(null), target.getTopics()); }
/** * Creates a new {@link Target} from existing target but different address. * * @param target the target * @param address the address where the signals will be published * @return the created {@link Target} */ public static Target newTarget(final Target target, final String address) { return newTarget(address, target.getAuthorizationContext(), target.getHeaderMapping().orElse(null), target.getTopics()); }