[rules-users] KnowledgeAgent Issue

Steven Williams stevearoonie at gmail.com
Mon Mar 21 22:35:56 EDT 2011


Hi all,

I am trying to use a Knowledge Agent in 5.1.1 with a change set with a few
different packages and resource types in it, and I am running into a problem
where it is not adding all the packages. Looking at the code I can see that
KnowledegeAgentImpl.createPackageFromResource has the following code when it
loads a resource:

            if (kbuilder.getKnowledgePackages().iterator().hasNext()) {

                return (KnowledgePackageImp)
kbuilder.getKnowledgePackages().iterator().next();

            }


and KnowledgeBuilderImpl.getKnowledgePackages does the following:


Package[] pkgs = pkgBuilder.getPackages();

List<KnowledgePackage> list = new ArrayList<KnowledgePackage>( pkgs.length
);


and PackageBuilder.getPackages does the following:


        for ( PackageRegistry pkgRegistry : this.pkgRegistryMap.values() ) {

            Package pkg = pkgRegistry.getPackage();

            // add package to array

        }


pkgRegistryMap is implemented as a HashMap however so the order the packages
are returned in is not guaranteed. I seem to be hitting this problem.

This is a hard one to create a unit test for so I wanted to check that my
analysis is correct before raising a bug. Perhaps using a LinkedHashMap or
similar would fix it?

thanks
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110322/90bf1eb9/attachment.html 


More information about the rules-users mailing list