Clears info response when clearing init response
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / Pz2Service.java
index 734d177..8b86fd6 100644 (file)
@@ -45,11 +45,27 @@ 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
+ * <h3>Configuration</h3>\r
+ *\r
+ * Configuration name: service\r
+ *  \r
+ * <p>When configuring the client using the Mk2Config scheme, this is the prefix to\r
+ * use in the .properties file. When using web.xml context parameters for configuration\r
+ * the configuration name has no effect.</p> \r
+ * \r
+ * <p>Pz2Service will acknowledge following configuration parameters:\r
+ * \r
+ * <ul>\r
+ *  <li>(service.)TYPE</li>  \r
+ * </ul> \r
+ * \r
+ * Possible values for service TYPE are: PZ2, SP, TBD. "TBD", meaning "to-be-decided runtime", is the default.\r
+ * \r
  **/ \r
 @Named("pz2") @SessionScoped\r
 public class Pz2Service implements StateListener, Configurable, Serializable {\r
@@ -178,7 +194,7 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
      \r
   \r
   /**\r
-   * Updates display data objects by simultaneously issuing the following pazpar2 commands: \r
+   * Updates display data objects by simultaneously issuing the following Pazpar2 commands: \r
    * 'show', 'stat', 'termlist' and 'bytarget'. \r
    * <p>\r
    * If there are outstanding changes to the search command, a search\r
@@ -232,7 +248,7 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
    * Simultaneously refreshes the data objects listed in 'commands' from pazpar2, potentially running a\r
    * search or a record command first if any of these two commands have outstanding parameter changes.\r
    * \r
-   * @param commands comma separated list of Pazpar2 commands to execute\r
+   * @param commands, a comma-separated list of Pazpar2 commands to execute\r
    * \r
    * @return Number of activeclients at the time of the 'show' command,\r
    *         or 'new' if search was just initiated.\r
@@ -322,6 +338,9 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
     }\r
   }\r
       \r
+  /**\r
+   * Used by the state manager to notify Pz2Service about state changes\r
+   */\r
   @Override\r
   public void stateUpdated(String commandName) {\r
     logger.debug("State change reported for [" + commandName + "]");\r
@@ -413,12 +432,21 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
     return pager;\r
   }\r
      \r
+  /**\r
+   * Sets the URL of the Service Proxy to use for requests\r
+   * \r
+   * @param url\r
+   */\r
   public void setServiceProxyUrl(String url) {\r
     searchClient = spClient;\r
     setServiceType(SERVICE_TYPE_SP);\r
     setServiceUrl(url);\r
   }\r
   \r
+  /**\r
+   * Returns the Service Proxy URL currently defined for servicing requests\r
+   * \r
+   */\r
   public String getServiceProxyUrl () {\r
     if (isServiceProxyService()) {\r
       return spClient.getServiceUrl();\r
@@ -426,13 +454,22 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
       return "";\r
     }\r
   }\r
-  \r
+\r
+  /**\r
+   * Sets the URL of the Pazpar2 to use for requests\r
+   * \r
+   * @param url\r
+   */\r
   public void setPazpar2Url(String url) {\r
     searchClient = pz2Client;\r
     setServiceType(SERVICE_TYPE_PZ2);\r
     setServiceUrl(url);\r
   }\r
   \r
+  /**\r
+   * Returns the Pazpar2 URL currently defined for servicing requests\r
+   * \r
+   */  \r
   public String getPazpar2Url() {\r
     if (isPazpar2Service()) {\r
       return pz2Client.getServiceUrl();\r
@@ -441,6 +478,12 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
     }\r
   }\r
 \r
+  /**\r
+   * Sets the URL to be used by the currently selected search client \r
+   * when running requests. \r
+   * \r
+   * @param url\r
+   */\r
   public void setServiceUrl(String url) {\r
     if (url!=null && searchClient != null && !url.equals(searchClient.getServiceUrl())) {\r
       pzreq.getRecord().removeParametersInState();\r
@@ -450,6 +493,10 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
     }    \r
   }\r
   \r
+  /**\r
+   * Gets the currently selected URL used for executing requests. \r
+   * @return\r
+   */\r
   public String getServiceUrl() {\r
     return (searchClient!=null ? searchClient.getServiceUrl() : "");\r
   }\r
@@ -559,15 +606,15 @@ public class Pz2Service implements StateListener, Configurable, Serializable {
   }\r
 \r
   public void setServiceTypePZ2() {\r
-    setServiceType(SERVICE_TYPE_PZ2);    \r
+    setServiceType(SERVICE_TYPE_PZ2);\r
   }\r
 \r
   public void setServiceTypeSP() {\r
-    setServiceType(SERVICE_TYPE_SP);        \r
+    setServiceType(SERVICE_TYPE_SP);\r
   }\r
 \r
   public void setServiceTypeTBD() {\r
-    setServiceType(SERVICE_TYPE_TBD);    \r
+    setServiceType(SERVICE_TYPE_TBD);\r
   }\r
   \r
   private void setServiceType(String type) {\r