use of org.commonjava.indy.autoprox.data.AutoProxRule in project indy by Commonjava.
the class ScriptRuleParser method parseRule.
public RuleMapping parseRule(final String spec, final String scriptName) throws AutoProxRuleException {
if (spec == null) {
return null;
}
AutoProxRule rule;
try {
rule = scriptEngine.parseScriptInstance(spec, AutoProxRule.class);
} catch (final IndyGroovyException e) {
throw new AutoProxRuleException("[AUTOPROX] Cannot load autoprox factory from: {} as an instance of: {}. Reason: {}", e, scriptName, AutoProxRule.class.getSimpleName(), e.getMessage());
}
if (rule != null) {
return new RuleMapping(FilenameUtils.removeExtension(scriptName), spec, rule);
}
logger.warn("Rule named: {} parsed to null AutoProxRule instance. Spec was:\n\n{}\n\n", scriptName, spec);
return null;
}
Aggregations