6 Replies Latest reply on Oct 12, 2011 7:44 AM by uvijayreddy657

    What does "Build package" do? How to deploy in running engine

    tob1as

      Hello,

       

      could someone please explain me what exactly happens when I click "Build package" in guvnor.  I checked the jboss-5.1.0.GA\server\default\deploy folder, hoping to find out more about those links:

       

      URL for package documentation:

      http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/documentation.pdf

      URL for package source:

      http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/source

      URL for package binary:

      http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/binary

      URL for running tests:

      http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/SCENARIOS

      Change Set:

      http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/ChangeSet.xml

      Model:

      http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/MODEL

       

      However, the only thing I find there is the drools-guvnor.war. If I extract this, I still do not find any defaultPackage.pkg or any of the above folders such as rest, packages or defaultPackage. (I deployed the evaluation.bpmn).

       

      Where exactly do the deployed files go?

       

      I am trying to understand how I can deploy a process definition into the running engine.

       

      I guess a java object is generated from the xml file which then becomes executable? So where are the java, xml and bin files ?

       

      Thank you for your help in advance,

       

      Tobias

        • 1. Re: What does "Build package" do? How to deploy in running engine
          tob1as

          Little update:

           

          When I check http://localhost:8080/gwt-console-server/rs/process/definitions, I get:

           

          {"definitions":[{"id":"com.sample.evaluation","name":"Evaluation","version":0,"packageName":"defaultPackage","deploymentId":"N/A","suspended":false,"formUrl":"http://localhost:8080/gwt-console-server/rs/form/process/com.sample.evaluation/render","diagramUrl":"vfszip:/C:/Tobias/jbpm/jboss-5.1.0.GA/server/default/deploy/jbpm-gwt-console-server.war/WEB-INF/lib/jbpm-gwt-graph-5.1.0.Final.jar/com.sample.evaluation.png"}]}

           

          The process definition is obviously there. However, the deploymentId is not available.

           

          When I check http://localhost:8080/gwt-console-server/rs/engine/deployments, I get an empty page.

           

          I checked in the console, there the process is existent and I could start it.

           

          When I try: http://localhost:8080/gwt-console-server/rs/process/definition/com.sample.evaluation/new_instance with a little html form, I get:

           

          HTTP Status 404 - Could not find resource for full path: http://localhost:8080/gwt-console-server/rs/process/definition/com.sample.evaluation/new_instance

           

           

          How can the process be accessible in the console, if it does not seem to be deployed?

          • 2. Re: What does "Build package" do? How to deploy in running engine
            chaitanya1987

            Hi,

                 Did you find the answer to u r question. I wish to deploy a jbPM process (using jBPM 5.1 on jBoss 5.1) without using the guvnor plugin on eclipse. Please share if you have idea on the same. Thanks.

            • 3. Re: What does "Build package" do? How to deploy in running engine
              eaa

              When you click "Build Package" in Guvnor, all the assets (rules, processes, dsl, spreadsheets, etc) are compiled into a binary file (a package). This package can be later used for external applications (like gwt-console for example) to create different knowledge sessions. The links that you mentioned are "fake" links. This means that you will not find its route or content inside Guvnor directory tree. What happens in reality is that Guvnor intercepts these links and add dynamic logic to them, like retrieve the package from its internal database and return it.  So, the deployed files (uploaded .bpmn or drl files) go inside Guvnor's database. They never exist in the file system.  So, if you want to upload your processes into guvnor, you have 3 main options:

              • Use drools eclipse-plugin: you already said you don't want to use it.
              • Use Guvnor Rest API: http://community.jboss.org/wiki/AtomPubinterfaceforGuvnor I think gwt-console is using "default" package in Guvnor. So you will need to upload your .bpmn file there. Just remember to re-build the package after you uploaded the process.
              • Mount Guvnor DB using DAV: Guvnor's uses a JCR database. You can mount it using an URL like this: dav://localhost:8084/drools-guvnor/org.drools.guvnor.Guvnor/webdav Then you can browse though the packages of Guvnor and copy your processes definitions there. Again. remember to re-build the package when you finish. 
              1 of 1 people found this helpful
              • 4. Re: What does "Build package" do? How to deploy in running engine
                tob1as

                Thanks Esteban,

                 

                I uploaded bpmn files with eclipse via the guvnor repository view.

                I connected via web dav.

                I clicked through to the defaultPackage.

                The process files are visible here and in the guvnor console.

                 

                1) When I click build package, it creates a binary file and puts it into an internal database ? Where exactly is this binary file located? (Lets say I want to write my own console and retrieve the package)

                 

                2) How I usually consume a process definition file for testing is as follows. That basically creates a binary file as well, right?!

                 

                KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"), ResourceType.BPMN2);
                return kbuilder.newKnowledgeBase();

                 

                The Knowledgebuilder API says you can consume:

                • XLS decision table resource
                • DRL
                • BPMN

                 

                How would the package be consumed by the console?

                 

                http://docs.jboss.org/jbpm/v5.1/javadocs/org/drools/builder/KnowledgeBuilder.html

                • 5. Re: What does "Build package" do? How to deploy in running engine
                  tob1as

                  Ok, do not mind about the second question. Found an answer here:

                   

                  http://community.jboss.org/thread/163523

                   

                  Hi Julio,

                   

                  If you want to upload a knowledge base which includes the process definitions from guvnor repository the code you require is the following:

                   

                  ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());

                  ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());        ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());

                  BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());       

                   

                  KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();

                  KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("testKAgent", aconf);      

                          kagent.applyChangeSet(

                                  ResourceFactory.newUrlResource(

                                  "http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor"

                                  + "/package/defaultPackage/LATEST/ChangeSet.xml"));

                   

                   

                  And then you take the knowledgeBase from the KnowledgeAgent like this :

                  KnowledgeBase kbase = kagent.getKnowledgeBase();

                   

                  In order to take the process you want from within the knowledgeBase you create a knowledgeSession :

                  StatefulKnowledgeSession ksession =

                                      JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);

                   

                  And finally something like  "ksession.getProcessInstances()" will gine you the collection of all the processes that lie inside the guvnor repository.

                   

                  Regards,

                   

                  Vasiliki.

                  The first question is still valid. As I understood, the package is always generated on the fly in guvnor, but the client must save it somewhere ?!

                  • 6. Re: What does "Build package" do? How to deploy in running engine
                    uvijayreddy657

                    The above code is not fetching any processes for me. any extra logic to include.

                    "ksession.getProcessInstances()" returning 0 processes