1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package net.sf.hermesftp.common;
26
27 import java.util.Properties;
28
29 import javax.net.ssl.SSLContext;
30
31 import net.sf.hermesftp.exception.FtpConfigException;
32
33 /***
34 * Defines the contract for classes representing the static server options retrieved from the
35 * configuration file.
36 *
37 * @author Lars Behnke
38 */
39 public interface FtpServerOptions {
40
41 /***
42 * Getter method for the java bean <code>properties</code>.
43 *
44 * @return Returns the value of the java bean <code>properties</code>.
45 */
46 Properties getProperties();
47
48 /***
49 * Setter method for the java bean <code>properties</code>.
50 *
51 * @param properties The value of properties to set.
52 */
53 void setProperties(Properties properties);
54
55 /***
56 * Convenience method for accessing the options.
57 *
58 * @param key The option key.
59 * @return The option value as string.
60 */
61 String getProperty(String key);
62
63 /***
64 * Read the buffer size for downloading or uploading files. The default buffer size is 1024
65 * bytes.
66 *
67 * @return The buffer size;
68 */
69 int getBufferSize();
70
71 /***
72 * Getter method for the server side remote directory.
73 *
74 * @return The directory
75 */
76 String getRootDir();
77
78 /***
79 * Returns the FTP port.
80 *
81 * @return The port.
82 */
83 int getFtpPort();
84
85 /***
86 * Returns the implicit SSL port.
87 *
88 * @return The port.
89 */
90 int getImplicitSslPort();
91
92 /***
93 * Returns a an option as boolean value.
94 *
95 * @param optionName The name of the option.
96 * @param defaultValue The default value.
97 * @return The boolean value.
98 */
99 boolean getBoolean(String optionName, boolean defaultValue);
100
101 /***
102 * Returns a an option as integer value.
103 *
104 * @param optionName The name of the option.
105 * @param defaultValue The default value.
106 * @return The integer.
107 */
108 int getInt(String optionName, int defaultValue);
109
110 /***
111 * Returns a an option as string value.
112 *
113 * @param optionName The name of the option.
114 * @param defaultValue The default value.
115 * @return The string.
116 */
117 String getString(String optionName, String defaultValue);
118
119 /***
120 * Returns an array of options. The corresponding property value has to be a comma separated
121 * list.
122 *
123 * @param optionName The name of the option.
124 * @param defaultValues The default values.
125 * @return The array.
126 */
127 String[] getStringArray(String optionName, String[] defaultValues);
128
129 /***
130 * Returns an array of integer options. The corresponding property value has to be a comma
131 * separated list.
132 *
133 * @param optionName The name of the option.
134 * @param defaultValues The default values.
135 * @return The array.
136 */
137 int[] getIntArray(String optionName, int[] defaultValues);
138
139 /***
140 * Returns a set of all allowed passive ports.
141 *
142 * @return The set.
143 */
144 Integer[] getAllowedPorts();
145
146 /***
147 * Returns the SSL context to be used for creating SSL sockets.
148 *
149 * @return The SSL context.
150 * @throws FtpConfigException Error initializing SSL context or keystore.
151 */
152 SSLContext getSslContext() throws FtpConfigException;
153
154 /***
155 * Getter method for the java bean <code>systemProperties</code>.
156 *
157 * @return Returns the value of the java bean <code>systemProperties</code>.
158 */
159 Properties getSystemProperties();
160
161 /***
162 * Returns the application title as defined in the POM file.
163 *
164 * @return The application title.
165 */
166 String getAppTitle();
167
168 /***
169 * Returns the application version as defined in the POM file.
170 *
171 * @return The application version.
172 */
173 String getAppVersion();
174
175 /***
176 * Returns the application build info as defined in the POM file.
177 *
178 * @return The application build info.
179 */
180 String getAppBuildInfo();
181
182 }