Class ComponentIds

java.lang.Object
org.apache.tika.pipes.api.ComponentIds

public final class ComponentIds extends Object
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 Details

    • SYSTEM_PREFIX

      public static final String SYSTEM_PREFIX
      Prefix reserved for host-wired components; not nameable from user config or a request.
      See Also:
  • Method Details

    • normalize

      public static String normalize(String id)
      Canonical form of an id: trimmed, or null if null.
    • isSystem

      public static boolean isSystem(String id)
      True if the normalized id is in the reserved system namespace.
    • requireUserId

      public static String requireUserId(String id, String what, String where)
      Normalizes id and rejects it if it is blank, illegal, or system-reserved.
      Parameters:
      id - the raw, caller-supplied id
      what - 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

      public static String requireLegalId(String id, String what, String where)
      As requireUserId(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 outside LEGAL_ID