import com.indexdata.pz2utils4jsf.errors.ConfigurationError;\r
import com.indexdata.pz2utils4jsf.errors.ConfigurationException;\r
import com.indexdata.pz2utils4jsf.errors.ErrorHelper;\r
-import com.indexdata.pz2utils4jsf.errors.ErrorInterface;\r
+import com.indexdata.pz2utils4jsf.errors.ErrorCentral;\r
import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter;\r
import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Commands;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.Pazpar2ResponseData;\r
@Inject StateManager stateMgr;\r
@Inject Pazpar2Commands pzreq;\r
@Inject Pazpar2Responses pzresp;\r
+ @Inject ErrorCentral errors;\r
\r
protected ResultsPager pager = null; \r
\r
- protected List<ErrorInterface> configurationErrors = null;\r
+ \r
protected ErrorHelper errorHelper = null;\r
\r
public Pz2Bean () {\r
} \r
\r
public void configureClient(SearchClient searchClient, ConfigurationReader configReader) {\r
- errorHelper = new ErrorHelper(configurator);\r
- logger.info("pz2 " + Utils.objectId(this) + " sets error helper " + Utils.objectId(errorHelper) + " on pzresp " + Utils.objectId(pzresp));\r
- pzresp.setErrorHelper(errorHelper);\r
- configurationErrors = new ArrayList<ErrorInterface>(); \r
logger.debug(Utils.objectId(this) + " will configure search client for the session");\r
try {\r
searchClient.configure(configReader); \r
} catch (ConfigurationException e) {\r
- configurationErrors.add(new ConfigurationError("Search Client","Configuration",e.getMessage(),new ErrorHelper(configReader))); \r
+ logger.debug("Pz2Bean adding configuration error");\r
+ errors.addConfigurationError(new ConfigurationError("Search Client","Configuration",e.getMessage())); \r
} \r
logger.info(configReader.document());\r
pzresp.reset(); \r
* @return Number of activeclients at the time of the 'show' command\r
*/\r
public String update (String commands) {\r
- if (! hasConfigurationErrors()) {\r
+ if (! errors.hasConfigurationErrors()) {\r
if (commandsAreValid(commands)) {\r
if (hasQuery()) {\r
handleQueryStateChanges(commands);\r
stateMgr.setCurrentStateKey(key);\r
}\r
\r
- public boolean hasConfigurationErrors () {\r
- return (configurationErrors.size()>0); \r
- }\r
- \r
- public boolean hasCommandErrors () {\r
- return pzresp.hasApplicationError();\r
- }\r
- \r
- /**\r
- * Returns true if application error found in any response data objects \r
- */\r
- public boolean hasErrors () {\r
- logger.debug("Checking for configuration errors or command errors.");\r
- return hasConfigurationErrors() || hasCommandErrors();\r
- }\r
-\r
- public List<ErrorInterface> getConfigurationErrors() { \r
- return configurationErrors;\r
- }\r
\r
\r
protected boolean hasQuery() { \r