Example: Using WLST to Edit the E-Mail Sender Display Name Configuration Setting

22-16 System Administrators Guide for Oracle Business Intelligence Enterprise Edition if id == oracleInstanceName: matching = oi break if matching : print Found matching OracleInstance... else : print Failed to find target OracleInstance with name: + oracleInstanceName exit deployments = getBIInstanceDeployments Should only ever be one of these deployment = deployments[0] print Acquired BIInstanceDeployment : + deployment.toString cd.. cd oracle.biee.admin:type=BIDomain,group=Service print Calling lock ... objs = jarray.array[], java.lang.Object strs = jarray.array[], java.lang.String invokelock, objs, strs cd.. cddeployment.toString numBIServers = getnumBIServers print Current number of BI Servers is:, numBIServers print About to set number of BI Servers to:, newNumBIServers setnumBIServers, newNumBIServers print Successfully set number of BI Servers to, newNumBIServers 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 print Connecting to BIInstance MBean ... cd .. cd biinstance.toString servicestatus=getServiceStatus print BIInstance MBean; ServiceStatus: + servicestatus print Calling stop ... objs = jarray.array[], java.lang.Object strs = jarray.array[], java.lang.String invokestop, objs, strs servicestatus=getServiceStatus print BIInstance MBean; ServiceStatus: + servicestatus print Calling start ... objs = jarray.array[], java.lang.Object strs = jarray.array[], java.lang.String invokestart, objs, strs Introducing the Oracle BI Systems Management API 22-17 servicestatus=getServiceStatus print BIInstance MBean; ServiceStatus: + servicestatus 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_scaleout_obi.py localhost 7001 user1 password1 UNIX wlst wlst_wlst_scaleout_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 ... About to cd to: oracle.biee.admin:type=BIDomain.BIInstance,biInstance=coreapplication,group=Ser vice BIInstance MBean; ServiceStatus: FULLY_STARTED Looping through OracleInstances looking for: instance1 About to cd to: oracle.biee.admin:oracleInstance=instance1,type=BIDomain.OracleInstance,group=S ervice Found instance with id: instance1 Found matching OracleInstance... Acquired BIInstanceDeployment : oracle.biee.admin:oracleInstance=instance1,type=BIDomain.OracleInstance.BIInsta nceDeployment,biInstance=coreapplication,group=Service Calling lock ... Current number of BI Servers is: 1 About to set number of BI Servers to: 6 Successfully set number of BI Servers to 6 Calling commit ... 22-18 System Administrators Guide for Oracle Business Intelligence Enterprise Edition Committed OK Connecting to BIInstance MBean ... BIInstance MBean; ServiceStatus: PARTIALLY_STARTED Calling stop ... BIInstance MBean; ServiceStatus: PARTIALLY_STARTED Calling start ... BIInstance MBean; ServiceStatus: FULLY_STARTED Exiting WebLogic Scripting Tool. For more information about using WLST commands, see Oracle Fusion Middleware WebLogic Scripting Tool Command Reference.

22.3.4.2 Example: Using a Java Program to Scale Out to Servers

To use a Java program to scale out to servers: 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 do some scale-out operations. 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. br Note that you need codewljmxclient.jarcode and codewlclient.jarcode on the classpath. public class MBeanAPIExample4ScaleOut { private String host; private int port; private String username; private String password; private String oracleInstanceName; private int newNumBIServers; private MBeanServerConnection mbs = null; private ObjectName biDomainMBeanName; private ObjectName biInstanceMBeanName; private ObjectName[] oracleInstanceMBeanNames; private MBeanAPIExample4ScaleOutString[] args { if args.length 6 { System.out.printlnUsage: MBeanAPIExample1Connect host port username password oracleInstanceName NumBIServers; throw new IllegalArgumentExceptionNot enough arguments; } Introducing the Oracle BI Systems Management API 22-19 host = args[0]; port = Integer.parseIntargs[1]; username = args[2]; password = args[3]; oracleInstanceName = args[4]; newNumBIServers = Integer.parseIntargs[5]; } 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 JMXServiceURLjmxUrl, h; mbs = jmxConnector.getMBeanServerConnection; System.out.printlnConnected OK; biDomainMBeanName = new ObjectNameoracle.biee.admin:type=BIDomain,group=Service; ObjectName[] biInstanceMBeanNames = ObjectName[]mbs.getAttributebiDomainMBeanName, BIInstances; biInstanceMBeanName = biInstanceMBeanNames[0]; there should only be one System.out.printlnFound BI Instance MBean: + biInstanceMBeanName; oracleInstanceMBeanNames = ObjectName[]mbs.getAttributebiDomainMBeanName, OracleInstances; for ObjectName oracleInstanceMBeanName : oracleInstanceMBeanNames { System.out.printlnFound Oracle Instance MBean: + oracleInstanceMBeanName; } } private void displayStatus throws Exception { String status = Stringmbs.getAttributebiInstanceMBeanName, ServiceStatus; System.out.printlnStatus is: + status; } 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 ObjectName findMatchingOracleInstanceMBean throws Exception { for ObjectName oracleInstanceMBeanName : oracleInstanceMBeanNames { String oracleInstanceId = Stringmbs.getAttributeoracleInstanceMBeanName, Id;