Class FSUploadManager
java.lang.Object
java.util.TimerTask
org.ametys.plugins.core.impl.upload.FSUploadManager
- All Implemented Interfaces:
Runnable
,UploadManager
,Disposable
,Initializable
,Contextualizable
,LogEnabled
,ThreadSafe
public class FSUploadManager
extends TimerTask
implements UploadManager, ThreadSafe, Initializable, Contextualizable, LogEnabled, Disposable
UploadManager
which stores uploaded files into the
uploads-user
directory located in Ametys home
Note that this implementation is not cluster safe.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
Context.protected File
Global uploads directory.protected Timer
Timer.static final String
The path to the global uploads directory relative to ametys homeFields inherited from interface org.ametys.core.upload.UploadManager
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected File
_getUploadDir
(String login, String id) Retrieves the upload directory for a login and an upload id.void
contextualize
(Context context) void
dispose()
void
enableLogging
(Logger logger) getUpload
(UserIdentity user, String id) Retrieves a previous file uploaded by an user.void
void
run()
storeUpload
(UserIdentity user, String filename, InputStream is) Stores a file uploaded by an user.Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Field Details
-
UPLOADS_DIRECTORY
The path to the global uploads directory relative to ametys home- See Also:
-
_context
Context. -
_globalUploadsDir
Global uploads directory. -
_timer
Timer.
-
-
Constructor Details
-
FSUploadManager
public FSUploadManager()
-
-
Method Details
-
enableLogging
- Specified by:
enableLogging
in interfaceLogEnabled
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
run
-
storeUpload
Description copied from interface:UploadManager
Stores a file uploaded by an user.- Specified by:
storeUpload
in interfaceUploadManager
- Parameters:
user
- the user.filename
- the upload filename.is
- the upload data.- Returns:
- the upload.
- Throws:
IOException
- if an error occurs.
-
getUpload
Description copied from interface:UploadManager
Retrieves a previous file uploaded by an user.- Specified by:
getUpload
in interfaceUploadManager
- Parameters:
user
- the user.id
- the upload id.- Returns:
- the upload.
- Throws:
NoSuchElementException
- if there is no upload for this parameters.
-
dispose
- Specified by:
dispose
in interfaceDisposable
-
_getUploadDir
Retrieves the upload directory for a login and an upload id.- Parameters:
login
- the login.id
- the upload id.- Returns:
- the upload directory.
-