SuggestionCompletionEngine result = null;
ClassLoader originalCL = Thread.currentThread().getContextClassLoader();
try {
PackageItem pkg = repository.loadPackage( packageName );
BRMSSuggestionCompletionLoader loader = null;
List<JarInputStream> jars = BRMSPackageBuilder.getJars( pkg );
if ( jars != null && !jars.isEmpty() ) {
ClassLoader cl = BRMSPackageBuilder.createClassLoader( jars );
Thread.currentThread().setContextClassLoader( cl );
loader = new BRMSSuggestionCompletionLoader( cl );
} else {
loader = new BRMSSuggestionCompletionLoader();
}
result = loader.getSuggestionEngine( pkg );
} catch ( RulesRepositoryException e ) {
log.error( "An error occurred loadSuggestionCompletionEngine: " + e.getMessage() );
throw new SerializationException( e.getMessage() );
} finally {