Class ConnectorMetadata
java.lang.Object
ai.pipeline.connector.intake.util.ConnectorMetadata
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConnectorMetadataParse a ConnectorMetadata instance from its JSON representation.Get default metadata applied to every stored document.longGet the maximum allowed file size for uploads.longGet the allowed ingestion rate.Get the base path within the S3 bucket where documents are stored.Get the S3 bucket name used for storage.voidsetDefaultMetadata(Map<String, String> defaultMetadata) Set default metadata applied to every stored document.voidsetMaxFileSize(long maxFileSize) Set the maximum allowed file size for uploads.voidsetRateLimitPerMinute(long rateLimitPerMinute) Set the allowed ingestion rate.voidsetS3BasePath(String s3BasePath) Set the base path within the S3 bucket where documents are stored.voidsetS3Bucket(String s3Bucket) Set the S3 bucket name used for storage.toJson()Convert this metadata object to its JSON representation.
-
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
Get the S3 bucket name used for storage.- Returns:
- bucket name (never null, may be empty)
-
setS3Bucket
Set the S3 bucket name used for storage.- Parameters:
s3Bucket- bucket name; null is treated as empty string
-
getS3BasePath
Get the base path within the S3 bucket where documents are stored.- Returns:
- base path/prefix (never null, may be empty)
-
setS3BasePath
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
-
setDefaultMetadata
-
toJson
Convert this metadata object to its JSON representation.- Returns:
- JSON string encoding the connector metadata
-
fromJson
Parse a ConnectorMetadata instance from its JSON representation. Unknown fields are ignored. Missing metadata uses defaults.- Parameters:
json- JSON string produced bytoJson()or equivalent structure- Returns:
- parsed
ConnectorMetadatainstance; default instance if input is null/empty - Throws:
IllegalArgumentException- if the metadata is malformed or has invalid field types
-