Package org.apache.tika.pipes.api
Class ComponentIds
java.lang.Object
org.apache.tika.pipes.api.ComponentIds
Naming rules for pipes component instance ids (fetchers, emitters, iterators).
Ids beginning with "__" are reserved for components the host wires up for its own use -- tika-server's upload fetcher, for instance. Reserving a namespace rather than enumerating names means a new internal component cannot be reached from a request by someone forgetting to add it to a list.
Callers must normalize(String) an id before comparing or storing it, and must validate
the normalized form. Validating the raw id and resolving the trimmed one would let
" __foo" slip past the prefix check and then bind to __foo.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue if the normalized id is in the reserved system namespace.static StringCanonical form of an id: trimmed, or null if null.static StringrequireLegalId(String id, String what, String where) AsrequireUserId(java.lang.String, java.lang.String, java.lang.String), but permits the system namespace.static StringrequireUserId(String id, String what, String where) Normalizesidand rejects it if it is blank, illegal, or system-reserved.
-
Field Details
-
SYSTEM_PREFIX
Prefix reserved for host-wired components; not nameable from user config or a request.- See Also:
-
LEGAL_ID
Ids are restricted to this set so a normalized id can be used verbatim everywhere. Trimming alone leaves NBSP and zero-width characters, which produce ids that look reserved but resolve to nothing; the allowlist refuses them outright. It also keeps path separators and quoting characters out of anything derived from an id. System ids satisfy it too --_is a member.
-
-
Method Details
-
normalize
Canonical form of an id: trimmed, or null if null. -
isSystem
True if the normalized id is in the reserved system namespace. -
requireUserId
Normalizesidand rejects it if it is blank, illegal, or system-reserved.- Parameters:
id- the raw, caller-supplied idwhat- component kind, for the message (e.g. "fetcher")where- origin, for the message (e.g. "configuration" or "a request")- Returns:
- the normalized id
- Throws:
IllegalArgumentException- if the id is blank, illegal, or system-reserved
-
requireLegalId
AsrequireUserId(java.lang.String, java.lang.String, java.lang.String), but permits the system namespace. For ids the host itself supplies, where the charset rule still applies but__is legitimate.- Throws:
IllegalArgumentException- if the id is blank or outsideLEGAL_ID
-