Install
* Drop jboss-brms.war into the deploy directory.
* Restart JBoss
* Point browser to http://localhost:8080/drools-guvnor.
Switch to Oracle DB
* Copy Oracle jdbc driver jar (jodbc14.jar) into the lib directory.
* Create an Oracle user schema (brms) to host repository, workspace, and versioning data. Alternatively use different schema to host. Grant following privileges to the user.
GRANT create session, create table, create sequence, create view, create trigger To brms_rep;
* Modify repository.xml in the workspace directory.
<Repository> <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> <param name="url" value="jdbc:oracle:thin:@db.my.com:1521:brms"/> <param name="user" value="brms"/> <param name="password" value="brms"/> <param name="schemaObjectPrefix" value="rep_"/> </FileSystem> <Repository> <Workspace> <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> <param name="url" value="jdbc:oracle:thin:@db.my.com:1521:brms"/> <param name="user" value="brms"/> <param name="password" value="brms"/> <param name="schemaObjectPrefix" value="${wsp.name}_fs_"/> </FileSystem> <PersistenceManager class= "org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager"> <param name="driver" value="oracle.jdbc.OracleDriver"/> <param name="url" value="jdbc:oracle:thin:@db.my.com:1521:brms" /> <param name="schema" value="oracle"/> <param name="user" value="brms" /> <param name="password" value="brms" /> <param name="schemaObjectPrefix" value="${wsp.name}_" /> </PersistenceManager> </Workspace> <Versioning> <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> <param name="url" value="jdbc:oracle:thin:@db.my.com:1521:brms"/> <param name="user" value="brms"/> <param name="password" value="brms"/> <param name="schemaObjectPrefix" value="version_fs_"/> </FileSystem> <PersistenceManager class= "org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager"> <param name="driver" value="oracle.jdbc.OracleDriver"/> <param name="url" value="jdbc:oracle:thin:@db.my.com:1521:brms" /> <param name="schema" value="oracle"/> <param name="user" value="brms" /> <param name="password" value="brms" /> <param name="schemaObjectPrefix" value="version_" /> </PersistenceManager> </Versioning>
* Clean workspace by removing all files and directories in the workspace directory *except* the repository.xml file.
* Restart JBoss.
Samples
Hello World
* Create a new package “HelloWorldPackage”. Knowledge Base/Create New/New Package.
* Create a new category “HelloWorldCategory”. Administration/Category/New category.
* Create a new rule “HelloWorldRule”. Knowledge Base/Create New/New Rule.
Initial category: HelloWorldCategory Type of Rule: Business Rule Package: HelloWorldPackage.
* Edit HelloWorldRule. “Green + Sign”/Free form drl/Enter text. Click “Save changes” to save the rule when done.
WHEN eval(true) THEN System.out.println("Hello world");
* Test the rule by creating a new test scenario. Knowledge Base/Create New/New Test Scenario. Click “Run scenario” button to fire off HelloWorldRule. One should see “Hello world” text on the JBoss log file or console screen.
Build Fact Model
* Create a new Java project.
* Create a new Java package: org.sample.
* Create a new Java class: org.sample.Sales.
* Add new java properties (getters/setters) to class.
* Export org.sample package as jar file.
* Import jar file into Guvnor.
– Create new package: org.sample
– Create new category: SalesCategory
– Upload POJO Model jar: Knowledge Base/Create New/Upload POJO Model jar. Name: SalesModel. Browse to jar file and click upload button. Click Save changes button.
* Create a new rule. Knowledge Base/Create New/New Rule.
rule "SalesDiscountRule" dialect "mvel" when Sales( sales >= "100" ) then Sales fact0 = new Sales(); fact0.setName( "Discount" ); fact0.setSales( -10 ); insert(fact0 ); end
* Create a new Test Scenario.