\r
import com.indexdata.pz2utils4jsf.errors.ConfigurationException;\r
\r
+/**\r
+ * Interface to be implemented by any part of an application that wish to\r
+ * use a ConfigurationReader for it's configuration. The Configurables that\r
+ * come with the project are a Pazpar2 client and a Service Proxy client\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public interface Configurable {\r
\r
+ /**\r
+ * Configures the Configurable using the configuration obtained by the \r
+ * provided configuration reader\r
+ * @param reader used for reading the configuration \r
+ * @throws ConfigurationException\r
+ */\r
public void configure(ConfigurationReader reader) throws ConfigurationException;\r
+ \r
+ /**\r
+ * Returns the default parameters that the configurable has defined for itself\r
+ * Should be invoked by the configuration reader before it possibly overrides\r
+ * some parameters obtained from the external configuration source \r
+ * @return\r
+ */\r
public Map<String,String> getDefaults();\r
+ \r
+ /**\r
+ * Returns the name of the module, can be used by a configuration reader that \r
+ * has distinguishes between sets of configuration properties by component name\r
+ * @return name of the part that is to be configured\r
+ */\r
public String getModuleName();\r
+ \r
+ /**\r
+ * The components documentation of how it was configured. \r
+ * \r
+ * @return a list of Strings describing configuration details\r
+ */\r
public List<String> documentConfiguration(); \r
\r
}\r
\r
import com.indexdata.pz2utils4jsf.errors.ConfigurationException;\r
\r
+/**\r
+ * Interface to be implemented by classes that read configurations from a source -\r
+ * i.e. from web.xml, the file system, a database or hard-coded. \r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public interface ConfigurationReader extends Serializable {\r
\r
+ /**\r
+ * Returns a Configuration to be used by the given Configurable\r
+ * \r
+ * @param configurable the configurable to be configured by a configuration obtained by this reader\r
+ * @return a Configuration, basically a set of key-value pairs\r
+ * @throws ConfigurationException\r
+ */\r
public Configuration getConfiguration(Configurable configurable) throws ConfigurationException;\r
\r
+ /**\r
+ * Returns documentation for the key-value pairs obtained by this reader\r
+ * @return\r
+ */\r
public List<String> document();\r
}\r