EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  running rui project on multi systems

    Posted Fri December 26, 2014 02:43 PM

    we have two iseries (test & production). I would like to be able to run my rui project on each without making any changes (deployment & build descriptors for example) to the project.

     

    What would be the best way to do this?

     

     

    nick_tn


  • 2.  Re: running rui project on multi systems

    Posted Sat December 27, 2014 04:23 AM

    Hi Nick,

    Your approach to create deployable units that can run on all your environments without modification is highly recommended.

    We run our RUI projects on WAS. The EARs we create can be run on all environments, connect to the proper backend and can behave differently depending on the server they're deployed to. What we do is create Resource Environment Entries on the WAS. These can be retrieved by the RUI application at startup. You can define the REEs at your need. E.g. to determine the environment: DEV / PROD and or to define the backend host for the environment.

    Ortwin

    Ortwin


  • 3.  Re: running rui project on multi systems

    Posted Sat December 27, 2014 07:43 PM

    Hi Ortwin,

    Im running apache tomcat server. I export my project as a WAR, then install it using apache manager. Is what you explained above available for apache? Right now i add entries to my build and deployment descriptors specifying the back end server. I dont see a place where the backend could be a variable.

    For example, in my build descriptor i have the following:
    sqlDB="jdbc:as400:web.xxx.com;prompt=false" - production system example
    sqlDB="jdbc:as400:web.xxxtest.com;prompt=false" - test system example

    in my deployment descriptor i have the folowing:
    <protocols><egl:protocol.java400 name="xxx" library="" location="web.xxx.com" password="crypto:xx" userID="xxx"/></protocols>
     

    So with your method, i would remove the hard coded web.xxx entries and replace them with REE's (do these exist in apache)?

     

    nick_tn


  • 4.  Re: running rui project on multi systems

    Posted Mon December 29, 2014 01:53 PM

    Nick,

    We are primarily Tomcat-based here too. It took us a while to address the issue with app portability but we are there now.

    We use a database table on the server to store all the server-specific app settings. It's a simple property/value structure with the key being a unique ID by business application. The business app retrieves these at initialization.

    Sounds simple but it's more complicated than that, right? Here are a few more details:

    1. We use a web application to serve the properties. The individual business applications use the services of this properties-serving web application to get their properties instead of going directly to the database.

    2. In order to know which server to go to get the web properties, the individual business apps start by pulling the server name out of the URL used to invoke the business app.

    You can parse it out of this string:

    urlString string = document.location;

    3. Once we know the server where the business app was launched we pull the properties for the business app from the properties-serving web app on the same server. The properties-serving web app has the link to the database where the properties live. This is the most important aspect of the implementation. This is what allows use to have different settings in development and production or even on different instances of Tomcat running on the same server.

    4. For development/testing an app inside the IDE we check the "egl.contextAware" flag (exposed with an external type function). If we determine that we are running inside the IDE we go directly to the properties-serving web app on our development server for our app properties instead of trying to parse out the server from the URL.

    That external type function looks like this:

            "inDevelopmentMode" : function() {
                  return egl.contextAware;
              },
     

    So this is what the code looks like in a RUI business app's initialization function:

            host string = "http://www.developmentserver.com:8081/";   // The default testing/development server when inside IDE

            if(!browserFunctions.inDevelopmentMode())                        // Are we in the IDE or on a server?
                dl string = document.location;
                dlo int = strlib.indexof(dl, "/", strlib.indexof(dl, "//") + 2);
                host = dl[1:dlo];
            end

            Properties.init(me, host);                                                           // Go get the properties

    Properties.init calls a web service to retrieve properties. Once the properties have been retrieved, they are returned to this app via InfoBus. Until we get the properties the business app does nothing ... the successful retrieval of properties causes the business app to continue initializing.

    The "me" on the Properties.init call is a unique ID for this business application. It is used as the key to retrieve the properties for this application and as a target for the InfoBus callback.

    There is more code behind the scenes and implementation details of course but that's the basic idea. We like the abstraction of the properties retrieval into a web service so that we can change the whole back-end implementation (to use the WAS REEs perhaps) without changing business app logic.

    Dan
     

    dan_darnell


  • 5.  Re: running rui project on multi systems

    Posted Wed December 31, 2014 06:39 AM

    Nick,

    There's more to retrieving the REE too. There needs a java class to be created and used in the EGL service. Also the creation of the REE's on the WAS needs a multiple step manual. I think this would make a nice RFE for RBD.

    Maybe you can create an RFE to add this functionality to RBD. It is a common business need to have the application be "context aware". Aswel as for WAS as for Tomcat. It would be great if RBD can easily address this.

    Ortwin

    Ortwin


  • 6.  Re: running rui project on multi systems

    Posted Fri January 02, 2015 12:20 PM

    Hi Nick,

    Similar to you, we have three (WAS) environments each with a separate db target on 2 physical IBM i systems:

    1. Development (local on pc)
    2. Quality/Testing
    3. Production

    To ensure the correct db is used, we create a common REE and use the JNDI reference exclusively in the EGL Build Descriptor without having specified sqlDB, sqlJDBCDriverClass, sqlPassword.  Only the sqlJNDIName is referenced.  To enable the db connection to work in the IDE, you must first create a database connection having the same name as the REE.

    As I'm unfamiliar with deploying to tomcat I'm unsure if this is feasible and is only applicable to WAS deployments via EAR's.  Otherwise, I can provide more details as necessary.  Also, this is only beneficial for the db connection and not other application specific properties.

    Daron

    canutri