diff --git a/adapter/adapter-service/src/main/scala/net/shrine/adapter/Adapter.scala b/adapter/adapter-service/src/main/scala/net/shrine/adapter/Adapter.scala index 186c65200..c799f9db0 100644 --- a/adapter/adapter-service/src/main/scala/net/shrine/adapter/Adapter.scala +++ b/adapter/adapter-service/src/main/scala/net/shrine/adapter/Adapter.scala @@ -1,101 +1,101 @@ package net.shrine.adapter import java.sql.SQLException import java.util.Date import net.shrine.adapter.dao.BotDetectedException import net.shrine.log.Loggable import net.shrine.problem.{AbstractProblem, LoggingProblemHandler, Problem, ProblemNotYetEncoded, ProblemSources} import net.shrine.protocol.{AuthenticationInfo, BaseShrineResponse, BroadcastMessage, ErrorResponse, ShrineRequest} import scala.util.control.NonFatal /** * @author Bill Simons * @since 4/8/11 * @see http://cbmi.med.harvard.edu * @see http://chip.org *
* NOTICE: This software comes with NO guarantees whatsoever and is * licensed as Lgpl Open Source * @see http://www.gnu.org/licenses/lgpl.html */ abstract class Adapter extends Loggable { //noinspection RedundantBlock final def perform(message: BroadcastMessage): BaseShrineResponse = { def problemToErrorResponse(problem:Problem):ErrorResponse = { - LoggingProblemHandler.handleProblem(problem) + //TODO: Is this needed? LoggingProblemHandler.handleProblem(problem) ErrorResponse(problem) } val shrineResponse = try { processRequest(message) } catch { case e: AdapterLockoutException => problemToErrorResponse(AdapterLockout(message.request.authn,e)) case e: BotDetectedException => problemToErrorResponse(BotDetected(e)) case e @ CrcInvocationException(invokedCrcUrl, request, cause) => problemToErrorResponse(CrcCouldNotBeInvoked(invokedCrcUrl,request,e)) case e: AdapterMappingException => problemToErrorResponse(AdapterMappingProblem(e)) case e: SQLException => problemToErrorResponse(AdapterDatabaseProblem(e)) case NonFatal(e) => { val summary = if(message == null) "Unknown problem in Adapter.perform with null BroadcastMessage" else s"Unexpected exception in Adapter" problemToErrorResponse(ProblemNotYetEncoded(summary,e)) } } shrineResponse } protected[adapter] def processRequest(message: BroadcastMessage): BaseShrineResponse //NOOP, may be overridden by subclasses def shutdown(): Unit = () } case class AdapterLockout(authn:AuthenticationInfo,x:AdapterLockoutException) extends AbstractProblem(ProblemSources.Adapter) { override val throwable = Some(x) override val summary: String = s"User '${authn.domain}:${authn.username}' locked out." override val description:String = s"User '${authn.domain}:${authn.username}' has run too many queries that produce the same result at ${x.url} ." } case class CrcCouldNotBeInvoked(crcUrl:String,request:ShrineRequest,x:CrcInvocationException) extends AbstractProblem(ProblemSources.Adapter) { override val throwable = Some(x) override val summary: String = s"Error communicating with I2B2 CRC." override val description: String = s"Error invoking the CRC at '$crcUrl' with a ${request.getClass.getSimpleName} due to ${throwable.get}." override val detailsXml =Adapter Configuration | |
These are the parameters that the SHRINE Adapter will use for querying the i2b2 CRC. | |
CRC URL | {{vm.configuration.crcEndpointURL}} |
CRC Project | {{vm.configuration.crcProjectId}} |
Domain | {{vm.configuration.domain}} |
Adapter User | {{vm.configuration.username}} |
Adapter Password | {{vm.configuration.password}} |
Lockout Threshold | {{vm.configuration.lockoutThreshold}} |
Adapter Query Test | ||
SHRINE Query Term | {{vm.adapter.term}} | |
Status | Success | Failed |
Details | {{vm.adapter.description}} | |
Error Details |
Summary:
{{vm.adapter.errorData.summary }} Description:
{{vm.adapter.errorData.description }} For information on troubleshooting and resolution, check
the SHRINE Error
Codex.
Copy the text below and paste it in an email to your site administrator for a faster response.
Technical Details: {{vm.adapter.errorData.description}} Codec: {{vm.adapter.errorData.codec }} - Stamp: {{vm.adapter.errorData.stamp}} - Stack Trace Name: {{vm.adapter.errorData.details.exception.name }} - Stack Trace Message: {{vm.adapter.errorData.details.exception.message}} + Stamp: {{vm.adapter.errorData.stampText}} + Stack Trace Name: {{vm.adapter.errorData.detailsXml.details.exception.name }} + Stack Trace Message: {{vm.adapter.errorData.detailsXml.details.exception.message}} |
Mappings File | |
Filename | {{vm.mappings.mappingsFilename}} |
Version Info | |
This site is running SHRINE {{vm.summary.shrineVersion}} built on | |
- This site is currently using ontology version + This site is currently using ontology version | |
- This site is currently using for mappings. + This site is currently using for mappings. |
Error: click here for more details. | OK | |
Error: click here for more details. | OK | |
Error: click here for more details. | OK | |
Error: click here for more details. | OK |
Fatal SHRINE Error | |