I've written a bit of jsp, vbscript, and java based applications in the past and lately I've really enjoyed writing simple java apps that can be run as a Program File (.jar) within the BI 4.x environment. A couple examples of these Program Files were shared earlier this year called the 'biUserSessionKillScript' and 'DisableInactiveUsers'.
How to Delete Stale BI4 User Sessions with biUserSessionKillScript
How to Auto-Disable Inactive Users in BI4
In BI 4.x, Program Files can be in the form of a batch file, vbscript, javascript, shell script, or a jar file. The examples above were compiled as .jar files and below I'll explain what it takes to create your own java Program File. I've created a template that can be imported into Eclipse to help get you started. The source code is attached to a Kbase which can be downloaded separately here:
In this example, its assumed you know how to import a java project into Eclipse and how to export it to a jar file.
The What and Why:
Developing a BI4 Program File has many benefits.
Attached at the bottom of this article is an Eclipse project template for creating a new BI4 program file. Feel free to use this as a starting point for creating your own Program File. Below is an explanation and breakdown of how this application template works.
How it works:
In the top portion of the example you'll find the class definition and main method. The difficulty in writing a new program file is the application needs to be able to run standalone in order for you to develop it, alter it and debug it within Eclipse. When the application is run as a program file within BI, the standalone portion of this application will never be executed. In other words, the main() method is never actually called. Instead, the Adaptive Job Server calls the run() method directly.
The example starts off with the class definition and the main() method. The class implements the IProgramBase interface. This is a requirement for all BI4 program file applications because of how the program job server service calls the run() method directly.

The majority of the main() method code does nothing more than create an enterprise session and pass it to the run() method. Be careful of what you include in your main() method as this will only be executed when your application is run outside of BI (within Eclipse, via command line or any other means). All code you want executed when the application runs within BI must be inside the run() method or in another method called from this point down. Again, think of the run() method as your starting point.
In order to run the application from the command line in standalone mode, you will need to create an enterprise session. This requires 4 command line parameters passed to your application. The code below first ensures that 4 values were entered. It compensates for a 5th value in case something else needs to be passed, but this isn't necessary for the code below to work.

There's not much going on here in the run() method. In this example, its assigning the username within the enterprise session to a variable and then writing it to the console. However, every time you output text to console via System.out.println() the Adaptive Job Server will write this to the text file created in the Output FRS when the program file is scheduled. There's no need for additional code to output your information to a text file. This is all built into BI and automatically done at schedule time.

Although this really doesn't do much, keep in mind its just an example. The program will run as-is and output to console the user name held in the enterprise session. To test this within the Eclipse IDE, you will need to create a Run Configuration.


Import the Program File into the CMC
To import the Program File into the CMC, you'll need to follow these steps:


You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4243 | |
| 3355 | |
| 2602 | |
| 2152 | |
| 1982 | |
| 1255 | |
| 1164 | |
| 1122 | |
| 1100 |