Tuesday, August 23, 2011

Advanced Weblogic Scripting(WLST) with Record functionality

            Weblogic Console has been a really good tool for administrating all server related configurations. One of the innovative features I liked in weblogic console was the Record option. It’s an amazing utility that allows us to capture the steps involved in server configuration. The recording gets stored as a collection of WLST commands that got executed behind the scenes in a python script file.
The Recording option can be made automatic based on the Preferences. It starts recording when you obtain a lock on the domain configuration and stops recording when you activate your changes, undo your changes, release the lock, or lose the lock. This feature is not available when "Automatically Acquire Lock and Activate Changes" (under "User Preferences") is enabled. When this is disabled we can have the manual Record option.

Here I will show you the WLST script that gets generated when we create a datasource.
Recorded Script


set('JNDINames',jarray.array([String('jdbc/TestDS1')], String))

setEncrypted('Password', 'Password_1314091630125', 'C:/ Oracle/Middleware/SOA11gPS3/user_projects/domains/soa_domain/Script1314091383906Config', 'C:/Oracle/Middleware/SOA11gPS3/user_projects/domains/soa_domain/Script1314091383906Secret')

cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n')




set('Targets',jarray.array([], ObjectName))


Modified  Script - Parameterized

wlURL = raw_input('Enter server URL:')
wlUserName = raw_input('Enter weblogic username:')
wlPassword = raw_input('Enter weblogic password:')
dsName = raw_input('Enter JDBC resource name:')
jndiName = raw_input('Enter JDBC JNDI name:')
dbURL = raw_input('Enter JDBC DB url:')
dsUsername= raw_input('Enter DB username:')
dsPassword=raw_input('Enter DB password:')

connect(wlUserName, wlPassword, wlURL)



set('JNDINames',jarray.array([String(jndiName)], String))


cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n')




set('Targets',jarray.array([], ObjectName))


How to run the script
  1. Go to the Domain bin folder and run setDomainEnv.sh script
  2. Run  >> java weblogic.WLST  /tmp/geo/CreateDataSourceScript.py

Execution StackTrace
>>>java weblogic.WLST D:\CreateDataSourceScript.py

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Enter server URL:t3://localhost:7001
Enter weblogic username:weblogic
Enter weblogic password:welcome1
Enter JDBC resource name:TestDS4
Enter JDBC JNDI name:jdbc/TestDS4
Enter JDBC DB url:jdbc:oracle:thin:@localhost:1521:XE
Enter DB username:DEV_TestDB
Enter DB password:welcome1
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'soa_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit().

For more help, use help(edit)
You already have an edit session in progress and hence WLST will
continue with your edit session.

Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed

That’s it for today. thanks to below references.
  1. Advanced WebLogic Scripting with WLST: Recording, Editing and Reusing
  2. Using the Console to Create Repeatable Configuration Scripts

Wednesday, August 17, 2011

Capturing Business Events @Oracle BPM 11g

        This blog will be the first in series of blogs I will be writing on Oracle BPM suite. In this blog I will look at different options available in Oracle BPM for tracking and monitoring the business process. So how do we get started on monitoring part? In BPEL we used to have sensors and it can be monitored on BAM dashboards, AIA had audit logging mechanisms which we had to invoke to get the information logged. In BPM we have BAM Data Objects as well as BPM Process Cubes. So what/how do we feed these monitoring mechanisms? That’s what we will be focusing on in this blog.

Capturing the business events
To get started with this the analyst need to follow the below steps
  1.     Identify KPI’s and process metrics
  2.  Create Business indicators to capture metrics
  3.    Identifying Sampling points for capturing business indicators
  4.   Enable publishing using BAM  or BPM Process Cubes
  5.    Validate and deploy
  I will be focusing on the initial 3 steps, as step 4 is on enabling the BAM Data objects and BPM Process cubes, step5 on deployment.
1.    Identify KPI’s and process metrics
First step will be to identify the KPI’s and process metrics. KPI’s help an organization define and measure progress toward organizational goals. They are quantifiable measurements, agreed to beforehand, that reflect the critical success factors of an organization. Process metrics are measurements of the steps of a process. Steps generally have completion milestones, and processes are generally measurable in business terms such as timeliness and cost. 

2.    Create Business indicators to capture metrics
Business Indicators are project data objects that are used to store the value of the KPI’s of your process. i.e they can store the value of an indicator you want to measure in your process. Oracle BPM gives you 3 options to define business indicators, and it needs to chosen based on the information type of the value.
a.    Dimension
It defines specify how the data need to be picked. Dimension store the value of a KPI that you can use to group the values of the measure business indicators in your process.
b.    Measure
Measure will help you capture numerical data which signifies a value which will help you in analytics
c.    Counters
Counters are type of measures used for no.of occurrence, keeps track of the number of times an instance completes a certain activity

3.    Identifying Sampling Points for capturing business indicators
                At runtime when the BPMN Service Engine runs the activity in the process it stores data about the process to the BPM Cubes and Oracle BAM Data Objects. This data comes from the sampling points defined in the project.
          Sampling points are broadly divided into two.
 a.    Build-in Sampling Point
-          configured  at project, process and activity level
o    generate sampling for all user tasks
o    generate sampling for start/end of process
o    generate sampling for start/end of activity
-          Dimensions are always captured
-          Sampling point settings can be overridden at different levels.

b.     User defined Sampling Point
- Measurement marks
Measurement marks store the following data into the Process Analytics databases:
      • The value of the process default measures
      • The value of the measure business indicators associated to that measurement mark
      • The value of the dimensions defined in the process

(i)    Single Measurement
To sample business indicators at a specific point in process
(ii)   Counter Mark
It is used to track the number of times the instance runs the particular activity
(iii)                Interval(start & end)
This will measure a business indicator in a section of your process Always use these measurement marks to monitor critical sections of your process
 What Happens @ Measurement Marks
The BPMN Service Engine stores the values of the measure business indicators associated with the pair of measurement marks to the Process Analytics databases. It also stores the values for the dimensions and default measures for that process section.
That’s pretty much for today on the capturing of business events in BPM.

Wednesday, August 3, 2011

Executing WLST - offline and online

  I recently got a query on one of my blogs regarding the WLST commands related to SOA suite that can be run in different modes. –offline and online
1.    online (connected to a running Administration Server or Managed Server instance)
2.    offline (not connected to a running server).

 As per the WLST documentation for SOASuite customWLST commands , the  sca_deployComposite and sca_undeployComposite  can be executed offline. So what does this offline and online mean?

The offline and online are specific to WLST. When you use connect() command in WSLT you are connecting to the server and becoming online, but if you wish to remain offline you can use disconnect() and exit the online session. The online and offline should not be implied as the running status of the server. If the server is shutdown these commands will fail as it requires the hostname and port and connects to it. These commands will work even if the soa-infra is shutdown.

The commands work properly when WLST is online. For testing the WLST command offline, I brought down the server and then executing it offline.
 But since the commands require serverURL and it does validate the connection to host and port.

I will show the difference between offline and online mode with sca_undeploy command.


When you try to do cd('Servers/ soa_server1’) it will give below error
Error: No domain or domain template has been read.

So you will have to give the entire path of the domain

wls:/offline>cd('Servers/ AdminServer’)
wls:/offline/soa_domain/Server/AdminServer’>sca_undeployComposite("http://localhost:8001","GeoComposite", "1.0","weblogic","weblogic123",partition=’default’)
serverURL = http://localhost:7001
user = weblogic
partition = default
compositeName = GeoComposite
revision = 1.0  
timeout= -1
set user and password...
compositeDN = default/GeoComposite!1.0
Creating HTTP connection to host:localhost, port:7001
Received HTTP response from the server, response code=200
---->Undeploying composite (default/ GeoComposite!1.0) success.


wls:/offline> connect()
Please enter your username [weblogic] :weblogic
Please enter your password [welcome1] :
Please enter your server URL [t3://localhost:7001] : t3://localhost:7001
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'soa_domain'.

wls:/soa_domain/serverConfig> sca_undeployComposite("http://localhost:8001","GeoComposite", "1.0","weblogic","weblogic123")
serverURL = http://localhost:8001
user = weblogic
partition = default
compositeName = GeoComposite
revision = 1.0
timeout= -1
set user and password...
compositeDN = default/GeoComposite!1.0
Creating HTTP connection to host:localhost, port:8001
Received HTTP response from the server, response code=200
---->Undeploying composite (default/GeoComposite!1.0) success.

Hope this clarifies.