SlideShare a Scribd company logo
Daniel Selman – ODM Product Architect
March 2013




Using the Rules SDK v8.0.1
Business Rules Embedded




                                        © 2009 IBM Corporation
Agenda



    ■   What is the Rules SDK?
    ■   When to use it?
    ■   Code Samples
    ■   Q&A




2                                © 2013 IBM Corporation
IBM Presentation Template Full Version


What is the Rules SDK?



    ■   APIs and embeddable components for:
             –Defining business object models and vocabularies
             –Authoring rules in Eclipse and on the Web
             –Building ruleset archives
             –Executing rules
    ■   APIs are significantly simpler than full ODM APIs
    ■   Full ODM APIs are available and may be used if necessary




Source If Applicable

3                                                                  © 2013 IBM Corporation
IBM Presentation Template Full Version


When should it be used?



    ■   To allow business users to customize the behavior of an application
          using rules
    ■   Provide a highly customized and limited authoring and management
          environment:
             –Relatively small numbers of rules (< 500?)
             –XSD models
             –Only If/Then rules and Decision Tables may be used




Source If Applicable

4                                                                      © 2013 IBM Corporation
IBM Presentation Template Full Version


When should it not be used?



    ■   To re-implement a Decision Management Platform or Business Rules
          Management Platform
              –Just use ODM! :-)
    ■   With great power comes great responsibility...




Source If Applicable

5                                                                  © 2013 IBM Corporation
Getting Access



    ■   The Rules SDK ships with ODM and requires an ODM license.
    ■   After installing ODM you can find the components and samples within the rules-sdk
            directory.




6                                                                                     © 2013 IBM Corporation
Rules SDK vs ODM
Capability                 Rules SDK    ODM
If/Then Rule (SWT)         Yes          Yes
If/Then Rule (Web)         Yes          Yes
Project export to ODM      Yes          Yes
Decision Tables (Web)      Yes          Yes
Decision Tables (Swing)    No           Yes
# rules per ruleset        <100         <100,000
Execution algorithms       Sequential   Sequential, Rete, Fastpath
Governance / Lifecycle /   No           Yes
Simulation
Vocabulary/model editing   No           Yes
ODM project model:         No           Yes
Decision Trees, Ruleflow
etc.
JEE execution support      No           Yes
Rule refactoring           No           Yes
7                                                       © 2013 IBM Corporation
Defining a Vocabulary and a BAL Rule
    // the locale / encoding for the test
    final Locale locale = Locale.US;
    final String encoding = "UTF-8";

    // create the ObjectModelBuilder
    ObjectModelBuilder omBuilder = new ObjectModelBuilder();

    // add an XSD
    String xsd = "customer.xsd";
    InputStream is = this.getClass().getClassLoader().getResourceAsStream( xsd );
    omBuilder.addXmlSchema(new XmlSchema(xsd, encoding, is));

    // create the RuleLanguageService
    RuleLanguageService ruleLanguageService = new RuleLanguageService();

    // create the vocabulary for the locale
    ruleLanguageService.registerVocabulary( omBuilder.createVocabulary(locale) );

    // define a parameter
    ruleLanguageService.addParameter("com.ilog.rules.customer.Customer", "cust",
     "the customer", locale);

    // create the RulesetBuilder
    RulesetBuilder rsBuilder = new RulesetBuilder(ruleLanguageService);

    // add a rule
    rsBuilder.addBusinessRule(locale, "rule1",
      "if the name of 'the customer' contains "Smith" then print "Hello John!";");




8                                                                                        © 2013 IBM Corporation
Using the DecisionTableBuilder




// add a decision table
DecisionTableBuilder dtBuilder = new DecisionTableBuilder(ruleLanguageService, "dt1", locale,
readDTXmlModel("dt1.xml"));
rsBuilder.addDecisionTable(Locale.US, "dt1", dtBuilder.getDTModel());

// define a decision table via API
DecisionTableBuilder builder = new DecisionTableBuilder(ruleLanguageService, "test", locale);
builder.addConditionColumn( "cust", "Category", "the category");
builder.addConditionColumn( "cust", "Age", "the age");
builder.addActionColumn( "cust", "Category", "the resulting category");
builder.addContent(new String[][] {{ "Gold", "< 20", "Silver" },
        { "Gold", "[20..30]", "Gold" },
        { "Gold", ">= 30", "Platinum" },
        { "Bronze", "< 30", "Silver" },
        { "Bronze", ">= 30", "Platinum" }});




9                                                                                               © 2013 IBM Corporation
Generating and Executing the Ruleset Archive
 // generate the archive
 byte[] rs = rsBuilder.buildRuleset("ruleset.jar");
 Assert.assertEquals( "Unexpected build issues", 0, rsBuilder.getBuildIssues().size() );

 // create the rule service
 IlrRuleService ruleService = new XMLRuleService(new PrintWriter(System.out));
 IlrPath path = new IlrPath("RuleApp", "Ruleset");

 // undeploy the ruleset if required
 if (ruleService.isRulesetDeployed(path)) {
 ruleService.undeployRuleset(path);
 }

 // deploy the ruleset
 Map<String, String> properties = new HashMap<String, String>();
 properties.put(IlrRulesetArchiveProperties.KEY_SEQUENTIAL_TRACE_ENABLED, Boolean.toString(true));
 ruleService.deployRuleset(path, rs, properties);

 // load instance document
 is = this.getClass().getClassLoader().getResourceAsStream( "sample-customer.xml" );

 // execute the engine
 Map<String, Object> params = new HashMap<String, Object>();
 params.put( "cust", inputStreamToString( encoding, is ));

 // retrieve the results
 IlrSessionResponse response = ruleService.executeRuleset(path, params, true);
 IlrBusinessExecutionTrace businessTrace = new IlrBusinessExecutionTrace(response.getRulesetExecutionTrace());




10                                                                                                   © 2013 IBM Corporation
Export the RuleSetBuilder to a Zipped Rule Project
// generate the archive that contains the rule project
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
ZipOutputStream out = new ZipOutputStream( bytes );
// The following line of code can be used to dump that project on disk
//ZipOutputStream out = new ZipOutputStream( new FileOutputStream(new File(System.getProperty("user.dir"),
"textProject.zip")) );
rsBuilder.export(out, "testProject");




11                                                                                               © 2013 IBM Corporation
SWT BAL Editor




12               © 2013 IBM Corporation
Using the SWT BAL Editor                                                /**
                                                                         * Represents a BAL rule in the
                                                                        model.
                                                                         */
                                                                        public class BalRule {

                                                                        private Locale locale;
                                                          Editing       private String name;
                                                                        private String contents;

     // creation and display of the rule editor component
     IntelliTextDefaultEnvironment environment = new IntelliTextDefaultEnvironment();
     // set some prediction configuration
     environment.getPreferenceStore().setValue(IntelliTextPreferences.FILTER_UNREACHABLE, true);
     // create the JFace element
     final IntelliTextViewer ruleEditor = new IntelliTextViewer(composite, SWT.NONE, environment);
     // create a document to hold the edited text
     IntelliTextDocument document = new IntelliTextDocument(IlrBAL.BAL_DEFINITION, rule.getLocale(),
         ruleLanguageService.getParserManager());
     // register the variables
     document.setVariableProvider(ruleLanguageService.getVariableProvider(rule.getLocale()));
     // set the text
     document.set(rule.getContents());
     // add a listener to react to text changes
     document.addDocumentListener(new IDocumentListener() {
       @Override
       public void documentChanged(DocumentEvent event) {
         rule.setContents(event.getDocument().get());
       }

       @Override
       public void documentAboutToBeChanged(DocumentEvent event) {
         // nothing to do
       }
     });
     // assign the document to the editor
     ruleEditor.setInput(document);



13                                                                                                 © 2013 IBM Corporation
Web BAL Editor




14               © 2013 IBM Corporation
Web BAL Editor GUI (index.jsp)
         <script type="text/javascript">
             dojo.registerModulePath("com.ibm.bdsl.web", "$
     {pageContext.request.contextPath}/WebRuleEditor/com/ibm/bdsl/web");
             dojo.registerModulePath("com.ibm.rules.bdsl.dt", "$
     {pageContext.request.contextPath}/WebDTEditor/resources/js/com/ibm/rules/bdsl/dt");

            // Decision Tables
            dojo.require("com.ibm.rules.bdsl.dt.DecisionTable");
            dojo.require("com.ibm.rules.bdsl.dt.EditableDecisionTable");

            // Rules
            dojo.require("com.ibm.bdsl.web.editor.dojo.DojoIntelliTextEditorDecorated");


 // create a rule editor
 var ruleEditor = new com.ibm.bdsl.web.editor.dojo.DojoIntelliTextEditorDecorated({
                 id: 'ruleEditor',
                 handlerUrl: '${pageContext.request.contextPath}/WebRuleEditor'
             }, dojo.create('div', null, 'rulePane'));
             ruleEditor.startup();




15                                                                                         © 2013 IBM Corporation
Web BAL Editor Servlet
public class WebRuleEditorServlet extends IntelliTextEditorServlet {
    public static final String ENV_ATTRIBUTE_NAME = "intellitextEnvironment";

         @Override
         protected IntelliTextEditorEnvironment getEnvironment(HttpServletRequest req) {
             HttpSession session = req.getSession();
             IntelliTextEditorEnvironment env = (IntelliTextEditorEnvironment) session.getAttribute(ENV_ATTRIBUTE_NAME);
             if (env == null) {
                     env = createEnvironment(session);
             }
             return env;
         }

         public static synchronized IntelliTextEditorEnvironment createEnvironment(HttpSession session) {
             Locale locale = new Locale(SessionUtils.DEFAULT_LOCALE);
             RuleLanguageService ruleLanguageService = SessionUtils.getRuleLanguageService(session);

             IlrBRLDefinition definition = IlrBAL.getDefinition(locale);
             IlrBRLParserManager parserManager = ruleLanguageService.getParserManager();
             IlrBRLVariableProvider variableProvider = ruleLanguageService.getVariableProvider(locale);

             IntelliTextEditorEnvironment environment =
                 new DefaultIntelliTextEditorEnvironment(parserManager, variableProvider, definition, null);
             session.setAttribute(ENV_ATTRIBUTE_NAME, environment);

             return environment;
         }
}




    16                                                                                                    © 2013 IBM Corporation
Web DT Editor




17              © 2013 IBM Corporation
Web DT Editor GUI (index.jsp)
         <script type="text/javascript">
             dojo.registerModulePath("com.ibm.bdsl.web", "$
     {pageContext.request.contextPath}/WebRuleEditor/com/ibm/bdsl/web");
             dojo.registerModulePath("com.ibm.rules.bdsl.dt", "$
     {pageContext.request.contextPath}/WebDTEditor/resources/js/com/ibm/rules/bdsl/dt");

            // Decision Tables
            dojo.require("com.ibm.rules.bdsl.dt.DecisionTable");
            dojo.require("com.ibm.rules.bdsl.dt.EditableDecisionTable");

            // Rules
            dojo.require("com.ibm.bdsl.web.editor.dojo.DojoIntelliTextEditorDecorated");


                   // Create a decision table editor
                   dojo.xhrPost({
                       url: '${pageContext.request.contextPath}/WebDTEditor/command/create',
                       handleAs: 'json',
                       preventCache: true,
                       load: function (response) {
                           if (response) {
                               var dt = new com.ibm.rules.bdsl.dt.EditableDecisionTable({
                                   id: 'dt',
                                   model: response,
                                   baseUrl:'${pageContext.request.contextPath}/WebDTEditor/'
                               }, dojo.create('div', null, 'gridPanel'));
                               dt.startup();
                               dt.getSelectionService().selectCells(0, 1);
                           }
                       }
                   });




18                                                                                             © 2013 IBM Corporation
Web DT Editor Servlet
     public class WebDtEditorServlet extends DTEditorServlet {
           public static final String ENV_ATTRIBUTE_NAME = "dtEditorEnv";

          @Override
          protected DTEditorEnvironment getDtEnvironment(HttpServletRequest request) {
                HttpSession session = request.getSession();
                WebDTEditorEnvironment env = (WebDTEditorEnvironment) session
                            .getAttribute(WebDtEditorServlet.ENV_ATTRIBUTE_NAME);
                if (env == null) {
                      session.setAttribute(WebDtEditorServlet.ENV_ATTRIBUTE_NAME,
                                  env = new WebDTEditorEnvironment());
                }
                return env;
          }

          @Override
          protected IlrDTModel getModelTemplate(HttpServletRequest request) {
                DTEditorEnvironment env = (DTEditorEnvironment) request.getSession()
                            .getAttribute(WebDtEditorServlet.ENV_ATTRIBUTE_NAME);
                if (env != null) {
                      DTHandle dtHandle = env.getDTHandle();
                      if (dtHandle != null) {
                            return dtHandle.getModelTemplate();
                      }
                }
                return null;
          }

          @Override
          protected IlrBRLDefinition getBALDefinition(HttpServletRequest request) {
                return IlrBAL.getDefinition(new Locale(SessionUtils.DEFAULT_LOCALE));
          }

          @Override
          protected IlrBRLParserService getBALParser(HttpServletRequest request) {
                return SessionUtils.getRuleLanguageService(request.getSession())
                                  .getParserManager();
          }                                                                              © 2013 IBM Corporation
19
     }
Any Questions?




20               © 2013 IBM Corporation

More Related Content

What's hot

Impact 2011 2899 - Designing high performance straight through processes usin...
Impact 2011 2899 - Designing high performance straight through processes usin...Impact 2011 2899 - Designing high performance straight through processes usin...
Impact 2011 2899 - Designing high performance straight through processes usin...
Brian Petrini
 
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin CenterDeploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
WASdev Community
 
Building Operational Intelligence in Telecom with IBM ODM @Claro
Building Operational Intelligence in Telecom with IBM ODM @ClaroBuilding Operational Intelligence in Telecom with IBM ODM @Claro
Building Operational Intelligence in Telecom with IBM ODM @Claro
Icaro Tech
 
Impact 2008 1994A - Exposing services people want to consume: a model-driven ...
Impact 2008 1994A - Exposing services people want to consume: a model-driven ...Impact 2008 1994A - Exposing services people want to consume: a model-driven ...
Impact 2008 1994A - Exposing services people want to consume: a model-driven ...
Brian Petrini
 
Cloud Technology: Now Entering the Business Process Phase
Cloud Technology: Now Entering the Business Process PhaseCloud Technology: Now Entering the Business Process Phase
Cloud Technology: Now Entering the Business Process Phase
finteligent
 
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Pierre Feillet
 
Red Hat JBoss BRMS Primer - JBoss Business Rules and BPM Solutions
Red Hat JBoss BRMS Primer - JBoss Business Rules and BPM SolutionsRed Hat JBoss BRMS Primer - JBoss Business Rules and BPM Solutions
Red Hat JBoss BRMS Primer - JBoss Business Rules and BPM Solutions
Eric D. Schabell
 
Bpms ecu2014
Bpms ecu2014Bpms ecu2014
Bpms ecu2014
Bob Brodt
 
2829 liberty
2829 liberty2829 liberty
2829 liberty
nick_garrod
 
Impact 2013 2971 - Fundamental integration and service patterns
Impact 2013 2971 - Fundamental integration and service patternsImpact 2013 2971 - Fundamental integration and service patterns
Impact 2013 2971 - Fundamental integration and service patterns
Brian Petrini
 
Ibm pure systems pov_idr_spig_v1
Ibm pure systems pov_idr_spig_v1Ibm pure systems pov_idr_spig_v1
Ibm pure systems pov_idr_spig_v1
Marco Laucelli
 
Supercharge Your Integration Services
Supercharge Your Integration Services�Supercharge Your Integration Services�
Supercharge Your Integration Services
Christina Lin
 
Impact 2013 2963 - IBM Business Process Manager Top Practices
Impact 2013 2963 - IBM Business Process Manager Top PracticesImpact 2013 2963 - IBM Business Process Manager Top Practices
Impact 2013 2963 - IBM Business Process Manager Top Practices
Brian Petrini
 
Impact 2012 1640 - BPM Design considerations when optimizing business process...
Impact 2012 1640 - BPM Design considerations when optimizing business process...Impact 2012 1640 - BPM Design considerations when optimizing business process...
Impact 2012 1640 - BPM Design considerations when optimizing business process...
Brian Petrini
 
Improving Software Delivery with Software Defined Environments (IBM Interconn...
Improving Software Delivery with Software Defined Environments (IBM Interconn...Improving Software Delivery with Software Defined Environments (IBM Interconn...
Improving Software Delivery with Software Defined Environments (IBM Interconn...
Michael Elder
 
EclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse Stardust
EclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse StardustEclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse Stardust
EclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse Stardust
Sopra Steria
 
AIMMS product presentation
AIMMS product presentationAIMMS product presentation
AIMMS product presentation
jhjsmits
 
Migrating Legacy Code
Migrating Legacy CodeMigrating Legacy Code
Migrating Legacy Code
Siddhi
 

What's hot (18)

Impact 2011 2899 - Designing high performance straight through processes usin...
Impact 2011 2899 - Designing high performance straight through processes usin...Impact 2011 2899 - Designing high performance straight through processes usin...
Impact 2011 2899 - Designing high performance straight through processes usin...
 
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin CenterDeploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
 
Building Operational Intelligence in Telecom with IBM ODM @Claro
Building Operational Intelligence in Telecom with IBM ODM @ClaroBuilding Operational Intelligence in Telecom with IBM ODM @Claro
Building Operational Intelligence in Telecom with IBM ODM @Claro
 
Impact 2008 1994A - Exposing services people want to consume: a model-driven ...
Impact 2008 1994A - Exposing services people want to consume: a model-driven ...Impact 2008 1994A - Exposing services people want to consume: a model-driven ...
Impact 2008 1994A - Exposing services people want to consume: a model-driven ...
 
Cloud Technology: Now Entering the Business Process Phase
Cloud Technology: Now Entering the Business Process PhaseCloud Technology: Now Entering the Business Process Phase
Cloud Technology: Now Entering the Business Process Phase
 
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0
 
Red Hat JBoss BRMS Primer - JBoss Business Rules and BPM Solutions
Red Hat JBoss BRMS Primer - JBoss Business Rules and BPM SolutionsRed Hat JBoss BRMS Primer - JBoss Business Rules and BPM Solutions
Red Hat JBoss BRMS Primer - JBoss Business Rules and BPM Solutions
 
Bpms ecu2014
Bpms ecu2014Bpms ecu2014
Bpms ecu2014
 
2829 liberty
2829 liberty2829 liberty
2829 liberty
 
Impact 2013 2971 - Fundamental integration and service patterns
Impact 2013 2971 - Fundamental integration and service patternsImpact 2013 2971 - Fundamental integration and service patterns
Impact 2013 2971 - Fundamental integration and service patterns
 
Ibm pure systems pov_idr_spig_v1
Ibm pure systems pov_idr_spig_v1Ibm pure systems pov_idr_spig_v1
Ibm pure systems pov_idr_spig_v1
 
Supercharge Your Integration Services
Supercharge Your Integration Services�Supercharge Your Integration Services�
Supercharge Your Integration Services
 
Impact 2013 2963 - IBM Business Process Manager Top Practices
Impact 2013 2963 - IBM Business Process Manager Top PracticesImpact 2013 2963 - IBM Business Process Manager Top Practices
Impact 2013 2963 - IBM Business Process Manager Top Practices
 
Impact 2012 1640 - BPM Design considerations when optimizing business process...
Impact 2012 1640 - BPM Design considerations when optimizing business process...Impact 2012 1640 - BPM Design considerations when optimizing business process...
Impact 2012 1640 - BPM Design considerations when optimizing business process...
 
Improving Software Delivery with Software Defined Environments (IBM Interconn...
Improving Software Delivery with Software Defined Environments (IBM Interconn...Improving Software Delivery with Software Defined Environments (IBM Interconn...
Improving Software Delivery with Software Defined Environments (IBM Interconn...
 
EclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse Stardust
EclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse StardustEclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse Stardust
EclipseCon BPM Day Ludwigsburg - Roundtrip Modelling with Eclipse Stardust
 
AIMMS product presentation
AIMMS product presentationAIMMS product presentation
AIMMS product presentation
 
Migrating Legacy Code
Migrating Legacy CodeMigrating Legacy Code
Migrating Legacy Code
 

Similar to Rules SDK IBM WW BPM Forum March 2013

IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
Brian Cavalier
 
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham ChartersDS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
mfrancis
 
.NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012).NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012)
David McCarter
 
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham ChartersDS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
mfrancis
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
lennartkats
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
Amit Solanki
 
RequireJS
RequireJSRequireJS
RequireJS
Tim Doherty
 
Tips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsTips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS Applications
Strongback Consulting
 
Grails 101
Grails 101Grails 101
Grails 101
David Jacobs
 
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
timfanelli
 
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
Cynthia Saracco
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA Austria
Rainer Stropek
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
Matthias Noback
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
mfrancis
 
Epoxy 介紹
Epoxy 介紹Epoxy 介紹
Epoxy 介紹
Kros Huang
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
Arun Gupta
 
A Groovy Kind of Java (San Francisco Java User Group)
A Groovy Kind of Java (San Francisco Java User Group)A Groovy Kind of Java (San Francisco Java User Group)
A Groovy Kind of Java (San Francisco Java User Group)
Nati Shalom
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
Jack-Junjie Cai
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For Managers
AgileThought
 
Understanding cil & dynamic assemblies
Understanding cil & dynamic assembliesUnderstanding cil & dynamic assemblies
Understanding cil & dynamic assemblies
Paul Fryer
 

Similar to Rules SDK IBM WW BPM Forum March 2013 (20)

IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
 
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham ChartersDS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
 
.NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012).NET Coding Standards For The Real World (2012)
.NET Coding Standards For The Real World (2012)
 
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham ChartersDS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
RequireJS
RequireJSRequireJS
RequireJS
 
Tips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsTips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS Applications
 
Grails 101
Grails 101Grails 101
Grails 101
 
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
 
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA Austria
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
 
Epoxy 介紹
Epoxy 介紹Epoxy 介紹
Epoxy 介紹
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
A Groovy Kind of Java (San Francisco Java User Group)
A Groovy Kind of Java (San Francisco Java User Group)A Groovy Kind of Java (San Francisco Java User Group)
A Groovy Kind of Java (San Francisco Java User Group)
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For Managers
 
Understanding cil & dynamic assemblies
Understanding cil & dynamic assembliesUnderstanding cil & dynamic assemblies
Understanding cil & dynamic assemblies
 

More from Dan Selman

Hyperleger Composer Architecure Deep Dive
Hyperleger Composer Architecure Deep DiveHyperleger Composer Architecure Deep Dive
Hyperleger Composer Architecure Deep Dive
Dan Selman
 
Hyperledger Composer Update 2017-04-05
Hyperledger Composer Update 2017-04-05Hyperledger Composer Update 2017-04-05
Hyperledger Composer Update 2017-04-05
Dan Selman
 
Service Oriented Architecture - Agility Rules!
Service Oriented Architecture - Agility Rules!Service Oriented Architecture - Agility Rules!
Service Oriented Architecture - Agility Rules!
Dan Selman
 
European Business Rules Conference 2005 : Rule Standards
European Business Rules Conference 2005 : Rule StandardsEuropean Business Rules Conference 2005 : Rule Standards
European Business Rules Conference 2005 : Rule Standards
Dan Selman
 
European Business Rules Conference 2004: The Business Rules Platform and Ente...
European Business Rules Conference 2004: The Business Rules Platform and Ente...European Business Rules Conference 2004: The Business Rules Platform and Ente...
European Business Rules Conference 2004: The Business Rules Platform and Ente...
Dan Selman
 
October Rules Fest 2008 - Distributed Data Processing with ILOG JRules
October Rules Fest 2008 - Distributed Data Processing with ILOG JRulesOctober Rules Fest 2008 - Distributed Data Processing with ILOG JRules
October Rules Fest 2008 - Distributed Data Processing with ILOG JRules
Dan Selman
 

More from Dan Selman (6)

Hyperleger Composer Architecure Deep Dive
Hyperleger Composer Architecure Deep DiveHyperleger Composer Architecure Deep Dive
Hyperleger Composer Architecure Deep Dive
 
Hyperledger Composer Update 2017-04-05
Hyperledger Composer Update 2017-04-05Hyperledger Composer Update 2017-04-05
Hyperledger Composer Update 2017-04-05
 
Service Oriented Architecture - Agility Rules!
Service Oriented Architecture - Agility Rules!Service Oriented Architecture - Agility Rules!
Service Oriented Architecture - Agility Rules!
 
European Business Rules Conference 2005 : Rule Standards
European Business Rules Conference 2005 : Rule StandardsEuropean Business Rules Conference 2005 : Rule Standards
European Business Rules Conference 2005 : Rule Standards
 
European Business Rules Conference 2004: The Business Rules Platform and Ente...
European Business Rules Conference 2004: The Business Rules Platform and Ente...European Business Rules Conference 2004: The Business Rules Platform and Ente...
European Business Rules Conference 2004: The Business Rules Platform and Ente...
 
October Rules Fest 2008 - Distributed Data Processing with ILOG JRules
October Rules Fest 2008 - Distributed Data Processing with ILOG JRulesOctober Rules Fest 2008 - Distributed Data Processing with ILOG JRules
October Rules Fest 2008 - Distributed Data Processing with ILOG JRules
 

Recently uploaded

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
Data Hops
 

Recently uploaded (20)

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
 

Rules SDK IBM WW BPM Forum March 2013

  • 1. Daniel Selman – ODM Product Architect March 2013 Using the Rules SDK v8.0.1 Business Rules Embedded © 2009 IBM Corporation
  • 2. Agenda ■ What is the Rules SDK? ■ When to use it? ■ Code Samples ■ Q&A 2 © 2013 IBM Corporation
  • 3. IBM Presentation Template Full Version What is the Rules SDK? ■ APIs and embeddable components for: –Defining business object models and vocabularies –Authoring rules in Eclipse and on the Web –Building ruleset archives –Executing rules ■ APIs are significantly simpler than full ODM APIs ■ Full ODM APIs are available and may be used if necessary Source If Applicable 3 © 2013 IBM Corporation
  • 4. IBM Presentation Template Full Version When should it be used? ■ To allow business users to customize the behavior of an application using rules ■ Provide a highly customized and limited authoring and management environment: –Relatively small numbers of rules (< 500?) –XSD models –Only If/Then rules and Decision Tables may be used Source If Applicable 4 © 2013 IBM Corporation
  • 5. IBM Presentation Template Full Version When should it not be used? ■ To re-implement a Decision Management Platform or Business Rules Management Platform –Just use ODM! :-) ■ With great power comes great responsibility... Source If Applicable 5 © 2013 IBM Corporation
  • 6. Getting Access ■ The Rules SDK ships with ODM and requires an ODM license. ■ After installing ODM you can find the components and samples within the rules-sdk directory. 6 © 2013 IBM Corporation
  • 7. Rules SDK vs ODM Capability Rules SDK ODM If/Then Rule (SWT) Yes Yes If/Then Rule (Web) Yes Yes Project export to ODM Yes Yes Decision Tables (Web) Yes Yes Decision Tables (Swing) No Yes # rules per ruleset <100 <100,000 Execution algorithms Sequential Sequential, Rete, Fastpath Governance / Lifecycle / No Yes Simulation Vocabulary/model editing No Yes ODM project model: No Yes Decision Trees, Ruleflow etc. JEE execution support No Yes Rule refactoring No Yes 7 © 2013 IBM Corporation
  • 8. Defining a Vocabulary and a BAL Rule // the locale / encoding for the test final Locale locale = Locale.US; final String encoding = "UTF-8"; // create the ObjectModelBuilder ObjectModelBuilder omBuilder = new ObjectModelBuilder(); // add an XSD String xsd = "customer.xsd"; InputStream is = this.getClass().getClassLoader().getResourceAsStream( xsd ); omBuilder.addXmlSchema(new XmlSchema(xsd, encoding, is)); // create the RuleLanguageService RuleLanguageService ruleLanguageService = new RuleLanguageService(); // create the vocabulary for the locale ruleLanguageService.registerVocabulary( omBuilder.createVocabulary(locale) ); // define a parameter ruleLanguageService.addParameter("com.ilog.rules.customer.Customer", "cust", "the customer", locale); // create the RulesetBuilder RulesetBuilder rsBuilder = new RulesetBuilder(ruleLanguageService); // add a rule rsBuilder.addBusinessRule(locale, "rule1", "if the name of 'the customer' contains "Smith" then print "Hello John!";"); 8 © 2013 IBM Corporation
  • 9. Using the DecisionTableBuilder // add a decision table DecisionTableBuilder dtBuilder = new DecisionTableBuilder(ruleLanguageService, "dt1", locale, readDTXmlModel("dt1.xml")); rsBuilder.addDecisionTable(Locale.US, "dt1", dtBuilder.getDTModel()); // define a decision table via API DecisionTableBuilder builder = new DecisionTableBuilder(ruleLanguageService, "test", locale); builder.addConditionColumn( "cust", "Category", "the category"); builder.addConditionColumn( "cust", "Age", "the age"); builder.addActionColumn( "cust", "Category", "the resulting category"); builder.addContent(new String[][] {{ "Gold", "< 20", "Silver" }, { "Gold", "[20..30]", "Gold" }, { "Gold", ">= 30", "Platinum" }, { "Bronze", "< 30", "Silver" }, { "Bronze", ">= 30", "Platinum" }}); 9 © 2013 IBM Corporation
  • 10. Generating and Executing the Ruleset Archive // generate the archive byte[] rs = rsBuilder.buildRuleset("ruleset.jar"); Assert.assertEquals( "Unexpected build issues", 0, rsBuilder.getBuildIssues().size() ); // create the rule service IlrRuleService ruleService = new XMLRuleService(new PrintWriter(System.out)); IlrPath path = new IlrPath("RuleApp", "Ruleset"); // undeploy the ruleset if required if (ruleService.isRulesetDeployed(path)) { ruleService.undeployRuleset(path); } // deploy the ruleset Map<String, String> properties = new HashMap<String, String>(); properties.put(IlrRulesetArchiveProperties.KEY_SEQUENTIAL_TRACE_ENABLED, Boolean.toString(true)); ruleService.deployRuleset(path, rs, properties); // load instance document is = this.getClass().getClassLoader().getResourceAsStream( "sample-customer.xml" ); // execute the engine Map<String, Object> params = new HashMap<String, Object>(); params.put( "cust", inputStreamToString( encoding, is )); // retrieve the results IlrSessionResponse response = ruleService.executeRuleset(path, params, true); IlrBusinessExecutionTrace businessTrace = new IlrBusinessExecutionTrace(response.getRulesetExecutionTrace()); 10 © 2013 IBM Corporation
  • 11. Export the RuleSetBuilder to a Zipped Rule Project // generate the archive that contains the rule project ByteArrayOutputStream bytes = new ByteArrayOutputStream(); ZipOutputStream out = new ZipOutputStream( bytes ); // The following line of code can be used to dump that project on disk //ZipOutputStream out = new ZipOutputStream( new FileOutputStream(new File(System.getProperty("user.dir"), "textProject.zip")) ); rsBuilder.export(out, "testProject"); 11 © 2013 IBM Corporation
  • 12. SWT BAL Editor 12 © 2013 IBM Corporation
  • 13. Using the SWT BAL Editor /** * Represents a BAL rule in the model. */ public class BalRule { private Locale locale; Editing private String name; private String contents; // creation and display of the rule editor component IntelliTextDefaultEnvironment environment = new IntelliTextDefaultEnvironment(); // set some prediction configuration environment.getPreferenceStore().setValue(IntelliTextPreferences.FILTER_UNREACHABLE, true); // create the JFace element final IntelliTextViewer ruleEditor = new IntelliTextViewer(composite, SWT.NONE, environment); // create a document to hold the edited text IntelliTextDocument document = new IntelliTextDocument(IlrBAL.BAL_DEFINITION, rule.getLocale(), ruleLanguageService.getParserManager()); // register the variables document.setVariableProvider(ruleLanguageService.getVariableProvider(rule.getLocale())); // set the text document.set(rule.getContents()); // add a listener to react to text changes document.addDocumentListener(new IDocumentListener() { @Override public void documentChanged(DocumentEvent event) { rule.setContents(event.getDocument().get()); } @Override public void documentAboutToBeChanged(DocumentEvent event) { // nothing to do } }); // assign the document to the editor ruleEditor.setInput(document); 13 © 2013 IBM Corporation
  • 14. Web BAL Editor 14 © 2013 IBM Corporation
  • 15. Web BAL Editor GUI (index.jsp) <script type="text/javascript"> dojo.registerModulePath("com.ibm.bdsl.web", "$ {pageContext.request.contextPath}/WebRuleEditor/com/ibm/bdsl/web"); dojo.registerModulePath("com.ibm.rules.bdsl.dt", "$ {pageContext.request.contextPath}/WebDTEditor/resources/js/com/ibm/rules/bdsl/dt"); // Decision Tables dojo.require("com.ibm.rules.bdsl.dt.DecisionTable"); dojo.require("com.ibm.rules.bdsl.dt.EditableDecisionTable"); // Rules dojo.require("com.ibm.bdsl.web.editor.dojo.DojoIntelliTextEditorDecorated"); // create a rule editor var ruleEditor = new com.ibm.bdsl.web.editor.dojo.DojoIntelliTextEditorDecorated({ id: 'ruleEditor', handlerUrl: '${pageContext.request.contextPath}/WebRuleEditor' }, dojo.create('div', null, 'rulePane')); ruleEditor.startup(); 15 © 2013 IBM Corporation
  • 16. Web BAL Editor Servlet public class WebRuleEditorServlet extends IntelliTextEditorServlet { public static final String ENV_ATTRIBUTE_NAME = "intellitextEnvironment"; @Override protected IntelliTextEditorEnvironment getEnvironment(HttpServletRequest req) { HttpSession session = req.getSession(); IntelliTextEditorEnvironment env = (IntelliTextEditorEnvironment) session.getAttribute(ENV_ATTRIBUTE_NAME); if (env == null) { env = createEnvironment(session); } return env; } public static synchronized IntelliTextEditorEnvironment createEnvironment(HttpSession session) { Locale locale = new Locale(SessionUtils.DEFAULT_LOCALE); RuleLanguageService ruleLanguageService = SessionUtils.getRuleLanguageService(session); IlrBRLDefinition definition = IlrBAL.getDefinition(locale); IlrBRLParserManager parserManager = ruleLanguageService.getParserManager(); IlrBRLVariableProvider variableProvider = ruleLanguageService.getVariableProvider(locale); IntelliTextEditorEnvironment environment = new DefaultIntelliTextEditorEnvironment(parserManager, variableProvider, definition, null); session.setAttribute(ENV_ATTRIBUTE_NAME, environment); return environment; } } 16 © 2013 IBM Corporation
  • 17. Web DT Editor 17 © 2013 IBM Corporation
  • 18. Web DT Editor GUI (index.jsp) <script type="text/javascript"> dojo.registerModulePath("com.ibm.bdsl.web", "$ {pageContext.request.contextPath}/WebRuleEditor/com/ibm/bdsl/web"); dojo.registerModulePath("com.ibm.rules.bdsl.dt", "$ {pageContext.request.contextPath}/WebDTEditor/resources/js/com/ibm/rules/bdsl/dt"); // Decision Tables dojo.require("com.ibm.rules.bdsl.dt.DecisionTable"); dojo.require("com.ibm.rules.bdsl.dt.EditableDecisionTable"); // Rules dojo.require("com.ibm.bdsl.web.editor.dojo.DojoIntelliTextEditorDecorated"); // Create a decision table editor dojo.xhrPost({ url: '${pageContext.request.contextPath}/WebDTEditor/command/create', handleAs: 'json', preventCache: true, load: function (response) { if (response) { var dt = new com.ibm.rules.bdsl.dt.EditableDecisionTable({ id: 'dt', model: response, baseUrl:'${pageContext.request.contextPath}/WebDTEditor/' }, dojo.create('div', null, 'gridPanel')); dt.startup(); dt.getSelectionService().selectCells(0, 1); } } }); 18 © 2013 IBM Corporation
  • 19. Web DT Editor Servlet public class WebDtEditorServlet extends DTEditorServlet { public static final String ENV_ATTRIBUTE_NAME = "dtEditorEnv"; @Override protected DTEditorEnvironment getDtEnvironment(HttpServletRequest request) { HttpSession session = request.getSession(); WebDTEditorEnvironment env = (WebDTEditorEnvironment) session .getAttribute(WebDtEditorServlet.ENV_ATTRIBUTE_NAME); if (env == null) { session.setAttribute(WebDtEditorServlet.ENV_ATTRIBUTE_NAME, env = new WebDTEditorEnvironment()); } return env; } @Override protected IlrDTModel getModelTemplate(HttpServletRequest request) { DTEditorEnvironment env = (DTEditorEnvironment) request.getSession() .getAttribute(WebDtEditorServlet.ENV_ATTRIBUTE_NAME); if (env != null) { DTHandle dtHandle = env.getDTHandle(); if (dtHandle != null) { return dtHandle.getModelTemplate(); } } return null; } @Override protected IlrBRLDefinition getBALDefinition(HttpServletRequest request) { return IlrBAL.getDefinition(new Locale(SessionUtils.DEFAULT_LOCALE)); } @Override protected IlrBRLParserService getBALParser(HttpServletRequest request) { return SessionUtils.getRuleLanguageService(request.getSession()) .getParserManager(); } © 2013 IBM Corporation 19 }
  • 20. Any Questions? 20 © 2013 IBM Corporation