def sendEmail(self, useremail, subject, messageText): # server connection smtpconfig = self.getSmtpConfig() properties = Properties() properties.setProperty("mail.smtp.host", smtpconfig['host']) properties.setProperty("mail.smtp.port", str(smtpconfig['port'])) properties.setProperty("mail.smtp.starttls.enable", "true") session = Session.getDefaultInstance(properties) message = MimeMessage(session) message.setFrom(InternetAddress(smtpconfig['from'])) message.addRecipient(Message.RecipientType.TO, InternetAddress(useremail)) message.setSubject(subject) #message.setText(messageText) message.setContent(messageText, "text/html") transport = session.getTransport("smtp") transport.connect(properties.get("mail.smtp.host"), int(properties.get("mail.smtp.port")), smtpconfig['user'], smtpconfig['pwd_decrypted']) transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO)) transport.close()
def intialize(): global domainProps global userConfigFile global userKeyFile global adminURL global processingMode global domain global domain_home global nodemanager_home global nodemanager_port global nodemanagerUserConfigFile global nodemanagerUserKeyFile global servername global propertyFilename global serverType try: hostname = str(socket.gethostname()).replace(".*", "") domainProps = Properties() if os.path.isfile(src_dir + '/config/midctl_' + hostname + ".cfg") == false: hostname = hostname.split('.')[0] propertyFilename = src_dir + '/config/midctl_' + hostname + ".cfg" input = FileInputStream(propertyFilename) domainProps.load(input) input.close() #initialize domain, servername, processing mode from parameters: processingMode = sys.argv[1] serverType = sys.argv[2] domain = sys.argv[3] servername = sys.argv[4] propertyPrefix = serverType + "-" + sys.argv[1] + "-" + sys.argv[ 2] + "-" # extract required properties from config file nodemanager_home = domainProps.get('NodeManager-' + domain + '-home') nodemanager_port = domainProps.get('NodeManager-' + domain + '-port') nodemanagerUserConfigFile = domainProps.get('NodeManager-' + domain + '-NodeUserConfigFile') nodemanagerUserKeyFile = domainProps.get('NodeManager-' + domain + '-NodeUserKeyFile') if nodemanager_port is None: nodemanager_port = 5556 domain_home = domainProps.get(serverType + "-" + domain + '-domainHome') if (domainProps.get(serverType + "-" + domain + '-' + servername + '-domainHome') != ""): domain_home = domainProps.get(serverType + "-" + domain + '-' + servername + '-domainHome') adminURL = domainProps.get(serverType + "-" + domain + '-adminUrl') userConfigFile = domainProps.get(serverType + "-" + domain + '-AdminUserConfigFile') userKeyFile = domainProps.get(serverType + "-" + domain + '-AdminUserKeyFile') print highlightInfo('init script for command: ' + processingMode + ' serverName: ' + servername + ' on host: ' + hostname + nodemanagerUserConfigFile) except: print highlightError('Cannot load properties ' + propertyFilename + '!') exit()
def load_common_properties(): """Loads common test properties into grinder properties.""" current_dir = os.path.dirname(os.path.abspath(__file__)) file_name = os.path.join(current_dir, PROPERTIES) source = BufferedInputStream(FileInputStream(file_name)) props = Properties() props.load(source) source.close() for key in props.keySet().iterator(): grinder.properties[key] = props.get(key)
cmo.setMaximumMessageSize(20) ########################################## # JMS Queu configuration function # arguments are : JMS module, # Queue name, jndi name ########################################## def createJMSQ(jms_module_name,jndi,jms_queue_name): jms_module_path = getJMSModulePath(jms_module_name) cd(jms_module_path) cmo.createQueue(jms_queue_name) cd(jms_module_path+'/Queues/'+jms_queue_name) cmo.setJNDIName(jndi) cmo.setSubDeploymentName(subdeployment_name) adminUser=configProps.get("adminUser") adminPassword=configProps.get("adminPassword") adminURL=configProps.get("adminURL") connect(adminUser,adminPassword,adminURL) #adm_name=get('AdminServerName') adm_name=ls('Servers',returnMap='true')[0] print adm_name edit() startEdit() ########################################## # JMS CONFIGURATION## ########################################## total_conf=configProps.get("total_conf") tot_djmsm=configProps.get("total_default_jms_module")
# -*- coding: utf-8 -*- import sys, os, re from datetime import date from java.util import Properties from java.io import FileInputStream # Load the properties file. properties = Properties() properties.load(FileInputStream('gradle.properties')) # Set the basic project information. project = 'Armeria' project_short = 'Armeria' copyright = properties.get('inceptionYear') + '-' + str( date.today().year) + ', LINE Corporation' # Set the project version and release. # Use the last known stable release if the current version ends with '-SNAPSHOT'. if re.match(r'^.*-SNAPSHOT$', properties.get('version')): release = '0.31.0.Final' else: release = properties.get('version') version = re.match(r'^[0-9]+\.[0-9]+', release).group(0) # Export the loaded properties and some useful values into epilogs rst_epilog = '\n' rst_epilog += '.. |baseurl| replace:: http://line.github.io/armeria/\n' propIter = properties.entrySet().iterator() while propIter.hasNext(): propEntry = propIter.next() if propEntry.getKey() in ['release', 'version']:
if opt == '-h': print 'set_datasource.py -p <path-to-properties-file>' sys.exit() elif opt in ("-p", "--properties"): properties = arg print 'properties=', properties # Load the properties from the properties file. from java.io import FileInputStream propInputStream = FileInputStream(properties) configProps = Properties() configProps.load(propInputStream) # Set all variables from values in properties file. adminUsername=configProps.get("admin.username") adminPassword=configProps.get("admin.password") adminURL=configProps.get("admin.url") machineName=configProps.get("machine.name") from java.util import Properties ################################################################### def createMachine(): # Display the variable values. print 'adminUsername='******'adminPassword='******'adminURL=', adminURL print 'machineName=', machineName
if opt == '-h': print 'set_datasource.py -p <path-to-properties-file>' sys.exit() elif opt in ("-p", "--properties"): properties = arg print 'properties=', properties # Load the properties from the properties file. from java.io import FileInputStream propInputStream = FileInputStream(properties) configProps = Properties() configProps.load(propInputStream) # Set all variables from values in properties file. adminUsername = configProps.get("admin.username") adminPassword = configProps.get("admin.password") adminURL = configProps.get("admin.url") mailName = configProps.get("mail.name") mailJNDIName = configProps.get("mail.jndi.name") mailconnectiontimeout = configProps.get("mail.smtp.connectiontimeout") mailtimeout = configProps.get("mail.smtp.timeout") mailprotocol = configProps.get("mail.transport.protocol") mailhost = configProps.get("mail.smtp.host") mailport = configProps.get("mail.smtp.port") mailTargetType = configProps.get("mail.target.type") mailTargetName = configProps.get("mail.target.name") mailTargetAdmin = configProps.get("mail.target.admin") from java.util import Properties
srvr.setBytesThresholdLow(long(thrs_low)) srvr.setBytesThresholdHigh(long(thrs_high)) srvr.setMaximumMessageSize(long(msg_size)) envproperty = "" if (len(sys.argv) > 1): envproperty = sys.argv[1] else: print "Environment Property file not specified" sys.exit(2) propInputStream = FileInputStream(envproperty) configProps = Properties() configProps.load(propInputStream) adminUser = configProps.get("adminUser") adminPassword = configProps.get("adminPassword") adminURL = configProps.get("adminURL") connect(adminUser, adminPassword, adminURL) edit() startEdit() #=============# JMS SERVER and PERSISITENT STORE CONFIGURATION #=============# total_fstore = configProps.get("total_fstore") #total_jstore=configProps.get("total_jstore") total_jmssrvr = configProps.get("total_jmssrvr") j = 1 while (j <= int(total_jmssrvr)):
# -*- coding: utf-8 -*- import sys, os, re from datetime import date from java.util import Properties from java.io import FileInputStream # Load the properties file. properties = Properties() properties.load(FileInputStream('gradle.properties')) # Set the basic project information. project = 'Armeria' project_short = 'Armeria' copyright = properties.get('inceptionYear') + '-' + str(date.today().year) + ', LINE Corporation' # Set the project version and release. # Use the last known stable release if the current version ends with '-SNAPSHOT'. if re.match(r'^.*-SNAPSHOT$', properties.get('version')): release = '0.32.0' else: release = properties.get('version') version = re.match(r'^[0-9]+\.[0-9]+', release).group(0) # Export the loaded properties and some useful values into epilogs rst_epilog = '\n' rst_epilog += '.. |baseurl| replace:: http://line.github.io/armeria/\n' propIter = properties.entrySet().iterator() while propIter.hasNext(): propEntry = propIter.next() if propEntry.getKey() in [ 'release', 'version' ]: continue
srvr.addTarget(getMBean("/Servers/"+target_name)) srvr.setBytesThresholdLow(long(thrs_low)) srvr.setBytesThresholdHigh(long(thrs_high)) srvr.setMaximumMessageSize(long(msg_size)) envproperty="" if (len(sys.argv) > 1): envproperty=sys.argv[1] else: print "Environment Property file not specified" sys.exit(2) propInputStream=FileInputStream(envproperty) configProps=Properties() configProps.load(propInputStream) adminUser=configProps.get("adminUser") adminPassword=configProps.get("adminPassword") adminURL=configProps.get("adminURL") connect(adminUser,adminPassword,adminURL) edit() startEdit() #=============# JMS SERVER and PERSISITENT STORE CONFIGURATION #=============# total_fstore=configProps.get("total_fstore") #total_jstore=configProps.get("total_jstore") total_jmssrvr=configProps.get("total_jmssrvr") j=1 while (j <= int(total_jmssrvr)):
if domainDir == "": print "Missing \"-t domainDir\" parameter." usage() sys.exit(2) if properties == "": print "Missing \"-p Property File\" parameter." usage() sys.exit(2) propsInputStream = FileInputStream(properties) props.load(propsInputStream) print "Shutting down domain" + domainDir try: connect(props.get('adminUserName'), props.get('adminPassword'), 't3://' + props.get('listenAddress') + ':' + props.get('listenPort')) cmo = cd('/') adminServerName = cmo.getAdminServerName() cmo = cd('/Servers') servers = cmo.getServers() # Shut down all managed servers first for server in servers: if (server.getName() != adminServerName): try: shutdown(server.getName(), block='true') except: print 'Unable to shutdown server ' + server.getName() # Now shutdown admin server shutdown(block='false') disconnect()
sys.exit(2) if properties == "": print "Missing \"-p Property File\" parameter." usage() sys.exit(2) if nodemgrHomeDir == "": print "Missing \"-n nodemgrHomeDir\" parameter." usage() sys.exit(2) propsInputStream = FileInputStream(properties) props.load(propsInputStream) adminUserName = props.get('adminUserName') adminAddress = props.get('listenAddress') domainName = props.get('domainName') adminPassword = getPassword(props, 'adminPassword') adminURL = 't3://' + adminAddress + ':' + props.get('listenPort') connect(adminUserName, adminPassword, adminURL) print "Connecting to admin server with url: " + adminURL connect(adminUserName, adminPassword, adminURL) nmEnroll(domainDir, nodemgrHomeDir) disconnect() print "Enroll returns SUCCESS"
if domainDir == "": print "Missing \"-t domainDir\" parameter." usage() sys.exit(2) if properties == "": print "Missing \"-p Property File\" parameter." usage() sys.exit(2) propsInputStream = FileInputStream(properties) props.load(propsInputStream) # get JDBC config from property file url = props.get('rcu.jdbc.ConnectionUrl') print 'JDBC parameters:' print 'url = ' + url #======================================================================================= # Open the existing domain. #======================================================================================= readDomain(domainDir) #======================================================================================= # Create machine(s) and assign WebLogic servers to machines. #======================================================================================= result = ConfigureMachines.configureMachines(props, domain) if not result: sys.exit(1)
import sys import os.path import time import application_util as app_util from java.io import FileInputStream from java.util import Properties prop = Properties() prop.load(FileInputStream(sys.argv[0] + '/config_app.properties')) warPath = sys.argv[1] cellName = prop.get('ws.cell.name') serverName = prop.get('ws.server.name') nodeName = prop.get('ws.node.name') cluster = prop.get('ws.cluster.name') contextPath = prop.get('ws.context.path') virtualHost = prop.get('ws.virtual.host') appName = prop.get('ws.app.name') classloaderMode = prop.get('ws.classloader.mode') print('serverName is %s' % (serverName)) print('nodeName is %s' % (nodeName)) print('cluster is %s' % (cluster)) print('contextPath is %s' % (contextPath)) print('virtualHost is %s' % (virtualHost)) print('appName is %s' % (appName)) print('warPath is %s' % (warPath)) def checkWarExist(warPath): if not os.path.isfile(warPath):
connectionPoolParams.setMaxCapacity(30) connectionPoolParams.setStatementCacheSize(150) connectionPoolParams.setInitialCapacity(30) connectionPoolParams.setHighestNumWaiters(2) connectionPoolParams.setShrinkFrequencySeconds(0) connectionPoolParams.setConnectionReserveTimeoutSeconds(15) connectionPoolParams.setStatementTimeout(180) connectionPoolParams.setRemoveInfectedConnections(bool(false)) connectionPoolParams.setConnectionCreationRetryFrequencySeconds(15) connectionPoolParams.setSecondsToTrustAnIdlePoolConnection(15) driverProperties = driverParams.getProperties() prop = driverProperties.createProperty('user') prop.setValue(ds_user) adminUser = configProps.get("adminUser") adminPassword = configProps.get("adminPassword") adminURL = configProps.get("adminURL") try: connect(adminUser, adminPassword, adminURL) edit() startEdit() ############################################################################################## # JDBC CONFIGURATION ############################################################################################## total_ds = configProps.get("total_ds") print 'Total dataSources: ' + total_ds
########################################## # JMS Queu configuration function # arguments are : JMS module, # Queue name, jndi name ########################################## def createJMSQ(jms_module_name, jndi, jms_queue_name): jms_module_path = getJMSModulePath(jms_module_name) cd(jms_module_path) cmo.createQueue(jms_queue_name) cd(jms_module_path + '/Queues/' + jms_queue_name) cmo.setJNDIName(jndi) cmo.setSubDeploymentName(subdeployment_name) adminUser = configProps.get("adminUser") adminPassword = configProps.get("adminPassword") adminURL = configProps.get("adminURL") connect(adminUser, adminPassword, adminURL) #adm_name=get('AdminServerName') adm_name = ls('Servers', returnMap='true')[0] print adm_name edit() startEdit() ########################################## # JMS CONFIGURATION## ########################################## total_conf = configProps.get("total_conf") tot_djmsm = configProps.get("total_default_jms_module")
elif opt == "-p": properties = arg elif opt == "-t": domainDir = arg if domain == "": print "Missing \"-d domain\" parameter." usage() sys.exit(2) if domainDir == "": print "Missing \"-t domainDir\" parameter." usage() sys.exit(2) if properties == "": print "Missing \"-p Property File\" parameter." usage() sys.exit(2) propsInputStream = FileInputStream(properties) props.load(propsInputStream) print "ConfigureIAMDomain started" iam_home_dir = props.get("IAM_HOME") print "IAM_HOME=" + iam_home_dir sys.exit()
# -*- coding: utf-8 -*- import sys, os, re from datetime import date from java.util import Properties from java.io import FileInputStream # Load the properties file. properties = Properties() properties.load(FileInputStream('gradle.properties')) # Set the basic project information. project = 'Armeria' project_short = 'Armeria' copyright = properties.get('inceptionYear') + '-' + str(date.today().year) + ', LINE Corporation' # Set the project version and release. # Use the last known stable release if the current version ends with '-SNAPSHOT'. if re.match(r'^.*-SNAPSHOT$', properties.get('version')): release = '0.31.1.Final' else: release = properties.get('version') version = re.match(r'^[0-9]+\.[0-9]+', release).group(0) # Export the loaded properties and some useful values into epilogs rst_epilog = '\n' rst_epilog += '.. |baseurl| replace:: http://line.github.io/armeria/\n' propIter = properties.entrySet().iterator() while propIter.hasNext(): propEntry = propIter.next() if propEntry.getKey() in [ 'release', 'version' ]: continue