本文整理汇总了Python中java.util.Properties.load方法的典型用法代码示例。如果您正苦于以下问题:Python Properties.load方法的具体用法?Python Properties.load怎么用?Python Properties.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Properties
的用法示例。
在下文中一共展示了Properties.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addPropertiesFromFile
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [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 load [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: loadProperties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [as 别名]
def loadProperties(fileName):
properties = Properties()
input = FileInputStream(fileName)
properties.load(input)
input.close()
result= {}
for entry in properties.entrySet(): result[entry.key] = entry.value
return result
示例4: load_redback_registry
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [as 别名]
def load_redback_registry():
reg = Properties()
reg_file = 'redback.properties'
if os.path.isfile(reg_file):
reg_fd = FileInputStream(reg_file)
reg.load(reg_fd)
reg_fd.close()
return reg
示例5: read_versions
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [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
示例6: getPushProperties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [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
示例7: loadProperties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [as 别名]
def loadProperties(propFileName):
from java.io import FileInputStream
from java.util import Properties
fileprop = Properties()
fileStream = FileInputStream(propFileName)
fileprop.load(fileStream)
return fileprop
示例8: intialize
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [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';
示例9: get_file_properties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [as 别名]
def get_file_properties(filename):
if filename not in deploy_files_properties:
data = get_file_data(filename)
input_stream = ByteArrayInputStream(data)
properties = Properties()
properties.load(input_stream)
deploy_files_properties[filename] = properties
return deploy_files_properties[filename]
示例10: read_tools_list
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [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
示例11: loadPropertiesFromFile
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [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
示例12: loadProperties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [as 别名]
def loadProperties(self, filename):
f = File("%s" % filename)
props = Properties()
if f.exists():
print 'Chargement de la configuration depuis ' + filename
fis = FileInputStream( f )
props.load( fis )
else:
print 'ERROR: Impossible de charger le fichier de configuration ' + filename
return props
示例13: load_common_properties
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [as 别名]
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)
示例14: run
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [as 别名]
def run():
versionFile = File(os.getcwd(), 'core/resources/version.properties')
log.debug('Checking if ' + str(versionFile) + ' exists')
if os.path.exists(str(versionFile)):
versionProperties = Properties()
input = FileInputStream(versionFile)
versionProperties.load(input)
input.close()
versionInfo=getVersionInfo(versionProperties)
else:
versionInfo=getVersionInfo(None)
log.info('this')
log.info(versionInfo)
示例15: _areUserFilesValid
# 需要导入模块: from java.util import Properties [as 别名]
# 或者: from java.util.Properties import load [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