public List<String> document() {\r
List<String> doc = new ArrayList<String>();\r
\r
- doc.add("-- Set to access Pazpar2 at: " +pz2config.get("PAZPAR2_URL"));\r
+ doc.add("-- App set to access Pazpar2 at: " +pz2config.get("PAZPAR2_URL"));\r
if (pz2config.get("PAZPAR2_SERVICE_XML") != null) {\r
doc.add("-- App set to use the service definition contained in " + pz2config.getConfigFilePath() + "/" + pz2config.get("PAZPAR2_SERVICE_XML"));\r
if (pz2config.get("PAZPAR2_SETTINGS_XML") != null) {\r
import org.apache.log4j.Logger;\r
\r
import com.indexdata.pz2utils4jsf.config.Pz2Configurator;\r
+import com.indexdata.pz2utils4jsf.config.Pz2ConfigureByMk2Config;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.Pazpar2Error;\r
import com.indexdata.pz2utils4jsf.utils.Utils;\r
\r
LOCAL_SERVICE_DEF_FILE_NOT_FOUND,\r
REMOTE_SERVICE_DEF_NOT_FOUND,\r
LOCAL_SETTINGS_FILE_NOT_FOUND,\r
+ MASTERKEY_CONFIG_FILE_NOT_FOUND,\r
NOT_RESOLVED,\r
SKIP_SUGGESTIONS};\r
\r
return ErrorCode.PAZPAR2_UNEXPECTED_RESPONSE;\r
}\r
} \r
+ } else if (appError.getMessage().contains("Configuration file") & appError.getMessage().contains("properties")) {\r
+ return ErrorCode.MASTERKEY_CONFIG_FILE_NOT_FOUND; \r
} else if (appError.getMessage().contains("Error reading service definition XML")) {\r
return ErrorCode.LOCAL_SERVICE_DEF_FILE_NOT_FOUND; \r
} else if (appError.getMessage().contains("Cannot query Pazpar2 while there are configuration errors")) {\r
suggestions.add("Unexpected response code from Pazpar2. " + nl\r
+ "Please check the PAZPAR2_URL configuration and verify "\r
+ "that a pazpar2 service is running at the given address." + nl);\r
+ break; \r
+ case MASTERKEY_CONFIG_FILE_NOT_FOUND: \r
+ suggestions.add("The main configuration file that is looked up using parameters" +\r
+ " in web.xml (MASTERKEY_ROOT_CONFIG_DIR,MASTERKEY_COMPONENT_CONFIG_DIR,MASTERKEY_CONFIG_FILE_NAME)" +\r
+ " could not be found. Please check the web.xml parameters and the expected file system location. "); \r
break;\r
case LOCAL_SERVICE_DEF_FILE_NOT_FOUND:\r
suggestions.add("The service definition file could not be loaded.");\r
logger.error("Could not configure Pazpar2 client: " + io.getMessage());\r
configurationErrors.add(new ConfigurationError("Pz2Client Config","ProxyError","Could not configure Pazpar2 client: " + io.getMessage(),errorHelper));\r
}\r
- try {\r
- client = new Pazpar2ClientGeneric(cfg); \r
- } catch (ProxyErrorException pe) {\r
- logger.error("Could not instantiate Pazpar2 client: " + pe.getMessage());\r
- configurationErrors.add(new ConfigurationError("Pz2Client error","ProxyError","Could not create Pazpar2 client: " +pe.getMessage(),errorHelper)); \r
- } \r
- logger.info("Got " + configurationErrors.size() + " configuration errors");\r
+ if (cfg != null) {\r
+ try {\r
+ client = new Pazpar2ClientGeneric(cfg); \r
+ } catch (ProxyErrorException pe) {\r
+ logger.error("Could not instantiate Pazpar2 client: " + pe.getMessage());\r
+ configurationErrors.add(new ConfigurationError("Pz2Client error","ProxyError","Could not create Pazpar2 client: " +pe.getMessage(),errorHelper)); \r
+ } \r
+ logger.info("Got " + configurationErrors.size() + " configuration errors"); \r
+ }\r
resetDataObjects();\r
} else {\r
logger.warn("Attempt to configure session but it already has a configured client");\r
return queryStates.getCurrentStateKey();\r
}\r
\r
- public void setCurrentStateKey(String key) {\r
- logger.debug("************** request to set state key to: [" + key + "]"); \r
+ public void setCurrentStateKey(String key) { \r
queryStates.setCurrentStateKey(key);\r
}\r
\r
return hasConfigurationErrors() || hasCommandErrors();\r
}\r
\r
- public List<ApplicationError> getConfigurationErrors() {\r
- logger.info("Returning " + configurationErrors.size() + " configuration errors");\r
+ public List<ApplicationError> getConfigurationErrors() { \r
return configurationErrors;\r
}\r
\r
dataObjects.put("search", new SearchResponse());\r
}\r
\r
-\r
}\r