Search in sources :

Example 1 with XmlElement

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");
    }
}
Also used : XmlElement(com.tangosol.run.xml.XmlElement) DefaultConfigurableCacheFactory(com.tangosol.net.DefaultConfigurableCacheFactory) DefaultConfigurableCacheFactory(com.tangosol.net.DefaultConfigurableCacheFactory) ConfigurableCacheFactory(com.tangosol.net.ConfigurableCacheFactory) HashSet(java.util.HashSet)

Aggregations

ConfigurableCacheFactory (com.tangosol.net.ConfigurableCacheFactory)1 DefaultConfigurableCacheFactory (com.tangosol.net.DefaultConfigurableCacheFactory)1 XmlElement (com.tangosol.run.xml.XmlElement)1 HashSet (java.util.HashSet)1