de.focus_shift.jollyday.jackson.JacksonConfigurationService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jollyday-jackson Show documentation
Show all versions of jollyday-jackson Show documentation
Jackson based jollyday implementation
package de.focus_shift.jollyday.jackson;
import de.focus_shift.jollyday.core.ManagerParameter;
import de.focus_shift.jollyday.core.spi.Configuration;
import de.focus_shift.jollyday.core.spi.ConfigurationService;
import java.io.InputStream;
import java.net.URL;
public class JacksonConfigurationService implements ConfigurationService {
private final XMLUtil xmlUtil = new XMLUtil();
@Override
public Configuration getConfiguration(ManagerParameter parameter) {
final URL resourceUrl = parameter.createResourceUrl();
try (final InputStream inputStream = resourceUrl.openStream()) {
return new JacksonConfiguration(xmlUtil.unmarshallConfiguration(inputStream));
} catch (Exception e) {
throw new IllegalStateException("Cannot instantiate configuration from URL '" + resourceUrl + "'.", e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy