class_docstr: Run suites for Java. 
docstr: Returns a BenchmarkRunner from a path or a git revision.
  
  First, it checks if `rev_or_path` is a valid path (or string) of a json
  object that can deserialize to a BenchmarkRunner. If so, it initialize
  a StaticBenchmarkRunner from it. This allows memoizing the result of a
  run in a file or a string.
  
  Second, it checks if `rev_or_path` points to a valid Maven build
  directory.  If so, it creates a JavaBenchmarkRunner with this existing
  MavenBuild.
  
  Otherwise, it assumes `rev_or_path` is a revision and clone/checkout
  the given revision and create a fresh MavenBuild.
docstr_tok: ["Returns","a","BenchmarkRunner","from","a","path","or","a","git","revision",".","First",",","it","checks","if","`","rev_or_path","`","is","a","valid","path","(","or","string",")","of","a","json","object","that","can","deserialize","to","a","BenchmarkRunner",".","If","so",",","it","initialize","a","StaticBenchmarkRunner","from","it",".","This","allows","memoizing","the","result","of","a","run","in","a","file","or","a","string",".","Second",",","it","checks","if","`","rev_or_path","`","points","to","a","valid","Maven","build","directory",".","If","so",",","it","creates","a","JavaBenchmarkRunner","with","this","existing","MavenBuild",".","Otherwise",",","it","assumes","`","rev_or_path","`","is","a","revision","and","clone\/checkout","the","given","revision","and","create","a","fresh","MavenBuild","."]
code: def from_rev_or_path(src, root, rev_or_path, maven_conf, **kwargs):
      """Returns a BenchmarkRunner from a path or a git revision.
  
      First, it checks if `rev_or_path` is a valid path (or string) of a json
      object that can deserialize to a BenchmarkRunner. If so, it initialize
      a StaticBenchmarkRunner from it. This allows memoizing the result of a
      run in a file or a string.
  
      Second, it checks if `rev_or_path` points to a valid Maven build
      directory.  If so, it creates a JavaBenchmarkRunner with this existing
      MavenBuild.
  
      Otherwise, it assumes `rev_or_path` is a revision and clone/checkout
      the given revision and create a fresh MavenBuild.
      """
      if StaticBenchmarkRunner.is_json_result(rev_or_path):
          return StaticBenchmarkRunner.from_json(rev_or_path, **kwargs)
      elif MavenBuild.is_build_dir(rev_or_path):
          maven_def = JavaMavenDefinition(rev_or_path, maven_conf)
          return JavaBenchmarkRunner(
              maven_def.build(rev_or_path), **kwargs
          )
      else:
          # Revisions can references remote via the `/` character, ensure
          # that the revision is path friendly
          path_rev = rev_or_path.replace("/", "_")
          root_rev = os.path.join(root, path_rev)
          os.mkdir(root_rev)
  
          clone_dir = os.path.join(root_rev, "arrow")
          # Possibly checkout the sources at given revision, no need to
          # perform cleanup on cloned repository as root_rev is reclaimed.
          src_rev, _ = src.at_revision(rev_or_path, clone_dir)
          maven_def = JavaMavenDefinition(src_rev.java, maven_conf)
          build_dir = os.path.join(root_rev, "arrow/java")
          return JavaBenchmarkRunner(
              maven_def.build(build_dir), **kwargs
          )
  
imports: import glob
  import json
  import os
  import re
  from .core import BenchmarkSuite
  from .google import GoogleBenchmarkCommand, GoogleBenchmark
  from .jmh import JavaMicrobenchmarkHarnessCommand, JavaMicrobenchmarkHarness
  from ..lang.cpp import CppCMakeDefinition, CppConfiguration
  from ..lang.java import JavaMavenDefinition, JavaConfiguration
  from ..utils.cmake import CMakeBuild
  from ..utils.maven import MavenBuild
  from ..utils.logger import logger
label_desc: Use image node_id 6 for calling the JavaBenchmarkRunner obj's underlying member method code with example usage: obj.from_rev_or_path(src, root, rev_or_path, maven_conf) and returns: StaticBenchmarkRunner, JavaBenchmarkRunner, JavaBenchmarkRunner