Class ConnectorMetadata

java.lang.Object
ai.pipestream.connector.intake.util.ConnectorMetadata

public class ConnectorMetadata extends Object
Utility class for parsing and serializing connector metadata JSON.

Connector metadata is stored as JSON in the database and contains:

  • S3 bucket and base path
  • File size limits
  • Rate limits
  • Default metadata to add to all documents
  • Constructor Details

    • ConnectorMetadata

      public ConnectorMetadata()
      Create an instance with safe defaults.
      • s3Bucket/s3BasePath: empty strings
      • maxFileSize: 100 MiB
      • rateLimitPerMinute: 1000
      • defaultMetadata: empty map
  • Method Details

    • getS3Bucket

      public String getS3Bucket()
      Get the S3 bucket name used for storage.
      Returns:
      bucket name (never null, may be empty)
    • setS3Bucket

      public void setS3Bucket(String s3Bucket)
      Set the S3 bucket name used for storage.
      Parameters:
      s3Bucket - bucket name; null is treated as empty string
    • getS3BasePath

      public String getS3BasePath()
      Get the base path within the S3 bucket where documents are stored.
      Returns:
      base path/prefix (never null, may be empty)
    • setS3BasePath

      public void setS3BasePath(String s3BasePath)
      Set the base path within the S3 bucket where documents are stored.
      Parameters:
      s3BasePath - path/prefix; null is treated as empty string
    • getMaxFileSize

      public long getMaxFileSize()
      Get the maximum allowed file size for uploads.
      Returns:
      max size in bytes
    • setMaxFileSize

      public void setMaxFileSize(long maxFileSize)
      Set the maximum allowed file size for uploads.
      Parameters:
      maxFileSize - size in bytes; non-positive values reset to default (100 MiB)
    • getRateLimitPerMinute

      public long getRateLimitPerMinute()
      Get the allowed ingestion rate.
      Returns:
      documents per minute
    • setRateLimitPerMinute

      public void setRateLimitPerMinute(long rateLimitPerMinute)
      Set the allowed ingestion rate.
      Parameters:
      rateLimitPerMinute - documents per minute; non-positive values reset to default (1000)
    • getDefaultMetadata

      public Map<String,String> getDefaultMetadata()
      Get default metadata applied to every stored document.
      Returns:
      map of key-value metadata (never null)
    • setDefaultMetadata

      public void setDefaultMetadata(Map<String,String> defaultMetadata)
      Set default metadata applied to every stored document.
      Parameters:
      defaultMetadata - map of key-value metadata; null becomes an empty map
    • toJson

      public String toJson()
      Convert this metadata object to its JSON representation.
      Returns:
      JSON string encoding the connector metadata
    • fromJson

      public static ConnectorMetadata fromJson(String json)
      Parse a ConnectorMetadata instance from its JSON representation. Unknown fields are ignored. Missing metadata uses defaults.
      Parameters:
      json - JSON string produced by toJson() or equivalent structure
      Returns:
      parsed ConnectorMetadata instance; default instance if input is null/empty
      Throws:
      IllegalArgumentException - if the metadata is malformed or has invalid field types