@Override public Map<DocumentType, Set<DocumentType>> getSupportedConversions() { return converter.getSupportedConversions(); }
@Override public Map<DocumentType, Set<DocumentType>> getSupportedConversions() { Map<DocumentType, Set<DocumentType>> supportedConversions = new HashMap<DocumentType, Set<DocumentType>>(); for (IConverter converter : converters) { for (Map.Entry<DocumentType, Set<DocumentType>> entry : converter.getSupportedConversions().entrySet()) { Set<DocumentType> targetTypes = supportedConversions.get(entry.getKey()); if (targetTypes == null) { targetTypes = new HashSet<DocumentType>(); supportedConversions.put(entry.getKey(), targetTypes); } targetTypes.addAll(entry.getValue()); } } return supportedConversions; }
protected IConverter nextConverter(DocumentType sourceFormat, DocumentType targetFormat) { List<IConverter> supportingConverters = new ArrayList<IConverter>(converters.size()); for (IConverter converter : converters) { Set<DocumentType> documentTypes = converter.getSupportedConversions().get(sourceFormat); if (documentTypes != null && documentTypes.contains(targetFormat)) { supportingConverters.add(converter); } } if (supportingConverters.isEmpty()) { LOGGER.trace("No converter available for conversion of {} to {}", sourceFormat, targetFormat); return new ImpossibleConverter(); } IConverter converter = selectionStrategy.select(supportingConverters); LOGGER.trace("Selected {} for conversion of {} to {}", converter, sourceFormat, targetFormat); return new FailureAwareConverter(converter, this); }
@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(); }
Logger logger = LoggerFactory.getLogger(StandaloneClient.class); sayHello(converter, logger, console); DocumentType[] documentTypes = configureConversion(console, converter.getSupportedConversions()); console.printf("Enter '<source> [-> <target>]' for converting a file. Enter '\\q' for exiting this application.%n"); String argument; break; } else if (argument.equals("\\f")) { documentTypes = configureConversion(console, converter.getSupportedConversions()); } else if (argument.trim().equals("")) { continue;