Package com.exedio.cope.vault
Class VaultReferenceService
- java.lang.Object
-
- com.exedio.cope.vault.VaultReferenceService
-
- All Implemented Interfaces:
VaultService
,AutoCloseable
public final class VaultReferenceService extends Object implements VaultService
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Overrides method fromAutoCloseable
to add empty default implementation.byte[]
get(String hash)
void
get(String hash, OutputStream sink)
long
getLength(String hash)
VaultService
getMainService()
VaultService
getReferenceService()
void
purgeSchema(JobContext ctx)
Gives this service the chance to purge / cleanup whatever it needs to.boolean
put(String hash, byte[] value, VaultPutInfo info)
Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.boolean
put(String hash, InputStream value, VaultPutInfo info)
Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.boolean
put(String hash, Path value, VaultPutInfo info)
The caller must make sure, thatvalue
is not modified during the call.String
toString()
-
-
-
Method Detail
-
purgeSchema
public void purgeSchema(JobContext ctx)
Description copied from interface:VaultService
Gives this service the chance to purge / cleanup whatever it needs to. Is called byModel.purgeSchema(JobContext)
. The default implementation does nothing.- Specified by:
purgeSchema
in interfaceVaultService
-
close
public void close()
Description copied from interface:VaultService
Overrides method fromAutoCloseable
to add empty default implementation. Also requires implementations not to declare any checked exception to be thrown.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceVaultService
-
getMainService
public VaultService getMainService()
-
getReferenceService
public VaultService getReferenceService()
-
getLength
public long getLength(String hash) throws VaultNotFoundException
- Specified by:
getLength
in interfaceVaultService
- Throws:
VaultNotFoundException
-
get
public byte[] get(String hash) throws VaultNotFoundException
- Specified by:
get
in interfaceVaultService
- Throws:
VaultNotFoundException
-
get
public void get(String hash, OutputStream sink) throws VaultNotFoundException, IOException
Description copied from interface:VaultService
Must notclose
orflush
sink
.If this method throws a
VaultNotFoundException
, it MUST not have modifiedsink
in any way. In particular it must not have written any byte tosink
.- Specified by:
get
in interfaceVaultService
- Throws:
VaultNotFoundException
IOException
-
put
public boolean put(String hash, byte[] value, VaultPutInfo info)
Description copied from interface:VaultService
Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.- Specified by:
put
in interfaceVaultService
- Returns:
true
ifhash
has been initially stored in the vault by this call. The result is used for statistics only. If the implementation does not have this information available, simply returntrue
.
-
put
public boolean put(String hash, InputStream value, VaultPutInfo info) throws IOException
Description copied from interface:VaultService
Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.- Specified by:
put
in interfaceVaultService
- Returns:
true
ifhash
has been initially stored in the vault by this call. The result is used for statistics only. If the implementation does not have this information available, simply returntrue
.- Throws:
IOException
-
put
public boolean put(String hash, Path value, VaultPutInfo info) throws IOException
Description copied from interface:VaultService
The caller must make sure, thatvalue
is not modified during the call. Is not called, if service instance was created withVaultServiceParameters.isWritable()
==false.- Specified by:
put
in interfaceVaultService
- Returns:
true
ifhash
has been initially stored in the vault by this call. The result is used for statistics only. If the implementation does not have this information available, simply returntrue
.- Throws:
IOException
-
-