Class RulesCache


  • public class RulesCache
    extends Object
    Manages a cache of compiled Prolog rules.

    Rules are loaded from the site_path/cache/rules/rules-SHA1.jar, where SHA1 is the SHA1 of the Prolog rules.pl in a project's RefNames.REFS_CONFIG branch.

    • Constructor Detail

      • RulesCache

        @Inject
        protected RulesCache​(org.eclipse.jgit.lib.Config config,
                             SitePaths site,
                             GitRepositoryManager gm,
                             PluginSetContext<PredicateProvider> predicateProviders,
                             com.google.common.cache.Cache<org.eclipse.jgit.lib.ObjectId,​com.googlecode.prolog_cafe.lang.PrologMachineCopy> machineCache)
    • Method Detail

      • isProjectRulesEnabled

        public boolean isProjectRulesEnabled()
      • loadMachine

        public com.googlecode.prolog_cafe.lang.PrologMachineCopy loadMachine​(Project.NameKey project,
                                                                             org.eclipse.jgit.lib.ObjectId rulesId)
                                                                      throws com.googlecode.prolog_cafe.exceptions.CompileException
        Locate a cached Prolog machine state, or create one if not available.
        Returns:
        a Prolog machine, after loading the specified rules.
        Throws:
        com.googlecode.prolog_cafe.exceptions.CompileException - the machine cannot be created.
      • loadMachine

        public com.googlecode.prolog_cafe.lang.PrologMachineCopy loadMachine​(String name,
                                                                             Reader in)
                                                                      throws com.googlecode.prolog_cafe.exceptions.CompileException
        Throws:
        com.googlecode.prolog_cafe.exceptions.CompileException