Class DnDRepository
java.lang.Object
com.levigo.jadice.web.demo.common.server.dnd.DnDRepository
A implementation to store drag an drop request data in temporary files. The files default
directory is $user.home/.jwt-dnd/. By default after two hours of not accessing a file it will be
deleted. The create files got the name '$uuid.dat'.
-
Method Summary
Modifier and TypeMethodDescriptionSearches for the file within the defaultDirectory and if found return an InputStream of the file.static DnDRepository
void
saveFile
(InputStream inputStream, String uuid) Save the given resource in the defaultDirectory dictionary with a filename matching the uuid.void
Save the given resource in the defaultDirectory dictionary with a filename matching the uuid.void
setDefaultDirectory
(String defaultDirectory) void
setInitialLifeTime
(Duration initialLifeTime) void
setLifeTime
(Duration lifeTime)
-
Method Details
-
getInstance
-
getFile
Searches for the file within the defaultDirectory and if found return an InputStream of the file.- Parameters:
uuid
- The uuid of the file- Returns:
- An InputStream of the file or null if no file was found.
- Throws:
FileNotFoundException
- Should not happen except permissions are missing
-
saveFile
Save the given resource in the defaultDirectory dictionary with a filename matching the uuid.- Parameters:
resource
- The resource to be saveduuid
- The uuid which represents the filename- Throws:
IOException
- If the file couldn't be created
-
saveFile
Save the given resource in the defaultDirectory dictionary with a filename matching the uuid.- Parameters:
inputStream
- The inputStream to be saveduuid
- The uuid which represents the filename- Throws:
IOException
- If the file couldn't be created
-
getDefaultDirectory
-
setDefaultDirectory
-
getLifeTime
-
setLifeTime
-
getInitialLifeTime
-
setInitialLifeTime
-