BRMS Bulk Importer
Introduction
The Bulk Importer is a tool that recurses a rules directory structure and constructs an xml
import file that can be manually imported into the BRM web interface via the import/export
administration feature.
It is useful when you have a large number of rule resources which you do not want to
manually import rule-by-rule into BRM.

Quick Notes for running the example:
1)java -jar ../brms-bulk-importer-1.0.0-SNAPSHOT.jar -prop test.properties
2)Import the generated import.xml from BRMS web interface

Running a test for bulk importer
To test, create a directory where you want to run the test (from now on called $testDir).
Copy the guvnor-importer-1.0.0-SNAPSHOT-jar-with-dependencies.jar to $testDir
Copy the templates (http://anonsvn.jboss.org/repos/labs/labs/jbossrules/soa_branches/
BRMS-5.1.1/drools-guvnor/bulk-importer-util/guvnor-importer/templates/) directory to
$testDir
Copy the my_rules (http://anonsvn.jboss.org/repos/labs/labs/jbossrules/soa_branches/
BRMS-5.1.1/drools-guvnor/bulk-importer-util/guvnor-importer/my_rules/) directory to
$testDir
Next step is to create the configuration properties file for the builk importer test. For this you
can create a file called test.properties in $testDir that looks like this:

#############################
#directory to start importing from                                                                                                   2
-p=$testDir/my_rules
#package to start importing from
-s=my_rules
#exclude packages
-e=[0-9|.]*[.|-]+[SNAPSHOT]+[.|-]*[09|.]*
#recurse sub-directories when looking for rules files
-r=true
#user account name to import the rules files as
-u=admin
#rule file extension to import
-f=drl,xls
#import file generated
-o=import.xml
#snapshot name
-n=1.0.0-SNAPSHOT
#functions file to look for
-c=functions.drl
#brms server url
-k=http://localhost:8080/jboss-brms/org.drools.guvnor.Guvnor/package/
#base dir
-b=/Users/tihomir/importer_test
#kagent changeset file output
-w=changeset.xml
###############################

Don't forget to replace $testDir with the actual location of the test directory.
To run your test, now execute the command:

java -jar guvnor-importer-1.0.0-SNAPSHOT-jar-with-dependencies.jar -prop test.properties

and you should get an output that looks like for example:
Running BRMS Import Generator (started 2010/10/13 03:50:32):
Scanning directories...
Generating 'Guvnor import data'...
25% - permissions.zone2 - [DEPENDENCY ERRORS]
50% - permissions.zone1 - [OK]
75% - thresholds.amounts - [OK]
100% - ping - [OK]
==========================
=== PACKAGE SUMMARY ===
==========================
 Rules compiled OK: 3
 Errors:           1
                ____
                                                                                         3
BRMS Bulk Importer
 Total:        4
==========================
Writing 'Guvnor import data to disk' (/Users/tihomir/importer_test/import.xml)
Generating 'Knowledge agent changeset' data...
Writing 'Knowledge agent changeset' to disk (/Users/tihomir/importer_test/changeset.xml)
Finished in (0m2s)

now you will be able to find two files generated in $testDir, namely import.xml, and
changeset.xml.

In your BRM instance now you can navigate to the Administration->Import Export section
and import your import.xml file. You should be able to see the new packages "permissions",
"thresholds", and "ping" have been imported with their corresponding technical rules.

Note that all rules will be imported as Technical Rules. This is not a limitation of this tool,
however there is no way to convert from DRL to BRL so no way to import any DRL rules as
rules editable in the guided editors. This is a manual task that you would have to do yourself.
                                                                                                4

