/** * * @param requiredOptions : options for initialising writer * @return the registered InteractionWriter supporting this options, null if nothing could be found */ public InteractionWriter getInteractionWriterWith(Map<String,Object> requiredOptions) { for (Map.Entry<Class<? extends InteractionWriter>, Map<String, Object>> entry : registeredWriters.entrySet()){ // we check for a DataSource that can be used with the given options if (areSupportedOptions(entry.getValue(), requiredOptions)){ try { return instantiateNewWriter(entry.getKey(), requiredOptions); } catch (IllegalAccessException e) { logger.log(Level.SEVERE, "We cannot instantiate interaction writer of type " + entry.getKey() + " with the given options.", e); } catch (InstantiationException e) { logger.log(Level.SEVERE, "We cannot instantiate interaction writer of type " + entry.getKey() + " with the given options.", e); } catch (Exception e) { logger.log(Level.WARNING, "We cannot instantiate interaction writer of type " + entry.getKey() + " with the given options.", e); } } } return null; }