本文整理汇总了Python中java.util.Properties.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Python Properties.getProperty方法的具体用法?Python Properties.getProperty怎么用?Python Properties.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Properties
的用法示例。
在下文中一共展示了Properties.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addPropertiesFromFile
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def addPropertiesFromFile(props, filename, site_home):
addProps = Properties()
input = FileInputStream(filename)
addProps.load(input)
input.close()
baseFileList = addProps.getProperty('base')
if not baseFileList is None:
baseFiles = baseFileList.split(",")
for baseFile in baseFiles:
baseFileResolved=getBaseFile(baseFile, site_home)
if baseFileResolved=='':
log.error('Configuration inherits from properties file that does not exist: ' + baseFile)
log.info('Suggested Fix: Update the base property within ' + filename + ' to the correct file path')
sys.exit()
log.debug('Attempting to load properties from ' + baseFile)
addPropertiesFromFile(addProps, baseFileResolved, site_home)
addProps.remove('base')
enum = addProps.keys()
while enum.hasMoreElements():
key = enum.nextElement()
if props.getProperty(key) is None:
props.setProperty(key, addProps.getProperty(key))
addDataLinage(key,filename,addProps.getProperty(key))
示例2: intialize
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def intialize():
global domainProps;
global userConfigFile;
global userKeyFile;
# test arguments
if len(sys.argv) != 3:
print 'Usage: stopDomain.sh <default.properties_file> <property_file>';
exit();
print 'Starting the initialization process';
try:
domainProps = Properties()
# load DEFAULT properties
input = FileInputStream(sys.argv[1])
domainProps.load(input)
input.close()
# load properties and overwrite defaults
input = FileInputStream(sys.argv[2])
domainProps.load(input)
input.close()
userConfigFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userconfig'
userKeyFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userkey'
except:
print 'Cannot load properties !';
exit();
print 'Initialization completed';
示例3: read_versions
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def read_versions(self):
versionsProperties = Properties()
fin = FileInputStream(self.versionsFileName)
versionsProperties.load(fin)
scriptVersion = versionsProperties.getProperty("script")
toolsVersion = versionsProperties.getProperty("tools")
fin.close()
return scriptVersion, toolsVersion
示例4: getPushProperties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def getPushProperties():
pushProperties = HashMap()
pushPropertiesFileStr = "%s%s%s" % (adapterConfigBaseDir, FILE_SEPARATOR, PUSH_PROPERTIES_FILE)
properties = Properties()
debugMode = 0
sortCSVFields = ""
smartUpdateIgnoreFields = ""
testConnNameSpace = "BMC.CORE"
testConnClass = "BMC_ComputerSystem"
try:
logger.debug("Checking push properties file for debugMode [%s]" % pushPropertiesFileStr)
fileInputStream = FileInputStream(pushPropertiesFileStr)
properties.load(fileInputStream)
# Property: debugMode
try:
debugModeStr = properties.getProperty("debugMode")
if isNoneOrEmpty(debugModeStr) or string.lower(string.strip(debugModeStr)) == 'false':
debugMode = 0
elif string.lower(string.strip(debugModeStr)) == 'true':
debugMode = 1
except:
logger.debugException("Unable to read debugMode property from push.properties")
if debugMode:
logger.debug("Debug mode = TRUE. XML data pushed to Remedy/Atrium will be persisted in the directory: %s" % adapterResBaseDir)
else:
logger.debug("Debug mode = FALSE")
# Property: smartUpdateIgnoreFields
try:
smartUpdateIgnoreFields = properties.getProperty("smartUpdateIgnoreFields")
except:
logger.debugException("Unable to read smartUpdateIgnoreFields property from push.properties")
# Property: sortCSVFields
try:
sortCSVFields = properties.getProperty("sortCSVFields")
except:
logger.debugException("Unable to read sortCSVFields property from push.properties")
# Property: testConnNameSpace
try:
testConnNameSpace = properties.getProperty("testConnNameSpace")
except:
logger.debugException("Unable to read testConnNameSpace property from push.properties")
# Property: testConnClass
try:
testConnClass = properties.getProperty("testConnClass")
except:
logger.debugException("Unable to read testConnClass property from push.properties")
fileInputStream.close()
except:
logger.debugException("Unable to process %s file." % PUSH_PROPERTIES_FILE)
return debugMode, smartUpdateIgnoreFields, sortCSVFields, testConnNameSpace, testConnClass
示例5: intialize
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def intialize():
global domainLocation;
global jvmLocation;
global domainTemplate;
global domainProps;
global adminUserName;
global adminPassword;
global userConfigFile;
global userKeyFile;
# test arguments
if len(sys.argv) != 6:
print 'Usage: createDomain.sh <template-file> <default.properties_file> <property_file> <wls_username> <wls_password>';
exit();
print 'Starting the initialization process';
domainTemplate = sys.argv[1];
print 'Using Domain Template: ' + domainTemplate;
try:
domainProps = Properties()
# load DEFAULT properties
# print 'Reading default properties from '+sys.argv[2];
input = FileInputStream(sys.argv[2])
domainProps.load(input)
input.close()
# load properties and overwrite defaults
input = FileInputStream(sys.argv[3])
domainProps.load(input)
input.close()
adminUserName = sys.argv[4];
adminPassword = sys.argv[5];
# Files for generating secret key
userConfigFile = File(sys.argv[3]).getParent()+'/'+domainProps.getProperty('domainName')+'.userconfig'
print userConfigFile
userKeyFile = File(sys.argv[3]).getParent()+'/'+domainProps.getProperty('domainName')+'.userkey'
print userKeyFile
domainLocation = domainProps.getProperty('domainsDirectory') + pathSeparator + domainProps.getProperty('domainName');
print 'Domain Location: ' + domainLocation;
if len(domainProps.getProperty('jvmLocation')) == 0:
print 'JVM location property not defined - cancel creation !';
exit();
print 'JVM Location: ' + domainProps.getProperty('jvmLocation');
except:
dumpStack()
print 'Cannot initialize creation process !';
exit();
print 'Initialization completed';
示例6: read_tools_list
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def read_tools_list(tmpToolsListFile):
"""Read the tools names and tools data urls
from the downlaoded tools list
"""
toolsInfo = []
properties = Properties()
fin = FileInputStream(tmpToolsListFile)
properties.load(fin)
toolsRefs = properties.getProperty("tools.list").split("|")
for toolRef in toolsRefs:
jarUrl = properties.getProperty(toolRef)
toolsInfo.append([toolRef, jarUrl.replace("\n", "")])
fin.close()
return toolsInfo
示例7: _areUserFilesValid
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def _areUserFilesValid(self):
if not (self._userConfigFile and self._userKeyFile):
return False
if not (self._is_non_zero_file(self._userConfigFile) and self._is_non_zero_file(self._userKeyFile)):
return False
try:
inStream=FileInputStream(self._userConfigFile)
userConfigs=Properties()
userConfigs.load(inStream)
except NullPointerException:
return False
if not (userConfigs.getProperty('weblogic.management.username') and userConfigs.getProperty('weblogic.management.password')):
return False
return True
示例8: read_tools_list
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def read_tools_list(tmpToolsListFile):
"""Read the tools names and tools data urls
from the downlaoded tools list
"""
properties = Properties()
fin = FileInputStream(tmpToolsListFile)
properties.load(fin)
toolsRefs = properties.getProperty("tools.list").split("|")
fin.close()
return toolsRefs
示例9: intialize
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def intialize():
global domainProps;
global userConfigFile;
global userKeyFile;
global overwrittenServerURL;
global levelToPrint;
# test arguments
if ((len(sys.argv) != 3) and (len(sys.argv) != 4)):
print 'Usage: threaddump.py <default.properties_file> <property_file>';
print 'OR'
print 'Usage: threaddump.py <default.properties_file> <property_file> <ADMIN-URL overwrite>';
exit();
print 'Starting the initialization process';
try:
domainProps = Properties()
# load DEFAULT properties
input = FileInputStream(sys.argv[1])
domainProps.load(input)
input.close()
# load properties and overwrite defaults
input = FileInputStream(sys.argv[2])
domainProps.load(input)
input.close()
userConfigFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userconfig'
userKeyFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userkey'
if (len(sys.argv) == 4):
overwrittenServerURL = sys.argv[3];
except:
dumpStack()
print 'Cannot load properties !';
exit();
print 'Initialization completed';
示例10: loadPropertiesFromFile
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def loadPropertiesFromFile(filename,props):
newprops=Properties()
inputstr = FileInputStream(filename)
newprops.load(inputstr)
inputstr.close()
enum = newprops.keys()
while enum.hasMoreElements():
key = enum.nextElement()
if props.getProperty(key) is None:
props.setProperty(key, newprops.getProperty(key))
return props
示例11: getVersionInfo
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def getVersionInfo(versionProperties):
if versionProperties is None:
versionProperties = Properties()
versionProperties.setProperty('version','TBA')
version=versionProperties.getProperty('version')
date=versionProperties.getProperty('release.date')
client=versionProperties.getProperty('client')
versionInfo=''
versionInfo += '\n\n ===================================================\n'
versionInfo += ' ===================================================\n\n'
versionInfo += ' Redback Environment Configuration Tool\n'
versionInfo += ' \n'
if not version:
version='TBA'
versionInfo += ' Release Version : ' + version + '\n'
if date:
versionInfo += ' Release Date : ' + date + '\n'
if client:
versionInfo += ' Client : ' + client + '\n'
versionInfo += ' \n'
if version == 'TBA':
versionInfo += ' Notes: This is a development release of ConfigNOW.\n'
versionInfo += ' Notes: This is a development release of ConfigNOW.\n'
versionInfo += ' This release has not been packaged as part of the\n'
versionInfo += ' formal release process.\n\n'
versionInfo += ' ===================================================\n'
versionInfo += ' ===================================================\n'
return versionInfo
示例12: getDebugMode
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def getDebugMode():
pushPropertiesFileStr = "%s%s%s" % (adapterConfigBaseDir, FILE_SEPARATOR, PUSH_PROPERTIES_FILE)
properties = Properties()
debugMode = 0
try:
logger.debug("Checking push properties file for debugMode [%s]" % pushPropertiesFileStr)
fileInputStream = FileInputStream(pushPropertiesFileStr)
properties.load(fileInputStream)
debugModeStr = properties.getProperty("debugMode")
if isNoneOrEmpty(debugModeStr) or string.lower(string.strip(debugModeStr)) == 'false':
debugMode = 0
elif string.lower(string.strip(debugModeStr)) == 'true':
debugMode = 1
fileInputStream.close()
except:
debugMode = 0 # ignore and continue with debugMode=0
logger.debugException("Unable to process %s file." % PUSH_PROPERTIES_FILE)
if debugMode:
logger.debug("Debug mode = TRUE. XML data pushed to CA CMDB will be persisted in the directory: %s" % adapterResBaseDir)
else:
logger.debug("Debug mode = FALSE")
return debugMode
示例13: __getEc2PrivateIpv4s
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def __getEc2PrivateIpv4s(self, additionalVariables):
try:
dir = File(self.__basedir)
dir = dir.getParentFile().getParentFile().getParentFile()
fileReader = FileReader(File(dir, "engine-session.properties" ))
props = Properties()
props.load(fileReader)
ec2PrivateIpv4s = props.getProperty("ec2PrivateIpv4s")
if ec2PrivateIpv4s:
ipList = ec2PrivateIpv4s.split()
logger.info("Ec2 Private IPv4s:" + list2str(ipList))
engineInstance = getVariableValue("ENGINE_INSTANCE")
engineInstance = int(engineInstance)
if len(ipList) > engineInstance:
self.__dockerHostIp = ipList[engineInstance]
logger.info("Setting DOCKER_HOST_IP:" +self.__dockerHostIp)
additionalVariables.add(RuntimeContextVariable("DOCKER_HOST_IP", self.__dockerHostIp, RuntimeContextVariable.STRING_TYPE, "Docker Host IP", False, RuntimeContextVariable.NO_INCREMENT))
else:
self.__dockerHostIp = getVariableValue("LISTEN_ADDRESS")
additionalVariables.add(RuntimeContextVariable("DOCKER_HOST_IP", self.__dockerHostIp , RuntimeContextVariable.STRING_TYPE, "Docker Host IP", False, RuntimeContextVariable.NO_INCREMENT))
except:
type, value, traceback = sys.exc_info()
logger.warning("read engine session properties error:" + `value`)
示例14: doInBackground
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
def doInBackground(self):
#print "\n- Checking for the latest version..."
try:
url = URL(self.app.scriptVersionUrl)
uc = url.openConnection()
ins = uc.getInputStream()
p = Properties()
p.load(ins)
latestScriptVersion = p.getProperty("script")
self.app.latestToolsVersion = p.getProperty("tools")
except (UnknownHostException, SocketException):
print "I can't connect to:\n%s" % url
ins.close()
return
if latestScriptVersion == self.app.SCRIPTVERSION:
#using latest script
print " already using the latest script version:", self.app.SCRIPTVERSION
if self.app.latestToolsVersion == self.app.TOOLSVERSION:
#using latest tools
print " already using the latest tools version:", self.app.TOOLSVERSION
if self.mode != "auto":
JOptionPane.showMessageDialog(self.app.preferencesFrame,
self.app.strings.getString("using_latest"))
return
else:
#not using latest tools
print " tools can be updated: %s -> %s" % (self.app.TOOLSVERSION,
self.app.latestToolsVersion)
answer = JOptionPane.showConfirmDialog(Main.parent,
self.app.strings.getString("update_tools_question"),
self.app.strings.getString("updates_available"),
JOptionPane.YES_NO_OPTION)
if answer == 0:
#Download the updated tools data
print "\n- Update tools data"
try:
self.app.toolsProgressDialog
except AttributeError:
from java.awt import Dialog
self.app.toolsProgressDialog = ToolsProgressDialog(Main.parent,
self.app.strings.getString("download_tools_updates"),
Dialog.ModalityType.APPLICATION_MODAL,
self.app)
self.app.toolsProgressDialog.show()
else:
#not using latest script
print "a new script version is available:\n%s -> %s" % (self.app.SCRIPTVERSION,
latestScriptVersion)
messageArguments = array([self.app.SCRIPTVERSION, latestScriptVersion], String)
formatter = MessageFormat("")
formatter.applyPattern(self.app.strings.getString("updates_warning"))
msg = formatter.format(messageArguments)
options = [
self.app.strings.getString("Do_not_check_for_updates"),
self.app.strings.getString("Visit_Wiki"),
self.app.strings.getString("cancel")]
answer = JOptionPane.showOptionDialog(Main.parent,
msg,
self.app.strings.getString("updates_available"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
None,
options,
options[1])
if answer == 0:
self.app.properties.setProperty("check_for_update", "off")
self.app.save_config(self)
elif answer == 1:
OpenBrowser.displayUrl(self.app.SCRIPTWEBSITE)
示例15: Properties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import getProperty [as 别名]
#!/usr/bin/env /oracle/product/middleware/Oracle_OSB1/common/bin/wlst.sh
from java.util import Properties
from java.io import FileInputStream
# ===============
# Variable Defs
# ===============
# relativo estar na mesma pasta .
prop = Properties()
prop.load(FileInputStream("osb.properties"))
ADMIN_SERVER = prop.getProperty('ADMIN_SERVER')
ADMIN_SERVER_PORT = int(prop.getProperty('ADMIN_SERVER_PORT'))
DATABASE = prop.getProperty('DATABASE')
DOMAIN = prop.getProperty('DOMAIN')
DOMAIN_HOME = prop.getProperty('DOMAIN_HOME')
LISTEN_ADDRESS = prop.getProperty('LISTEN_ADDRESS')
MACHINE = prop.getProperty('MACHINE')
MANAGED_SERVER = prop.getProperty('MANAGED_SERVER')
MANAGED_SERVER_PORT = int(prop.getProperty('MANAGED_SERVER_PORT'))
MDS_USER = prop.getProperty('MDS_USER')
MDS_PASSWORD = prop.getProperty('MDS_PASSWORD')
MW_HOME = prop.getProperty('MW_HOME')
NODE_MANAGER = prop.getProperty('NODE_MANAGER')
NODE_MANAGER_LISTEN_ADDRESS = prop.getProperty('NODE_MANAGER_LISTEN_ADDRESS')
NODE_MANAGER_PASSWORD = prop.getProperty('NODE_MANAGER_PASSWORD')
NODE_MANAGER_PORT = int(prop.getProperty('NODE_MANAGER_PORT'))
OSB_HOME = prop.getProperty('OSB_HOME')
SOAINFRA_USER = prop.getProperty('SOAINFRA_USER')
SOAINFRA_PASSWORD = prop.getProperty('SOAINFRA_PASSWORD')
WEBLOGIC_PASSWORD = prop.getProperty('WEBLOGIC_PASSWORD')