this.rootClassLoader.loadClass( type ) );
}
}
}
} catch (ClassNotFoundException e) {
throw new RuntimeDroolsException( "Unable to resolve class '" + lastType +
"' for global '" + lastIdent + "'" );
}
// merge entry point declarations
if (newPkg.getEntryPointIds() != null) {
for (String ep : newPkg.getEntryPointIds()) {
pkg.addEntryPointId( ep );
}
}
// merge the type declarations
if (newPkg.getTypeDeclarations() != null) {
// add type declarations
for (TypeDeclaration type : newPkg.getTypeDeclarations().values()) {
// @TODO should we allow overrides? only if the class is not in use.
if (!pkg.getTypeDeclarations().containsKey( type.getTypeName() )) {
// add to package list of type declarations
pkg.addTypeDeclaration( type );
}
}
}
// merge window declarations
if ( newPkg.getWindowDeclarations() != null ) {
// add window declarations
for ( WindowDeclaration window : newPkg.getWindowDeclarations().values() ) {
if ( !pkg.getWindowDeclarations().containsKey( window.getName() ) ||
pkg.getWindowDeclarations().get( window.getName() ).equals( window ) ) {
pkg.addWindowDeclaration( window );
} else {
throw new RuntimeDroolsException( "Unable to merge two conflicting window declarations for window named: "+window.getName() );
}
}
}
//Merge rules into the RuleBase package