Example: Using a Java Program to Display the Status of Oracle Business Intelligence

Introducing the Oracle BI Systems Management API 22-11 print Existing email displayname is: + oldDisplayName print Changing email displayname to: + newDisplayName + ... setSenderDisplayName, newDisplayName print Calling commit ... cd .. cd oracle.biee.admin:type=BIDomain,group=Service objs = jarray.array[], java.lang.Object strs = jarray.array[], java.lang.String invokecommit, objs, strs print Committed OK exit 2. Save the script. 3. Navigate to the folder \MW_HOME\wlserver_10.3\common\bin and run the script, entering any arguments required. For example, you might enter the following at the command line: .wlst.sh wlst_email_disp_name_obi.py localhost 7001 user1 password1 UNIX wlst wlst_wlst_email_disp_name_obi.cmd localhost 7001 user1 password1 Windows The command window and log file displays prompts and messages, for example: Initializing WebLogic Scripting Tool WLST ... Welcome to WebLogic Server Administration Scripting Shell Type help for help on available commands Connecting to localhost:7001 as user: user1 ... Connecting to t3:localhost:7001 with userid password1 ... Successfully connected to Administration Server AdminServer that belongs to domain bifoundation_domain. Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, use the SSL port or Admin port instead. Connecting to Domain ... Location changed to domain custom tree. This is a writable tree with No root. For more help, use helpdomainCustom Connecting to BIDomain MBean ... Connecting to BIInstance MBean ... BIInstance MBean; ServiceStatus: FULLY_STARTED Connecting to BIInstance Email MBean ... Existing email displayname is: Oracle Business Intelligence Changing email displayname to: FredBloggs ... Calling commit ... Committed OK Exiting WebLogic Scripting Tool. 22-12 System Administrators Guide for Oracle Business Intelligence Enterprise Edition

22.3.3.2 Example: Using a Java Program to Edit the E-Mail Sender Display Name Configuration Setting

To use a Java program to Edit the E-Mail Sender Display Name Configuration Setting: 1. Open a Java editor and compile a Java program similar to the following example: package com.oracle.bi.example; import java.util.Hashtable; import javax.management.Attribute; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.naming.Context; Example class showing how to connect to the Oracle BIEE AdminMBeans JMX Interface and change a simple configuration setting.. br This example is intentionally succinct for clarity, so for example, it does not do any exception handling. Any production code should include robust error handling. Note that you need codewljmxclient.jarcode and codewlclient.jarcode on the classpath. public class MBeanAPIExample3Edit { private String host; private int port; private String username; private String password; private String newDisplayName; private MBeanServerConnection mbs = null; private ObjectName biDomainMBeanName; private ObjectName biInstanceMBeanName; private ObjectName biEmailMBeanName; private MBeanAPIExample3EditString[] args { if args.length 5 { System.out.printlnUsage: MBeanAPIExample3Edit host port username password newDisplayName; throw new IllegalArgumentExceptionNot enough arguments; } host = args[0]; port = Integer.parseIntargs[1]; username = args[2]; password = args[3]; newDisplayName = args[4]; } private void connect throws Exception { String jmxUrl = service:jmx:t3: + host + : + port + jndiweblogic.management.mbeanservers.domainruntime; System.out.printlnConnecting using URL: + jmxUrl + ...; HashtableString,String h = new HashtableString,String; h.putContext.SECURITY_PRINCIPAL, username; h.putContext.SECURITY_CREDENTIALS, password; h.putJMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, weblogic.management.remote; JMXConnector jmxConnector = JMXConnectorFactory.connectnew Introducing the Oracle BI Systems Management API 22-13 JMXServiceURLjmxUrl, h; mbs = jmxConnector.getMBeanServerConnection; System.out.printlnConnected OK; biDomainMBeanName = new ObjectNameoracle.biee.admin:type=BIDomain,group=Service; ObjectName[]biInstanceMBeanNames=ObjectName[]mbs.getAttribute biDomainMBeanName, BIInstances; biInstanceMBeanName = biInstanceMBeanNames[0]; there should only be one System.out.printlnFound BI Instance MBean: + biInstanceMBeanName; } private void lock throws Exception{ System.out.printlnLocking domain ...; Object[] args = new Object[]{}; String[] sig = new String[]{}; mbs.invokebiDomainMBeanName, lock, args, sig; System.out.printlnLocked domain OK; } private void commit throws Exception{ System.out.printlnCommitting changes ...; Object[] args = new Object[]{}; String[] sig = new String[]{}; mbs.invokebiDomainMBeanName, commit, args, sig; System.out.printlnCommitted changes OK; } private void getEmailBean throws Exception{ System.out.printlnGetting Email MBean ...; biEmailMBeanName = ObjectNamembs.getAttributebiInstanceMBeanName, EmailConfiguration; System.out.printlnFound BI Email MBean: + biEmailMBeanName; } private void updateEmailDisplayName throws Exception { String oldDisplayName = Stringmbs.getAttributebiEmailMBeanName, SenderDisplayName; System.out.printlnExisting email displayname is: + oldDisplayName; System.out.printlnChanging email displayname to: + newDisplayName; mbs.setAttributebiEmailMBeanName, new AttributeSenderDisplayName, newDisplayName; } param args public static void mainString[] args throws Exception { MBeanAPIExample3Edit example = new MBeanAPIExample3Editargs; example.connect; example.getEmailBean; example.lock; example.updateEmailDisplayName; example.commit; } } 2. Navigate to the \wlserver\server\lib folder and run the Java program giving the class path, class name and any arguments required. 22-14 System Administrators Guide for Oracle Business Intelligence Enterprise Edition java -classpath JavaClassName host port username password SenderDisplayName For example: java -classpath MW_HOMEwls_10.3serverlibwjmxclient.jar com.oracle.bi.example.MBeanAPIExample3Edit localhost 7001 user1 password1 FredBloggs Use quotation marks to include spaces, for example Fred Bloggs. The command window and log file, displays prompts and messages, for example: Connecting using URL: service:jmx:t3:localhost:7001jndiweblogic.management.mbeanservers.domainrun time ... Connected OK Found BI Instance MBean: oracle.biee.admin:type=BIDomain.BIInstance,biInstance=coreapplication,group=Ser vice Getting Email MBean ... Found BI Email MBean: oracle.biee.admin:type=BIDomain.BIInstance.EmailConfiguration,biInstance=coreap plication,group=Service Locking domain ... Locked domain OK Existing email displayname is: Oracle Business Intelligence Changing email displayname to: FredBloggs Committing changes ... Committed changes OK

22.3.4 Scaling Out for High Availability and Performance Using the Oracle BI Systems Management API

You can use the Oracle BI Systems Management API to scale out to additional host computers for high availability and performance. Use the Enterprise Install to install Oracle Business Intelligence onto a new host computer, and then scale out using steps similar to those described in the following examples: ■ Section 22.3.4.1, Example: Using WLST to Scale Out to Servers ■ Section 22.3.4.2, Example: Using a Java Program to Scale Out to Servers

22.3.4.1 Example: Using WLST to Scale Out to Servers

This example connects a user to Oracle Business Intelligence and scales out to a server. To use WLST commands in a script to scale out to servers: 1. Open a text editor and create a WLST script similar to the following example: Example to demonstrate connecting to a BIEE domain using WLST and do some scale-out operations. This scripts expects the following arguments: 1. wls.host localhost 2. wls.port 7001 3. wls.user user1 4. wls.password password1