1 package net.sourceforge.argval.utils;
2
3
4 import java.io.File;
5 import java.io.FileNotFoundException;
6 import java.io.IOException;
7 import java.util.Properties;
8
9 import net.sourceforge.argval.utils.impl.PropertiesLoaderImpl;
10
11
12 /**
13 * A PropertiesLoader does provides a standard way for loading configuration(s), as Properties.
14 *
15 * @see PropertiesLoaderImpl
16 *
17 * @author T. Verhagen
18 */
19 public interface PropertiesLoader {
20
21 /**
22 * Returns the loaded configuration <code>Properties</code>, including the {@link System#getProperties().}
23 * @return The loaded Properties.
24 * @throws FileNotFoundException When no configuration file is found.
25 * @throws IOException When loading of properties file is not successful.
26 */
27 Properties loadConfiguration() throws FileNotFoundException, IOException;
28
29 /**
30 * Load the configuration properties from file and add the System properties (environment variable). Or
31 * explicitly instruct not to add the system properties.
32 *
33 * @param includeSystemProperties - If <code>true</code> the system properties will be included
34 * (over ruling the loaded properties from file), else (when false) the system properties will
35 * not added. (Default is <code>true</code>)
36 * @return The loaded Properties.
37 * @throws FileNotFoundException When no configuration file is found.
38 * @throws IOException When loading of properties file is not successful.
39 */
40 Properties loadConfiguration(Boolean includeSystemProperties) throws FileNotFoundException, IOException;
41
42 /**
43 * Returns the location of the properties file.
44 * @return The location of the properties file.
45 * @throws FileNotFoundException When no configuration file is found.
46 */
47 File getPropertiesFile() throws FileNotFoundException;
48
49 /**
50 * Returns a message about the location from which the message was loaded.
51 * @return A message about the location from which the message was loaded.
52 */
53 String getPropertiesFileMessage();
54
55 }