def main(): print ' Copyright 2012 Oracle Corporation. ' print ' All Rights Reserved. ' print '' print ' Provided on an ''as is'' basis, without warranties or conditions of any kind, ' print ' either express or implied, including, without limitation, any warranties or ' print ' conditions of title, non-infringement, merchantability, or fitness for a ' print ' particular purpose. You are solely responsible for determining the ' print ' appropriateness of using and assume any risks. You may not redistribute.' print '' print ' Please refer to http://redstack.wordpress.com/continous-integration for details.' print '' print ' This WLST script can be used as part of a continuous integration build process' print ' before deploying a SCA composite, to create any necessary JMS queues' print ' on the WebLogic Server.' print '' print ' In addition to creating the queue, this script will also update the ' print ' resource adapter and redeploy it.' print '' print ' !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!' print '' print ' This script will make changes to your WebLogic domain. Make sure you know ' print ' what you are doing. There is no support for this script. If something bad ' print ' happens, you are on your own! You have been warned.' # # generate a unique string to use in the names # uniqueString = str(int(time.time())) # # Create a JDBC Data Source. # try: print('--> about to connect to weblogic') wl.connect(username, password, url) print('--> about to create a queue ' + qName) wl.edit() wl.startEdit() wl.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule) wl.cmo.createQueue(qName) wl.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/Queues/' + qName) wl.set('JNDIName', jndiName) wl.set('SubDeploymentName', jmsSubDeployment) wl.save() print('--> activating changes') wl.activate() print('--> done') # # update the deployment plan # print('--> about to update the deployment plan for the DbAdapter') wl.startEdit() planPath = wl.get('/AppDeployments/JmsAdapter/PlanPath') appPath = wl.get('/AppDeployments/JmsAdapter/SourcePath') print('--> Using plan ' + planPath) plan = wl.loadApplication(appPath, planPath) print('--> adding variables to plan') makeDeploymentPlanVariable(plan, 'ConnectionInstance_eis/wls/' + qName + '_JNDIName_' + uniqueString, eisName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="oracle.tip.adapter.jms.IJmsConnectionFactory"]/connection-instance/[jndi-name="' + eisName + '"]/jndi-name') makeDeploymentPlanVariable(plan, 'ConfigProperty_ConnectionFactoryLocation' + uniqueString, eisName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="oracle.tip.adapter.jms.IJmsConnectionFactory"]/connection-instance/[jndi-name="' + eisName + '"]/connection-properties/properties/property/[name="ConnectionFactoryLocation"]/value') print('--> saving plan') makeDeploymentPlanVariableplan.save(); makeDeploymentPlanVariablesave(); print('--> activating changes') activate(block='true'); wl.cd('/AppDeployments/JmsAdapter/Targets'); print('--> redeploying the JmsAdapter') print(appName, planPath) wl.redeploy(appName, planPath, targets=cmo.getTargets()) print('--> done') except Exception, inst : print('--> something went wrong, bailing out') print type(inst) # the exception instance print inst.args # arguments stored in .args print inst # __str__ allows args to be printed directly # x, y = inst.args # print 'x =', x # print 'y =', y stopEdit('y') raise SystemExit
for t in topicList: createTopic(theJMSResource, t, jms_module_path) print "Python version = " + sys.version print "Connecting to the server ..." wl.connect("weblogic", "welcome1", "t3://localhost:7021") wl.edit() wl.startEdit() # set('CompatibilityMBeanServerEnabled', 'true') print "Show command line arguments" print "Argument List:", str(sys.argv) checkParams() servermb = wl.getMBean("Servers/" + adminServer) if servermb is None: print "servermb Value is Null" else: createJMS() try: # wl.serverRuntime() wl.save() wl.activate(block="true") importSecuritySettings() print "script returns SUCCESS" except: print "Error while trying to save and/or activate!!!" dumpStack()