Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About...

23
Introduction of Guvnor And DataBase By PANKAJ SHARMA 1 Introduction Of Guvnor And DataBase

Transcript of Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About...

Page 1: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Introduction of Guvnor And DataBase

By PANKAJ SHARMA

1 Introduction Of Guvnor And DataBase

Page 2: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Introduction to Guvnor And Business Rule ManagerAbout Guvnor:

Drools Guvnor is a centralised repository for Drools Knowledge Bases, with rich web based GUIs, editors, and tools to aid in the management of large numbers of rules. As you know, Drools allows you to create executable knowledge bases. The repository component is where you can store versions of rules, models, functions, processes etc that all relate to these knowledge bases. Access is controlled, and it is possible to lock down access and restrict features so domain experts (non programmers) can view and edit rules without being exposed to all the features at once.Guvnor is the name of the web and network related components for managing rules with drools.

Adavantages of Guvnor

• It is used to create rule for drools project.• Guvnor Editor is provided to various types of assets to using into

drools project.• It supports to implemented web application.• Business analyzers are used to execute business rule by Guvnor

Editor.• Guvnor provides ability to create packages to using into drools

applications.

2 Introduction Of Guvnor And DataBase

Page 3: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Figure 1.1 The Guvnor main screen

3 Introduction Of Guvnor And DataBase

Page 4: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

What is a Business Rules Manager? A business rules manager allows people to manage rules in a multi user

environment, it is a single point of truth for your business rules, allowing change in a controlled fashion, with user friendly interfaces.

Guvnor is the name of the web and network related components formanaging rules with drools. This combined with the core drools engine andother tools forms the business rules manager.

When to use GuvnorYou should consider Guvnor if any of the following apply to you: You need to manage versions/deployment of rules, you need to let multiple users of different skill levels access and edit rules, you don't have any existing infrastructure to manage rules, you have lots of "business" rules (as opposed to technical rules as part of an application).Guvnor can be used on its own, or with the IDE tooling (often both together).Guvnor can be "branded" and made part of your application, or it can be a central rule repository.

When to not use GuvnorIn this case, the drools-template library is worth a look - you can define templates for rules to be generated from any tabular data source.

Otherwise, perhaps an existing rule management system and user interface already exists (and is tailored to your environment already) - in this case migrating to Guvnor may not be necessary.

If you are using rules to solve complex algorithmic problems, and the rules are essentially an integral part of the application (and don't need to be managed separately to the code).

4 Introduction Of Guvnor And DataBase

Page 5: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Who uses GuvnorThe main roles of people who would use Guvnor are: Business Analyst, Rule expert, Developer, Administrators (rule administrators etc).

Guvnor is designed in such a way as these different roles can be accommodated, it can be controlled how much is exposed to different users in a safe fashion.

Features Of Guvnor1. Version control (historical assets)

2. Categorization

3. Build and deploy

4. Store multiple rule "assets" together as a package

5. Multiple types of rule editors (GUI, text)

Configure MySQL datasource to JBoss with Drools GuvnorsAnother optimization that can be added to Guvnor storage configuration is to use an RDBMS instead of storing the assets in a file directory. With this configuration, Guvnor will have a more solid storage engine and also will obtain more advanced storage features such as clustering, advanced backup system, and so on. This recipe will cover the configuration needed to change the JCR repository storage to use a MySQL database, but as you will see at the end of the recipe it's also possible to use another RDBMS.

Now here I am using a Unix like system with a bash shell and have already downloaded and extracted the JBoss AS 7 application server.

5 Introduction Of Guvnor And DataBase

Page 6: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Download the MySQL ConnectorThe connector can be downloaded from:

http://dev.mysql.com/downloads/connector/j/.The current version at the time of writing is 5.1.18, further sections of this guide assume that version number.

Unzip the connector to your downloads folder and save the location of the main JAR in a variable which we can refer to later:

cd ~/Downloads unzip mysql-connector-java-5.1.18.zip

Create to My SQL Data BaseOnce the MySQL database is up and running, it is time to create the database and user permissions. Open a terminal or command-line console and carry out the following steps:

1. Log in as the root user using the MySQL command-line client:

shell>mysql -u root -p

Enter password:

2. Once you are logged in, Mydb database/schema with the following SQL query:

mysql> CREATE DATABASE Mydb;

3. If you want to verify the schema creation, the available schemas can be displayed by executing the following query:

mysql>SHOW DATABASES;

N.P :Now I am useing Jboss server inside the /usr/local

1. Jboss Configuraton with .bashrc

Now we need to go to the bashrc and set the path:

export JBOSS_HOME= /usr/local/jboss-as-web-7.0.0.FinalPath=$JBOSS_HOME/bin

6 Introduction Of Guvnor And DataBase

Page 7: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

2. Now we need to create the directory for connector jar

cd $JBOSS_HOMEmkdir -p modules/com/mysql/main

3. Copy the driver jar to the new directory and move to that directory:

cp $MYSQL_JAR $JBOSS_HOME/modules/com/mysql/maincd $JBOSS_HOME/modules/com/mysql/main

4. Define the module in XML. This is the key part of the process:

vi module.xml5. If the version of the jar has changed, remember to update it here:

<?xml version="1.0" encoding="UTF-8"?><module xmlns="urn:jboss:module:1.0" name="com.mysql"> <resources> <resource-root path="mysql-connector-java-5.1.18-bin.jar"/> </resources> <dependencies> <module name="javax.api"/><module name="javax.trancection.api"/> </dependencies>

</module>

If you are useing windows os you can use “javax.api” but if you are useing mac or ubuntu os then you will have to use “javax.trancection.api”.you remember this point check your connector version and apiThe new module directory should now have the following contents:

module.xml mysql-connector-java-5.1.18-bin.jar

7 Introduction Of Guvnor And DataBase

Page 8: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Create a Driver ReferenceNow the module has been created, we need to make a reference to it from the main application server configuration file:

cd $JBOSS_HOME/standalone/configuration vi standalone.xmlFind the ‘drivers’ element and add a new driver to it:

<drivers> <driver name="mysql" module="com.mysql"/> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class> org.h2.jdbcx.JdbcDataSource </xa-datasource-class> </driver></drivers>

The ‘h2′ driver is part of the default JBoss configuration. The new driver that needs adding is named ‘mysql’.

Now We Need to Add the DatasourceGo into the configuration directory and open the main configuration file:

cd $JBOSS_HOME/standalone/configurationvi standalone.xml

Find the datasources element and add a new datasource inside:

<datasource jndi-name="java:/mydb" pool-name="my_pool" enabled="true" jta="true" use-java-context="true" use-ccm="true"> <connection-url> jdbc:mysql://localhost:3306/mydb </connection-url> <driver>

8 Introduction Of Guvnor And DataBase

Page 9: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

mysql </driver> <security> <user-name> root </user-name> <password>

root </password> </security> <statement> <prepared-statement-cache-size> 100 </prepared-statement-cache-size> <share-prepared-statements/> </statement>

</datasource>

Now you can start the application serverNow try running the application server. Make sure you run initially as a user which has write access to the modules directory where you placed the MySQL connector JAR. This is because the appication server seems to generate an index of the directories inside the JAR.

cd $JBOSS_HOMEbin/standalone.xml

Hopefully, amongst the application server’s console output you should see the following:20:31:33,843 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) Bound data source [java:/mydb]You can see looks like this in console

9 Introduction Of Guvnor And DataBase

Page 10: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Note :- If you want to configure Drools Guvnore repository you will have to use lower version of java 1.7 and you can use jboss-4.2.0.GA

Configuring Configuring Guvnor to use an external RDBMSIn some cases it may be a requirement that you use an external RDBMS, such as Oracle, MySQL, or Microsoft SQL Server as the data store - this is permitted and recommended as storing your repository data in an external RDBMS is much more reliable than the default file-system storage option. The JackRabbit repository.xml file contains the information where your repository data is stored, so changes to this file are necessary for RDBMS setup. You have two options to make changes to repository.xml, namely make all changes manually, or use the Guvnor Repository Configuration Manager.Using the Repository Configuration Manager in Guvnor is often a lot easier and a less error-prone options to make the necessary configuration changes in repository.xml. With Guvnor application running, select the Administration tab in the left-hand-side navigation bar, then select the Repository Configuration link.

Fig 1.2:Finding the Repository Configuration Manager in the Administration section

10 Introduction Of Guvnor And DataBase

Page 11: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Repository Configuration Manager includes template configuration files for many external RDBMS types. The first thing you have to do is the select the RDBMS type from the dropdown menu and select if you are using JNDI to look up your data source or not.

If you opt to use JNDI, you have to enter the JNDI name configured in your deployed data source. Otherwise you need to enter your RDBMS information.

Fig 1.3 :Select RDBMS type and RDBMS information

At this point you are ready to generate your repository.xml give your RDBMS information. Click on the "Generate repository config" button.

11 Introduction Of Guvnor And DataBase

Page 12: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Figure 1.4.Generated repository.xml

You can download the generated repository.xml file by clicking the "Save Configuration" button, or copy/paste the generated text manually. Replace your existing repository.xml with the generated one and restart Guvnor for the changes to get picked up.

Note:- You should remember .you will have to copy mySql connectore jar inside the $JBOSS_HOME//modules/javax/persistence/api/main/ Now we need to change module.xml file add the following content same looks like this:

12 Introduction Of Guvnor And DataBase

Page 13: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

<resources> <resource-root path="mysql-connector-java-5.1.18-bin.jar"/>

<resource-root path="hibernate-jpa-2.0-api-1.0.1.Final.jar"/> <!-- Insert resources here -->

</resources>

How to restore repository informationIn order to migrate to an existing repository, you will have to generate an information export, as was seen in the previous recipe, which will be used later to restore the information previously stored using the Apache Jackrabbit file-based storage. If you didn't start Drools Guvnor earlier, you will need to execute it once to create the default repository.xml file that will be later modified.

1. Shut down the JBoss Application Server or the Servlet container where Guvnor is deployed if it's currently running.

2. Open the repository.xml file with your favorite text editor, generated by default in the bin/ folder of the JBoss Application Server or the Servlet container directory, and be ready to search and replace XML tags.

Note :Remember to always create a backup of the repository.xml file and the repository folder in order to prevent information loss.

3. Replace all the <FileSystem /> tags with the following configuration: <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">

<param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost/guvnodb"/> <param name="user" value="guvnor"/> <param name="password" value="guvnor"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="FS_"/>

</FileSystem>

13 Introduction Of Guvnor And DataBase

Page 14: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

4. Replace all the <PersistenceManager /> tags with the following configuration:<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost/guvnordb"/> <param name="user" value="guvnor"/> <param name="password" value="guvnor"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /></PersistenceManager>

Save the repository.xml file and remove the repository folder, which is going to be replaced with new data.

You should remember .repository should be looks like this:<?xml version="1.0"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

14 Introduction Of Guvnor And DataBase

Page 15: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

See the License for the specific language governing permissions and limitations under the License. --> <!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN" "http://jackrabbit.apache.org/dtd/repository-1.4.dtd"> <Repository> <!-- virtual file system where the repository stores global state (e.g. registered namespaces, custom node types, etc.) --> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/mydb"/> <param name="user" value="root"/> <param name="password" value="root"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="FS_"/>

</FileSystem>

<!-- security configuration --> <Security appName="Jackrabbit"> <!-- access manager: class: FQN of class implementing the AccessManager interface --> <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"> <!-- <param name="config" value="${rep.home}/access.xml"/> --> </AccessManager>

15 Introduction Of Guvnor And DataBase

Page 16: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

<LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"> <!-- anonymous user name ('anonymous' is the default value) --> <!-- <param name="anonymousId" value="anonymous"/> --> <!-- default user name to be used instead of the anonymous user when no login credentials are provided (unset by default) --> <!-- <param name="defaultUserId" value="superuser"/> --> </LoginModule> </Security> <!-- location of workspaces root directory and name of default workspace --> <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/> <!-- workspace configuration template: used to create the initial workspace if there's no workspace yet --> <Workspace name="${wsp.name}"> <!-- virtual file system of the workspace: class: FQN of class implementing the FileSystem interface --> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/mydb"/> <param name="user" value="root"/> <param name="password" value="root"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="FS_WS_${wsp.name}_"/> </FileSystem>

16 Introduction Of Guvnor And DataBase

Page 17: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

<!-- persistence manager of the workspace: class: FQN of class implementing the PersistenceManager interface --> <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/mydb"/> <param name="user" value="root"/> <param name="password" value="root"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /> </PersistenceManager> <!-- Search index and the file system it uses. class: FQN of class implementing the QueryHandler interface --> <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex"> <param name="path" value="${wsp.home}/index"/> <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/> <param name="extractorPoolSize" value="2"/> <param name="supportHighlighting" value="true"/> </SearchIndex> </Workspace>

17 Introduction Of Guvnor And DataBase

Page 18: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

<!-- Configures the versioning --> <Versioning rootPath="${rep.home}/version"> <!-- Configures the filesystem to use for versioning for the respective persistence manager --> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/mydb"/> <param name="user" value="root"/> <param name="password" value="root"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="Versioning_FS_"/> </FileSystem> <!-- Configures the persistence manager to be used for persisting version state. Please note that the current versioning implementation is based on a 'normal' persistence manager, but this could change in future implementations. --> <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/mydb"/> <param name="user" value="root"/> <param name="password" value="root"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="Versioning_PM_" /> </PersistenceManager>

18 Introduction Of Guvnor And DataBase

Page 19: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

</Versioning> <!-- Search index for content that is shared repository wide (/jcr:system tree, contains mainly versions) --> <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex"> <param name="path" value="${rep.home}/repository/index"/> <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/> <param name="extractorPoolSize" value="2"/> <param name="supportHighlighting" value="true"/> </SearchIndex> </Repository>

Backing up your database One of the most important tasks when you store data is backup.In this way you to manually export all your data to back up your knowledge in case of information loss.

You can follow the following steps in order to create a backup of your knowledge stored in Drools Guvnor:

1. It's a simple task; open your favorite web browser. Type http://localhost:8080/drools-guvnor/ and once the application is loaded, select the Import Export option in the Administration section, as shown in the following screenshot:

19 Introduction Of Guvnor And DataBase

Page 20: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Figure 1.5 Import and Export Repository

2. In this new tab, you will see the options to import and export backups. Click on the Export button and a pop-up will appear on the screen, which will ask you for a confirmation. Once you agree, a database backup will be generated in a zipped file. Finally, the web browser will ask you to save the backup with a common save dialog.

The Guvnor data storage API is based on the Java Content Repository (JCR) standard, using the Apache Jackrabbit (http://jackrabbit.apache.org/) as the default implementation. Using a standard implementation, it's possible to interchange the JCR implementation without any issue.

Getting back on track, the backup option in Guvnor exports all the assets created with the UI in a ZIP file that contains a single XML file. In order to import this data, you will only have to use the Import option from the backup module.

20 Introduction Of Guvnor And DataBase

Page 21: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

What is versioning?Versioning is the creation and management of multiple releases of a product, all of which have the same general function but are improved, upgraded or customized. The term applies especially to opreting system (OSs), software and Web services. Version control is the practice of ensuring collaborative data sharing and editing among users of systems that employ different versions of a product. The terms "versioning" and "version control" are sometimes used interchangeably even though their technical meanings are different.

Versioning and storageJackrabbit has a separate storage area for version storage (as over time, the number of old versions will increase, yet it should not slow down the performance of the main data store). The version storage also has its own persistence manage configuration in the repository.xml, but for most purposes you can use the same database as the main storage (just with a different schema object prefix - ie in your database, all the version data will be prefixed with version_ but otherwise in the same tablespace). See the repository.xml for more details of this.

<Versioning rootPath="${rep.home}/version"> <!-- Configures the filesystem to use for versioning for the respective persistence manager --> <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/mydb"/> <param name="user" value="root"/> <param name="password" value="root"/> <param name="schema" value="mysql"/>

21 Introduction Of Guvnor And DataBase

Page 22: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

<param name="schemaObjectPrefix" value="Versioning_FS_"/> </FileSystem> <!-- Configures the persistence manager to be used for persisting version state. Please note that the current versioning implementation is based on a 'normal' persistence manager, but this could change in future implementations. --> <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager"> <param name="driver" value="com.mysql.jdbc.Driver"/> <param name="url" value="jdbc:mysql://localhost:3306/mydb"/> <param name="user" value="root"/> <param name="password" value="root"/> <param name="schema" value="mysql"/> <param name="schemaObjectPrefix" value="Versioning_PM_" /> </PersistenceManager> </Versioning>

For Storing data you can use datastoreclass in this way:

<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore"><param name="driver" value="com.mysql.jdbc.Driver"/> <!--<param name="url" value="java:comp/env/jdbc/drools"/>--> <param name="url" value="jdbc:mysql://localhost:3306/mysql"/> <param name="databaseType" value="mysql"/> </DataStore>

22 Introduction Of Guvnor And DataBase

Page 23: Introduction of Guvnor And DataBase€¦ · Introduction to Guvnor And Business Rule Manager About Guvnor: Drools Guvnor is a centralised repository for Drools Knowledge Bases, with

Searching and IndexingLucene is used to provide indexing across the semi structured data, and across versions. This indexing is generally best stored on a filesystem, local to Guvnor (as per the default in the repository.xml) - in most cases the default is fine.

<!-- Search index for content that is shared repository wide (/jcr:system tree, contains mainly versions) --> <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex"> <param name="path" value="${wsp.home}/index"/> <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/> <param name="extractorPoolSize" value="2"/> <param name="supportHighlighting" value="true"/> </SearchIndex> </Repository>

You can configure in the same way repository.xml

23 Introduction Of Guvnor And DataBase