Search in sources :

Example 1 with IRuleChangeListener

use of com.predic8.membrane.core.model.IRuleChangeListener in project service-proxy by membrane.

the class RuleManager method addProxyAndOpenPortIfNew.

public synchronized void addProxyAndOpenPortIfNew(Rule rule, RuleDefinitionSource source) throws IOException {
    if (exists(rule.getKey()))
        return;
    router.getTransport().openPort(rule.getKey().getIp(), rule.getKey().getPort(), rule.getSslInboundContext());
    rules.add(rule);
    ruleSources.add(source);
    for (IRuleChangeListener listener : listeners) {
        listener.ruleAdded(rule);
    }
}
Also used : IRuleChangeListener(com.predic8.membrane.core.model.IRuleChangeListener)

Example 2 with IRuleChangeListener

use of com.predic8.membrane.core.model.IRuleChangeListener in project service-proxy by membrane.

the class RuleManager method removeRule.

public synchronized void removeRule(Rule rule) {
    getExchangeStore().removeAllExchanges(rule);
    int i = rules.indexOf(rule);
    rules.remove(i);
    ruleSources.remove(i);
    for (IRuleChangeListener listener : listeners) {
        listener.ruleRemoved(rule, rules.size());
    }
}
Also used : IRuleChangeListener(com.predic8.membrane.core.model.IRuleChangeListener)

Example 3 with IRuleChangeListener

use of com.predic8.membrane.core.model.IRuleChangeListener in project service-proxy by membrane.

the class RuleManager method ruleDown.

public synchronized void ruleDown(Rule rule) {
    int index = rules.indexOf(rule);
    if (index < 0 || index == (rules.size() - 1))
        return;
    Collections.swap(rules, index, index + 1);
    Collections.swap(ruleSources, index, index + 1);
    for (IRuleChangeListener listener : listeners) {
        listener.rulePositionsChanged();
    }
}
Also used : IRuleChangeListener(com.predic8.membrane.core.model.IRuleChangeListener)

Example 4 with IRuleChangeListener

use of com.predic8.membrane.core.model.IRuleChangeListener in project service-proxy by membrane.

the class RuleManager method ruleUp.

public synchronized void ruleUp(Rule rule) {
    int index = rules.indexOf(rule);
    if (index <= 0)
        return;
    Collections.swap(rules, index, index - 1);
    Collections.swap(ruleSources, index, index - 1);
    for (IRuleChangeListener listener : listeners) {
        listener.rulePositionsChanged();
    }
}
Also used : IRuleChangeListener(com.predic8.membrane.core.model.IRuleChangeListener)

Example 5 with IRuleChangeListener

use of com.predic8.membrane.core.model.IRuleChangeListener in project service-proxy by membrane.

the class RuleManager method addProxy.

public synchronized void addProxy(Rule rule, RuleDefinitionSource source) {
    if (exists(rule.getKey()))
        return;
    rules.add(rule);
    ruleSources.add(source);
    for (IRuleChangeListener listener : listeners) {
        listener.ruleAdded(rule);
    }
}
Also used : IRuleChangeListener(com.predic8.membrane.core.model.IRuleChangeListener)

Aggregations

IRuleChangeListener (com.predic8.membrane.core.model.IRuleChangeListener)6