[jboss-svn-commits] JBL Code SVN: r29381 - in labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook: en-US/Chapter-Console and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 16 11:58:27 EDT 2009
Author: KrisVerlaenen
Date: 2009-09-16 11:58:27 -0400 (Wed, 16 Sep 2009)
New Revision: 29381
Added:
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Console/
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Console/Chapter-Console.xml
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Walkthrough/
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Walkthrough/Chapter-Walkthrough.xml
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/EventingReport.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/EventingReportEdit.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GoogleCalendar.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuidedValidationRule.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuvnorGuidedValidationRule.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuvnorPackage.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging1.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging2.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging3.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging4.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/Process.png
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/ProcessEditor.png
Modified:
labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/master.xml
Log:
- added gwt-console documentation
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Console/Chapter-Console.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Console/Chapter-Console.xml (rev 0)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Console/Chapter-Console.xml 2009-09-16 15:58:27 UTC (rev 29381)
@@ -0,0 +1,378 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter version="5.0" xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xml:base="./">
+
+ <title>Console</title>
+
+ <para>Drools processes can be managed through a web console. This includes
+ features like managing your process instances (starting/stopping/inspecting),
+ inspecting your (human) task list and executing those tasks, and generating
+ reports.</para>
+
+ <para>The Drools build system generates two wars for you that can be deployed in your
+ application server and contains the necessary libraries, the actual application,
+ etc. One jar contains the server application, the other one the client. Download
+ gwt-console-server-drools-{version}.war and gwt-console-drools-{version}.war and deploy
+ them to your application server, {AS_HOME}/server/{configuration}/deploy (so for example,
+ we are using jboss-4.2.3.GA/server/default/deploy).</para>
+
+ <section>
+ <title>Installation</title>
+
+ <para>You need to have an application server installed. This chapter assumes
+ you are using the JBoss AS version 4.2.3.GA, but other versions or other
+ application servers should be possible as well.</para>
+
+ <section>
+ <title>Installing Guvnor</title>
+
+ <para>The process management console uses Drools Guvnor for loading the process
+ definitions that can be used inside the console. You therefore need to install
+ Guvnor, to be able to add new process definitions to the repository, so they
+ can then be managed through the console. To do so, simply copy
+ drools-guvnor.war to your application server,
+ {AS_HOME}/server/{configuration}/deploy.</para>
+
+ </section>
+
+ <section>
+ <title>Changing the persistence configuration of your runtime data</title>
+
+ <para>The persistence.xml that is included in the server war refers to
+ a JTA data source called "java:jdbc/testDS1" for storing the runtime information.
+ To define this data source, create a testDS1-ds.xml file with the following content
+ (note that we are using an embedded H2 in memory database, but similar configurations
+ for another JPA data source is possible as well of course), and copy it to your
+ application server deploy directory:</para>
+
+ <programlisting>
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>jdbc/testDS1</jndi-name>
+ <connection-url>jdbc:h2:mem:mydb</connection-url>
+ <driver-class>org.h2.jdbcx.JdbcDataSource</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+</datasources></programlisting>
+
+ <para>Also make sure that the driver class can be found on the server classpath.
+ In this case, we copied the h2-1.0.77.jar to the {AS_HOME}/server/{config}/lib
+ folder.</para>
+
+ </section>
+
+ <section>
+ <title>Changing the persistence configuration of your history data</title>
+
+ <para>Drools uses Hibernate to persist history information in a database,
+ for long term storagy. The drools-bam module (inside the gwt-console-server-drools
+ war) contains a hibernate.cfg.xml file that contains the default configuration,
+ i.e using an embedded H2 in memory database. However, this embedded database
+ does not allow concurrent access. If you are planning to use reporting, concurrent
+ access might be required, so you should use the server configuration of the H2 in memory
+ database in that case. Change the connection url in the hibernate.cfg.xml
+ to this:</para>
+
+ <programlisting>
+<property name="connection.url">jdbc:h2:tcp://localhost/~/test</property></programlisting>
+
+ <para>In this case, you should also make sure you have the H2 database running in
+ server mode when running the application - for example by executing the org.h2.tools.Server
+ class.</para>
+
+ </section>
+
+ <section>
+ <title>Installing the reporting engine</title>
+
+ <para>The reporting engine is based on the Eclipse BIRT engine. You need to
+ install the Eclipse BIRT runtime engine in your application server to be able to use
+ the reporting functionality. To do so, create a new directory called
+ {AS_HOME}/server/{configuration}/data/birt. Download the Eclipse BIRT report
+ engine version 2.3.2 (birt-runtime-2_3_2_2.zip), extract it and copy the ReportEngine
+ directory to the newly created directory (the other directories are not needed).</para>
+
+ <para>Next, you need to copy your process instance reports to the newly created
+ directory as well. Eclipse BIRT allows you to define your own reports based on
+ existing data sources. The console expects two different reports:
+ <orderedlist>
+ <listitem><emphasis>overall_activity.rptdesign</emphasis>: this reports shows
+ an overview of all running process instances in your system</listitem>
+ <listitem><emphasis>process_summary.rptdesign</emphasis>: this reports is
+ shown when the user wants to look into one process definition. It gives more
+ details about all instances for that process.</listitem>
+ </orderedlist>
+ We have created some example reports you could use and customize according to your
+ own requirements. The example report templates can be found in the drools-bam
+ module (src/test/resources). Note that these example reports are also using the H2
+ in memory database (in server mode). If you configured the persistence of the history
+ data differently, you will have to update the data source of these reports accordingly.
+ You also need to copy your database drivers to the reporting plugin. In our case,
+ using H2, copy the h2-1.0.77.jar to {AS_HOME}/server/{configuration}/data/birt/ReportEngine/plugins/
+ org.eclipse.birt.report.data.oda.jdbc_2.3.2.r232_v20090212/drivers.</para>
+
+ </section>
+
+ <section>
+ <title>User authentication</title>
+
+ <para>The application uses simple password authentication to verify who is allowed to
+ use the application. For example, usernames / passwords can be specified in a
+ users.properties file in {AS_HOME}/server/{configuration}/conf, for example:</para>
+
+ <programlisting>
+admin=admin
+krisv=mypassword</programlisting>
+
+ <para>The roles associated with these users can be specified in a roles.properties file
+ in the same directory, for example:</para>
+
+ <programlisting>
+admin=admin,manager,user
+krisv=admin,manager,user</programlisting>
+
+ </section>
+
+ <section>
+ <title>Configure memory settings</title>
+
+ <para>You might want to increase the memory that can be used by the application server
+ (especially the PermGen space) if you run into OutOfMemory exceptions. To do so, edit
+ the run.conf or run.bat (depending on your OS) and for example add the following line:</para>
+
+ <programlisting>
+JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=256m"</programlisting>
+
+ </section>
+
+ <para>You are now ready to startup the application server. If you are using human tasks in
+ your processes, you should also make sure you have the task service running (on
+ 127.0.0.1:9123). Also make sure your database is up and running of course.</para>
+
+ </section>
+
+ <section>
+ <title>Adding process definitions in Guvnor</title>
+
+ <para>Drools Guvnor allows you to manage all your business knowledge in a (logically)
+ centralized location. This includes all your process definitions, business rules, etc.
+ The process management console automatically retrieves all the processes from the latest
+ snapshot of the "default" package on Guvnor. To find out how to get processes on the
+ Guvnor repository (for example manually uploading them, or using the Eclipse Guvnor
+ synchronization), check out the Guvnor documentation. After deploying Guvnor to your
+ application server, navigate to the following URL to open up Guvnor (replace the host
+ and/or port depending on how the application server is configured):
+ <ulink url="http://localhost:8080/gwt-console">http://localhost:8080/gwt-console</ulink></para>
+
+ <para>The following screenshot shows an example where the "default" package contains one
+ "Evaluation" process. After adding the necessary process definitions, make sure to build
+ the package, so that the built package can be downloaded by the web console.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/Guvnor.PNG"/></imageobject></mediaobject>
+
+ </section>
+
+ <section>
+ <title>Running the process management console</title>
+
+ <para>Now navigate to the following URL (replace the host and/or port depending on how the application server
+ is configured):
+ <ulink url="http://localhost:8080/gwt-console">http://localhost:8080/gwt-console</ulink></para>
+
+ <para>A login screen should pop up, asking for your user name and password.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/Login.PNG"/></imageobject></mediaobject>
+
+ <para>After filling these in, the process management workbench should be opened, as shown in the
+ screenshot below. On the right you will see several tabs, related to process instance management,
+ human task lists and reporting, as explained in the following sections.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/Tasks.PNG"/></imageobject></mediaobject>
+
+ <section>
+ <title>Managing process instances</title>
+
+ <para>The "Processes" section allows you to inspect the process definitions that are currently
+ part of the installed knowledge base, start new process instances and manage running process
+ instances (which includes inspecting their state and data).</para>
+
+ <section>
+ <title>Inspecting process definitions</title>
+
+ <para>When you open the process definition list, all processes that are stored in the "default"
+ package on Guvnor are shown. You can then either inspect process instances for one specific
+ process or start a new process instance.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/ProcessDefinitions.PNG"/></imageobject></mediaobject>
+
+ </section>
+
+ <section>
+ <title>Starting new process instances</title>
+
+ <para>To start a new process instance for one specific process definition, select the process
+ definition in the process definition list and select the process instances tab. Click on the
+ "Start" button to start a new instance of that specific process. When a form is associated
+ with this particular process (to ask for additional information before starting the process),
+ this form will be shown. After completing this form, the process will be started with the
+ provided information.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/StartProcess.PNG"/></imageobject></mediaobject>
+
+ </section>
+
+ <section>
+ <title>Managing process instances</title>
+
+ <para>The process instances tab also contains a table showing all running instances of that
+ specific process definition. Select a process instance to show the details of that specific
+ process instance.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/ProcessInstances.PNG"/></imageobject></mediaobject>
+
+ </section>
+
+ <section>
+ <title>Inspecting process instance state</title>
+
+ <para>You can inspect the (top-level) variables of a specific process instance by clicking on
+ the "Instance Data" button. This will show you how each variable defined in the process
+ maps to it's corresponding value for that specific process instance.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/ProcessInstanceDiagram.PNG"/></imageobject></mediaobject>
+
+ </section>
+
+ <section>
+ <title>Inspecting process instance variables</title>
+
+ <para>You can inspect the state of a specific process instance by clicking on
+ the "Diagram" button. This will show you the process flow chart, where a red
+ traingle is shown at each node that is currently active (like for example a human
+ task node waiting for the task to be completed or a join node waiting for more
+ incoming connections before continuing). [Note that multiple instances of one node
+ could be executing simultaneously. They will still be shown using only one red
+ triangle.]</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/ProcessInstanceData.PNG"/></imageobject></mediaobject>
+
+ </section>
+
+ </section>
+
+ <section>
+ <title>Human task lists</title>
+
+ <para>The task management section allows a user to see his/her current task list.
+ The group task list shows all the tasks that are not yet assigned to one specific
+ user but that the currently logged in user could claim. The personal task list shows
+ all tasks that are assigned to the currently logged in user. To execute a task,
+ select it in your personal task list and select "View". If a form is associated
+ with the selected task (for example to ask for additional information), this form
+ will be shown. After completing the form, the task will also be completed.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/TaskForm.PNG"/></imageobject></mediaobject>
+
+ </section>
+
+ <section>
+ <title>Reporting</title>
+
+ <para>The reporting section allows you to view reports about the execution of
+ processes. This includes an overall report showing an overview of all processes,
+ as shown below.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/ReportOverall.PNG"/></imageobject></mediaobject>
+
+ <para>A report regarding one specific process instance can also be generated.</para>
+
+ <mediaobject><imageobject><imagedata align="center" format="PNG" role="" fileref="images/Chapter-Console/ReportProcess.PNG"/></imageobject></mediaobject>
+
+ <para>Drools Flow provides some sample reports that could be used to visualize some
+ generic execution characteristics like the number of active process instances per
+ process etc. But custom reports could be generated to show the information your
+ company thinks is important, by replacing the report templates in the report
+ directory.</para>
+
+ </section>
+
+ </section>
+
+ <section>
+ <title>Adding new process / task forms</title>
+
+ <para>Forms can be used to (1) start a new process or (2) complete a human task.
+ We use freemarker templates to dynamically create forms. To create a form for a
+ specific process definition, create a freemarker template with the name
+ {processId}.ftl. The template itself should use HTML
+ code to model the form. For example, the form to start the evalution process shown
+ above is defined in the com.sample.evaluation.ftl file:</para>
+
+ <programlisting>
+<html>
+<body>
+<h2>Start Performance Evaluation</h2>
+<hr>
+<form action="complete" method="POST" enctype="multipart/form-data">
+Please fill in your username: <input type="text" name="employee" /></BR>
+<input type="submit" value="Complete">
+</form>
+</body>
+</html></programlisting>
+
+ <para>Similarly, task forms for a specific type of human task (uniquely identified
+ by its task name) can be linked to that human task by creating a freemarker template
+ with the name {taskName}.ftl. The form has access to a "task" parameter that represents
+ the current human task, so it allows you to dynamically adjust the task form based on
+ the task input. The task parameter is a Task model object as defined in the
+ drools-process-task module. This for example allows you to customize the task form based
+ on the description or input data related to that task. For example, the evaluation form
+ shown earlier uses the task parameter to access the description of the task and show that
+ in the task form:</para>
+
+ <programlisting>
+<html>
+<body>
+<h2>Employee evaluation</h2>
+<hr>
+${task.descriptions[0].text}<br/>
+<br/>
+Please fill in the following evaluation form:
+<form action="complete" method="POST" enctype="multipart/form-data">
+Rate the overall performance: <select name="performance">
+<option value="outstanding">Outstanding</option>
+<option value="exceeding">Exceeding expectations</option>
+<option value="acceptable">Acceptable</option>
+<option value="below">Below average</option>
+</select><br/>
+<br/>
+Check any that apply:<br/>
+<input type="checkbox" name="initiative" value="initiative">Displaying initiative<br/>
+<input type="checkbox" name="change" value="change">Thriving on change<br/>
+<input type="checkbox" name="communication" value="communication">Good communication skills<br/>
+<br/>
+<input type="submit" value="Complete">
+</form>
+</body>
+</html>
+</programlisting>
+
+ <para>Data that is provided by the user when filling in the task form will be
+ added as parameters when completing the task. For example, when completing the
+ task above, the Map of outcome parameters will include result variables called
+ "performance", "initiative", "change" and "communication". The result parameters
+ can be accessed in the related process by mapping these parameters to process
+ variables.</para>
+
+ <para>Forms should be included in the drools-gwt-form.jar in the server war.</para>
+
+ </section>
+
+</chapter>
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Console/Chapter-Console.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Walkthrough/Chapter-Walkthrough.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Walkthrough/Chapter-Walkthrough.xml (rev 0)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Walkthrough/Chapter-Walkthrough.xml 2009-09-16 15:58:27 UTC (rev 29381)
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter version="5.0" xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:db="http://docbook.org/ns/docbook" xml:base="./" >
+ <title>Walkthrough</title>
+
+ <para>This section describes a sample application that combines processes
+ and rules, and walks you through the most important features of the Drools
+ platform. Its main purpose is not to explain every step in detail, but rather
+ show the capabilities of the platform. We will simply refer to more detailed
+ documentation (in other chapters) in case you are wondering how to do this
+ yourself. The example itself can also be found in the drools-examples module.
+ </para>
+
+ <para>The example describes a fictitous company that specializes in
+ advertising public events. Customers can register their events and the company
+ will make sure those events get added to for example a calendar on a web site,
+ a mailing list, or gets advertised in magazines, etc. The part we will show
+ here is how they are managing the registration of customer events using a
+ process and a set of rules. The process will be responsible for the validation
+ of the customer events, the registration in the company calendar and sending
+ feedback (in this case using email) to the customer.</para>
+
+ <para>Among other things, this example will show:
+ <orderedlist>
+ <listitem>How easy it is to create a simple event registration process that
+ combines process logic with rules.</listitem>
+ <listitem>How to test your application and find out what is happening using
+ our integrated debugging.</listitem>
+ <listitem>How to publish this business knowledge in a central location and
+ use Drools Guvnor to allow business users to look up and possibly modify
+ this information.</listitem>
+ <listitem>How to monitor your business using a history log of what is going
+ on and reports that visualize your key business indicators, and how to respond
+ to possible changes in the enviroment using complex event processing and
+ dynamically changing your business logic.</listitem>
+ </orderedlist>
+ </para>
+
+ <section>
+ <title>Creating a RuleFlow process</title>
+
+ <para>To manage the registration of customer events, we create a process and a set
+ of associated rules that define the necessary business logic. The process describes
+ how to handle a request, from the moment it is received until after it has been
+ processed.</para>
+
+ <section>
+ <title>Creating the process</title>
+
+ <para>The following figure shows the resulting process.</para>
+
+ <figure>
+ <title>The "RegisterEvents" process</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/Process.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>
+ <orderedlist>
+ <listitem>A process should be started automatically whenever a request comes in.
+ This is implemented by adding a automatic trigger to the start node that starts
+ the process (and assigns the request to the "request" variable of the process
+ instance) whenever a request comes in.</listitem>
+ <listitem>We must first determine whether the request can be handled automatically.
+ Only requests that contain structured event descriptions can be handled automatically.
+ Non-structured requests must first be handled by a sales representative. This choice
+ is shown as an XOR split node (exclusive choice), where the request is logged in case
+ it can be handled automatically, or assigned to a sales representative in the other case.
+ </listitem>
+ <listitem>We have to make sure all requests are handled in a specific time interval
+ (to avoid unhappy customers), so we added a timer to the "Register Events" human task.
+ If the task is not completed within 1 minute (for demo purposes we use small time
+ intervals, in reality this would probably be more like one day or something similar), a
+ reminder email is sent to the sales manager. This mail will repeat itself every 30 seconds
+ until the request has been handled. This is implemented by adding a timer to the "Register
+ Events" human task that signals a timeout event whenever necessary. The timeout event
+ is handled by the event node immediately underneath it.</listitem>
+ <listitem>While everyone can register events, gold customers get special advantages.
+ For example, only gold customers can register events more than one week upfront,
+ or more than one event at the same time. Therefore, requests must be validated
+ before being processed. The validation is handled by a set of validation rules that define
+ in which cases requests are invalid.</listitem>
+ <listitem>If an error is detected, the user must be notified of the errors by sending
+ back an email.</listitem>
+ <listitem>Each event in the (valid) request must be added to the calendar. This can be
+ achieved by using a ForEach node that loops over all events in a request and adds them
+ one by one to the calendar.</listitem>
+ </orderedlist>
+ </para>
+
+ <para>Domain-specific work items (TODO) ...</para>
+
+ </section>
+
+ <section>
+ <title>Creating the rules</title>
+
+ <para>The rules that define the advantages of the different categories of customers (gold,
+ silver, etc.) are defined as a separate ruleset. This makes it easy to change this logic
+ (e.g. give more advantages, add a new category, make changes for particular users, regions
+ or time periods) without having to change the process itself. This makes it much easier for
+ the process to cope with changing requirements.</para>
+
+ <para>The figure below shows an example of a validation rule that makes sure that only
+ gold customers are allowed to do requests with more than 1 event simultaneously. The rule
+ uses a predefined domain-specific language (DSL) so that the user can use natural language
+ to define the rules, making them much easier to read, create and update.</para>
+
+ <figure>
+ <title>A guided validation rule</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/GuidedValidationRule.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </section>
+
+ <section>
+ <title>Executing the process</title>
+
+ <para>To execute our process and rules, we need to first create a knowledge base (containing
+ all relevant rules and processes), create a session to interact with and then insert a new
+ event request. The following code snippet shows how this looks. For more detail on how to create
+ the knowledge base and session, you can take a look at the source code in drools-examples.</para>
+
+<programlisting>public static final void main(String[] args) {
+ try {
+ // load up the knowledge base
+ KnowledgeBase kbase = readKnowledgeBase();
+ StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
+
+ // create event request
+ EventRequest request = new EventRequest();
+ request.setEmail("drools.demo at gmail.com");
+ request.setDescription("Drools Flow Web Seminars");
+ Event event1 = new Event();
+ event1.setName("Drools Flow Web Seminar");
+ event1.setDescription("This seminar will showcase the most important features of Drools Flow.");
+ event1.setStart(new DateTime(new Date(109, 1, 6, 9, 0)).toString());
+ event1.setEnd(new DateTime(new Date(109, 1, 6, 12, 0)).toString());
+ request.addEvent(event1);
+ Event event2 = new Event();
+ event2.setName("Drools Flow Web Seminar");
+ event2.setDescription("This seminar will showcase the most important features of Drools Flow.");
+ event2.setStart(new DateTime(new Date(109, 1, 13, 9, 0)).toString());
+ event2.setEnd(new DateTime(new Date(109, 1, 13, 12, 0)).toString());
+ request.addEvent(event2);
+
+ // insert the request
+ ksession.insert(request);
+ ksession.fireAllRules();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+}</programlisting>
+
+ <para>Executing this code will add the two given events to the calendar, as shown in the screenshot below.</para>
+
+ <figure>
+ <title>The events show up in Google Calendar</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/GoogleCalendar.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </section>
+
+ </section>
+
+ <section>
+ <title>Integrated debugging</title>
+
+ <para>Whenever you are testing your process or rules (or usually both simulaneously), it might be necessary to
+ figure out why one specific decision was taken, or what the state is of your process at some point, etc. Drools
+ provides an integrated debugging environment where you can stop the execution of your application at any point and
+ inspect the current state.</para>
+
+ <para>The following figure shows how you can simply add breakpoints in your rule consequences so you can determine
+ when those rules are executed exactly and what the values are of each of the bound variables.</para>
+
+ <figure>
+ <title>A breakpoint in a rule</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/IntegratedDebugging1.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>It also possible to look at the current state of all process instances. For example, at the rule breakpoint shown
+ above, the process will be in the validation node (shown by a slightly thicker line around that node).</para>
+
+ <figure>
+ <title>The process instance view</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/IntegratedDebugging2.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>The working memory view shows all the data that is currently inserted into the session (in this case the request).
+ Similar views are provided for looking at the agenda and the globals.</para>
+
+ <figure>
+ <title>The working memory view</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/IntegratedDebugging3.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Finally, the audit view can be used to show the history of all execution events (in a tree-based view). This
+ view for example shows the different nodes that have already been executed, and shows that we are now executing the
+ "Invalid customer" rule.</para>
+
+ <figure>
+ <title>The audit view</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/IntegratedDebugging4.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </section>
+
+ <section>
+ <title>Web-based management using Drools Guvnor</title>
+
+ <para>Instead of having your processes and rules on some location on local disk, this logic can also be managed on a
+ more centralized knowledge repository. Drools Guvnor allows users to publish their knowledge artefacts to a central
+ repository, and manage it through a web-based console. The Guvnor Eclipse plugin makes it possible to upload your
+ knowledge to the repository. It provides all the features needed to make your knowledge management easier: uploading,
+ downloading, versioning, diffs, etc.</para>
+
+ <para>Once the knowledge has been uploaded to Guvnor, business users can inspect all the knowledge and if necessary
+ update it. For example, the following screenshot shows the guided validation rule as shown earlier but now from within
+ Guvnor. Business users can change this rule or add new rules.</para>
+
+ <figure>
+ <title>A guided validation rule in Guvnor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/GuvnorGuidedValidationRule.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Guvnor can also package all your knowledge so that it can be used to create a knowledge base for a session. The
+ following screenshot shows how to package your knowledge in Guvnor. The generated package is published on a predefined
+ URL so that this package can easily be downloaded by the runtime engine. We are using a knowledge agent to load the
+ knowledge from Guvnor. This knowledge agent also makes sure that my knowledge base that I am using at runtime is updated
+ automatically whenever a user rebuilds the package on Guvnor.</para>
+
+ <figure>
+ <title>Building the package in Guvnor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/GuvnorPackage.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </section>
+
+ <section>
+ <title>Monitoring and dynamic intervention</title>
+
+ <para>By adding a history logger to the process engine, all relevent events are stored in the database. This history
+ log can then be used to monitor and analyze the execution of your processes. We are using Eclipse BIRT (Business Intelligence
+ Reporting Tool) to create reports that show the key performance indicators. We do provide some basic reports ourselves, but
+ it's easy to define your own reports yourself, using the predefined data sets containing all process history information, and
+ any other data sources you might want to add yourself. The following screen shot shows how a chart can be created using the
+ Eclipse BIRT report editor.</para>
+
+ <figure>
+ <title>Creating a monitoring report</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/EventingReportEdit.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>The next figure shows a simple report based on some history data, showing the number of requests every hour, and the
+ average completion time of the request in that hour. These charts could be used to check for an unexpected drop or rise
+ of request, an increase in the average processing time, etc. These charts could signal possible problems before the
+ situation really gets out of hand.</para>
+
+ <figure>
+ <title>The eventing report</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="images/Chapter-Walkthrough/EventingReport.png" format="PNG" role="" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </section>
+
+</chapter>
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/Chapter-Walkthrough/Chapter-Walkthrough.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/master.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/master.xml 2009-09-16 15:33:21 UTC (rev 29380)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/en-US/master.xml 2009-09-16 15:58:27 UTC (rev 29381)
@@ -62,6 +62,7 @@
<xi:include href="Chapter-Eclipse/Chapter-Eclipse.xml" />
<xi:include href="Chapter-BAM/Chapter-BAM.xml" />
<xi:include href="Chapter-BPMN2/Chapter-BPMN2.xml" />
+ <xi:include href="Chapter-Console/Chapter-Console.xml" />
<index/>
</book>
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/EventingReport.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/EventingReport.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/EventingReportEdit.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/EventingReportEdit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GoogleCalendar.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GoogleCalendar.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuidedValidationRule.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuidedValidationRule.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuvnorGuidedValidationRule.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuvnorGuidedValidationRule.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuvnorPackage.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/GuvnorPackage.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging1.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging2.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging3.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging3.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging4.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/IntegratedDebugging4.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/Process.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/Process.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/ProcessEditor.png
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/drools-docs/drools-docs-flow/src/main/docbook/images/Chapter-Walkthrough/ProcessEditor.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-svn-commits
mailing list