X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2FPz2Service.java;h=8b86fd6faad35fb3c9e99c8bae649bdb3a09920d;hb=HEAD;hp=734d17750478b131222ba2f80bc73c1d6e1faef6;hpb=7df6b1590eb285bca094652950a23edc3da95f70;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Service.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Service.java index 734d177..8b86fd6 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Service.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Service.java @@ -45,11 +45,27 @@ import com.indexdata.mkjsf.utils.Utils; * transparent to the UI that they are retrieved through this object. *

*

- * Pz2Service is exposed to the UI as 'pz2'. However, if the service is pre-configured, - * the Faces pages might never need to reference 'pz2' explicitly. Indirectly they UI will, - * though, if the polling mechanism in the tag <pz2utils:pz2watch> is used. + * Pz2Service is exposed to the UI as pz2. However, if the service is pre-configured, + * the Faces pages might never need to reference pz2 explicitly. Indirectly they will, + * though, if the polling mechanism in the tag <pz2utils:pz2watch> is used. * * + *

Configuration

+ * + * Configuration name: service + * + *

When configuring the client using the Mk2Config scheme, this is the prefix to + * use in the .properties file. When using web.xml context parameters for configuration + * the configuration name has no effect.

+ * + *

Pz2Service will acknowledge following configuration parameters: + * + *

+ * + * Possible values for service TYPE are: PZ2, SP, TBD. "TBD", meaning "to-be-decided runtime", is the default. + * **/ @Named("pz2") @SessionScoped public class Pz2Service implements StateListener, Configurable, Serializable { @@ -178,7 +194,7 @@ public class Pz2Service implements StateListener, Configurable, Serializable { /** - * Updates display data objects by simultaneously issuing the following pazpar2 commands: + * Updates display data objects by simultaneously issuing the following Pazpar2 commands: * 'show', 'stat', 'termlist' and 'bytarget'. *

* If there are outstanding changes to the search command, a search @@ -232,7 +248,7 @@ public class Pz2Service implements StateListener, Configurable, Serializable { * Simultaneously refreshes the data objects listed in 'commands' from pazpar2, potentially running a * search or a record command first if any of these two commands have outstanding parameter changes. * - * @param commands comma separated list of Pazpar2 commands to execute + * @param commands, a comma-separated list of Pazpar2 commands to execute * * @return Number of activeclients at the time of the 'show' command, * or 'new' if search was just initiated. @@ -322,6 +338,9 @@ public class Pz2Service implements StateListener, Configurable, Serializable { } } + /** + * Used by the state manager to notify Pz2Service about state changes + */ @Override public void stateUpdated(String commandName) { logger.debug("State change reported for [" + commandName + "]"); @@ -413,12 +432,21 @@ public class Pz2Service implements StateListener, Configurable, Serializable { return pager; } + /** + * Sets the URL of the Service Proxy to use for requests + * + * @param url + */ public void setServiceProxyUrl(String url) { searchClient = spClient; setServiceType(SERVICE_TYPE_SP); setServiceUrl(url); } + /** + * Returns the Service Proxy URL currently defined for servicing requests + * + */ public String getServiceProxyUrl () { if (isServiceProxyService()) { return spClient.getServiceUrl(); @@ -426,13 +454,22 @@ public class Pz2Service implements StateListener, Configurable, Serializable { return ""; } } - + + /** + * Sets the URL of the Pazpar2 to use for requests + * + * @param url + */ public void setPazpar2Url(String url) { searchClient = pz2Client; setServiceType(SERVICE_TYPE_PZ2); setServiceUrl(url); } + /** + * Returns the Pazpar2 URL currently defined for servicing requests + * + */ public String getPazpar2Url() { if (isPazpar2Service()) { return pz2Client.getServiceUrl(); @@ -441,6 +478,12 @@ public class Pz2Service implements StateListener, Configurable, Serializable { } } + /** + * Sets the URL to be used by the currently selected search client + * when running requests. + * + * @param url + */ public void setServiceUrl(String url) { if (url!=null && searchClient != null && !url.equals(searchClient.getServiceUrl())) { pzreq.getRecord().removeParametersInState(); @@ -450,6 +493,10 @@ public class Pz2Service implements StateListener, Configurable, Serializable { } } + /** + * Gets the currently selected URL used for executing requests. + * @return + */ public String getServiceUrl() { return (searchClient!=null ? searchClient.getServiceUrl() : ""); } @@ -559,15 +606,15 @@ public class Pz2Service implements StateListener, Configurable, Serializable { } public void setServiceTypePZ2() { - setServiceType(SERVICE_TYPE_PZ2); + setServiceType(SERVICE_TYPE_PZ2); } public void setServiceTypeSP() { - setServiceType(SERVICE_TYPE_SP); + setServiceType(SERVICE_TYPE_SP); } public void setServiceTypeTBD() { - setServiceType(SERVICE_TYPE_TBD); + setServiceType(SERVICE_TYPE_TBD); } private void setServiceType(String type) {