/** * Defines that a pipeline element (data processor or data sink) supports processing messaging arriving in Thrift * format * @return The resulting {@link org.streampipes.model.grounding.TransportFormat}. */ public static TransportFormat thriftFormat() { return new TransportFormat(MessageFormat.Thrift); } }
public TransportFormat(TransportFormat other) { super(other); this.rdfType = other.getRdfType(); }
/** * Defines that a pipeline element (data processor or data sink) supports processing messaging arriving in JSON format * @return The resulting {@link org.streampipes.model.grounding.TransportFormat}. */ public static TransportFormat jsonFormat() { return new TransportFormat(MessageFormat.Json); }
@Override public boolean match(TransportFormat offer, TransportFormat requirement, List<MatchingResultMessage> errorLog) { return MatchingUtils.nullCheck(offer, requirement) || requirement.getRdfType().containsAll(offer.getRdfType()); }
/** * Defines the transport format Apache Thrift used by a data stream at runtime. * @return The {@link org.streampipes.model.grounding.TransportFormat} of type Thrift. */ public static TransportFormat thriftFormat() { return new TransportFormat(MessageFormat.Thrift); } }
@Override public boolean match(TransportFormat offer, TransportFormat requirement, List<MatchingResultMessage> errorLog) { return MatchingUtils.nullCheck(offer, requirement) || requirement.getRdfType().containsAll(offer.getRdfType()); }
/** * Defines the transport format JSON used by a data stream at runtime. * @return The {@link org.streampipes.model.grounding.TransportFormat} of type JSON. */ public static TransportFormat jsonFormat() { return new TransportFormat(MessageFormat.Json); }
public Optional<SpDataFormatDefinition> findDefinition(TransportFormat transportFormat) { // TODO why is transportFormat.getRdfType a list? return this.availableDataFormats .stream() .filter (adf -> transportFormat .getRdfType() .stream() .anyMatch(tf -> tf.toString().equals(adf .getTransportFormatRdfUri()))) .map(SpDataFormatFactory::createInstance) .findFirst(); }
public static List<TransportFormat> standardFormat() { List<TransportFormat> formats = new ArrayList<>(); formats.add(new TransportFormat(MessageFormat.Json)); formats.add(new TransportFormat(MessageFormat.Thrift)); return formats; }
public Optional<SpDataFormatDefinition> findDefinition(TransportFormat transportFormat) { // TODO why is transportFormat.getRdfType a list? return this.availableDataFormats .stream() .filter (adf -> transportFormat .getRdfType() .stream() .anyMatch(tf -> tf.toString().equals(adf .getTransportFormatRdfUri()))) .map(SpDataFormatFactory::createInstance) .findFirst(); }
public List<TransportFormat> transportFormats( List<TransportFormat> transportFormats) { return transportFormats.stream().map(t -> new TransportFormat(t)).collect(Collectors.toList()); }
public <T extends TransportFormat> boolean supportsFormat(String format) { List<InvocableStreamPipesEntity> elements = buildInvocables(); return elements .stream() .allMatch(e -> e .getSupportedGrounding() .getTransportFormats() .stream() .anyMatch(s -> s.getRdfType().contains(format))); } }
public TransportFormat getTransportFormat() { if (source instanceof SpDataStream) { return ((SpDataStream) source) .getEventGrounding() .getTransportFormats() .get(0); } else { if (supportsFormat(MessageFormat.Json)) { return new TransportFormat(MessageFormat.Json); } else if (supportsFormat(MessageFormat.Thrift)) { return new TransportFormat(MessageFormat.Thrift); } } return new TransportFormat(MessageFormat.Json); }
public <T extends TransportFormat> boolean supportsFormat(String format) { List<InvocableStreamPipesEntity> elements = buildInvocables(); return elements .stream() .allMatch(e -> e .getSupportedGrounding() .getTransportFormats() .stream() .anyMatch(s -> s.getRdfType().contains(format))); } }
public TransportFormat getTransportFormat() { if (source instanceof SpDataStream) { return ((SpDataStream) source) .getEventGrounding() .getTransportFormats() .get(0); } else { if (supportsFormat(MessageFormat.Json)) { return new TransportFormat(MessageFormat.Json); } else if (supportsFormat(MessageFormat.Thrift)) { return new TransportFormat(MessageFormat.Thrift); } } return new TransportFormat(MessageFormat.Json); }
public static EventGrounding makeDummyGrounding() { EventGrounding grounding = new EventGrounding(); grounding.setTransportFormats(Arrays.asList(new TransportFormat())); grounding.setTransportProtocol(ProtocolGenerator.makeDummyProtocol()); return grounding; } }