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 <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))); } }
@Override public boolean match(EventGrounding offer, EventGrounding requirement, List<MatchingResultMessage> errorLog) { boolean match = MatchingUtils.nullCheckRightNullDisallowed(offer, requirement) || (matchProtocols(offer.getTransportProtocols(), requirement.getTransportProtocols(), errorLog) && matchFormats(offer.getTransportFormats(), requirement.getTransportFormats(), errorLog)); return match; }
@Override public boolean match(EventGrounding offer, EventGrounding requirement, List<MatchingResultMessage> errorLog) { boolean match = MatchingUtils.nullCheckRightNullDisallowed(offer, requirement) || (matchProtocols(offer.getTransportProtocols(), requirement.getTransportProtocols(), errorLog) && matchFormats(offer.getTransportFormats(), requirement.getTransportFormats(), errorLog)); return match; }
@Override public List<SpInputCollector> getInputCollectors() throws SpRuntimeException { List<SpInputCollector> inputCollectors = new ArrayList<>(); for (SpDataStream is : bindingParams.getGraph().getInputStreams()) { inputCollectors.add(ProtocolManager.findInputCollector(is.getEventGrounding() .getTransportProtocol(), is.getEventGrounding().getTransportFormats().get(0), singletonEngine)); } return inputCollectors; }
@Override public List<SpInputCollector> getInputCollectors() throws SpRuntimeException { List<SpInputCollector> inputCollectors = new ArrayList<>(); for (SpDataStream is : bindingParams.getGraph().getInputStreams()) { inputCollectors.add(ProtocolManager.findInputCollector(is.getEventGrounding() .getTransportProtocol(), is.getEventGrounding().getTransportFormats().get(0), singletonEngine)); } return inputCollectors; }
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 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 EventGrounding(EventGrounding other) { super(other); this.transportProtocols = new Cloner().protocols(other.getTransportProtocols()); this.transportFormats = new Cloner().transportFormats(other.getTransportFormats()); }
@Override public SpOutputCollector getOutputCollector() throws SpRuntimeException { return ProtocolManager.findOutputCollector(bindingParams.getGraph().getOutputStream() .getEventGrounding().getTransportProtocol(), bindingParams.getGraph().getOutputStream ().getEventGrounding().getTransportFormats().get(0)); }
public DataSetModificationMessage selectGrounding() { // TODO grounding negotiation TransportProtocol protocol = new KafkaTransportProtocol(BackendConfig.INSTANCE.getKafkaHost(), BackendConfig.INSTANCE.getKafkaPort(), TopicGenerator.generateRandomTopic(), BackendConfig.INSTANCE.getZookeeperHost(), BackendConfig.INSTANCE.getZookeeperPort()); TransportFormat format = spDataSet.getSupportedGrounding().getTransportFormats().get(0); EventGrounding outputGrounding = new EventGrounding(); outputGrounding.setTransportProtocol(protocol); outputGrounding.setTransportFormats(Arrays.asList(format)); return new DataSetModificationMessage(outputGrounding,RandomStringUtils.randomAlphanumeric(10)); } }
public DataSetModificationMessage selectGrounding() { // TODO grounding negotiation TransportProtocol protocol = new KafkaTransportProtocol(BackendConfig.INSTANCE.getKafkaHost(), BackendConfig.INSTANCE.getKafkaPort(), TopicGenerator.generateRandomTopic(), BackendConfig.INSTANCE.getZookeeperHost(), BackendConfig.INSTANCE.getZookeeperPort()); TransportFormat format = spDataSet.getSupportedGrounding().getTransportFormats().get(0); EventGrounding outputGrounding = new EventGrounding(); outputGrounding.setTransportProtocol(protocol); outputGrounding.setTransportFormats(Arrays.asList(format)); return new DataSetModificationMessage(outputGrounding,RandomStringUtils.randomAlphanumeric(10)); } }