Interface ComponentInstanceFileUploadVerification
-
public interface ComponentInstanceFileUploadVerification
It is a process implied within the manufacturing of a new file upload. When a file upload is performed, it is first verified according to its name (the file is not yet on the server), then it is verified a second time after than the upload is completed successfully. In some circumstances, according to the application, some verifications have to be performed in the behalf of the new file upload. The file upload process is unaware of these circumstances and it cannot know what verification to perform; It is the responsibility of the application to perform such verifications. This is why an implementation of this interface qualified by a name that satisfies the following convention[COMPONENT NAME]InstanceFileUploadVerification
is looked for by the file upload process and then invoked if it is has been found. Any application that requires specific actions when a file upload is performed has to implement this interface and the implementation has to be qualified with the @Named annotation by a name satisfying the following convention[COMPONENT NAME]FileUploadVerification
. For example, for an application Kmelia, the implementation must be qualified with@Named("kmeliaInstanceFileUploadVerification")
- Author:
- Yohann Chastagnier
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME_SUFFIX
The predefined suffix that must compound the name of each implementation of this interface.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Optional<ComponentInstanceFileUploadVerification>
get(String componentInstanceId)
Gets the implementation of this interface with the qualified name guessed from the given component instance identifier.void
verify(String componentInstanceId, File uploadedFile)
Performs verification tasks in the behalf of the specified component instance and specified file.
Verification, here, are performed just after the file has been uploaded, but before the component instance is registering the file.void
verify(String componentInstanceId, FileUploadVerifyData fileUploadVerifyData)
Performs verification tasks in the behalf of the specified component instance and specified file data.
Verification, here, are performed before the upload of the file (so only on the filename which could not represent the real mime-type...).
-
-
-
Field Detail
-
NAME_SUFFIX
static final String NAME_SUFFIX
The predefined suffix that must compound the name of each implementation of this interface. An implementation of this interface by a Silverpeas application named Kmelia must be namedkmelia[NAME_SUFFIX]
where NAME_SUFFIX is the predefined suffix as defined below.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
static Optional<ComponentInstanceFileUploadVerification> get(String componentInstanceId)
Gets the implementation of this interface with the qualified name guessed from the given component instance identifier.- Parameters:
componentInstanceId
- the component instance identifier from which the qualified name of the implementation is guessed.- Returns:
- either an implementation of this interface or nothing.
-
verify
void verify(String componentInstanceId, FileUploadVerifyData fileUploadVerifyData)
Performs verification tasks in the behalf of the specified component instance and specified file data.
Verification, here, are performed before the upload of the file (so only on the filename which could not represent the real mime-type...).- Parameters:
componentInstanceId
- the unique identifier of the component instance.fileUploadVerifyData
- date about the file which will be uploaded.
-
verify
void verify(String componentInstanceId, File uploadedFile)
Performs verification tasks in the behalf of the specified component instance and specified file.
Verification, here, are performed just after the file has been uploaded, but before the component instance is registering the file.- Parameters:
componentInstanceId
- the unique identifier of the component instance.uploadedFile
- the uploaded file.
-
-