Class SimpleContentStore
- java.lang.Object
-
- com.levigo.jadice.server.rest.impl.SimpleContentStore
-
- All Implemented Interfaces:
ContentStore
,org.springframework.context.Lifecycle
public class SimpleContentStore extends Object implements ContentStore, org.springframework.context.Lifecycle
A simple implementation of aContentStore
that stores all content and meta data directly on disk in theWorkingDirectory
of jadice server.- Since:
- jadice server 5.6.0.0
-
-
Constructor Summary
Constructors Constructor Description SimpleContentStore(WorkingDirectory workingDirectory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(String id)
Delete aStream
TempFileReaper
getTempFileReaper()
WorkingDirectory
getWorkingDirectory()
boolean
isRunning()
Stream
retrieveStream(String id)
Retrieve aStream
void
setTempFileReaper(TempFileReaper tempFileReaper)
Provide an optionalTempFileReaper
which may take care of the content deletionvoid
setWorkingDirectory(WorkingDirectory workingDirectory)
void
start()
void
stop()
String
storeStream(Stream stream)
Store aStream
-
-
-
Constructor Detail
-
SimpleContentStore
public SimpleContentStore(WorkingDirectory workingDirectory)
-
-
Method Detail
-
storeStream
public String storeStream(Stream stream) throws IOException
Description copied from interface:ContentStore
Store aStream
- Specified by:
storeStream
in interfaceContentStore
- Parameters:
stream
- theStream
to store- Returns:
- a unique id under it has been stored
- Throws:
IOException
- if the content could not be stored.- See Also:
ContentStore.retrieveStream(String)
,ContentStore.delete(String)
-
retrieveStream
public Stream retrieveStream(String id) throws IOException
Description copied from interface:ContentStore
Retrieve aStream
- Specified by:
retrieveStream
in interfaceContentStore
- Parameters:
id
- the ID of the content- Returns:
- the
Stream
which has been stored under the given ID - Throws:
IOException
- if the content could not be retrieved.- See Also:
ContentStore.storeStream(Stream)
-
delete
public void delete(String id)
Description copied from interface:ContentStore
Delete aStream
- Specified by:
delete
in interfaceContentStore
- Parameters:
id
- the ID of the content- See Also:
ContentStore.storeStream(Stream)
-
getWorkingDirectory
public WorkingDirectory getWorkingDirectory()
- Returns:
- The
WorkingDirectory
where this implementation will store its contents
-
setWorkingDirectory
public void setWorkingDirectory(WorkingDirectory workingDirectory) throws IOException
- Throws:
IOException
-
getTempFileReaper
public TempFileReaper getTempFileReaper()
- Returns:
- A reaper to which this implementation can delegate the deletion of its content (or
null
)
-
setTempFileReaper
public void setTempFileReaper(TempFileReaper tempFileReaper)
Provide an optionalTempFileReaper
which may take care of the content deletion- Parameters:
tempFileReaper
- an optionalTempFileReaper
which may take care of the content deletion
-
start
public void start()
- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()
- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
-