Class FSUploadManager
java.lang.Object
org.ametys.plugins.core.impl.upload.FSUploadManager
- All Implemented Interfaces:
UploadManager
,Initializable
,Component
,Contextualizable
,LogEnabled
,ThreadSafe
public class FSUploadManager
extends Object
implements UploadManager, ThreadSafe, Initializable, LogEnabled, Contextualizable
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.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
enableLogging
(Logger logger) getUpload
(UserIdentity user, String id) Retrieves a previous file uploaded by an user.File[]
get directories under upload-user directoryvoid
storeUpload
(UserIdentity user, String filename, InputStream is) Stores a file uploaded by an user.
-
Field Details
-
UPLOADS_DIRECTORY
The path to the global uploads directory relative to ametys home- See Also:
-
_cocoonContext
Context. -
_globalUploadsDir
Global uploads directory.
-
-
Constructor Details
-
FSUploadManager
public FSUploadManager()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
enableLogging
- Specified by:
enableLogging
in interfaceLogEnabled
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
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.
-
_getUploadDir
Retrieves the upload directory for a login and an upload id.- Parameters:
login
- the login.id
- the upload id.- Returns:
- the upload directory.
-
getUploadsDirectories
get directories under upload-user directory- Returns:
- the directories
-