@ApplicationScoped public class FileBinaryService extends Object implements BinaryService
BinaryService implementation that stores LDP-NR resources as files on a local filesystem.| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_FILE_BINARY_HIERARCHY
The configuration key controlling the levels of hierarchy in a binary storage layout.
|
static String |
CONFIG_FILE_BINARY_LENGTH
The configuration key controlling the length of each level of hierarchy in a filesystem layout.
|
static String |
CONFIG_FILE_BINARY_PATH
The configuration key controlling the base filesystem path for the binary service.
|
| Constructor and Description |
|---|
FileBinaryService()
Create a File-based Binary service.
|
FileBinaryService(IdentifierService idService)
Create a File-based Binary service.
|
FileBinaryService(IdentifierService idService,
String basePath,
int hierarchy,
int length)
Create a File-based Binary service.
|
| Modifier and Type | Method and Description |
|---|---|
String |
generateIdentifier()
Get a new identifier.
|
CompletionStage<Binary> |
get(IRI identifier)
Get a resource by the given identifier.
|
CompletionStage<Void> |
purgeContent(IRI identifier)
Purge the content from its corresponding datastore.
|
CompletionStage<Void> |
setContent(BinaryMetadata metadata,
InputStream stream)
Set the content for a binary object.
|
public static final String CONFIG_FILE_BINARY_PATH
public static final String CONFIG_FILE_BINARY_HIERARCHY
public static final String CONFIG_FILE_BINARY_LENGTH
public FileBinaryService()
@Inject public FileBinaryService(IdentifierService idService)
idService - an identifier servicepublic FileBinaryService(IdentifierService idService, String basePath, int hierarchy, int length)
idService - an identifier servicebasePath - the base file pathhierarchy - the levels of hierarchylength - the length of each level of hierarchypublic CompletionStage<Binary> get(IRI identifier)
RetrievalServiceget in interface RetrievalService<Binary>identifier - the resource identifierpublic CompletionStage<Void> purgeContent(IRI identifier)
BinaryServicepurgeContent in interface BinaryServiceidentifier - the binary object identifierCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public CompletionStage<Void> setContent(BinaryMetadata metadata, InputStream stream)
BinaryServicesetContent in interface BinaryServicemetadata - the binary metadatastream - the contentpublic String generateIdentifier()
BinaryServicegenerateIdentifier in interface BinaryService