class UDFCatalogResource {

    @VisibleForTesting
    void processUdf(InputStream inputStream,
                            UDF udf,
                            boolean checkDuplicate,
                            boolean builtin) throws Exception {
        if (builtin) {
            udf.setDigest("builtin");
            udf.setJarStoragePath("builtin");
            checkDuplicate(udf);
        } else {
            MessageDigest md = MessageDigest.getInstance("SHA-256");
            File tmpFile;
            try (DigestInputStream dis = new DigestInputStream(inputStream, md)) {
                tmpFile = FileUtil.writeInputStreamToTempFile(dis, ".jar");
            }
            Map<String, Class<?>> udfs = StreamCatalogService.loadUdfsFromJar(tmpFile);
            validateUDF(udfs.keySet(), udf, checkDuplicate);
            updateTypeInfo(udf, udfs.get(udf.getClassName()));
            String digest = Hex.encodeHexString(md.digest());
            LOG.debug("Digest: {}", digest);
            udf.setDigest(digest);
            String jarPath = getExistingJarPath(digest).orElseGet(() -> uploadJar(tmpFile, udf.getName()));
            if (!fileStorage.exists(jarPath)) {
                String msg = String.format("The jar path '%s' does not exist. " +
                        "You may have to reset the db and run bootstrap again.", jarPath);
                LOG.error(msg);
                throw new RuntimeException(msg);
            }
            udf.setJarStoragePath(jarPath);
        }
    }

    public  UDFCatalogResource(StreamlineAuthorizer authorizer, StreamCatalogService catalogService, FileStorage fileStorage);

}