All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.maxifier.mxcache.config.ConfigurationControl Maven / Gradle / Ivy

/*
 * Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
 */
package com.maxifier.mxcache.config;

import com.maxifier.mxcache.mbean.ConfigurationControlMXBean;
import com.maxifier.mxcache.mbean.RuleInfo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Alexander Kochurov ([email protected])
 */
public class ConfigurationControl implements ConfigurationControlMXBean {
    private final MxCacheConfigProviderImpl provider;

    public ConfigurationControl(MxCacheConfigProviderImpl provider) {
        this.provider = provider;
    }

    @Override
    public List getRules() {
        List res = new ArrayList();
        for (RuleWithSelector rule : provider.getRules()) {
            List sel = rule.getSelectors();
            String[] selectors = new String[sel.size()];
            int i = 0;
            for (Selector selector : sel) {
                selectors[i++] = selector.toString();
            }
            res.add(new RuleInfo(rule.getName(), rule.getSource(), selectors, rule.getTrackDependency(), rule.getStrategy().toString()));
        }
        return res;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy