The OpenRulesTM Tutorials         Home  TOC   PREV TOP NEXT User's Guide
Divider

Deployment [T]

        Embedding OpenRules in Java Applications
        Deploying Rules as Web Services

        Deploying Rules and Forms as Web Applications
        Deployment on Web Servers
            Tomcat Deployment
            WebLogic Deployment
            WebSphere Deployment

OpenRules-based applications can be deployed using three major approaches:

OpenRules can be easily embedded in any Java application.  At the same time, it allows you to develop Web applications with complex rules-based logic without forcing you to become an expert in various Web development techniques.  Using the well known Excel interface, you can define your business logic in the form of Excel-based business rules and make them available as fine-grained Web services.  You also may define your presentation logic using Excel-based web forms with associated interaction rules.  When deployed as a presentation-oriented Web application, it will invoke the related rule services whenever necessary.  Frequently, such a service-oriented approach to web application development also involves a workflow engine that uses a publish/subscribe paradigm to automatically invoke different web services.

 

Embedding OpenRules in Java Applications

 

OpenRules allows you to incorporate the business rules represented in an Excel-based rules repository into any Java application.  Using an OpenRulesEngine API, a Java application can invoke the rule engine to execute different business rules and receive the results back through Java objects that were passed to the engine as parameters.  The sample project HelloJava demonstrates how to invoke OpenRulesEngine from a stand-alone Java program.  The sample project HelloJSP demonstrates how to invoke OpenRulesEngine from a JSP-based web application.  In general, with OpenRulesEngine extracted business logic remains a natural extension of a Java application: business rules can be invoked similar to regular Java methods.

 

Deploying Rules as Web Services

 

A service-oriented Web application implements the endpoint of a fine-grained Web service.  If your system is based on a Service-oriented architecture, you will probably prefer to treat business rules as a special type of loosely coupled web services that supports your decision making processes.  We will use the term "Rule Service" for business rules deployed as a web service.  With OpenRules you define and maintain your business rules using a combination of Excel, Java, and Eclipse.  You may test your rules as a stand-alone application or execute them locally using a simple Java API.  However, when you are ready to integrate your business rules into an enterprise level application, OpenRules provides a "push-button" mechanism for deployment of business rules as a Web Service.  The sample project HelloWS demonstrates how to deploy an OpenRules-based application as a web service.  Two related sample projects, HelloWSJavaClient and HelloWSExcelClient, demonstrate how to execute a web service from a Java-based or MS Office-based client. 

 

Deploying Rules and Forms as Web Applications

 

Presentation-oriented Web applications usually generate dynamic Web pages containing various types of markup language (HTML, XML, and so on) in response to requests coming from an Internet Browser.  Among the most popular Web techniques for web application development with Java are Java Servlets, Struts, and application frameworks such as Spring.  All these techniques use the Java programming language to dynamically process requests and construct responses in a form text-based markup such as HTML or XML.  At the same time, these techniques are designed for experienced software developers.  This seriously limits the participation of business analysts in the design and maintenance of business interfaces. 

 

OpenRules can be easily integrated with any of these techniques using its Java API.  However, OpenRules provides its own straight-forward mechanism for web application development without the involvement of "heavy" Java artillery.  Being functionally similar to the JSP technology, OpenRules provide a much more intuitive and simplified way to create dynamic web content.  Creators of intelligent web interfaces do not have to know HTML, JScript or even Java.  They will use only the commonly known Excel interface.  A non-technical user can define complex web form layouts and the associated interaction logic in simple Excel tables.  OpenRules Forms presented in MS Excel spreadsheets are automatically translated into HTML pages without any limitation on the expressiveness of HTML.  A web designer can use the power of decision tables to define complex relationships between fields inside web pages and/or between different pages.  She can easily add standard or custom Excel-based validators to check user input and inform a user about mistakes.  Based on user input and previously entered information, the forms content and presentation sequence can be changed dynamically during the interaction process.

 

Deployment on Web Servers

 

You can deploy OpenRules-based applications using Web Application Servers such as:

The standard sample projects are designed to be deployed on Apache Tomcat.  Sample projects such as HelloJsp, HelloForms, HelloWS, LoanWeb, StudentLoan, and HealthCare2 demonstrate how to address different Web application configuration problems.  They are all included in the standard OpenRules installation and are accompanied by the proper readme-files.  Detailed descriptions of several additional web applications are available through the following links:

More examples with step-by-step instructions are available though OpenRules Inside Track program.

 

All OpenRules examples include a server-independent target "build" inside their build.xml file.  This target allows you to build a self-sufficient war-file that can be deployed on any web server in accordance with server-specific recommendations.  For example, to deploy your application on Apache Tomcat it is enough to drop the generated war-file to the Tomcat webapps directory and Tomcat will do the rest of the work.  IBM WAS 6.1. provides a friendly Administrative Console that allows you to interactively select a war-file and deploy it by answering a few simple questions.  Below we will provide some server specific details.

 

Tomcat Deployment  ►top

 

The standard OpenRules installation is designed to work seamlessly with any pre-configured Apache Tomcat Server.  To deploy your rules project as a web service you will also require Apache Axis library.  After defining the location of your Tomcat server in the build.properies file, you may deploy standard examples right out-of-the-box on your server.

OpenRules is trying to minimize modifications to the standard Tomcat distribution.  The only change we recommend making to it is the addition of a "manager" role to the user "tomcat".  This allows a web application to establish connection as a Manager Application (responsible for remote Web Application deployment).  So,  in file conf/tomcat-users.xml you should add the word "manager":

    <user name="tomcat" password="tomcat" roles="tomcat,manager" />

Warning!  The simplicity of building Web applications with OpenRules should not mislead a user to conclude that administration of the Web server has become easier as well.  A deep understanding of security issues is highly recommended before you expose your server to the external world.  Running an application server on an Internet-connected computer poses a security risk.  By default, the standard Tomcat server allows the establishment of a connection to the Manager Application (responsible for remote Web Application deployment) from any location.  We recommend that the Manager Application be accessed only from localhost (see http://jakarta.apache.org/tomcat/tomcat-5.0-doc/manager-howto.html).  Note that Apache Axis by default comes pre-configured to accept requests only from the localhost

To deploy a basic rules project on a Tomcat server  you can incorporate we recommend the following:

  1. Incorporate OpenRulesEngine inside your regular Java code that is going to be deployed on Tomcat.  You may use the basic OpenRules API that you usually used for simple Java applications.  A simple example HelloJsp is provided.
  2. Make sure you specify correctly the location of you main xls-file.  In the sample project HelloJsp, this location is specified in the file GreetingEngine.java  as

    String fileName = "file:./webapps/HelloJsp/rules/HelloCustomer.xls";

    relative to the base Tomcat directory.  "bin" from where you usually start your Tomcat.  Of course, you can keep your rules in different locations.  Some customers prefer to introduce their own environment variable to specify the root of their rules repository, and use this variable in the definition of the main xls file.

To deploy an OpenRules-based Web Application on a Tomcat server we recommend the following:

  1. Make sure that the file build.properties corresponds to your Tomcat configuration

  2. In the file "war/index.jsp" make sure that the variable xlsMain points to the location of you main xls-file.  In the sample project HelloForms, this location is relative to the directory from where you start your Tomcat, e.g.:
            String xlsMain = "file:./webapps/HelloForms/rules/main/HelloWeb.xls";
    Of course, you can keep your rules in different locations.

  3. Execute targets "build" and "deploy" from build.xml.

To deploy an OpenRules-based Web Service on a Tomcat server we recommend the following:

  1. Make sure that the file build.properties corresponds to your Tomcat configuration

  2. In the file "build.properties" make sure that:

    - the property "ws.compile.src" points to the location of your main xls-file relative to the project, e.g.: ws.compile.src=file:war/rules/main/HelloWS.xls

    - the property "ws.depl.uhome" points to the Tomcat subdirectory where your main xls-file (defined by the property "ws.deploy.src") will be placed after deployment. This subdirectory should be defined relative to the directory from where you start your Tomcat, e.g.: ws.depl.uhome=file:./webapps/HelloWS/rules/main/

  3. Execute the target "generate.webservice.java.bat" from "build.xml"
  4. Execute targets "build" and "deploy" from build.xml.

WebLogic Deployment

 

To deploy your application on the BEA WebLogic server, you may create generate a war-file similar to the one that you create for deployment on a Tomcat server and copy it to the proper WebLogic directory.  The standard installation contains the sample project HelloWebLogic that is very similar to HelloJsp.  The only difference is the location of the main xls-file.  For example, if you installed your WebLogic 8.1 at Windows directory c:/bea you may copy your war-file to the directory C:/bea/weblogic81/server/bin/applications.  Then the file GreetingEngine.java specifies this location is specified in  as follows:

String fileName = "file:myserver/stage/_appsdir_HelloWebLogic_war/HelloWebLogic.war/rules/HelloCustomer.xls";

So, it is relative to the directory "bin" from where you usually start your BEA server.  Of course, you may put your rules in different location and just properly modify the fileName variable.

 

WebSphere Deployment

To deploy your application on a WebSphere server such as WebSphere WAS 6.1, you may create generate a war-file similar to the one that you create for deployment on a Tomcat server.  The standard installation contains the sample project HelloWebSphere that is very similar to HelloJsp.  The only difference is the location of the main xls-file.  For example, if you installed your WebSphere WAS 6.1 at the default Windows directory, you may specifies this location in the file GreetingEngine.java  as follows:

String fileName =  "file:C:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/4c83Node01Cell/HelloWebSphere_war.ear/HelloWebSphere.war/rules/HelloCustomer.xls";

Here we use an absolute path to the main xls-file.  Of course, you may put your rules in different location and just properly modify the fileName variable.

When a war-file is ready, you may deploy it using WebSphere tools.  In particular, here are the basic steps you should execute to deploy a war-file on WAS 6.1 using an interactive Integrated Solution Console:

  1. Start WAS 6.1 server.

  2. Start Integrated Solution Console

  3. From "Applications" select "Install New Application"

  4. For "Local file system" push "Browse" and select the generated war-files from your OpenRules project, for example HelloWebSphere.war

  5. In "Context root" type the name of your deployed application such as "HelloWebSphere_war" and push “Next”

  6. On the next screen push “Next”

  7. On the next screen mark “Select” and push “Next”

  8. On the next screen mark “Select” and push “Next”

  9. On the next screen push “Finish”

  10. On the next screen click to “Save”.  Your application is deployed.

  11. Select "Appications/Enterprise Applications" and make sure that your application has started.

  12. You can access your application using an internet browser with a correct URL, for instance:
    http://localhost:9080/HelloWebSphere_war/index.jsp - for a web application HelloWebSphere_war
    http://localhost:9080/HelloWS_war/services/HelloWS?wsdl - for a web service HelloWS.

For a presentation-oriented Web Application:

  1. In the file "war/index.jsp" make sure that the variable xlsMain points to the location of you main xls-file.  Frequently, this location is relative to the directory from where you start your WebSphere server.  Of course, like in the case of Tomcat you can keep your rules in different locations.

  2. Execute target "build" from build.xml to rebuild the war-file.

For a Web Service:

  1. In the file "build.properties" make sure that:

    - the property "ws.compile.src" points to the location of your main xls-file relative to the project, e.g.: ws.compile.src=file:war/rules/main/HelloWS.xls

    - the property "ws.depl.uhome" points to the WebSphere subdirectory where your main xls-file (defined by the property "ws.deploy.src") will be placed after deployment.  This subdirectory should be defined relative to the directory from where you start your server, e.g.: ws.depl.uhome=file:installedApps/4c83Node01Cell/HelloWS_war.ear/HelloWS.war/rules/main/

  2. Execute the target "generate.webservice.java.bat" from "build.xml"
  3. Execute target "build" from build.xml to rebuild the war-file.

 

 

►top

Divider