[jboss-user] [jBPM] - Re: Instantiating the KnowledgeBase

Piotr Tempes do-not-reply at jboss.com
Thu Apr 7 11:54:46 EDT 2011


Piotr Tempes [http://community.jboss.org/people/carek] created the discussion

"Re: Instantiating the KnowledgeBase"

To view the discussion, visit: http://community.jboss.org/message/598562#598562

--------------------------------------------------------------
Well my case is the second one. I'd like to read process definition and have it in KnowledgeBase, so that  I can run process, etc... but as I mentioned I was unable to get those processes... I don't know maybe I am doing something wrong. Here's my code snippets:

ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());
ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());        ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());
BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());       
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("default guvnor agent");      
kagent.applyChangeSet(ResourceFactory.newClassPathResource("ChangeSet.xml"));
kbase = kagent.getKnowledgeBase();


ChangeSet.xml:

<change-set xmlns='http://drools.org/drools-5.0/change-set'
            xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
            xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' >
    <add>
        <resource source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST' type='PKG'/>
    </add>
</change-set>


and when I want to list all loaded processes in index.jsp:

<% 
     if (connector.kbase.getProcesses().size() > 0) {
          for (Process proccess : connector.kbase.getProcesses()) {
               out.println("Process " + proccess.getName() + " loadded succesfully");
          }
     } else {
          out.println("No proccess loaded");
     }
%>


Else part is displayed. Do I need to do soemthing first in guvnor with this package? Some kind of export or what? Maybe it has something to do with this process status? Is Draft ok? I don't know. Any idea what could be wrong?
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/598562#598562]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110407/44f68cfc/attachment-0001.html 


More information about the jboss-user mailing list