use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.
the class StreamCatalogService method listCustomProcessorBundlesWithFilter.
private Collection<TopologyComponentBundle> listCustomProcessorBundlesWithFilter(List<QueryParam> params) throws IOException {
List<QueryParam> queryParamsForTopologyComponent = new ArrayList<>();
queryParamsForTopologyComponent.add(new QueryParam(TopologyComponentBundle.SUB_TYPE, TopologyLayoutConstants.JSON_KEY_CUSTOM_PROCESSOR_SUB_TYPE));
for (QueryParam qp : params) {
if (qp.getName().equals(TopologyComponentBundle.STREAMING_ENGINE)) {
queryParamsForTopologyComponent.add(qp);
}
}
Collection<TopologyComponentBundle> customProcessors = this.listTopologyComponentBundlesForTypeWithFilter(TopologyComponentBundle.TopologyComponentType.PROCESSOR, queryParamsForTopologyComponent);
Collection<TopologyComponentBundle> result = new ArrayList<>();
for (TopologyComponentBundle cp : customProcessors) {
Map<String, Object> config = new HashMap<>();
for (ComponentUISpecification.UIField uiField : cp.getTopologyComponentUISpecification().getFields()) {
config.put(uiField.getFieldName(), uiField.getDefaultValue());
}
boolean matches = true;
for (QueryParam qp : params) {
if (!qp.getName().equals(TopologyComponentBundle.STREAMING_ENGINE) && !qp.getValue().equals(config.get(qp.getName()))) {
matches = false;
break;
}
}
if (matches) {
result.add(cp);
}
}
return result;
}
use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.
the class StreamCatalogService method listTopologyTestRunCase.
public Collection<TopologyTestRunCase> listTopologyTestRunCase(Long topologyId, Long versionId) {
List<QueryParam> queryParams = new ArrayList<>();
queryParams.add(new QueryParam("topologyId", String.valueOf(topologyId)));
queryParams.add(new QueryParam("versionId", String.valueOf(versionId)));
return dao.find(TopologyTestRunCase.NAMESPACE, queryParams);
}
use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.
the class StreamCatalogService method updateCustomProcessorInfoAsBundle.
public CustomProcessorInfo updateCustomProcessorInfoAsBundle(CustomProcessorInfo customProcessorInfo, InputStream jarFile, boolean verify) throws IOException, ComponentConfigException, NoSuchAlgorithmException {
List<QueryParam> queryParams = new ArrayList<>();
queryParams.add(new QueryParam(CustomProcessorInfo.NAME, customProcessorInfo.getName()));
Collection<TopologyComponentBundle> result = this.listCustomProcessorBundlesWithFilter(queryParams);
if (result.isEmpty() || result.size() != 1) {
throw new IOException("Failed to update custom processor with name:" + customProcessorInfo.getName());
}
this.handleCustomProcessorJar(jarFile, customProcessorInfo, verify);
TopologyComponentBundle newCustomProcessorBundle = customProcessorInfo.toTopologyComponentBundle();
this.addOrUpdateTopologyComponentBundle(result.iterator().next().getId(), newCustomProcessorBundle, null);
return customProcessorInfo;
}
use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.
the class StreamCatalogService method getOutputStreamIds.
private List<Long> getOutputStreamIds(TopologySource topologySource) {
List<Long> streamIds = new ArrayList<>();
if (topologySource != null) {
QueryParam qp1 = new QueryParam(TopologySourceStreamMap.FIELD_SOURCE_ID, String.valueOf(topologySource.getId()));
QueryParam qp2 = new QueryParam(TopologySourceStreamMap.FIELD_VERSION_ID, String.valueOf(topologySource.getVersionId()));
for (TopologySourceStreamMap mapping : listTopologySourceStreamMapping(ImmutableList.of(qp1, qp2))) {
streamIds.add(mapping.getStreamId());
}
}
return streamIds;
}
use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.
the class StreamCatalogService method listTopologyTestRunCaseSink.
public Collection<TopologyTestRunCaseSink> listTopologyTestRunCaseSink(Long testCaseId) {
List<QueryParam> queryParams = new ArrayList<>();
queryParams.add(new QueryParam("testCaseId", String.valueOf(testCaseId)));
return dao.find(TopologyTestRunCaseSink.NAMESPACE, queryParams);
}
Aggregations