de.focus_shift.jollyday.jaxb.JaxbConfigurationService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jollyday-jaxb Show documentation
Show all versions of jollyday-jaxb Show documentation
Jakarta XML Binding (JAXB) based jollyday implementation
package de.focus_shift.jollyday.jaxb;
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 JaxbConfigurationService 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 JaxbConfiguration(xmlUtil.unmarshallConfiguration(inputStream));
} catch (Exception e) {
throw new IllegalStateException("Cannot instantiate configuration from URL '" + resourceUrl + "'.", e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy