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);
}
Aggregations