Javadoc
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Thu, 6 Jun 2013 17:14:49 +0000 (13:14 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Thu, 6 Jun 2013 17:14:49 +0000 (13:14 -0400)
src/main/java/com/indexdata/mkjsf/config/package-info.java [new file with mode: 0644]
src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Service.java

diff --git a/src/main/java/com/indexdata/mkjsf/config/package-info.java b/src/main/java/com/indexdata/mkjsf/config/package-info.java
new file mode 100644 (file)
index 0000000..a131afc
--- /dev/null
@@ -0,0 +1,97 @@
+/**\r
+ * The library comes with two alternative mechanisms for configuration of an application, but it is\r
+ * possible to apply a custom scheme too or not use the configurations at all.\r
+ * <p>The library does require that a configuration scheme is chosen - in beans.xml as described below.</p>\r
+ * <p>But the library does NOT impose any mandatory parameters in order to start up (except for those required for \r
+ * bootstrapping the configuration). The library <i>does</i> know of certain parameters, if it encounters them.\r
+ *\r
+ * <p>The known parameters are TYPE (service type) PAZPAR2_URL, SERVICE_ID, and SERVICE_PROXY_URL</p>\r
+ * \r
+ * <p>The built-in configuration schemes are:</p>\r
+ * <ul>\r
+ *  <li>Configuration by context parameters in web.xml</li>\r
+ *  <li>The configuration scheme Index Data uses for other MasterKey applications</li>\r
+ * </ul> \r
+ * \r
+ * <p>It must be determined deploy-time what configuration scheme to use, by selecting the preferred \r
+ * mechanism in the application's beans.xml. In this example the MasterKey configuration scheme is injected:</p> \r
+ * \r
+ * <pre>\r
+ * &lt;beans xmlns="http://java.sun.com/xml/ns/javaee"\r
+ *         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ *         xsi:schemaLocation="\r
+ *     http://java.sun.com/xml/ns/javaee \r
+ *     http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt;  \r
+ *     &lt;alternatives>         \r
+ *        &lt;class>com.indexdata.mkjsf.config.Mk2ConfigReader&lt;/class&gt;\r
+ *        &lt;!-- Options                      Mk2ConfigReader     --&gt;\r
+ *        &lt;!--                              WebXmlConfigReader  --&gt;        \r
+ *     &lt;/alternatives&gt;          \r
+ * &lt;/beans&gt;\r
+ * </pre>\r
+ * \r
+ * <p>For the web.xml configuration scheme (choosing WebXmlConfigReader in beans.xml)\r
+ * to pre-define the URL of the Pazpar2 to use, the configuration could be:</p>\r
+ * \r
+ * <pre>\r
+ *  &lt;context-param&gt;\r
+ *   &lt;param-name&gt;PAZPAR2_URL&lt;/param-name&gt;\r
+ *   &lt;param-value&gt;http://localhost:8004/&lt;/param-value&gt;\r
+ *  &lt;/context-param&gt;\r
+ * </pre>\r
+ * \r
+ * <p>For the Mk2ConfigReader scheme to work, the web.xml must then contain pointers to the configuration directory \r
+ * and properties file. \r
+ * In this example the configuration directory is in the web application itself (war://testconfig). A more regular \r
+ * example would put it in a separate directory to not have it overwritten by each deployment of the war.</p> \r
+ * <pre>\r
+ * &lt;context-param&gt;\r
+ *  &lt;param-name&gt;MASTERKEY_ROOT_CONFIG_DIR&lt;/param-name&gt;\r
+ *  &lt;param-value&gt;war://testconfig&lt;/param-value&gt;\r
+ * &lt;/context-param&gt;\r
+ * &lt;context-param&gt;\r
+ *  &lt;description&gt;\r
+ *   The sub directory to hold config file(s) for this Masterkey component.\r
+ *  &lt;/description&gt;\r
+ *  &lt;param-name&gt;MASTERKEY_COMPONENT_CONFIG_DIR&lt;/param-name&gt;\r
+ *  &lt;param-value&gt;/jsfdemo&lt;/param-value&gt;\r
+ * &lt;/context-param&gt;\r
+ * &lt;context-param&gt;\r
+ *  &lt;param-name&gt;MASTERKEY_CONFIG_FILE_NAME&lt;/param-name&gt;\r
+ *  &lt;param-value>jsfdemo.properties&lt;/param-value&gt;\r
+ * &lt;/context-param&gt;\r
+ * &lt;context-param&gt;\r
+ *  &lt;description&gt;\r
+ *   Defines the lifespan of configuration parameters as retrieved\r
+ *   from the file pointed to by MASTERKEY_CONFIG_FILE_NAME.\r
+ *   Can be SERVLET (cached) or REQUEST (read for every request).\r
+ *   Will default to SERVLET.\r
+ *  &lt;/description&gt;\r
+ *  &lt;param-name&gt;MASTERKEY_CONFIG_LIFE_TIME&lt;/param-name&gt;\r
+ *  &lt;param-value&gt;REQUEST&lt;/param-value&gt;\r
+ * &lt;/context-param&gt;\r
+ * </pre>\r
+ * \r
+ * <p>The jsfdemo.properties file might look like this for running against a \r
+ * local Pazpar2 service:</p>\r
+ * \r
+ * <code>pz2client.PAZPAR2_URL = http://localhost:8004/</code>\r
+ * \r
+ * <p>Some of the other know parameters in this format could be:</p>\r
+ * \r
+ * <pre>\r
+ * service.TYPE = SP              \r
+ * proxyclient.SERVICE_PROXY_URL = http://localhost:8080/service-proxy/\r
+ * </pre> \r
+ * \r
+ * <p>It's possible to implement a custom configuration scheme by either ignoring whatever scheme is \r
+ * injected and then applying the required values otherwise, OR by extending the ConfigurationReader\r
+ * and inject that class in beans.xml instead of any of the two predefined options. The extended\r
+ * class must construct a Configuration object -- which is basically a set of key-value pairs -- \r
+ * and then set the desired values and hand it off to the Configurable (currently Pz2Service, Pz2Client, \r
+ * ServiceProxyClient</p> \r
+ * \r
+ * <p>Finally it's possible to set the URL runtime even from the UI pages.</p> \r
+ * \r
+ */\r
+package com.indexdata.mkjsf.config;
\ No newline at end of file
index fea4a44..efbcfe3 100644 (file)
@@ -45,9 +45,9 @@ import com.indexdata.mkjsf.utils.Utils;
  * transparent to the UI that they are retrieved through this object.\r
  * </p>\r
  * <p>\r
- * Pz2Service is exposed to the UI as 'pz2'. However, if the service is pre-configured, \r
- * the Faces pages might never need to reference 'pz2' explicitly. Indirectly they UI will, \r
- * though, if the polling mechanism in the tag &lt;pz2utils:pz2watch&gt; is used.\r
+ * Pz2Service is exposed to the UI as <code>pz2</code>. However, if the service is pre-configured, \r
+ * the Faces pages might never need to reference <code>pz2</code> explicitly. Indirectly they will, \r
+ * though, if the polling mechanism in the tag <code>&lt;pz2utils:pz2watch&gt;</code> is used.\r
  * \r
  * \r
  **/ \r