Upload
rvijaysubs764835048
View
653
Download
36
Embed Size (px)
DESCRIPTION
How To Create and Invoke Enterprise Java Beans (EJB) Using The Action Framework in OBIEE 11g
Citation preview
OBIEE 11g: How To Create and Invoke Enterpise Java Beans (EJB) Using The Action Framework (Doc ID
1610118.1)
Modified: Jan 8, 2014 Type: BULLETIN
In this Document
Purpose
Scope
Details
Creating an EJB Application Using JDeveloper
Creating the EJB JAR File and the EAR Deployment Profile
Deploying the EJB Application (EAR File) Using the WebLogic Server Console
Configuring the Action Framework
Invoking and Running the EJB Application Using the Action Framework
Attachments
APPLIES TO:
Business Intelligence Suite Enterprise Edition - Version 11.1.1.7.0 and later
Information in this document applies to any platform.
Products and versions used for this integration:
- Oracle Enterprise Linux 6 - 64-bit but the integration applies to any platform
- OBIEE 11.1.1.7.131017
- JDeveloper 11.1.1.6.0 (used in this document) or 11.1.1.7.0
The combination of products used in this example is certified. Always check the certification matrix to verify that you are on a certified
product combination.
PURPOSE
The document provides step by step instructions on how to create and pack an EJB with JDeveloper, deploy it in a Weblogic managed
server, configure the Action Framework to invoke EJBs and run the EJBs using the Action Framework.
The example EJB in this document is used to write an Analysis to the file system. It takes 2 parameters: output file name (complete physical
path in the file system) and the Analsys to archive. The output is the Analysis saved on disk as a PDF file.
SCOPE
This document is informational and intended for Administrators and Advanced Users. Before reading this document, the user must have a
good understanding of Weblogic Server, OBIEE, the Action Framework and JDeveloper.
DETAILS
In the steps provided in this document, OBIEE is configured to use the default Weblogic authenticator.
Creating an EJB Application Using JDeveloper
First create the application. Go to JDeveloper -> File -> New... -> General -> Generic Application and click OK:1.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
1 of 32 7/24/2014 2:01 PM
Provide an application name:2.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
2 of 32 7/24/2014 2:01 PM
Click on Next. Provide a project name: ArchiveReportsToPdf. Then, click on Finish:3.
Next, create the session Bean. Right click on ArchiveReportsToPdfPrj -> New... -> Business Tier -> EJB and select Session Bean on
the right pane and click OK:
4.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
3 of 32 7/24/2014 2:01 PM
Accept the default and click on Next:5.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
4 of 32 7/24/2014 2:01 PM
Provide the following and click on Next:
- EJB Name: ArchiveReportsToPdf
- Session Type: Stateless
- Transaction Type: Bean
6.
Accept the defaults and click on Next:7.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
5 of 32 7/24/2014 2:01 PM
Accept the defaults and click on Next:
8.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
6 of 32 7/24/2014 2:01 PM
Click on Finish:9.
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
10.
Import the needed libraries to execute this code. Right click on MyEJBProject -> 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
11.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
7 of 32 7/24/2014 2:01 PM
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
8 of 32 7/24/2014 2:01 PM
The following is the code implemented in the EJB:
a) EJB Bean Code: ArchiveReportsToPdfBean.class
package archivereportstopdf;import java.io.*;
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
9 of 32 7/24/2014 2:01 PM
import javax.activation.DataHandler;// Referenced classes of package archivereportstopdf:// ArchiveReportsToPdf, ArchiveReportsToPdfLocal
public class ArchiveReportsToPdfBean implements ArchiveReportsToPdf, ArchiveReportsToPdfLocal{ public ArchiveReportsToPdfBean() { } 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"; }}
b) EJB Remote Interface Java code: ArchiveReportsToPdf.class
package archivereportstopdf;import java.io.FileNotFoundException;import java.io.IOException;import javax.activation.DataHandler;public interface ArchiveReportsToPdf{ public abstract String ArchiveReport(String s, DataHandler datahandler) throws FileNotFoundException, IOException;}
c) EJB Local Interface Code: ArchiveReportsToPdfLocal.class
package archivereportstopdf;public interface ArchiveReportsToPdfLocal{}
Creating the EJB JAR File and the EAR Deployment Profile
You need to create a deployment profile for each project in your application and a deployment profile for your EAR application. For more
details on deployment profiles, please check the Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development
Framework 11g Release 1 (11.1.1.7.0) Part Number B31974-12
Create a deployment profile for your project. Right click on the project name -> Project Properties... -> Deployment -> New... button
and provide
- Archive Type: WAR File
- Name: ArchiveReportsToPdf
1.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
10 of 32 7/24/2014 2:01 PM
Then click OK.
Accept the defaults and click OK:2.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
11 of 32 7/24/2014 2:01 PM
Click OK:3.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
12 of 32 7/24/2014 2:01 PM
Create a deployment profile for your application. In the Application Navigator, right click on the application -> New... The New Gallery
opens. In the New Gallery go to General -> Deployment Profile -> EAR File and click OK:
4.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
13 of 32 7/24/2014 2:01 PM
Provide a Deployment Profile Name: ArchiveReportsToPdf. Click OK:5.
In the Edit EAR Deployment Profile Properties dialog -> Application Assembly -> select the project WAR you want to make available
in the project file: ArchiveReportsToPdf. Then click OK:
6.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
14 of 32 7/24/2014 2:01 PM
In the Edit EAR Deployment Profile Properties dialgo -> EAR Options -> check the "Include Manifest File (META-INF/MANIFEST.MF)"
check box:
7.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
15 of 32 7/24/2014 2:01 PM
In the Application Properties dialog, select Deployment and uncheck the following check boxes:
- Auto Generate and Synchronize weblogic-jdbc.xml Descriptors during Deployment
- Users and Groups (so the users and groups in the server's identity store are used)
Then, click OK:
8.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
16 of 32 7/24/2014 2:01 PM
Deploy your application to EAR file using JDeveloper. Right click on the application name -> Deploy -> ArchiveReportsToPdf... ->
select Deploy to EAR and click on Next:
9.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
17 of 32 7/24/2014 2:01 PM
Click on Finish to deploy the application to an EAR file:10.
Deploying the EJB Application (EAR File) Using the WebLogic Server Console
Copy the application EAR file generated by JDeveloper to a stage directory in the server where you can access it using the Weblogic
console. In this example, the file:
- ArchiveReportsToPdf.ear
is copied to the directory (it can be any directory accessible by Weblogic Server):
<FMW_HOME>/Oracle_BI1/bifoundation/jee
Note: Backup your code as upgrades or patching may possibly overwrite non-standard files
1.
Log in to the Weblogic console -> click Lock & Edit -> Deployments -> Install. Navigate to the directory where the EAR file is and
select it: ArchiveReportsToPdf.ear. Then click on Next
2.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
18 of 32 7/24/2014 2:01 PM
Accept the default to install it as an application and click on Next:3.
Select the managed server where you want to deploy it (typically bi_server1) and click on Next:4.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
19 of 32 7/24/2014 2:01 PM
Provide a name for the deployment: ArchiveReportsToPdf and click on Next:5.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
20 of 32 7/24/2014 2:01 PM
Accept the defaults and click on Finish6.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
21 of 32 7/24/2014 2:01 PM
Click on Activate Changes:7.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
22 of 32 7/24/2014 2:01 PM
The application shows as Prepared. Select the application deployed (ArchiveReportsToPdf) and click on Start -> Servicing All
Requests:
8.
The application should show as Active now:9.
Configuring the Action Framework
The Action Framework is a component of the Oracle BI EE architecture. It consists of the following items:
Actions web services for creating and invoking actions that are deployed in the application server.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
23 of 32 7/24/2014 2:01 PM
Components that reside within the Presentation Server and Scheduler Services.
Actions-specific JavaScript in the presentation tier for creating actions and invoking certain action types directly from the browser.
The Action Framework is a very broad subject. Some action types are automatically available when OBIEE is installed, while others require
specific configuration to make them available.
You should familiarize yourself with Action Framework concepts and tags in the configuration file such as 'Alias' and 'Registry' XML elements
before attempting to do this configuration.
You can read more about the Action Framework in the Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence
Enterprise Edition 11g Release 1 (11.1.1) Part Number E16364-05 -> 5 Using Actions to Integrate Oracle BI EE with External Systems
In this document we will configure the Action Framework to be able to invoke a Java Method (EJB). You can check the configuration steps
for each action types in the Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence Enterprise Edition 11g Release 1
(11.1.1) Part Number E16364-05 -> 5.2.1 Configuration Checklist by Action Type
For more details on invoking a Java Method (EJB), check the Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence
Enterprise Edition 11g Release 1 (11.1.1) Part Number E16364-05 -> 5.6.6 Invoke a Java Method (EJB):
5.6.6.1 Prerequisites for This Action Type
5.6.6.2 Parameters for the EJB
5.6.6.3 What Happens When This Action Type is Invoked?
A sample Action Framework configuration file (ActionFrameworkConfig.xml) is available in the Oracle® Fusion Middleware Integrator's Guide
for Oracle Business Intelligence Enterprise Edition 11g Release 1 (11.1.1) Part Number E16364-05 -> A Sample Files
The steps to configure the Action Framework to Invoke a Java Method (EJB) are:
Modify the ActionFrameworkConfig.xml Action Framework configuration file. It is located under <FMW_HOME>/user_projects
/domains/bifoundation_domain/config/fmwconfig/biinstances/coreapplication.
+ Add a Registry element. A registry defines how the Action Framework should access a browsable library of action targets. The
registry element name in this example is "Sample Test":
<registry> <id>reg01</id> <name>Sample Test</name> <content-type>java</content-type> <provider-class>oracle.bi.action.registry.java.EJBRegistry</provider-class> <description>Custom Java for Financial Reports</description> <location> <path /> </location> <custom-config> <ejb-targets> <appserver> <context-factory>weblogic.jndi.WLInitialContextFactory</context-factory> <jndi-url>t3://localhost:9704</jndi-url> <server-name>localhost</server-name> <account>WLSJNDI</account> <ejb-exclude>mgmt</ejb-exclude> <ejb-exclude>PopulationServiceBean</ejb-exclude> </appserver> <ejb-app> <server>localhost</server> <app-context>ArchiveReportsToPdf</app-context> </ejb-app> </ejb-targets> </custom-config>
1.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
24 of 32 7/24/2014 2:01 PM
</registry>
For more details, check the Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence Enterprise Edition 11g
Release 1 (11.1.1) Part Number E16364-05 -> 5.3.2.2 Invoke a Java Method Action Type Registry Example
+ Add a content-type element. Each content-type element provides meta-information about the types of services to which the
registries are connecting:
<content-type> <typename>java</typename> <displayname>Java Actions</displayname> <actionType>JavaActionType</actionType> </content-type>
For more details, check the Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence Enterprise Edition 11g
Release 1 (11.1.1) Part Number E16364-05 -> Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence
Enterprise Edition 11g Release 1 (11.1.1) Part Number E16364-05 -> 5.3.3 Content Types
+ Add an account element. The account element defines gateway accounts, which are used for authentication to action targets. The
registry element's service-access element then references the accounts that you have specified. The account element name in this
example is "WLSJNDI":
<account> <name>WLSJNDI</name> <description>Account used to access WLS JNDI.</description> <adminonly>false</adminonly> <credentialkey>JNDIuser</credentialkey></account>
For more details, check the Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence Enterprise Edition 11g
Release 1 (11.1.1) Part Number E16364-05 -> 5.3.4 Accounts
Here is and example of how it should look the ActionFrameworkConfig.xml configuration file after making these changes:
<?xml version="1.0" encoding="UTF-8"?><obi-action-config xsi:noNamespaceSchemaLocation="afconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
25 of 32 7/24/2014 2:01 PM
<aliases> <location-alias> <alias>biserver</alias> <actual>http://localhost:9704/analytics/saw.dll?WSDL </actual> </location-alias> </aliases><registries> <registry> <id>reg01</id> <name>Sample Test</name> <content-type>java</content-type> <provider-class>oracle.bi.action.registry.java.EJBRegistry</provider-class> <description>Custom Java for Financial Reports</description> <location> <path /> </location> <custom-config> <ejb-targets> <appserver> <context-factory>weblogic.jndi.WLInitialContextFactory</context-factory> <jndi-url>t3://localhost:9704</jndi-url> <server-name>localhost</server-name> <account>WLSJNDI</account> <ejb-exclude>mgmt</ejb-exclude> <ejb-exclude>PopulationServiceBean</ejb-exclude> </appserver> <ejb-app> <server>localhost</server> <app-context>ArchiveReportsToPdf</app-context> </ejb-app> </ejb-targets> </custom-config> </registry> </registries><content-types> <content-type> <typename>webservices</typename> <displayname>Web Services and BPEL Processes</displayname> <actionType>WebServiceActionType</actionType> </content-type> <content-type> <typename>epm</typename> <displayname>Hyperion Applications</displayname> <actionType>URLActionType</actionType> </content-type> <content-type> <typename>misc</typename> <displayname>Mixed Services</displayname> <actionType>URLActionType</actionType> </content-type> <content-type> <typename>java</typename> <displayname>Java Actions</displayname> <actionType>JavaActionType</actionType> </content-type></content-types><accounts> <account> <name>WLSJNDI</name> <description>Account used to access WLS JNDI.</description> <adminonly>false</adminonly> <credentialkey>JNDIuser</credentialkey></account></accounts></obi-action-config>
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
26 of 32 7/24/2014 2:01 PM
Adding a Credential Map and Credential Key to the Credential Store.
Credentials are security-related attributes used to authenticate or authorize users and systems requesting access to Oracle BI EE
resources such as actions. If you have configured one or more registries in the Action Framework to use credentials in the credential
store for either browsing for actions targets or invoking actions (namely, if you have specified account elements in the
ActionFrameworkConfig.xml) you need to enter a credential into a the credential store to match each account element in the
ActionFramworkConfig.xml file. All credentials referenced by account elements must be in a credential map called oracle.bi.actions.
For example, if you have the following account defined in the configuration file, you need to enter a credential for JNDIUser into a
map called oracle.bi.actions:
<account> <name>WLSJNDI</name> <description>Account used to access WLS JNDI.</description> <adminonly>false</adminonly> <credentialkey>JNDIUser</credentialkey></account>
+ Log in to Fusion Middleware Control Enterprise Manager: http://hostname:7001/em
+ Expand WebLogic Domain -> right click on bifoundation_domain -> Security -> Credentials.
+ Click Create Map and add a new map called oracle.bi.actions. Note that the only map Actions can reference is oracle.bi.actions, so
you need to create a map with this name and add credentials to it for use with Actions.
+ Click Create Key and add a key against the oracle.bi.actions credential map you created.
2.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
27 of 32 7/24/2014 2:01 PM
+ Save the key and the map.
For more details, check the Oracle® Fusion Middleware Integrator's Guide for Oracle Business Intelligence Enterprise Edition 11g
Release 1 (11.1.1) Part Number E16364-05 -> 5.4 Overview of Action Security
Verify that the users invoking the action has the required permissions in Analytics.
Actions privileges control the rights that users have to access the actions features and functionality in Oracle BI Presentation Services.
The OBIEE Administrator grants or denies privileges to specific application roles, individual users, and Catalog groups. The following
actions privileges should be granted to users or application roles invoking actions using the Action Framework:
+ Create Navigate Actions
+ Create Invoke Actions
+ Save Actions containing embedded HTML
3.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
28 of 32 7/24/2014 2:01 PM
Invoking and Running the EJB Application Using the Action Framework
Log in to Analytics: http://hostname:9704/analytics1.
Go to New -> Action -> Invoke a Java Method:2.
Expand the "Sample Test" registry element to show the available actions. Select the ArchiveReport bean under the
ArchiveReportsToPdf EJB application:
3.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
29 of 32 7/24/2014 2:01 PM
Then, click OK.
The invoked EJB appears. In this example it accepts two parameters:
+ Filename: this is the physical location and file name in the file system where the PDF file will be created. It should be provided
including full path and file name. Example: /home/oracle/BI_Middleware/analysis.pdf
+ Analysis: this is the analysis used as the input to be converted to a PDF format. You need to click on the "..." to select the analysis.
4.
Click on Save Action to save the action into the web catalog:5.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
30 of 32 7/24/2014 2:01 PM
This action can be added to be invoked in an Agent. The Agent is scheduled to run and the EJB is executed at that time:6.
Run the Agent. After that, check that the PDF file was successfully create in the file system:7.
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
31 of 32 7/24/2014 2:01 PM
Attachments
The EAR file to be deployed in the Weblogic managed server is uploaded to the this note so you can use it in your environment. The 3 Java
classes uploaded are included inside ArchiveReportsToPdf.ear. Also, the Action Framework configuration file is provided:
- ArchiveReportsToPdf.ear
- ArchiveReportsToPdf.class
- ArchiveReportsToPdfBean.class
- ArchiveReportsToPdfLocal.class
- ActionFrameworkConfig.xml
Document 1610118.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
32 of 32 7/24/2014 2:01 PM