Class DefaultPluginsDir
java.lang.Object
org.apache.tika.pipes.core.config.DefaultPluginsDir
Resolves the default
plugins directory when plugin-roots
is not configured (TIKA-4864). The probe order matches the install
layouts Tika ships:
- next to the jar the anchor class was loaded from (a flat install, tika-grpc's docker image);
- next to that directory's parent (the unpacked distributions and the
tika-server docker image load classes from
lib/, the plugins sit besidelib/); - a
pluginsdirectory in the current working directory.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionThe same probe asresolve(Class), but empty rather than a warning and a fallback path when nopluginsdirectory exists.static booleanneedsDefault(com.fasterxml.jackson.databind.JsonNode pluginRoots) static StringResolves the default plugins directory for the install layout of the given class.static PathThe probe itself, separated from the code-source lookup for testing.
-
Field Details
-
PLUGINS_DIR_NAME
The directory name probed in each location.- See Also:
-
-
Method Details
-
resolve
Resolves the default plugins directory for the install layout of the given class.- Parameters:
anchor- the class whose code source anchors the probe, usually the caller- Returns:
- the absolute path of the first
pluginsdirectory found, or the absolute path ofpluginsin the working directory if none exists yet
-
find
The same probe asresolve(Class), but empty rather than a warning and a fallback path when nopluginsdirectory exists. -
needsDefault
public static boolean needsDefault(com.fasterxml.jackson.databind.JsonNode pluginRoots) - Parameters:
pluginRoots- the configuredplugin-rootsnode, or null- Returns:
- true when it is absent or still a placeholder token copied from an example config, so the caller should install the default
-
resolve
The probe itself, separated from the code-source lookup for testing.- Parameters:
codeSourceDir- the directory holding the anchor's jar, or nullcwd- the working directory to fall back to- Returns:
- the absolute path of the resolved directory
-
find
- Returns:
- the first existing
pluginsdirectory: beside the code source, beside its parent, or incwd; empty when there is none
-