# for weblogic 12.1.2 wlsUser = '<%= @wlsUser %>' password = '<%= @password %>' machine = '<%= @address %>' portNumber = '<%= @port %>' # coherence_cluster_name,target,targetType,storage_enabled,unicast_address,unicast_port,multicast_address,multicast_port,machines <% @params.each do |param| -%> <%= param %> <% end -%> useStoreConfig = '<%= @useStoreConfig %>' if useStoreConfig != "true": connect(wlsUser,password,'t3://'+machine+':'+portNumber) else: connect(userConfigFile='<%= @userConfigFile %>', userKeyFile='<%= @userKeyFile %>', url='t3://'+machine+':'+portNumber) edit() startEdit() try: cd('/') print 'Create Coherence Cluster'; coherence_cluster = cmo.createCoherenceClusterSystemResource(coherence_cluster_name); coherence_cluster_resource = coherence_cluster.getCoherenceClusterResource(); coherence_cluster_params = coherence_cluster_resource.getCoherenceClusterParams(); coherence_cluster_params.setUnicastListenAddress(unicast_address); coherence_cluster_params.setUnicastListenPort(unicast_port); coherence_cluster_params.setUnicastPortAutoAdjust(true); coherence_cluster_params.setMulticastListenAddress(multicast_address); coherence_cluster_params.setMulticastListenPort(multicast_port); print 'Add known Coherence Cluster addresses'; for i in range(len(machines)): cd('/CoherenceClusterSystemResources/' + coherence_cluster_name + '/CoherenceClusterResource/' + coherence_cluster_name + '/CoherenceClusterParams/' + coherence_cluster_name + '/CoherenceClusterWellKnownAddresses/' + coherence_cluster_name); cmo.createCoherenceClusterWellKnownAddress('address_' + machines[i] + '_' + repr(unicast_port)); address = cmo.lookupCoherenceClusterWellKnownAddress('address_' + machines[i] + '_' + repr(unicast_port)); address.setListenPort(unicast_port); address.setListenAddress(machines[i]); cd('/'); print 'target Coherence Cluster/Server'; target_path = getPath('com.bea:Name=' + target + ',Type='+targetType); print target_path; target_mbean = getMBean(target_path); target_mbean.setCoherenceClusterSystemResource(coherence_cluster); target_mbean.getCoherenceTier().setLocalStorageEnabled(storage_enabled); coherence_cluster.addTarget(target_mbean); save() activate() except: print "Unexpected error:", sys.exc_info()[0] undo('true','y') stopEdit('y')