private void parseAuthentication( XMLExtendedStreamReader reader, MongoDBCacheStoreConfigurationBuilder builder) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = replaceProperties(reader.getAttributeValue(i)); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case USERNAME: { builder.username(value); break; } case PASSWORD: { builder.password(value); break; } default: { throw ParseUtils.unexpectedAttribute(reader, i); } } } ParseUtils.requireNoContent(reader); }
private void parseConnection( XMLExtendedStreamReader reader, MongoDBCacheStoreConfigurationBuilder builder) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = replaceProperties(reader.getAttributeValue(i)); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case HOST: { builder.host(value); break; } case PORT: { builder.port(Integer.valueOf(value)); break; } case TIMEOUT: { builder.timeout(Integer.valueOf(value)); break; } case ACKNOWLEDGMENT: { builder.acknowledgment(Integer.valueOf(value)); break; } default: { throw ParseUtils.unexpectedAttribute(reader, i); } } } ParseUtils.requireNoContent(reader); }