Search in sources :

Example 56 with QueryParam

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;
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ComponentUISpecification(com.hortonworks.streamline.common.ComponentUISpecification) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 57 with QueryParam

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);
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList)

Example 58 with QueryParam

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;
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList) IOException(java.io.IOException) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 59 with QueryParam

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;
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList) TopologySourceStreamMap(com.hortonworks.streamline.streams.catalog.TopologySourceStreamMap)

Example 60 with QueryParam

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);
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList)

Aggregations

QueryParam (com.hortonworks.registries.common.QueryParam)72 ArrayList (java.util.ArrayList)42 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)22 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)22 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)22 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)22 IOException (java.io.IOException)8 SchemaNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException)7 StorableKey (com.hortonworks.registries.storage.StorableKey)7 OrderByField (com.hortonworks.registries.storage.OrderByField)6 HashSet (java.util.HashSet)6 SchemaVersionLifecycleContext (com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleContext)5 TopologyComponentBundle (com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)5 Timed (com.codahale.metrics.annotation.Timed)4 Preconditions (com.google.common.base.Preconditions)4 SchemaBranchNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaBranchNotFoundException)4 StorageException (com.hortonworks.registries.storage.exception.StorageException)4 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)4 InputStream (java.io.InputStream)4 HashMap (java.util.HashMap)4