\r
import org.apache.log4j.Logger;\r
\r
-import com.indexdata.pz2utils4jsf.config.Pz2Configurator;\r
+import com.indexdata.pz2utils4jsf.config.ConfigurationReader;\r
import com.indexdata.pz2utils4jsf.utils.Utils;\r
\r
public class ErrorHelper implements Serializable {\r
\r
private static Logger logger = Logger.getLogger(ErrorHelper.class);\r
\r
- private Pz2Configurator configurator = null;\r
+ private ConfigurationReader configurator = null;\r
\r
- public ErrorHelper(Pz2Configurator configurator) {\r
+ public ErrorHelper(ConfigurationReader configurator) {\r
this.configurator = configurator;\r
}\r
\r
return ErrorCode.SKIP_SUGGESTIONS;\r
} else if (errmsg.contains("Missing mandatory parameter")) {\r
return ErrorCode.MISSING_MANDATORY_PROPERTY;\r
- } else if (errmsg.contains("Pz2ConfigureByMk2Config") && errmsg.contains("Init parameter") && (errmsg.contains("missing"))) { \r
+ } else if (errmsg.contains("ConfigureByMk2Config") && errmsg.contains("Init parameter") && (errmsg.contains("missing"))) { \r
return ErrorCode.MISSING_MK2_CONFIG_INIT_PARAMETER;\r
- } else if (appError.getMessage().contains("Pz2ConfigureByWebXml could not find mandatory context-param")) {\r
+ } else if (appError.getMessage().contains("WebXmlConfigReader could not find mandatory context-param")) {\r
return ErrorCode.MISSING_CONTEXT_PARAMETER;\r
}\r
return ErrorCode.NOT_RESOLVED;\r
switch (code) {\r
case MISSING_MK2_CONFIG_INIT_PARAMETER:\r
suggestions.add("A mandatory init parameter (context-param) was not found in the deployment descriptor (web.xml)." +\r
- " Following init parameters must be present when using the MasterKey configuration scheme (Pz2ConfigureByMk2Config):" +\r
+ " Following init parameters must be present when using the MasterKey configuration scheme (ConfigureByMk2Config):" +\r
" MASTERKEY_ROOT_CONFIG_DIR (i.e. '/etc/masterkey'), MASTERKEY_COMPONENT_CONFIG_DIR (i.e. '/myapp'), " +\r
" MASTERKEY_CONFIG_FILE_NAME (i.e. 'myapp.properties'"); \r
break;\r
case MISSING_CONTEXT_PARAMETER:\r
suggestions.add("A mandatory init parameter (context-param) was not found in the deployment descriptor (web.xml)." +\r
- " Following init parameters must be present when using Pz2ConfigureByWebXml:" +\r
+ " Following init parameters must be present when using WebXmlConfigReader:" +\r
" PAZPAR2_URL, PAZPAR2_SERVICE_ID"); \r
break;\r
case MISSING_MANDATORY_PROPERTY:\r
+ "that a pazpar2 service is running at the given address." + nl);\r
break; \r
case PAZPAR2_ERRORS:\r
- if (error.hasPazpar2Error()) {\r
- String pz2code = error.getPazpar2Error().getCode();\r
+ if (error.hasPazpar2Error()) { \r
+ int pz2code = Integer.parseInt(error.getPazpar2Error().getCode());\r
switch (pz2code) {\r
- case "3":\r
- suggestions.add("Query terms not supported.");\r
+ case 3:\r
+ suggestions.add("The search experienced a problem with the query terms.");\r
break;\r
- case "12":\r
+ case 12:\r
suggestions.add("The Pazpar2 server does not have a service defined by the requested ID ");\r
suggestions.add("Please check the service ID set in the configuration and compare it with the " +\r
" configuration on the Pazpar2 server-side.");\r
addConfigurationDocumentation(suggestions); \r
- break; \r
+ break;\r
+ case 100:\r
+ suggestions.add("Pazpar2 Service Proxy error");\r
+ suggestions.add("A request was made to the Pazpar2 Service Proxy, but the Service Proxy reports ");\r
+ suggestions.add(" that authentication is lacking. Could be no successful authentication request was made or");\r
+ suggestions.add(" that the Service Proxy session timed out.");\r
+ break;\r
default:\r
suggestions.add("Pazpar2 error: " + error.getPazpar2Error().getMsg() + " (Pazpar2 # "+error.getPazpar2Error().getCode()+")");\r
}\r
break; \r
case NOT_RESOLVED:\r
suggestions.add("Sorry, no troubleshooting suggestions were written for this error scenario just yet.");\r
- break;\r
+ break; \r
}\r
return suggestions;\r
}\r