Package org.apache.tika.pipes.core
Class PipesParser
java.lang.Object
org.apache.tika.pipes.core.PipesParser
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intReturns the current server port.longTotal forks performed across this parser's server managers.intClients not currently borrowed by aparse(org.apache.tika.pipes.api.FetchEmitTuple)call.intlonggetRestartCount(RestartReason reason) Forked-server restarts performed so far forreason, summed over all servers.booleanstatic PipesParserLoads a PipesParser from a configuration file path.static PipesParserload(TikaJsonConfig tikaJsonConfig, PipesConfig pipesConfig, Path tikaConfigPath) Loads a PipesParser from pre-loaded configuration objects.
-
Method Details
-
load
Loads a PipesParser from a configuration file path.This method:
- Loads the JSON configuration
- Pre-extracts plugins before spawning child processes
- Creates the PipesParser with the loaded configuration
- Parameters:
tikaConfigPath- path to the tika-config.json file- Returns:
- a new PipesParser instance
- Throws:
IOException- if reading config or extraction failsTikaConfigException- if configuration is invalid
-
load
public static PipesParser load(TikaJsonConfig tikaJsonConfig, PipesConfig pipesConfig, Path tikaConfigPath) throws IOException Loads a PipesParser from pre-loaded configuration objects.Use this method when you need to modify the PipesConfig before creating the parser (e.g., to override emit strategy).
- Parameters:
tikaJsonConfig- the pre-loaded JSON configurationpipesConfig- the pipes configuration (may be modified by caller)tikaConfigPath- path to the config file (passed to child processes)- Returns:
- a new PipesParser instance
- Throws:
IOException- if plugin extraction fails
-
parse
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getNumClients
public int getNumClients() -
getIdleClientCount
public int getIdleClientCount()Clients not currently borrowed by aparse(org.apache.tika.pipes.api.FetchEmitTuple)call. -
getRestartCount
Forked-server restarts performed so far forreason, summed over all servers. -
getGeneration
public long getGeneration()Total forks performed across this parser's server managers. One more than the number of restarts, since the first start of each manager is not a restart. Exposed for tests: it is the only observable that distinguishes a justified restart from a spurious one. -
getCurrentServerPort
public int getCurrentServerPort()Returns the current server port. For testing purposes only. In shared mode, returns the port of the shared server. In per-client mode, returns the port of the first client's server.- Returns:
- the current server port, or -1 if no server is running
-