boolean isLatest,
OutputStream out) throws IOException {
ModuleItem item = null;
if ( isLatest ) {
item = repository.loadModule( packageName );
ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(item.getFormat(), item, null);
String drl = moduleAssembler.getCompiledSource();
out.write( drl.getBytes() );
out.flush();
return packageName + ".drl";
} else {
item = repository.loadModuleSnapshot( packageName,
packageVersion );
ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(item.getFormat(), item, null);
String drl = moduleAssembler.getCompiledSource();
out.write( drl.getBytes() );
out.flush();
return packageName + "_" + URLEncoder.encode( packageVersion,
"UTF-8" ) + ".drl";
}