private ConverterServerInformation logConverterServerInformation(ConverterServerInformation converterServerInformation) { LOGGER.info("Currently operational @ conversion server: {}", converterServerInformation.isOperational()); LOGGER.info("Request timeout @ conversion server: {}", converterServerInformation.getTimeout()); LOGGER.info("Protocol version @ conversion server: {}", converterServerInformation.getProtocolVersion()); if (converterServerInformation.getProtocolVersion() != ConverterNetworkProtocol.CURRENT_PROTOCOL_VERSION) { LOGGER.warn("Server protocol version ({}) does not match client protocol version ({})", converterServerInformation.getProtocolVersion(), ConverterNetworkProtocol.CURRENT_PROTOCOL_VERSION); } return converterServerInformation; }
@Override public boolean isOperational() { try { return !executorService.isShutdown() && fetchConverterServerInformation().isOperational(); } catch (Exception e) { LOGGER.warn("Could not connect to conversion server @ {}", baseUri, e); return false; } }
@Override public Map<DocumentType, Set<DocumentType>> getSupportedConversions() { return fetchConverterServerInformation().getSupportedConversions(); }
@GET @Produces(MediaType.APPLICATION_XML) public Response serverInformation() { return Response .status(ConverterNetworkProtocol.Status.OK.getStatusCode()) .entity(new ConverterServerInformation( webConverterConfiguration.getConverter().isOperational(), webConverterConfiguration.getTimeout(), ConverterNetworkProtocol.CURRENT_PROTOCOL_VERSION, webConverterConfiguration.getConverter().getSupportedConversions())) .type(MediaType.APPLICATION_XML_TYPE) .build(); }