I am new to Jython . I have the following .py file . This has been created based on BEA’s doc. I used to create a weblogic domain. I want the py script to be more generic. I run now using

 

Java weblogic.WLST  filename.py

 

But I wanna do something like

 

Java –Denv=devconnect weblogic.WLST filename.py……How do you accomplish this?  This can be done in ant using similar concept like ${keyvalue}

 

Eager to see responses.

 

loadProperties('C:/beacases/627825/wlstoffline9/devconnect.properties')

 

loadProperties('C:/beacases/627825/wlstoffline9/stageconnect.properties')

 

 

loadProperties('C:/beacases/627825/wlstoffline9/prodconnect.properties')

 

import sys

from java.lang import Integer

from java.io import *

 

def storeFile(fileName,fileText):

  try:

    out = FileOutputStream(fileName)

    p = PrintStream(out)

    p.println(fileText);

    # p.println("password=" + password);

    p.close()

    print "File " + fileName + " was created."

  except:

    print "ERROR trying to create: " + fileName

    dumpStack()

   

readTemplate("c:/bea91/weblogic91/common/templates/domains/wls.jar")

 

loadProperties('C:/beacases/627825/wlstoffline9/connect.properties')

 

 

 

domain_home=domain_path+'/' + domainname

print "domain home value", domain_home

 

cd('Servers/AdminServer')

set('Name',dservername)

set('ListenAddress',hostname)

set('ListenPort',Integer(listenport).intValue())

 

create('AdminServer','SSL')

cd('SSL/AdminServer')

set('Enabled', 'True')

set('ListenPort',Integer(listenportssl).intValue())

 

#=======================================================================================

# Update system password

#=======================================================================================

 

print "Updating admin account: ",username

 

 

cd('/')

cd('Security/base_domain/User/weblogic')

cmo.setName(dusername)

cmo.setPassword(dpassword)

 

#=======================================================================================

# Create domain directory

#=======================================================================================

 

print "Creating domain: ",domain_home

 

 

setOption('OverwriteDomain', 'true')

writeDomain(domain_home)

closeTemplate()

#=======================================================================================

# Create boot.properties

#=======================================================================================

 

 

try:

    boot_properties = domain_home + '/' + 'boot.properties'

    storeFile( boot_properties, "username=" + dusername + "\n" + "password=" + dpassword )

except:

    print "ERROR trying to create boot.properties!"

    dumpStack()

exit()