public JAXBService(Class<?>... xsdRootClasses) { try { JAXBContext jaxbContext = JAXBContext.newInstance(xsdRootClasses); marshaller = jaxbContext.createMarshaller(); unmarshaller = jaxbContext.createUnmarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); String schemas = Arrays.stream(xsdRootClasses).map(c -> { XSDRootElement element = c.getAnnotation(XSDRootElement.class); if (element != null && StringUtils.isNotEmpty(element.namespace()) && StringUtils.isNotEmpty(element.schemaLocation())) { return (element.namespace() + " " + element.schemaLocation()); } return null; }).filter(Objects::nonNull).collect(Collectors.joining(" ")); marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemas); // use a custom Filter so that we can unmarshall older namespace or no namespace xml XMLReader reader = XMLReaderFactory.createXMLReader(); nameSpaceFilter = new NameSpaceFilter(); nameSpaceFilter.setParent(reader); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
}) @XmlRootElement(name = "index", namespace = "http://geode.apache.org/schema/lucene") @XSDRootElement(namespace = "http://geode.apache.org/schema/lucene", schemaLocation = "http://geode.apache.org/schema/lucene/lucene-1.0.xsd") public class Index implements CacheElement {
@XmlType(name = "") @XmlRootElement(name = "mapping", namespace = "http://geode.apache.org/schema/jdbc") @XSDRootElement(namespace = "http://geode.apache.org/schema/jdbc", schemaLocation = "http://geode.apache.org/schema/jdbc/jdbc-1.0.xsd") public class RegionMapping implements CacheElement {
"resourceManager", "serializationRegistration", "backups", "initializer", "cacheElements"}) @XmlRootElement(name = "cache", namespace = "http://geode.apache.org/schema/cache") @XSDRootElement(namespace = "http://geode.apache.org/schema/cache", schemaLocation = "http://geode.apache.org/schema/cache/cache-1.0.xsd") @Experimental