Tuesday, April 15, 2014

osb_server1, where does it come from?

When you create a new OSB domain, typically you include 2 templates:

SB_BASE_TEMPLATE = '/common/templates/applications/wlsb_base.jar'
SB_TEMPLATE = '/common/templates/applications/wlsb.jar'

in wlsb.jar there is a tiny config.xml defining the osb_server1 managed server.

So, a brand new domain will contain this osb_server1.

To customize the domain, you can either delete it (not advisable, since there are singleton services targeted to it) or rename it (better this way)

In the same way, a datasource wlsbjmsrpDataSource will be created automatically, using some default values:

<jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source">
  <name>wlsbjmsrpDataSource</name>
  <jdbc-driver-params>
    <url>jdbc:derby://localhost:1527/osbexamples;create=true;serverName=localhost</url>
    <driver-name>org.apache.derby.jdbc.ClientDriver</driver-name>
    <properties>
      <property>
        <name>user</name>
        <value>DEV_SOAINFRA</value>
      </property>
    </properties>
    <password-encrypted>weblogic</password-encrypted>
  </jdbc-driver-params>
  <jdbc-connection-pool-params>
    <initial-capacity>5</initial-capacity>
    <max-capacity>20</max-capacity>
    <capacity-increment>1</capacity-increment>
  </jdbc-connection-pool-params>
  <jdbc-data-source-params>
    <jndi-name>wlsbjmsrpDataSource</jndi-name>
    <global-transactions-protocol>LoggingLastResource</global-transactions-protocol>
  </jdbc-data-source-params>
</jdbc-data-source>


Of course you will have to customize this Datasource to suit your needs, with code like this:
            DS_NAME_REP = 'wlsbjmsrpDataSource'
            db_driver = 'oracle.jdbc.OracleDriver'
            db_url = 'jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.acme.com)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=myservice)))'
            db_password = 'bla'
            db_name = 'myservice'

            cd('/')
            cd('JDBCSystemResource/' + DS_NAME_REP + '/JdbcResource/' + DS_NAME_REP )
            cd('JDBCDriverParams/NO_NAME_0')
            set('DriverName', db_driver)
            set('URL', db_url)
            set('PasswordEncrypted', db_password )
            
            # set/create all properties
            cd('Properties/NO_NAME_0')
            
            cd('Property/user')
            cmo.setValue(db_username)
            
            cd('../..')
            create('databaseName', 'Property')
            cd('Property/databaseName')
            cmo.setValue(db_name)
            
            cd('../..')
            create('serverName', 'Property')
            cd('Property/serverName')
            cmo.setValue(db_host)
            
            cd('../..')
            create('portNumber', 'Property')
            cd('Property/portNumber')
            cmo.setValue(db_port)
            
            cd('/JDBCSystemResource/' + DS_NAME_REP + '/JdbcResource/' + DS_NAME_REP )
            cd('JDBCConnectionPoolParams/NO_NAME_0')
            set('TestTableName', db_testtable)

            set('InitialCapacity', 0)
            
            cd('/JDBCSystemResource/' + DS_NAME_REP + '/JdbcResource/' + DS_NAME_REP )
            cd ('JDBCDataSourceParams/NO_NAME_0' )
            set('GlobalTransactionsProtocol', 'LoggingLastResource')
            


All this is very beautiful and instructive.

No comments: