OBIEE 12c Archive Report Setup
OBIEE 12c Archive Report Setup
OBIEE 12c Archive Report Setup
CHANGE HISTORY
Contents
Description ............................................................................................................................................ 2
Create EJB WAR / EAR file ................................................................................................................ 3
Create an EJB Application Using the following steps ..................................................... 3
Start with ArchiveReportsBean.java ............................................................................................... 9
ArchiveReports.java ...................................................................................................................... 10
ArchiveReportsLocal.java .............................................................................................................. 11
Let’s compile the project and Debug the Project ............................................................................. 12
Let’s create the WAR file and then the EAR file................................................................................ 13
Deploy the Application: Generate physical WAR and EAR files ........................................................ 19
Enable the Action Frame Work ......................................................................................................... 21
Credential Store Entry ....................................................................................................................... 22
Invocation of EJB Java Method within OBIEE ................................................................................... 23
DELIVERBI Working Ear File .............................................................................................................. 23
DELIVERBI Dynamic Archive Ear File ................................................................................................. 24
--1 ArchiveReportsBean.java......................................................................................................... 24
--2 ArchiveReports.java ................................................................................................................. 27
--3 ArchiveReportsLocal.java ........................................................................................................ 27
Description
An Ear file is deployed to the weblogic server so that a JAVA EJB or Method is available within OBIEE
so that reports can be delivered to the file server. This solution was tested on OBIEE 12c on a Linux
Operating system.
The Solution is very simple to use when implemented. You can invoke a Java Method from within an
Agent or just execute as a Action. 2 Parameters,
2. If Action = Select Output Format and pick a REPORT, If Scheduler Agent just select Delivery
Content and output format.
https://app.box.com/s/vqdyqfcfr2yoyhle432o7ofm48y1e7i0
1. Deploy EAR File to BIServer1 - WebLogic server as a deployment and start servicing all
requests – Page 19
2. Amend the ActionFrameworkConfig.xml file page 21
3. Create a credential key within Enterprise Manager /em : page 22
4. Reboot all services: sh stop.sh within the bitools folder.
Alternatively create your own ear file and deploy with instructions in the document. With more
functionality such as dynamic file names etc.
Create EJB WAR / EAR file
Download JDeveloper 11.1.1.7 and install
Pick up the following two JAR files from DELIVERBIBOX or an existing OBIEE 11.1.1.9.0 installation
https://app.box.com/s/vqdyqfcfr2yoyhle432o7ofm48y1e7i0
actionframework-common.jar
schedulerrpccalls.jar
Open JDeveloper
1. Create an application -> File -> New... -> General -> Generic Application and click
OK:
2. Provide an application name: DeliverBIApplication
9. Click on Finish:
10. Get from the server the needed libraries to execute this code. Transfer the file to the
machine where JDeveloper is running. The libraries are under:
-
<FMW_HOME>/user_projects/domains/bifoundation_domain/servers/bi_server1/tmp
/_WL_user/bimiddleware_11.1.1/udy1lp/lib/actionframework-common.jar
Import the needed libraries to execute this code. Right click on ArchiveReports -> Project
Properties... Libraries and Classpath -> click on Add JAR Directory... -> Navigate to the
directory where you put the actionframework-common.jar and scheduler/schedulerrpccalls.jar
files, click on the files and click on Select. To add them. Then click
Click OK.
@Stateless(name="archivereports", mappedName="ejb/Application1-archivereports-archivereports")
@TransactionManagement(TransactionManagementType.BEAN)
@Remote
public class ArchiveReportsBean
implements ArchiveReports, ArchiveReportsLocal
{
public String ArchiveReport(String filename, DataHandler report)
throws FileNotFoundException, IOException
{
File f = new File(filename);
FileOutputStream outputStream = new FileOutputStream(f);
report.writeTo(outputStream);
outputStream.close();
return "Report Archived";
}
}
ArchiveReports.java
package archivereports;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.activation.DataHandler;
import javax.ejb.Remote;
import oracle.bi.action.annotation.OBIActionParameter;
@Remote
public abstract interface ArchiveReports
{
public abstract String ArchiveReport(@OBIActionParameter(name="Filename", prompt="Enter filename and location:")
String paramString
, @OBIActionParameter(name="Analysis", prompt="Choose Delivery Content:") DataHandler
paramDataHandler)
throws FileNotFoundException, IOException;
}
ArchiveReportsLocal.java
package archivereports;
import javax.ejb.Local;
@Local
public abstract interface ArchiveReportsLocal {}
Let’s compile the project and Debug the Project
Review Messages window to ensure there are no errors. There will be 1 warning which you can
ignore.
Let’s create the WAR file and then the EAR file
1. Create a deployment profile for your project. Right click on the project name ->
Project Properties... -> Deployment -> New... button and provide
3. Click OK:
4. Next we need to create an EAR file deployment profile. Click on Application in the
main tool bar and select Application Properties
Untick Auto Generate and Synch and Users and Groups Checkboxes as shown above
5. Click on New and select EAR File as Archive Type and Name as ArchiveReports
Click OK
Click on Application Assembly and click on ArchiveReports as shown below
Click on EAR Options tick Include Manifest File
Click OK
Click OK again
Next choose Application from the main menu and click Deploy
Click on ArchiveReports and Choose Deploy to EAR
and move the file to Oracle Home on Linux server or any location Web Logic can access.
/Middlewarehomebi12/user_projects/domains/bi12/config/fmwconfig/biconfig/actions
And amend the ActionFrameworkConfig.xml file which is available here. This one is for
OBIEE 12 . Remember to update the hostname to your server hostname and port if necessary
https://app.box.com/s/vqdyqfcfr2yoyhle432o7ofm48y1e7i0
The Action Framework Config file enables the use of an EJB Java Method within OBIEE
after the ear file has been deployed to the weblogic server as a deployment and has been
started to service all requests.
Credential Store Entry
New -> Action -> Invoke a Java Method within OBIEE Or within a OBIEE Scheduled agent.
A Working OBIEE 12c Ear File that we have created is also available to download from our box.net
location below. Just upload to Linux Server and Deploy to Weblogic as an application /console . Start
servicing all requests.
I worked with our original solution and improved it to burst / archive reports to Linux file system that
is generic.
The new functionality within EAR file enables dynamic file names to be produced for exporting /
using the content of the report / dashboard.
I have achieved this by adding few more parameters to the Java Bean when exposed in OBIEE EJB.
The new JAR file looks for Tags embedded in the Dashboard / Report and uses them to derive the file
name of the file being exported to the file system.
I used a public JAR from Apache Tika that allow file conversions.
Then I started amending the Java Bean code to extract the Delivery content as a String to work out
the target file name. I have added few more parameters to the Java Bean to make it as generic as
possible.
As this solution is an improvisation based on the original solution, I am only providing the high level
approach and components and not step by step instructions
--1 ArchiveReportsBean.java
package archivereports;
/* DeliverBI */
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJavaExtension;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.activation.DataHandler;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import java.io.*;
import java.lang.Thread;
import org.apache.pdfbox.pdmodel.PDDocument;
import sun.management.FileSystemImpl;
import org.apache.tika.detect.DefaultDetector;
import org.apache.tika.detect.Detector;
import org.apache.tika.exception.TikaException;
import org.apache.tika.io.TikaInputStream;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.AutoDetectParser;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.parser.Parser;
import org.apache.tika.sax.BodyContentHandler;
import org.apache.tika.exception.TikaException;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
@Stateless(name="archivereports", mappedName="ejb/Application1-archivereports-
archivereports")
@TransactionManagement(TransactionManagementType.BEAN)
@Remote
public class ArchiveReportsBean
implements ArchiveReports, ArchiveReportsLocal
{
public String ArchiveReport(String filelocation, String filename, String StringStart, String StringEnd,
DataHandler report)
throws FileNotFoundException, IOException
{
File f = new File(filelocation + filename);
FileOutputStream outputStream = new FileOutputStream(f);
report.writeTo(outputStream);
outputStream.close();
try {
InputStream input = new FileInputStream(new File(newfile));
ContentHandler textHandler = new BodyContentHandler();
Metadata metadata = new Metadata();
AutoDetectParser parser = new AutoDetectParser();
ParseContext context = new ParseContext();
parser.parse(input, textHandler, metadata, context);
String st = metadata.get(metadata.TITLE);
st = st + textHandler.toString();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (TikaException e) {
e.printStackTrace();
}
try{
}
catch(Exception e){
File outputFile = new File("/tmp/DeliverBI_Bursting_debug.txt");
FileWriter out = new FileWriter(outputFile);
out.write("Landed in Exception. Unable to rename file" + "\r\n");
out.close(); }
return "Report Archived";
}
}
--2 ArchiveReports.java
package archivereports;
/* DeliverBI */
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.activation.DataHandler;
import javax.ejb.Remote;
import oracle.bi.action.annotation.OBIActionParameter;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJavaExtension;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobException;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobInfo;
@Remote
public abstract interface ArchiveReports
{
public abstract String ArchiveReport
(@OBIActionParameter(name="Filelocation", prompt="Enter file location:") String param1String
, @OBIActionParameter(name="Filename", prompt="Enter filename:") String paramString
, @OBIActionParameter(name="StringStart", prompt="Enter the Starting String pattern:") String
param3String
, @OBIActionParameter(name="StringEnd", prompt="Enter the Ending String pattern:") String
param4String
, @OBIActionParameter(name="Analysis", prompt="Choose Delivery Content:") DataHandler
paramDataHandler
)
throws FileNotFoundException, IOException;
}
--3 ArchiveReportsLocal.java
package archivereports;
/* DeliverBI */
import javax.ejb.Local;
@Local
public abstract interface ArchiveReportsLocal {}
I already created an EAR file even though I included the source code in this post. Just deploy
this EAR file like you would do for the original solution. You can access this EAR file along
with the Java Source code and the pdfbox jar from the following link
https://app.box.com/s/s0wx29gf9ptyv1sdnmcwk0kescxh5m7y
You only need to deploy the EAR file as I have done the hard work for you.
When used in OBIEE there will be now 5 parameters instead of the original 2.
1. The first parameter is just the Linux directory location for the output to be saved.
Ensure the ‘/’ is given at the end
2. The default name of the output file
3. The start Tag that will be looked up in the delivery content to identify the start of the
target file name. See below figure below
4. The end Tag that will be looked up in the delivery content to identify the end of the
target file name. See the below figure
I created a narrative view in the report I am going to export with the start and end tags. In the
narrative view I have included the User session variable and datetime to uniquely identify the
export file.
These tags are dynamic. The reason I have included the Start Tag and End Tag as parameters
is to enable usage of any tags. So any content that is included in between these tags will be
used to produce the export file name.
Note:
When the Start and End Tags specified is not found in the report / dashboard content then the
default file name provided in Parameter 2 will be used to produce the output file
When the Tags are located in the report / dashboard then the content between these two tags
is prefixed to the default file (parameter 2) name to produce the output file
If any of the parameter values specified pushes the EJB into error, the application produces a
debug file in the /tmp directory on the Linux server with the name
DeliverBI_Bursting_debug.txt