|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.indexdata.mkjsf.pazpar2.Pz2Service
@Named(value="pz2") @SessionScoped public class Pz2Service
Pz2Service is the main controller of the search logic, used for selecting the service type (which can be done by configuration and/or run-time), selecting which search client to use, and performing high-level control of request cycles and state management.
Command and response beans are also obtained through Pz2Service - although it is 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 will,
though, if the polling mechanism in the tag <pz2utils:pz2watch>
is used.
Nested Class Summary | |
---|---|
static interface |
Pz2Service.Preferred
|
Field Summary | |
---|---|
protected ErrorHelper |
errorHelper
|
protected ResultsPager |
pager
|
static String |
PAZPAR2_URL_LIST
|
protected Pz2Client |
pz2Client
|
protected SearchClient |
searchClient
|
static String |
SERVICE_PROXY_URL_LIST
|
protected ServiceProxyClient |
spClient
|
Constructor Summary | |
---|---|
Pz2Service()
|
Method Summary | |
---|---|
void |
configure(ConfigurationReader reader)
Configures the Configurable using the configuration obtained by the provided configuration reader |
void |
configureClient(SearchClient client,
ConfigurationReader configReader)
Configures the selected search client using the selected configuration reader. |
List<String> |
documentConfiguration()
The components documentation of how it was configured. |
static Pz2Service |
get()
|
boolean |
getAuthenticationRequired()
|
String |
getCheckHistory()
|
String |
getCurrentStateKey()
Returns the current hash key, used for internal session state tracking and potentially for browser history entries A UI author would not normally be concerned with retrieving this. |
Map<String,String> |
getDefaults()
Returns the default parameters that the configurable has defined for itself Should be invoked by the configuration reader before it possibly overrides some parameters obtained from the external configuration source |
ErrorCentral |
getErrors()
|
String |
getModuleName()
Returns the name of the module, can be used by a configuration reader that distinguishes between sets of configuration properties by component name, a name space of sorts. |
ResultsPager |
getPager()
Returns a component for drawing a pager to navigate by. |
String |
getPazpar2Url()
Returns the Pazpar2 URL currently defined for servicing requests |
List<String> |
getPazpar2Urls()
|
Pazpar2Commands |
getPzreq()
|
Responses |
getPzresp()
|
SearchClient |
getSearchClient()
|
String |
getServiceId()
|
String |
getServiceProxyUrl()
Returns the Service Proxy URL currently defined for servicing requests |
List<String> |
getServiceProxyUrls()
|
String |
getServiceType()
|
String |
getServiceUrl()
Gets the currently selected URL used for executing requests. |
boolean |
getServiceUrlIsDefined()
|
ServiceProxyClient |
getSpClient()
|
StateManager |
getStateMgr()
|
String |
getWatchActiveclients()
|
String |
getWatchActiveclientsRecord()
|
protected void |
handleQueryStateChanges(String commands)
This methods main purpose is to support browser history. |
protected boolean |
hasQuery()
|
boolean |
hasRecord(String recId)
Resolves whether the back-end has a record with the given recid in memory |
boolean |
isPazpar2Service()
|
boolean |
isServiceProxyService()
|
void |
postConstruct()
|
void |
resetSearchAndRecordCommands()
|
boolean |
serviceIsToBeDecided()
|
void |
setCurrentStateKey(String key)
Sets the current state key, i.e. |
ResultsPager |
setPager(int pageRange)
Initiates a pager object, a component holding the data to draw a sequence of page numbers to navigate by and mechanisms to navigate with |
void |
setPazpar2Url(String url)
Sets the URL of the Pazpar2 to use for requests |
void |
setServiceId()
|
void |
setServiceProxyUrl(String url)
Sets the URL of the Service Proxy to use for requests |
void |
setServiceTypePZ2()
|
void |
setServiceTypeSP()
|
void |
setServiceTypeTBD()
|
void |
setServiceUrl(String url)
Sets the URL to be used by the currently selected search client when running requests. |
void |
stateUpdated(String commandName)
Used by the state manager to notify Pz2Service about state changes |
String |
toggleRecord(String recId)
Will retrieve -- or alternatively remove -- the record with the given recid from memory. |
String |
update()
Updates display data objects by simultaneously issuing the following Pazpar2 commands: 'show', 'stat', 'termlist' and 'bytarget'. |
String |
update(String commands)
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SERVICE_PROXY_URL_LIST
public static final String PAZPAR2_URL_LIST
protected Pz2Client pz2Client
protected ServiceProxyClient spClient
protected SearchClient searchClient
protected ResultsPager pager
protected ErrorHelper errorHelper
Constructor Detail |
---|
public Pz2Service()
Method Detail |
---|
public static Pz2Service get()
@PostConstruct public void postConstruct() throws MissingConfigurationContextException
MissingConfigurationContextException
@Produces @SessionScoped @Named(value="pzresp") public Responses getPzresp()
@Produces @SessionScoped @Named(value="pzreq") public Pazpar2Commands getPzreq()
@Produces @SessionScoped @Named(value="errors") public ErrorCentral getErrors()
@Produces @SessionScoped @Named(value="stateMgr") public StateManager getStateMgr()
public void configureClient(SearchClient client, ConfigurationReader configReader) throws MissingConfigurationContextException
client
- search client to useconfigReader
- the selected configuration mechanism
MissingConfigurationContextException
- if this object is injected before there is a Faces context
for example in a Servlet filter.public void resetSearchAndRecordCommands()
public String update()
If there are outstanding changes to the search command, a search will be issued before the updates are performed. Outstanding changes could come from the UI changing a search parameter and not executing search before starting the update cycle - OR - it could come from the user clicking the browsers back/forward buttons.
This method is invoked from the composite 'pz2watch', which uses Ajax to keep invoking this method until it returns '0' (for zero active clients).
UI components that display data from show, stat, termlist or bytarget, should be re-rendered after each update.
Example of invocation in UI:<pz2utils:pz2watch id="pz2watch" renderWhileActiveclients="myshowui mystatui mytermsui" /< <h:form> <h:inputText id="query" value="#{pzreq.search.query}" size="50"/> <h:commandButton id="button" value="Search"> <f:ajax execute="query" render="${pz2.watchActiveclients}"/> </h:commandButton> </h:form>The expression pz2.watchActiveClients will invoke the method repeatedly, and the UI sections myshowui, mystatui, and mytermsui will be rendered on each poll.
public String update(String commands)
commands,
- a comma-separated list of Pazpar2 commands to execute
protected void handleQueryStateChanges(String commands)
commands
- com.indexdata.mkjsf.pazpar2.state.StateManager#setCurrentStateKey}
public void stateUpdated(String commandName)
stateUpdated
in interface StateListener
public String toggleRecord(String recId)
recid
-
public boolean hasRecord(String recId)
public String getCurrentStateKey()
public void setCurrentStateKey(String key)
key
- corresponding to browsers hash stringprotected boolean hasQuery()
public ResultsPager getPager()
public ResultsPager setPager(int pageRange)
pageRange
- number of pages to display in the pager
public void setServiceProxyUrl(String url)
url
- public String getServiceProxyUrl()
public void setPazpar2Url(String url)
url
- public String getPazpar2Url()
public void setServiceUrl(String url)
url
- public String getServiceUrl()
public void setServiceId()
public String getServiceId()
public boolean getServiceUrlIsDefined()
public List<String> getServiceProxyUrls()
public List<String> getPazpar2Urls()
public String getServiceType()
public boolean isPazpar2Service()
public boolean isServiceProxyService()
public boolean serviceIsToBeDecided()
public ServiceProxyClient getSpClient()
public boolean getAuthenticationRequired()
public String getCheckHistory()
public String getWatchActiveclients()
public String getWatchActiveclientsRecord()
public void configure(ConfigurationReader reader) throws ConfigurationException
Configurable
configure
in interface Configurable
reader
- used for reading the configuration
ConfigurationException
public Map<String,String> getDefaults()
Configurable
getDefaults
in interface Configurable
public String getModuleName()
Configurable
getModuleName
in interface Configurable
public List<String> documentConfiguration()
Configurable
documentConfiguration
in interface Configurable
public void setServiceTypePZ2()
public void setServiceTypeSP()
public void setServiceTypeTBD()
public SearchClient getSearchClient()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |