My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
DevDeveloperGettingStarted  

tidy, Featured
Updated Jun 7, 2011 by paul.m.browne

TODO Tidy this page

You've already checked out the Online Examples . And you've looked at the UserEndUserGettingStarted and PowerUserGettingStarted to see how to add your own information and new rules to these samples.But what if there is something that Red-Piranha doesn't yet do, a feature you want to add? This page shows you how to get started.

There are two parts to the Red-Piranha Project

  • Red Piranha - the core project, deployable to Google App Engine (GAE) that takes excel spreadsheets and runs pre-compiled rules against them. While this is a command line and other interace, mostly this project runs on the web.
  • Rule Player - A simple program used by Power Users (see PowerPowerUserGettingStarted in order to compile the rules for running in GAE. This runs (via Java Webstart, or local Java) on the Users PC (Windows, Mac, Linux or other). This local compile is needed as Google currently do not whitelist some of the code Drools needs to compile. Once compiled, the rule package is loaded into Google App Engine where normal users to can use them.

Instructions for developers on how to start using Red-Piranha

Other useful pages

Setup the environment

  1. Ensure you have Java installed on your Machine
  2. If you don't already have a google account, get one at here
  3. Download and install Eclipse
  4. Get the Subversion Plugin for Eclipse:
  5. Get the App Engine Plugin for Eclipse
  6. Get the Drools Eclipse Plugin

Checking out the code

The source code for Red Piranha is hosted by Google using Subversion. Background Information on Subversion (SVN) source control, hosted at Google code can be found at:

If you're logged in with google, This page will give you more detailed instructions on how to Checkout the code

When checking out the two projects, they should end up in two parallel folders i.e.

  • 'parent_dir'/red-piranha
  • 'parent_dir'/rule-player

This is because the rule-player build depends on some items from the 'core' red-piranha project (e.g. Drools Libraries, the Core Red Piranha code) and puts the result (e.g. the Jar with JNLP files) back into the Red-Piranha project. Once deployed to the App Engine, Power Users can download and run the completed Rule Player as part of the deployed project.

Source folders for both projects are:

Take care, as the structure in subversion differs slightly from the way the should be on your local disk after check out (see previous paragraph).

Building the code

TODO Complete these instructions

There two ways to build the Red Piranha Code - Via the supplied ant build files, or via Eclipse.

How to build in Ant

DevAntBuildFile gives details on how to build the Red Piranha Project via Ant.

How to build in Eclipse

Personally, I use Eclipse to edit and build the code (hence the reason why Eclipse build files are included when you check out the code). The Eclipse file should work once you check it out (as all the libs are provided), but right clicking on the Red Piranha will allow you to resolve them.

Running the code locally

Rule Player Console

The Rule Player - can be run directly in Eclipse

  1. Right click on RulePlayer Project in Eclipse, select 'Run as Java Application'
  2. In the Dialog that follows, select the 'RulePlayer' Class - its under net.firstpartners.player
  3. If this works ok, you should see the Rule Rule Console appear, similar to the following
RulePlayer Console

Red Piranha Junit Tests

(see DevProjectLayout), right click and run as JUnit test.

Red Piranha Main

  1. Find the Rp2CommandLine file (it's under net.firstpartners.ui)
  2. Right click on this file, select 'Run Configurations ...'
  3. Add any Arguments under the 'Arguments' tab
  4. Click Run
Google App Engine Local
  1. Make sure you have Google App Engine plugin for Eclipse installed.
  2. TODO more detailled instructions

Developer signing Rule Player jars

red-piranha/war/ruleplayer/lib folder when you execute this.

Deploying to App Engine

In general, most people will only want to deploy the packaged rules. These instructions are only if you are editing the Java Code in the Core Red Piranha build, or if you want to have your own instance of Red Piranha on the Google App Engine

Deploying Red Piranha to GAE Via Eclipse

Deploying Red Piranha to GAE Via Ant

More info at DevAntBuildFile

Deploying Red Piranha to GAE Via Rule Player

  • Feature not implemented yet TODO Document when done

Building your own rules

TODO - complete or remove this section

This is for building your rules in the Eclipse Development environment. PowerPowerUserGettingStarted details how most users will build their rules and then share them via the web

  • work in progress For the moment, you need to
  1. Write your rule (similar to log-then-modify-rule.drl
  2. Add you new rule using PreCompileRuleList.properties
  3. Create the pre-built KnowledgePackage using [PreCompileRuleBuilder.java http://code.google.com/p/red-piranha/source/browse/trunk/src/net/firstpartners/drools/PreCompileRuleBuilder.java] . TestPreCompileRuleBuilder is one easy way of running this through eclipse
  4. Modify the Service.jsp to include the option of selecting your newly created knowledgebase.
  5. Deploy to Google App Engine and enjoy!

More Options on running the Rule Player

TODO Complete Section

Extending Red Piranha

TODO Complete Section

for the moment you'll have to explore the code!

Link to Builder The code that builds the pre-compiled rule packages. Start with the main method.

Link to Servlet The code that calls the pre-compiled rule packages. Start with the service() method that runs in response to the form submitted by the jsp submission.
































Sign in to add a comment
Powered by Google Project Hosting