/** * Convert the description to another procedure description format. * * @param fromFormat the source format * @param toFormat the target format * @param description the procedure description. * @return the converted description * @throws OwsExceptionReport if conversion fails */ private SosProcedureDescription convert( String fromFormat, String toFormat, SosProcedureDescription description) throws OwsExceptionReport { try { Converter<SosProcedureDescription, Object> converter = ConverterRepository.getInstance().getConverter(fromFormat, toFormat); if (converter != null) { return converter.convert(description); } throw new ConverterException( String.format( "No converter available to convert from '%s' to '%s'", fromFormat, toFormat)); } catch (ConverterException ce) { throw new NoApplicableCodeException() .causedBy(ce) .withMessage("Error while processing data for DescribeSensor document!"); } }
private boolean existConverter(String from, String to) { return ConverterRepository.getInstance().hasConverter(from, to); }