01: package com.coldcore.coloradoftp.filter;
02:
03: import com.coldcore.coloradoftp.session.Session;
04:
05: import java.nio.channels.ReadableByteChannel;
06: import java.nio.channels.WritableByteChannel;
07:
08: /**
09: * This class applies flters to data channels when user uploads or downloads data.
10: *
11: * Data transfer commands (e.g. RETR, STOR) must use this class to apply required filters
12: * before they can proceed to data transfer operations.
13: *
14: * Commands store filter names in user session (e.g. TYPE, MODE, STRU), such commands must
15: * take care to not to store non-existing filters because the applicatior class does not
16: * check if required filters exist. If a filter cannot be loaded then an exception must be
17: * thrown and the command processor will report error reply to a user.
18: *
19: * This class usually exists in single instance and applies filters based on the information
20: * retrieved from user session.
21: *
22: * It is recommended to apply filters so that they execute in this order:
23: * upload: MODE->TYPE->STRU
24: * download: STRU->TYPE->MODE
25: *
26: *
27: * ColoradoFTP - The Open Source FTP Server (http://cftp.coldcore.com)
28: */
29: public interface DataFilterApplicator {
30:
31: /** Apply filters to data channel
32: * @param rbc Data channel
33: * @param userSession User session
34: * @return Filtered stream
35: */
36: public ReadableByteChannel applyFilters(ReadableByteChannel rbc,
37: Session userSession);
38:
39: /** Apply filters to data channel
40: * @param wbc Data channel
41: * @param userSession User session
42: * @return Filtered stream
43: */
44: public WritableByteChannel applyFilters(WritableByteChannel wbc,
45: Session userSession);
46: }
|