use of com.predic8.membrane.core.rules.Rule 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();
}
}
use of com.predic8.membrane.core.rules.Rule 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);
}
}
use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class RuleManager method replaceRule.
public synchronized void replaceRule(Rule rule, Rule newRule) {
getExchangeStore().removeAllExchanges(rule);
int i = rules.indexOf(rule);
rules.set(i, newRule);
for (IRuleChangeListener listener : listeners) {
listener.ruleRemoved(rule, rules.size());
}
for (IRuleChangeListener listener : listeners) {
listener.ruleAdded(newRule);
}
}
use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class EtcdPublisher method readConfig.
public void readConfig() {
nodesFromConfig.clear();
for (Rule rule : router.getRuleManager().getRules()) {
if (!(rule instanceof ServiceProxy))
continue;
ServiceProxy sp = (ServiceProxy) rule;
if (sp.getPath() == null)
continue;
nodesFromConfig.add(new EtcdNodeInformation(sp.getPath().getValue(), "/" + UUID.randomUUID().toString(), "localhost", Integer.toString(sp.getPort()), sp.getName()));
}
}
use of com.predic8.membrane.core.rules.Rule in project service-proxy by membrane.
the class AccessControlInterceptorIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", 3008), "thomas-bayer.com", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule);
}
Aggregations