Search in sources :

Example 1 with Udf

use of com.hortonworks.streamline.streams.layout.component.rule.expression.Udf in project streamline by hortonworks.

the class StormTopologyDependenciesHandler method visit.

@Override
public void visit(RulesProcessor rulesProcessor) {
    Set<UDF> udfsToShip = new HashSet<>();
    for (Rule rule : rulesProcessor.getRules()) {
        for (Udf udf : rule.getReferredUdfs()) {
            List<QueryParam> qps = QueryParam.params(UDF.NAME, udf.getName());
            // The null check for backward compatibility
            if (udf.getClassName() != null) {
                qps.add(new QueryParam(UDF.CLASSNAME, udf.getClassName()));
            }
            // The null check for backward compatibility
            if (udf.getType() != null) {
                qps.add(new QueryParam(UDF.TYPE, udf.getType().toString()));
            }
            Collection<UDF> udfs = catalogService.listUDFs(qps);
            if (udfs.size() > 1) {
                throw new IllegalStateException("Multiple UDF definitions for :" + udf);
            } else if (udfs.size() == 1) {
                udfsToShip.add(udfs.iterator().next());
            } else {
                throw new IllegalStateException("No catalog entity for udf: '" + udf + "'. " + "May be the UDF information is not bootstrapped or got deleted.");
            }
        }
        for (UDF udf : udfsToShip) {
            extraJars.add(udf.getJarStoragePath());
        }
    }
    resourceNames.addAll(rulesProcessor.getExtraResources());
    handleBundleForStreamlineComponent(rulesProcessor);
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) UDF(com.hortonworks.streamline.streams.catalog.UDF) Udf(com.hortonworks.streamline.streams.layout.component.rule.expression.Udf) Rule(com.hortonworks.streamline.streams.layout.component.rule.Rule) HashSet(java.util.HashSet)

Aggregations

QueryParam (com.hortonworks.registries.common.QueryParam)1 UDF (com.hortonworks.streamline.streams.catalog.UDF)1 Rule (com.hortonworks.streamline.streams.layout.component.rule.Rule)1 Udf (com.hortonworks.streamline.streams.layout.component.rule.expression.Udf)1 HashSet (java.util.HashSet)1