use of com.tangosol.run.xml.XmlElement in project oracle-bedrock by coherence-community.
the class GetAutoStartServiceNames method call.
@Override
public Set<String> call() throws Exception {
ConfigurableCacheFactory configurableCacheFactory = CacheFactory.getConfigurableCacheFactory();
if (configurableCacheFactory instanceof DefaultConfigurableCacheFactory) {
DefaultConfigurableCacheFactory cacheFactory = (DefaultConfigurableCacheFactory) configurableCacheFactory;
// obtain the XmlElements representing the service scheme configurations
XmlElement xmlCacheConfig = cacheFactory.getConfig();
Map<String, XmlElement> serviceSchemes = cacheFactory.collectServiceSchemes(xmlCacheConfig);
HashSet<String> serviceNames = new HashSet<>();
for (String serviceName : serviceSchemes.keySet()) {
XmlElement xmlServiceScheme = serviceSchemes.get(serviceName);
boolean isAutoStart = xmlServiceScheme.getSafeElement("autostart").getBoolean(false);
if (isAutoStart) {
serviceNames.add(serviceName);
}
}
return serviceNames;
} else {
throw new RuntimeException("The ConfigurableCacheFactory is not an DefaultConfigurableCacheFactory");
}
}
Aggregations