Enable/Disable Proxy Service in OSB via ANT+Python

Below is the configurable code for developers to maintain an ant script to be able to control(Enable/Disable) Proxy Services via Ant Script.

Files:


WLSTbuild.properties

weblogic.home.dir=<OSB Home>/wlserver_10.3
weblogic.lib.dir=${weblogic.home.dir}/server/lib


build.properties

fmw.home=<OSB Middleware Home>
wls.username =<Weblogic User Id>
wls.password =<Weblogic Password>
wls.server = t3://:<Weblogic Host>:<Weblogic Port>
service.script=osb_enable_service.py
service.project="<Project Name>/<Sub Project Name or 'ProxyServices' >"
service.name =<Proxy Name>
service.action = <disable/enable>


build.xml

<?xml version="1.0" encoding="windows-1252" ?>
<project name="ServiceControl" default="ServiceControl">
   <property file="./build.properties"/>
   <property file="./wlstbuild.properties"/>
   <taskdef classname="weblogic.ant.taskdefs.management.WLSTTask" name="wlst">
      <classpath>
         <pathelement location="${weblogic.lib.dir}/weblogic.jar"></pathelement>
      </classpath>
   </taskdef>
   <target name="ServiceControl">
      <echo>${weblogic.lib.dir}</echo>
      <wlst filename="${service.script}" debug="true" failonerror="false"
            arguments="${wls.username} ${wls.password} ${wls.server} ${service.project} ${service.name} ${service.action}">
         <classpath>
            <pathelement location="${weblogic.lib.dir}/weblogic.jar"></pathelement>
            <pathelement location="${fmw.home}/<OSB Installation Folder>/lib/sb-kernel-api.jar"></pathelement>
            <pathelement location="${fmw.home}/<OSB Installation Folder>/lib/sb-kernel-impl.jar"></pathelement>
            <pathelement location="${fmw.home}/<OSB Installation Folder>/lib/osb-coherence-client.jar"></pathelement>
         </classpath>
      </wlst>
   </target>
</project>

osb_enable_service.py

from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.config import Ref
from java.lang import String
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
from java.lang import String
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
adminUser = sys.argv[1]
adminPassword = sys.argv[2]
adminUrl = sys.argv[3]
project = sys.argv[4]
service = sys.argv[5]
action = sys.argv[6]
connect(adminUser,adminPassword,adminUrl)
domainRuntime()
print('WLST Connected')

Create a session name

sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
print('... after session. Session is: ', sessionName)

Get the session MBean and create a session

sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)
print('SessionMBean is: ', sessionMBean)
sessionMBean.createSession(sessionName)
print(String('Session was created ... ').concat(sessionName))

Get the ProxyServiceConfigurationMBean specific to our session

mbean = findService(String("ProxyServiceConfiguration.").concat(sessionName),'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean')

Creates a reference to a folder and 'ProxyServices' is a folder in the project and 'ProxyServices' is a folder in the project

projectName = Refs.makeParentRef(project + '/')
proxyRef = Refs.makeProxyRef(projectName, service)
if action == 'disable' :
print "Disabling " + service +" has been completed"
mbean.disableService(proxyRef)
else :
print "Enabling " + service +" has been completed"
mbean.enableService(proxyRef)

Now commit (activate) the changes

sessionMBean.activateSession(sessionName, "disabled PS")
print
disconnect()
exit()

Place all files in a single folder.

From CMD, Navigate to folder and just call ant

Verify from OSB Portal, the service will be in disabled/enabled format in Operational Settings Tab.

How to install Web Center Portal

Installing Oracle Web Center Portal has the following steps:

  • Download and Install:
    1. Weblogic Server 10.3.6 <!! 12c would not work, Only 11g Release 2 !!>
    2. Web Center Portal
      F
      ollow the complete steps or follow the wizard as shown:
      install_welcome
      install_software_updates
      install_prereqs
      install_location
      install_app_server
      *Please Note: Weblogic option will not be available if the Server version mentioned in the previous step is not 10.3.6. 12c will not work
      install_summary
      install_progress
      install_complete
    3. Database XE(Optional. install only if you dont have database already installed)
    4. RCU
      • In CMD, Open file

        <Download_folder>ofm_rcu_win_11.1.1.8.0_64_disk1_1of1rcuHomeBIN

      • Follow the below steps to install RCU:
        2015-05-05_1724 2015-05-05_1725 2015-05-05_1726 2015-05-05_1726_001 2015-05-05_1727 2015-05-05_1729 2015-05-05_1729_001 2015-05-05_1729_002 2015-05-05_1729_003 2015-05-05_1730 2015-05-05_1730_001 2015-05-05_1731 2015-05-05_1731_001 2015-05-05_1809
  • Configure Domain Config:
    2015-05-05_1818

    2015-05-05_1818_001
    2015-05-05_1819
    2015-05-05_1819_001 2015-05-05_1819_002

    2015-05-05_1820
    2015-05-05_1821
    2015-05-05_1822
    2015-05-05_1822_001
    2015-05-05_1822_002 2015-05-05_1822_003

How to install Weblogic Server 10.3.6

Follow the link: Weblogic Server 10.3.6

  • Accept the user agreement radio button. The link to download(Oracle WebLogic Server 11gR1 (10.3.6) ZIP Distribution) will be enabled.
    Note: You will be asked to login for the same.
  • click on the download link and the server jar file will be downloaded(wls1036_generic.jar)
  • Follow the complete steps mentioned here, or follow below steps:
    • Open CMD
    • Navigate to the directory where the file has been downloaded.
    • Run the following command as Admin

      java -jar wls1036_generic.jar

    • On Welcome, click the Next button.
    • On Choose Middleware Home Directory. select option

      Create a new Middleware Home

      create_middle_home_dir_win
      click the Next button

    • On Register for Security Updates, enter email id, and unselect the security updates checkbox. This will disable update information.
      reg_updates_win
      Click the Next button
    • Select Typical install on Choose Install Type Screen and keep clicking next for default options as shown:
      choose_shortcut_location
      install_type_1036
      choose_products
      jdk_select_win
      choose_install_dirs_win
      install_summary_wininstall_complete_1036
      Click on Done.
    • Domain Configuration(Quick Start) will open:
      quickstart_1036
    • On the QuickStart links panel, select this link

      Getting started with WebLogic Server 10.3.6

    • Follow the wizard as shown below:
      select_domain_source
      Enter domain related details
      specify_domain_name
      image020
      config_server_start_mode
      image022
      config_summary_win
      creating_domain_prog
  • Your weblogic server is now installed.

How to fill a increasing values in a column of a table?

How to fill a increasing values in a column of a table?

Lets assume we have a table
Table name : test

Name Value
Yogesh 0
Yogesh 0
Yogesh 0
Yogesh 0
Yogesh 0
Suresh 0
Suresh 0

Requirement : to insert 1, 2, 3 …. corresponding to values Yogesh

Query to Update :

create sequence seq start with 1 increment by 1;
update test set Value=seq.nextval where Name='Yogesh';
commit;

Output :

Name Value
Yogesh 1
Yogesh 2
Yogesh 3
Yogesh 4
Yogesh 5
Suresh 0
Suresh 0