PackageRegistry pkgRegistry = this.pkgRegistryMap.get( ruleDescr.getNamespace() );
Package pkg = pkgRegistry.getPackage();
DialectCompiletimeRegistry ctr = pkgRegistry.getDialectCompiletimeRegistry();
RuleBuildContext context = new RuleBuildContext( this,
ruleDescr,
ctr,
pkg,
ctr.getDialect( pkgRegistry.getDialect() ) );
this.ruleBuilder.build( context );
this.results.addAll( context.getErrors() );
if ( resource != null && ((InternalResource) resource).hasURL() ) {
context.getRule().setResource( resource );
}
context.getDialect().addRule( context );
if ( this.ruleBase != null ) {
if ( pkg.getRule( ruleDescr.getName() ) != null ) {
this.ruleBase.lock();
try {
// XXX: this one notifies listeners
this.ruleBase.removeRule( pkg,
pkg.getRule( ruleDescr.getName() ) );
} finally {
this.ruleBase.unlock();
}
}
}
pkg.addRule( context.getRule() );
}