and also
http://biemond.blogspot.com/2012/02/configure-weblogic-resource-adapters.html
This sample code sort-of-works (found here):
url='t3://localhost:7001'
username='weblogic'
password='xxxaaabb'
TargetServerName='AdminServer'
#Connect
appPath='/oracle/soa/mwhome/Oracle_SOA1/soa/connectors/DbAdapter.rar'
planPath='/oracle/soa/mwhome/Oracle_SOA1/soa/DBPlan/Plan.xml'
appName='DbAdapter'
moduleOverrideName=appName+'.rar'
moduleDescriptorName='META-INF/weblogic-ra.xml'
def makeDeploymentPlanVariable(wlstPlan, name, value, xpath, origin='planbased'):
while wlstPlan.getVariable(name):
while wlstPlan.getVariableAssignment(name, moduleOverrideName, moduleDescriptorName):
wlstPlan.destroyVariableAssignment(name, moduleOverrideName, moduleDescriptorName)
variableAssignment = wlstPlan.createVariableAssignment(name, moduleOverrideName, moduleDescriptorName)
variableAssignment.setXpath(xpath)
variableAssignment.setOrigin(origin)
wlstPlan.createVariable(name, value)
def main():
connect(username,password,url)
edit()
try:
startEdit()
myPlan=loadApplication(appPath, planPath)
makeDeploymentPlanVariable(myPlan, 'ConnectionInstance_eis/DB/MyCF_JNDIName_abc123', 'MyCF', '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="eis/DB/My_CF"]/jndi-name')
makeDeploymentPlanVariable(myPlan, 'ConfigProperty_xADataSourceName_Value_abc123', 'eis/DB/MyJDBC', '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="eis/DB/MyCF"]/connection-properties/properties/property/[name="xADataSourceName"]/value')
myPlan.save();
save();
activate(block='true');
cd('/AppDeployments/DbAdapter/Targets');
#updateApplication(appName, planPath);
redeploy(appName, planPath,targets=cmo.getTargets());
except:
stopEdit('y')
main()
I still feel it's a lot better to generate the Plan.xml from code, copy the XML in the WL domain and update the DbAdapter.rar with
java weblogic.Deployer -adminurl t3://admin-url:admin server port -user adminuser -password password -update -name DbAdapter -plan "db plan location"/DBPlan.xml
or the analogous WLST command.
I simply hate this overcomplicated unreadable code.
more to come...
No comments:
Post a Comment
comments where you are promoting your business will be marked as SPAM :o)