Exemple #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public Callables loadProceduresFromDir(java.io.File root) throws java.io.IOException, org.neo4j.internal.kernel.api.exceptions.KernelException
        public virtual Callables LoadProceduresFromDir(File root)
        {
            if (root == null || !root.exists())
            {
                return(Callables.Empty());
            }

            Callables @out = new Callables();

            File[] dirListing = root.listFiles((dir, name) => name.EndsWith(".jar"));

            if (dirListing == null)
            {
                return(Callables.Empty());
            }

            if (!AllJarFilesAreValidZipFiles(Stream.of(dirListing)))
            {
                throw new ZipException("Some jar procedure files are invalid, see log for details.");
            }

//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            URL[] jarFilesURLs = Stream.of(dirListing).map(this.toURL).toArray(URL[] ::new);

            URLClassLoader loader = new URLClassLoader(jarFilesURLs, this.GetType().ClassLoader);

            foreach (URL jarFile in jarFilesURLs)
            {
                LoadProcedures(jarFile, loader, @out);
            }
            return(@out);
        }
Exemple #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Callables loadProcedures(java.net.URL jar, ClassLoader loader, Callables target) throws java.io.IOException, org.neo4j.internal.kernel.api.exceptions.KernelException
        private Callables LoadProcedures(URL jar, ClassLoader loader, Callables target)
        {
            RawIterator <Type, IOException> classes = ListClassesIn(jar, loader);

            while (classes.HasNext())
            {
                Type next = classes.Next();
                target.AddAllProcedures(_compiler.compileProcedure(next, null, false));
                target.AddAllFunctions(_compiler.compileFunction(next));
                target.AddAllAggregationFunctions(_compiler.compileAggregationFunction(next));
            }
            return(target);
        }