def createDistributedQueue(queueName, jmsModule, targets, subDeploymentName, loadBalancingPolicy): print 'Creating Uniform Distributed Queue : ' + queueName + '...' print ' NOTE: the factory name and its JNDI name are BOTH taken from the factory name' cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule) cmo.createUniformDistributedQueue(queueName) cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/UniformDistributedQueues/' + queueName) cmo.setJNDIName(queueName) cmo.setLoadBalancingPolicy(loadBalancingPolicy) if (subDeploymentName != ''): cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/UniformDistributedQueues/' + queueName) cmo.setSubDeploymentName(subDeploymentName) if (targets != ''): cmo = wlst.cd('/SystemResources/' + jmsModule + '/SubDeployments/' + subDeploymentName) wlst.set('Targets', targets) else: # this code path needs to change to target in the absense of a subDeployment if (targets != ''): cmo = wlst.cd('/SystemResources/' + jmsModule + '/SubDeployments/' + subDeploymentName) wlst.set('Targets', targets) print 'Creating Uniform Distributed Queue : ' + queueName + '...end.'
def configureDevelopmentJTATransactionTimeout(serverName, timeout): print 'Setting JTS timeout' wlst.cd('/') wlst.create('JTA', 'JTA') wlst.cd('/JTA/JTA') wlst.set('TimeoutSeconds', timeout) print("Done")
def createUnixMachine(name, nmType, nmlistenPort): cmo = wlst.cd('/') cmo.createUnixMachine(name) cmo = wlst.cd('/Machines/' + name + '/NodeManager/' + name) cmo.setNMType(nmType) cmo.setListenPort(nmlistenPort)
def configureNodeManagerProperties(nmPort): print("Configuring NodeManager") wlst.cd('/') wlst.cd('NMProperties') wlst.set('ListenPort', nmPort) wlst.set('SecureListener', 'false') print("Done")
def create_server(server_instance_name, jms_server_name): wl.cd('/') wl.cmo.createJMSServer(jms_server_name) wl.cd('/JMSServers/' + jms_server_name) #cmo.setPersistentStore(None) wl.cmo.addTarget(lookup_server_instance(server_instance_name))
def createConnectionFactory(connectionFactoryName, jmsModule, targets, subDeploymentName): print 'Creating connection factory : ' + connectionFactoryName + '...' print ' NOTE: the factory name and its JNDI name are BOTH taken from the factory name' cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule) cmo.createConnectionFactory(connectionFactoryName) cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/ConnectionFactories/' + connectionFactoryName) cmo.setJNDIName(connectionFactoryName) cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/ConnectionFactories/' + connectionFactoryName + '/SecurityParams/' + connectionFactoryName) cmo.setAttachJMSXUserId(False) if (subDeploymentName != ''): cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/ConnectionFactories/' + connectionFactoryName) cmo.setSubDeploymentName(subDeploymentName) if (targets != ''): cmo = wlst.cd('/SystemResources/' + jmsModule + '/SubDeployments/' + subDeploymentName) wlst.set('Targets', targets) else: if (targets != ''): wlst.set('Targets', targets) print 'Creating connection factory : ' + connectionFactoryName + '...end.'
def create_bridge_remote_destination(connection_factory_jndi, destination_jndi, connection_url, username = None, password = None, bridge_destination_name = None): if (bridge_destination_name == None): bridge_destination_name = 'Remote_' + destination_jndi wl.cd('/') wl.cmo.createJMSBridgeDestination(bridge_destination_name) wl.cd('/JMSBridgeDestinations/' + bridge_destination_name) wl.set('ConnectionURL', connection_url) if username != None: wl.set('UserName', username) if password != None: if password.startswith('enc:'): splits = password.replace('enc:', '').split(',') # password = wl.encrypt(splits[0], splits[1]) password = splits[0] # wl.set('UserPassword', password) # TODO(ichsan): Fix this because it failed to run wl.set('AdapterJNDIName', 'eis.jms.WLSConnectionFactoryJNDIXA') wl.set('ConnectionFactoryJNDIName', connection_factory_jndi) wl.set('DestinationJNDIName', destination_jndi) return bridge_destination_name
def createServer(serverName, port): # create server cmo = wlst.cd('/') cmo.createServer(serverName) cmo = wlst.cd('/Servers/' + serverName) # cmo.setListenAddress('') cmo.setListenPort(port)
def configureMaxRequestParameter(serverName, maxRequestParameter): print("Configuring MaxRequestParameter") wlst.cd('/Server/' + serverName) wlst.create(serverName, 'WebServer') wlst.cd('WebServer/' + serverName) wlst.set('MaxRequestParameterCount', maxRequestParameter) print("Done")
def configureWebServer(serverName): print("Configuring webserver parameters") wlst.cd('/Server/' + serverName) wlst.cd('WebServer/' + serverName) wlst.set('KeepAliveSecs', 5) wlst.set('MaxRequestParameterCount', 125000) wlst.set('MaxRequestParamterCount', 125000) print("Done")
def fixBasicAuth(domainName): print("Fixing BasicAuth intercept") if (wlst.ls().find('SecurityConfiguration') == -1 or wlst.ls('SecurityConfiguration').find(domainName) == -1): wlst.create(domainName, 'SecurityConfiguration') wlst.cd('/SecurityConfiguration/' + domainName) wlst.set('EnforceValidBasicAuthCredentials', 'false') print("Done")
def createClusterUnicast(clusterName): # create cluster cmo = wlst.cd('/') cmo.createCluster(clusterName) cmo = wlst.cd('/Clusters/' + clusterName) cmo.setClusterMessagingMode('unicast') cmo.setClusterBroadcastChannel('')
def createFilestore(filestoreName, targets): # create file store cmo = wlst.cd('/') cmo.createFileStore(filestoreName) cmo = wlst.cd('/FileStores/' + filestoreName) wlst.set('Targets', targets) cmo.setDirectory(filestoreName) cmo.setSynchronousWritePolicy('Direct-Write')
def createMailSession(msName, msJndiName, properties, target): print("Creating mail session") wlst.cd('/') wlst.create(msName, 'MailSession') wlst.cd('/MailSession/(' + msName + ')') wlst.set('JNDIName', msJndiName) wlst.set('Properties', properties) wlst.assign('MailSession', msName, 'Target', target) print("Done")
def fixJms(jmsServerName, jmsModuleName, cfName, cfJndiName, queueNames, queueJndiNames, jmsSubName, target): wlst.cd('/') wlst.unassign('JMSSystemResource.SubDeployment', jmsSubName, 'Target', target) wlst.unassign('JMSSystemResource.SubDeployment', jmsSubName, 'Target', jmsServerName) wlst.assign('JMSSystemResource.SubDeployment', jmsSubName, 'Target', jmsServerName)
def createJMSModule(moduleName, targets): print 'Creating a JMS System module named : ' + moduleName + ' targetted to : ' + str( targets) + '...' cmo = wlst.cd('/') cmo.createJMSSystemResource(moduleName) cmo = wlst.cd('/SystemResources/' + moduleName) wlst.set('Targets', targets) print 'Creating a JMS System module named : ' + moduleName + ' targetted to : ' + str( targets) + '...end.'
def next_simple_bridge_name(): wl.cd('/Deployments/') i = 1 while True: name = 'Bridge' + str(i) matches = filter(lambda v, name = name: re.compile("^" + name + "$").match(v), __sls()) if len(matches) == 0: return name i += 1
def _cd_back(return_directory): """ Change directories back to the original directory, logging a warning if it fails :param return_directory: the directory to which to change """ if return_directory is not None: try: wlst.cd(return_directory) except (wlst.WLSTException, offlineWLSTException), ex: _logger.warning('WLSDPLY-00068', return_directory, ex.getLocalizedMessage(), error=ex)
def createWlsAdminUser(username, password): print("Creating admin user") wlst.cd('/Security/base_domain/User') wlst.delete('weblogic', 'User') wlst.create(username, 'User') wlst.cd(username) wlst.set('Password', password) wlst.set('IsDefaultAdmin', '1') wlst.assign('User', username, 'Group', 'Deployers') print("Done")
def create_subdeployment(jms_module_name, jms_server_name, jms_subdeployment): wl.cd('/JMSSystemResources/' + jms_module_name) wl.cmo.createSubDeployment(jms_subdeployment) jms_server = wl.getMBean('/JMSServers/' + jms_server_name) if (jms_server == None): raise LookupError("The JMS server doesn't exist") wl.cd('/JMSSystemResources/' + jms_module_name + '/SubDeployments/' + jms_subdeployment) wl.cmo.addTarget(jms_server)
def createJMSSubDeployment(jmsModule, subDeploymentName, targets): print 'Creating SubDeployment: ' + subDeploymentName + ', with targets: ' + str( targets) + '...' cmo = wlst.cd('/SystemResources/' + jmsModule) cmo.createSubDeployment(subDeploymentName) cmo = wlst.cd('/SystemResources/' + jmsModule + '/SubDeployments/' + subDeploymentName) wlst.set('Targets', targets) print 'Creating SubDeployment: ' + subDeploymentName + ', with targets: ' + str( targets) + '...end.'
def createServer(serverName, serverAddress, serverPort, serverMachine, serverArguments): if not serverAddress: serverAddress = socket.gethostbyname(socket.gethostname()) if not serverMachine: serverMachine = socket.gethostbyname(socket.gethostname()) wlst.cd('/Server/' + serverName) wlst.set('Name', serverName) wlst.set('ListenAddress', serverAddress) wlst.set('ListenPort', serverPort) wlst.set('Machine', serverMachine) if serverArguments: configureServerStart(serverName, serverArguments)
def createMachine(machineAddress, nodeManagerAddress=None, nodeManagerPort=0, nodeManagerType=None): if not machineAddress: machineAddress = socket.gethostbyname(socket.gethostname()) print("Creating machine") wlst.cd('/') wlst.create(machineAddress, 'UnixMachine') wlst.cd('/Machines/' + machineAddress) wlst.set('PostBindGID', 'nobody') wlst.set('PostBindGIDEnabled', 'false') wlst.set('PostBindUID', 'nobody') wlst.set('PostBindUIDEnabled', 'false') wlst.create(machineAddress, 'NodeManager') wlst.cd('NodeManager/' + machineAddress) wlst.set('Name', machineAddress) if (not nodeManagerType is None): wlst.cd('Machines/' + machineAddress + '/NodeManager/' + machineAddress) wlst.set('NMType', nodeManagerType) wlst.set('ListenPort', nodeManagerPort) configureNodeManagerProperties(nodeManagerPort) print("Done")
def create_bridge_local_destination(connection_factory_jndi, destination_jndi, connection_url = 't3://localhost:6001', bridge_destination_name = None): if (bridge_destination_name == None): bridge_destination_name = 'Local_' + destination_jndi wl.cd('/') wl.cmo.createJMSBridgeDestination(bridge_destination_name) wl.cd('/JMSBridgeDestinations/' + bridge_destination_name) wl.set('ConnectionURL', connection_url) wl.set('AdapterJNDIName', 'eis.jms.WLSConnectionFactoryJNDIXA') wl.set('ConnectionFactoryJNDIName', connection_factory_jndi) wl.set('DestinationJNDIName', destination_jndi) return bridge_destination_name
def targetOracleThinJDBCdataSource(dsName, datasourceTargets): print 'targetting: ' + dsName + ' to: ' + str(datasourceTargets) + '...' if (datasourceTargets != ''): cmo = wlst.cd('/SystemResources/' + dsName) wlst.set('Targets', datasourceTargets) print 'targetting: ' + dsName + ' to: ' + str( datasourceTargets) + '...end.'
def targetJMSServer(jmsServerName, targets): print 'Targetting JMS Server: ' + jmsServerName + ' to : ' + str( targets) + '...' cmo = wlst.cd('/Deployments/' + jmsServerName) wlst.set('Targets', targets) print 'Targetting JMS Server: ' + jmsServerName + ' to : ' + str( targets) + '...end.'
def deleteDistributedQueue(queueName, jmsModule): print 'Deleting Uniform Distributed Queue : ' + queueName + '...' cmo = wlst.cd('/JMSSystemResources/' + jmsModule + '/JMSResource/' + jmsModule + '/UniformDistributedQueues/') wlst.delete(queueName) print 'Deleting Uniform Distributed Queue : ' + queueName + '...end.'
def createManagedServer(serverName, serverAddress, serverPort, serverMachine, cluster, serverArguments=None): print("Creating managed server") wlst.cd('/') wlst.create(serverName, 'Server') createServer(serverName, serverAddress, serverPort, serverMachine, serverArguments) wlst.cd('/Server/' + serverName) wlst.set('ClientCertProxyEnabled', 'true') wlst.set('WeblogicPluginEnabled', 'true') if cluster: wlst.assign('Server', serverName, 'Cluster', cluster) print("Done")
def SetQFailureOptions(systemModule, queueName, backupQueueName): print 'Setting Queue Failure options for : ' + queueName + '... at System Module: ' + systemModule + '...' cmo = wlst.cd('/JMSSystemResources/' + systemModule + '/JMSResource/' + systemModule + '/UniformDistributedQueues/' + queueName + '/DeliveryFailureParams/' + queueName) cmo.setErrorDestination( wlst.getMBean('/JMSSystemResources/' + systemModule + '/JMSResource/' + systemModule + '/UniformDistributedQueues/' + backupQueueName)) cmo.setRedeliveryLimit(24) cmo.setExpirationPolicy('Discard') cmo = wlst.cd('/JMSSystemResources/' + systemModule + '/JMSResource/' + systemModule + '/UniformDistributedQueues/' + queueName + '/DeliveryParamsOverrides/' + queueName) cmo.setRedeliveryDelay(120000) print 'Setting Queue Failure options for : ' + queueName + '... at System Module: ' + systemModule + '...end.'
def createSecurity(serverName, identityFileName, identityPassword, trustFileName, trustPassword, keyAlias, keyPassword): print("Creating Security (Keystores)") wlst.cd('/') wlst.cd('Server/' + serverName) wlst.set('KeyStores', 'CustomIdentityAndCustomTrust') wlst.set('CustomIdentityKeyStoreFileName', identityFileName) wlst.set('CustomIdentityKeyStorePassPhraseEncrypted', identityPassword) wlst.set('CustomIdentityKeyStoreType', 'JKS') wlst.set('CustomTrustKeyStoreFileName', trustFileName) wlst.set('CustomTrustKeyStorePassPhraseEncrypted', trustPassword) wlst.set('CustomTrustKeyStoreType', 'JKS') wlst.create(serverName, 'SSL') wlst.cd('SSL/' + serverName) wlst.set('ServerPrivateKeyAlias', keyAlias) wlst.set('ServerPrivateKeyPassPhraseEncrypted', keyPassword) wlst.set('ClientCertAlias', keyAlias) wlst.set('ClientCertPrivateKeyPassPhraseEncrypted', keyPassword) wlst.set('UseClientCertForOutbound', 'true') wlst.set('UseServerCerts', 'true') print("Done")