Boolean ignoreModifications = null;
Boolean purgeOnStartup = null;
Boolean preload = null;
Boolean shared = null;
Boolean singleton = null;
CacheLoader store = null;
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 CLASS:
store = Util.getInstance(value, holder.getClassLoader());
break;
case FETCH_STATE:
fetchPersistentState = Boolean.valueOf(value);
break;
case READ_ONLY:
ignoreModifications = Boolean.valueOf(value);
break;
case PURGE:
purgeOnStartup = Boolean.valueOf(value);
break;
case PRELOAD:
preload = Boolean.parseBoolean(value);
break;
case SHARED:
shared = Boolean.parseBoolean(value);
break;
case SINGLETON:
singleton = Boolean.parseBoolean(value);
break;
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
if (store != null) {
if (store instanceof SingleFileStore) {
SingleFileStoreConfigurationBuilder sfs = builder.persistence().addSingleFileStore();
if (fetchPersistentState != null)
sfs.fetchPersistentState(fetchPersistentState);
if (ignoreModifications != null)
sfs.ignoreModifications(ignoreModifications);
if (purgeOnStartup != null)
sfs.purgeOnStartup(purgeOnStartup);
if (preload != null)
sfs.preload(preload);
if (shared != null)
sfs.shared(shared);
if (singleton != null)
sfs.singleton().enabled(singleton);
parseStoreElements(reader, sfs);
} else if (store instanceof ClusterLoader) {
ClusterLoaderConfigurationBuilder cscb = builder.persistence().addClusterLoader();
parseStoreElements(reader, cscb);
} else {
ConfiguredBy annotation = store.getClass().getAnnotation(ConfiguredBy.class);
Class<? extends StoreConfigurationBuilder> builderClass = null;
if (annotation != null) {
Class<?> configuredBy = annotation.value();
if (configuredBy != null) {
BuiltBy builtBy = configuredBy.getAnnotation(BuiltBy.class);
builderClass = builtBy.value().asSubclass(StoreConfigurationBuilder.class);
}
}
StoreConfigurationBuilder configBuilder;
// If they don't specify a builder just use the custom configuration builder and set the class
if (builderClass == null) {
configBuilder = builder.persistence().addStore(CustomStoreConfigurationBuilder.class).customStoreClass(
store.getClass());
} else {
configBuilder = builder.persistence().addStore(builderClass);
}
if (fetchPersistentState != null)