本文整理汇总了Java中org.apache.commons.configuration.DataConfiguration.getString方法的典型用法代码示例。如果您正苦于以下问题:Java DataConfiguration.getString方法的具体用法?Java DataConfiguration.getString怎么用?Java DataConfiguration.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.configuration.DataConfiguration
的用法示例。
在下文中一共展示了DataConfiguration.getString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isStyleForGroupDeclared
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
public static boolean isStyleForGroupDeclared(int group, DataConfiguration styleConfig) {
String groupSuffix = "." + group;
if (group <= 0) {
groupSuffix = "";
}
String sb = styleConfig.getString(PROP_FONT_FAMILY + groupSuffix, "") +
styleConfig.getString(PROP_FONT_SIZE + groupSuffix, "") +
styleConfig.getString(PROP_FONT_BOLD + groupSuffix, "") +
styleConfig.getString(PROP_FONT_ITALIC + groupSuffix, "") +
styleConfig.getString(PROP_FONT_UNDERLINE + groupSuffix, "") +
styleConfig.getString(PROP_BACKGROUND + groupSuffix, "") +
styleConfig.getString(PROP_FOREGROUND + groupSuffix, "");
return sb.trim().length() > 0;
}
示例2: init
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
public void init(InputStream in) throws ConfigurationException {
propertiesConfiguration = new PropertiesConfiguration();
propertiesConfiguration.setDelimiterParsingDisabled(true);
propertiesConfiguration.load(in, "UTF-8");
configuration = new DataConfiguration(propertiesConfiguration);
configuration.setDelimiterParsingDisabled(true);
String pa = configuration.getString(PROP_PATTERN);
int flags = 0;
flags = flags | (configuration.getBoolean(PROP_PATTERN_CANON_EQ, false) ? Pattern.CANON_EQ : 0);
flags = flags | (configuration.getBoolean(PROP_PATTERN_CASE_INSENSITIVE, false) ? Pattern.CASE_INSENSITIVE : 0);
flags = flags | (configuration.getBoolean(PROP_PATTERN_COMMENTS, false) ? Pattern.COMMENTS : 0);
flags = flags | (configuration.getBoolean(PROP_PATTERN_DOTALL, false) ? Pattern.DOTALL : 0);
flags = flags | (configuration.getBoolean(PROP_PATTERN_LITERAL, false) ? Pattern.LITERAL : 0);
flags = flags | (configuration.getBoolean(PROP_PATTERN_MULTILINE, false) ? Pattern.MULTILINE : 0);
flags = flags | (configuration.getBoolean(PROP_PATTERN_UNICODE_CASE, false) ? Pattern.UNICODE_CASE : 0);
flags = flags | (configuration.getBoolean(PROP_PATTERN_UNIX_LINES, false) ? Pattern.UNIX_LINES : 0);
pattern = Pattern.compile(pa, flags);
groupCount = countGroups(pattern);
name = configuration.getString(PROP_NAME, "NAME NOT SET!");
description = configuration.getString(PROP_DESCRIPTION, "DESCRIPTION NOT SET!");
testMessage = configuration.getString(PROP_TEST_MESSAGE, "");
}
示例3: doInBackground
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
@Override
protected String doInBackground() throws Exception {
String running;
String current = null;
final DataConfiguration c = getOtrosApplication().getConfiguration();
Proxy proxy = Proxy.NO_PROXY;
if (c.getBoolean(HTTP_PROXY_USE, false)) {
Proxy.Type proxyType = Proxy.Type.HTTP;
final InetSocketAddress proxySocketAddress = new InetSocketAddress(c.getString(HTTP_PROXY_HOST, ""), c.getInt(HTTP_PROXY_PORT, 80));
proxy = new Proxy(proxyType, proxySocketAddress);
}
try {
running = VersionUtil.getRunningVersion();
current = VersionUtil.getCurrentVersion(running, proxy, getOtrosApplication());
} catch (Exception e) {
LOGGER.error("Error checking version: " + e.getMessage());
}
return current;
}
示例4: sendSubmitExperimentEmail
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
/**
* @param project the newly created project
* @param projectLink the link to view the details of the project
* @throws MessagingException on other error
*/
public static void sendSubmitExperimentEmail(Project project, String projectLink) throws MessagingException {
DataConfiguration config = ConfigurationHelper.getConfiguration();
String subject = config.getString(ConfigParamEnum.SUBMIT_EXPERIMENT_EMAIL_SUBJECT.name());
String from = config.getString(ConfigParamEnum.EMAIL_FROM.name());
String plainMailBodyPattern = config.getString(ConfigParamEnum.SUBMIT_EXPERIMENT_EMAIL_PLAIN_CONTENT.name());
String htmlMailBodyPattern = config.getString(ConfigParamEnum.SUBMIT_EXPERIMENT_EMAIL_HTML_CONTENT.name());
Person pi = project.getExperiment().getPrimaryInvestigator().getContact();
String plainMailBody =
MessageFormat.format(plainMailBodyPattern, pi.getName(), project.getExperiment().getTitle(),
projectLink);
String htmlMailBody =
MessageFormat.format(htmlMailBodyPattern, pi.getName(), project.getExperiment().getTitle(),
projectLink);
if (!StringUtils.isEmpty(pi.getEmail())) {
EmailUtil.sendMultipartMail(Collections.singletonList(pi.getEmail()), from, subject, htmlMailBody,
plainMailBody);
}
}
示例5: findServerInfoByPrefixes
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
private List<ServerInfo> findServerInfoByPrefixes(
DataConfiguration serverConfig,
List<String> prefixes)
{
List<ServerInfo> servers = new ArrayList<ServerInfo>();
for (String prefix : prefixes)
{
String urlKey = prefix + URL_KEY_SUFFIX;
String userNameKey = prefix + USER_NAME_SUFFIX;
String apiKeyKey = prefix + API_KEY_SUFFIX;
ServerInfo server =
new ServerInfo(prefix, serverConfig.getURL(urlKey, null),
serverConfig.getString(userNameKey, null),
serverConfig.getString(apiKeyKey, null));
servers.add(server);
}
return servers;
}
示例6: loadFromProperties
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
public static List<Favorite> loadFromProperties(DataConfiguration conf) {
ArrayList<Favorite> list = new ArrayList<Favorite>();
int count = conf.getInt("favorites.count", 0);
LOGGER.info("Loading favorites {}", count);
for (int i = 0; i < count; i++) {
String name = conf.getString(String.format("favorite.item_%d.name", i));
String url = conf.getString(String.format("favorite.item_%d.url", i));
Favorite favorite = new Favorite(name, url, Type.USER);
list.add(favorite);
}
return list;
}
示例7: getStyle
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
public static Style getStyle(StyleContext styleContext, DataConfiguration styleConfig, String styleName, int group) {
Style style = styleContext.addStyle(styleName, styleContext.getStyle(StyleContext.DEFAULT_STYLE));
String groupSuffix = "." + group;
if (group <= 0) {
groupSuffix = "";
}
String fontFamily = styleConfig.getString(PROP_FONT_FAMILY + groupSuffix, "");
if (fontFamily.trim().length() > 0) {
StyleConstants.setFontFamily(style, styleConfig.getString(PROP_FONT_FAMILY + groupSuffix));
}
if (styleConfig.getString(PROP_FONT_SIZE + groupSuffix, "").trim().length() > 0) {
StyleConstants.setFontSize(style, styleConfig.getInt(PROP_FONT_SIZE + groupSuffix));
}
if (styleConfig.getString(PROP_FONT_BOLD + groupSuffix, "").trim().length() > 0) {
StyleConstants.setBold(style, styleConfig.getBoolean(PROP_FONT_BOLD + groupSuffix));
}
if (styleConfig.getString(PROP_FONT_ITALIC + groupSuffix, "").trim().length() > 0) {
StyleConstants.setItalic(style, styleConfig.getBoolean(PROP_FONT_ITALIC + groupSuffix));
}
if (styleConfig.getString(PROP_FONT_UNDERLINE + groupSuffix, "").trim().length() > 0) {
StyleConstants.setUnderline(style, styleConfig.getBoolean(PROP_FONT_UNDERLINE + groupSuffix));
}
if (styleConfig.getString(PROP_BACKGROUND + groupSuffix, "").trim().length() > 0) {
StyleConstants.setBackground(style, styleConfig.getColor(PROP_BACKGROUND + groupSuffix));
}
if (styleConfig.getString(PROP_FOREGROUND + groupSuffix, "").trim().length() > 0) {
StyleConstants.setForeground(style, styleConfig.getColor(PROP_FOREGROUND + groupSuffix));
}
return style;
}
示例8: Renderers
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
private Renderers(OtrosApplication otrosApplication) {
final DataConfiguration configuration = otrosApplication.getConfiguration();
classWrapperRenderer = new ClassWrapperRenderer();
classWrapperRenderer.reloadConfiguration(configuration.getString(LOG_TABLE_FORMAT_PACKAGE_ABBREVIATIONS, StringUtils.EMPTY));
levelRenderer = new LevelRenderer(configuration.get(LevelRenderer.Mode.class, LOG_TABLE_FORMAT_LEVEL_RENDERER, LevelRenderer.Mode.IconsOnly));
dateRenderer = new DateRenderer(configuration.getString(LOG_TABLE_FORMAT_DATE_FORMAT, "HH:mm:ss.SSS"));
stringRenderer = new StringRenderer();
configuration.addConfigurationListener(event -> {
if (event.isBeforeUpdate()) {
return;
}
final String property = event.getPropertyName();
final String value = event.getPropertyValue() != null ? event.getPropertyValue().toString() : "";
switch (property) {
case LOG_TABLE_FORMAT_PACKAGE_ABBREVIATIONS:
classWrapperRenderer.reloadConfiguration(value);
break;
case LOG_TABLE_FORMAT_LEVEL_RENDERER:
final LevelRenderer.Mode mode = configuration.get(LevelRenderer.Mode.class, LOG_TABLE_FORMAT_LEVEL_RENDERER, LevelRenderer.Mode.IconsOnly);
levelRenderer.setMode(mode);
break;
case LOG_TABLE_FORMAT_DATE_FORMAT:
dateRenderer.setDateFormatter(new SimpleDateFormat(value));
break;
default:
}
});
}
示例9: loadColumnLayouts
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
public static List<ColumnLayout> loadColumnLayouts(Configuration configuration) {
List<ColumnLayout> layouts = new ArrayList<>();
DataConfiguration dc = new DataConfiguration(configuration);
final int count = dc.getInt(COL_LAYOUT + ".count", 0);
for (int i = 0; i < count; i++) {
String columnLayoutName = dc.getString(COL_LAYOUT + "._" + i + ".name");
List<String> list = dc.getList(String.class, COL_LAYOUT + "._" + i + ".columns");
ColumnLayout columnLayout = new ColumnLayout(columnLayoutName, list);
layouts.add(columnLayout);
}
return layouts;
}
示例10: StringEncrypter
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
public StringEncrypter(String encryptionScheme) throws EncryptionException {
if(encryptionScheme != null && encryptionScheme.equals(Constants.DES_ENCRYPTION) )
encryption = new DESEncryption();
else
{
DataConfiguration config = null;
try {
config = ConfigurationHelper.getConfiguration();
} catch (CSConfigurationException e) {
e.printStackTrace();
}
encryption = new AESEncryption(config.getString("AES_ENCRYPTION_KEY"), Boolean.parseBoolean(config.getString("MD5_HASH_KEY")));
}
}
示例11: getWorkingDirectory
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
private File getWorkingDirectory() {
final DataConfiguration config = ConfigurationHelper.getConfiguration();
String tempDir = config.getString(ConfigParamEnum.STRUTS_MULTIPART_SAVEDIR.name());
if (StringUtils.isBlank(tempDir)) {
tempDir = System.getProperty(TEMP_DIR_PROPERTY_KEY);
}
final String workingDirectoryPath = System.getProperty(WORKING_DIRECTORY_PROPERTY_KEY, tempDir);
return new File(workingDirectoryPath);
}
示例12: registerEmail
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
/**
* @param registrationRequest request
* @throws MessagingException on other error
*/
public static void registerEmail(RegistrationRequest registrationRequest) throws MessagingException {
DataConfiguration config = ConfigurationHelper.getConfiguration();
if (!config.getBoolean(ConfigParamEnum.SEND_CONFIRM_EMAIL.name())) {
return;
}
String subject = config.getString(ConfigParamEnum.CONFIRM_EMAIL_SUBJECT.name());
String from = config.getString(ConfigParamEnum.EMAIL_FROM.name());
String mailBodyPattern = config.getString(ConfigParamEnum.CONFIRM_EMAIL_CONTENT.name());
String mailBody = MessageFormat.format(mailBodyPattern, registrationRequest.getId());
EmailUtil.sendMail(Collections.singletonList(registrationRequest.getEmail()), from, subject, mailBody);
}
示例13: registerEmailAdmin
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
/**
* @param registrationRequest request
* @throws MessagingException on error
*/
public static void registerEmailAdmin(RegistrationRequest registrationRequest) throws MessagingException {
DataConfiguration config = ConfigurationHelper.getConfiguration();
if (!config.getBoolean(ConfigParamEnum.SEND_ADMIN_EMAIL.name())) {
return;
}
String subject = config.getString(ConfigParamEnum.REG_EMAIL_SUBJECT.name());
String from = registrationRequest.getEmail();
String admin = config.getString(ConfigParamEnum.REG_EMAIL_TO.name());
String mailBody = "Registration Request:\n"
+ "First Name: " + registrationRequest.getFirstName() + "\n"
+ "Middle Initial: " + registrationRequest.getMiddleInitial() + "\n"
+ "Last Name: " + registrationRequest.getLastName() + "\n"
+ "Email: " + registrationRequest.getEmail() + "\n"
+ "Phone: " + registrationRequest.getPhone() + "\n"
+ "Fax: " + registrationRequest.getFax() + "\n"
+ "Organization: " + registrationRequest.getOrganization() + "\n"
+ "Address1: " + registrationRequest.getAddress1() + "\n"
+ "Address2: " + registrationRequest.getAddress2() + "\n"
+ "City: " + registrationRequest.getCity() + "\n"
+ "State: " + registrationRequest.getState() + "\n"
+ "Province: " + registrationRequest.getProvince() + "\n"
+ "Country: " + registrationRequest.getCountry().getPrintableName() + "\n"
+ "Zip: " + registrationRequest.getZip() + "\n"
+ "Role: " + registrationRequest.getRole();
EmailUtil.sendMail(Collections.singletonList(admin), from, subject, mailBody);
}
示例14: postInit
import org.apache.commons.configuration.DataConfiguration; //导入方法依赖的package包/类
/**
* set the upload temporary directory based on our config.
* {@inheritDoc}
*/
@Override
protected void postInit(Dispatcher dispatcher, FilterConfig filterConfig) {
DataConfiguration config = ConfigurationHelper.getConfiguration();
String multiPartSaveDir = config.getString(ConfigParamEnum.STRUTS_MULTIPART_SAVEDIR.name());
if (StringUtils.isNotBlank(multiPartSaveDir)) {
dispatcher.setMultipartSaveDir(multiPartSaveDir);
}
}