本文整理匯總了Java中org.apache.commons.configuration.AbstractConfiguration.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractConfiguration.getProperty方法的具體用法?Java AbstractConfiguration.getProperty怎麽用?Java AbstractConfiguration.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.configuration.AbstractConfiguration
的用法示例。
在下文中一共展示了AbstractConfiguration.getProperty方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doGet
import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// get list of properties
TreeSet<String> properties = new TreeSet<String>();
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
Iterator<String> keys = config.getKeys();
while (keys.hasNext()) {
String key = keys.next();
Object value = config.getProperty(key);
if ("aws.accessId".equals(key)
|| "aws.secretKey".equals(key)
|| "experiments-service.secret".equals(key)
|| "java.class.path".equals(key)
|| key.contains("framework.securityDefinition")
|| key.contains("password")
|| key.contains("secret")) {
value = "*****";
}
properties.add(key + "=" + value.toString());
}
// write them out in sorted order
for (String line : properties) {
resp.getWriter().append(line).println();
}
}
示例2: mergeProperties
import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Override
protected Properties mergeProperties() throws IOException {
Properties properties = super.mergeProperties();
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
Iterator<String> iter = config.getKeys();
while (iter.hasNext()) {
String key = iter.next();
Object value = config.getProperty(key);
properties.put(key, value);
}
return properties;
}
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:14,代碼來源:ConfigurationSpringInitializer.java
示例3: duplicateServiceCombConfigToCseListValue
import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
@Test
public void duplicateServiceCombConfigToCseListValue() throws Exception {
List<String> list = Arrays.asList("a", "b");
AbstractConfiguration config = new DynamicConfiguration();
config.addProperty("servicecomb.list", list);
Deencapsulation.invoke(ConfigUtil.class, "duplicateServiceCombConfigToCse", config);
Object result = config.getProperty("cse.list");
assertThat(result, instanceOf(List.class));
assertThat(result, equalTo(list));
}
示例4: infrastructureInit
import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
/**
* Initializes the Archaius system and configures the Netty leak detection level (if necessary).
* DO NOT CALL THIS DIRECTLY. Use {@link #launchServer(String[])} when you're ready to start the server.
*/
protected void infrastructureInit() {
MainClassUtils.setupJbossLoggingToUseSlf4j();
try {
Pair<String, String> appIdAndEnvironmentPair = MainClassUtils.getAppIdAndEnvironmentFromSystemProperties();
ConfigurationManager.loadCascadedPropertiesFromResources(appIdAndEnvironmentPair.getLeft());
}
catch (IOException e) {
throw new RuntimeException("Error loading Archaius properties", e);
}
AbstractConfiguration appConfig = ConfigurationManager.getConfigInstance();
Function<String, Boolean> hasPropertyFunction = (propKey) -> appConfig.getProperty(propKey) != null;
Function<String, String> propertyExtractionFunction = (propKey) -> {
// Properties in Archaius might be a Collection or an Object.
Object propValObj = appConfig.getProperty(propKey);
return (propValObj instanceof Collection)
? ((Collection<?>) propValObj).stream().map(String::valueOf).collect(Collectors.joining(","))
: String.valueOf(propValObj);
};
Set<String> propKeys = new LinkedHashSet<>();
appConfig.getKeys().forEachRemaining(propKeys::add);
MainClassUtils.logApplicationPropertiesIfDebugActionsEnabled(
hasPropertyFunction, propertyExtractionFunction, propKeys, false
);
MainClassUtils.setupNettyLeakDetectionLevel(hasPropertyFunction, propertyExtractionFunction);
}
示例5: buildDBObject
import org.apache.commons.configuration.AbstractConfiguration; //導入方法依賴的package包/類
public void buildDBObject(UserProvisioningManager userProvisioningManager) throws Exception {
AbstractConfiguration dataConfig = ConfigurationHelper.getConfiguration();
Iterator entries = request.getParameterMap().entrySet().iterator();
String prevExpiryVal = null;
String [] currExpiryVal = null;
while (entries.hasNext())
{
Entry thisEntry = (Entry) entries.next();
Object key = thisEntry.getKey();
String keyString = (String) thisEntry.getKey();
if(keyString!=null && keyString.equalsIgnoreCase("PASSWORD_EXPIRY_DAYS"))
{
if(dataConfig.getProperty(keyString) != null)
{
prevExpiryVal = (String)dataConfig.getProperty(keyString);
currExpiryVal = (String[])thisEntry.getValue();
}
}
if(dataConfig.getProperty((String) thisEntry.getKey()) != null)
{
dataConfig.setProperty( (String) thisEntry.getKey(), thisEntry.getValue() );
}
Object value = thisEntry.getValue();
}
if(prevExpiryVal!=null && currExpiryVal[0]!=null)
{
if(!prevExpiryVal.equalsIgnoreCase(currExpiryVal[0]))
{
List<User> list = userProvisioningManager.getUsers();
if(list != null)
{
Iterator UserListIterator = list.iterator();
while(UserListIterator.hasNext()){
User user = (User) UserListIterator.next();
if(user !=null ){
// compare and update the expiry dates here
int dateDiff = Integer.parseInt(currExpiryVal[0])-Integer.parseInt(prevExpiryVal);
user.setPasswordExpiryDate(DateUtils.addDays(user.getPasswordExpiryDate(),dateDiff));
userProvisioningManager.modifyUser(user);
}
}
}
}
}
}