Package org.apache.tika.pipes.fetcher.s3
Class S3Fetcher
- java.lang.Object
-
- org.apache.tika.pipes.fetcher.AbstractFetcher
-
- org.apache.tika.pipes.fetcher.s3.S3Fetcher
-
- All Implemented Interfaces:
Initializable
,Fetcher
,RangeFetcher
public class S3Fetcher extends AbstractFetcher implements Initializable, RangeFetcher
Fetches files from s3. Example file: s3://my_bucket/path/to/my_file.pdf The bucket must be specified via the tika-config or before initialization, and the fetch key is "path/to/my_file.pdf".
-
-
Constructor Summary
Constructors Constructor Description S3Fetcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkInitialization(InitializableProblemHandler problemHandler)
InputStream
fetch(String fetchKey, long startRange, long endRange, Metadata metadata)
InputStream
fetch(String fetchKey, Metadata metadata)
void
initialize(Map<String,Param> params)
This initializes the s3 client.void
setBucket(String bucket)
void
setCredentialsProvider(String credentialsProvider)
void
setExtractUserMetadata(boolean extractUserMetadata)
Whether or not to extract user metadata from the S3Objectvoid
setMaxConnections(int maxConnections)
void
setMaxLength(long maxLength)
void
setPrefix(String prefix)
prefix to prepend to the fetch key before fetching.void
setProfile(String profile)
void
setRegion(String region)
void
setRetries(int retries)
void
setSleepBeforeRetryMillis(long sleepBeforeRetryMillis)
void
setSpoolToTemp(boolean spoolToTemp)
-
Methods inherited from class org.apache.tika.pipes.fetcher.AbstractFetcher
getName, setName
-
-
-
-
Method Detail
-
fetch
public InputStream fetch(String fetchKey, Metadata metadata) throws TikaException, IOException
- Specified by:
fetch
in interfaceFetcher
- Throws:
TikaException
IOException
-
fetch
public InputStream fetch(String fetchKey, long startRange, long endRange, Metadata metadata) throws TikaException, IOException
- Specified by:
fetch
in interfaceRangeFetcher
- Throws:
TikaException
IOException
-
setSpoolToTemp
@Field public void setSpoolToTemp(boolean spoolToTemp)
-
setPrefix
@Field public void setPrefix(String prefix)
prefix to prepend to the fetch key before fetching. This will automatically add a '/' at the end.- Parameters:
prefix
-
-
setExtractUserMetadata
@Field public void setExtractUserMetadata(boolean extractUserMetadata)
Whether or not to extract user metadata from the S3Object- Parameters:
extractUserMetadata
-
-
setMaxConnections
@Field public void setMaxConnections(int maxConnections)
-
setRetries
@Field public void setRetries(int retries)
-
setMaxLength
@Field public void setMaxLength(long maxLength)
-
setSleepBeforeRetryMillis
@Field public void setSleepBeforeRetryMillis(long sleepBeforeRetryMillis)
-
initialize
public void initialize(Map<String,Param> params) throws TikaConfigException
This initializes the s3 client. Note, we wrap S3's RuntimeExceptions, e.g. AmazonClientException in a TikaConfigException.- Specified by:
initialize
in interfaceInitializable
- Parameters:
params
- params to use for initialization- Throws:
TikaConfigException
-
checkInitialization
public void checkInitialization(InitializableProblemHandler problemHandler) throws TikaConfigException
- Specified by:
checkInitialization
in interfaceInitializable
- Parameters:
problemHandler
- if there is a problem and no custom initializableProblemHandler has been configured via Initializable parameters, this is called to respond.- Throws:
TikaConfigException
-
-