当前位置: 首页>>代码示例>>Java>>正文


Java PropertiesConfiguration.getString方法代码示例

本文整理汇总了Java中org.apache.commons.configuration.PropertiesConfiguration.getString方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesConfiguration.getString方法的具体用法?Java PropertiesConfiguration.getString怎么用?Java PropertiesConfiguration.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.configuration.PropertiesConfiguration的用法示例。


在下文中一共展示了PropertiesConfiguration.getString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadData

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@Override
protected void loadData() {
    // 设定文件初期读入
    try {
        PropertiesConfiguration languageConf = new PropertiesConfiguration(Thread.currentThread()
                .getContextClassLoader().getResource("language/package.properties"));
        title = languageConf.getString(YiDuConfig.TITLE);
        siteKeywords = languageConf.getString(YiDuConfig.SITEKEYWORDS);
        siteDescription = languageConf.getString(YiDuConfig.SITEDESCRIPTION);
        name = languageConf.getString(YiDuConfig.NAME);
        url = languageConf.getString(YiDuConfig.URL);
        copyright = languageConf.getString(YiDuConfig.COPYRIGHT);
        beianNo = languageConf.getString(YiDuConfig.BEIANNO);
        analyticscode = languageConf.getString(YiDuConfig.ANALYTICSCODE);
        analyticscode = languageConf.getString(YiDuConfig.ANALYTICSCODE);
        category = languageConf.getString(YiDuConfig.CATEGORY);
    } catch (ConfigurationException e) {
        logger.error(e);
    }
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:21,代码来源:LanguageEditAction.java

示例2: execute

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@SkipValidation
@Override
public String execute() {
    logger.debug("execute start.");

    File lockFile = new File(LOCK_FILE);
    if (lockFile.exists()) {
        addActionError(getText("errors.install.file.exist", new String[] { LOCK_FILE }));
        return ERROR;
    }

    // 设定文件初期读入
    try {
        PropertiesConfiguration jdbcConf = new PropertiesConfiguration("jdbc.properties");
        String dburl = jdbcConf.getString(YiDuConfig.JDBC_URL).substring(prefixjdbc.length());
        String[] dbinfo = StringUtils.split(dburl, ":");
        dbhost = dbinfo[0];
        dbinfo = StringUtils.split(dbinfo[1], "/");
        dbport = dbinfo[0];
        // 数据库名暂时固定
        dbname = "yidu";
        dbusername = jdbcConf.getString(YiDuConfig.JDBC_USERNAME);
        dbpassword = jdbcConf.getString(YiDuConfig.JDBC_PASSWORD);
        PropertiesConfiguration languageConf = new PropertiesConfiguration(Thread.currentThread()
                .getContextClassLoader().getResource("language/package.properties"));
        title = languageConf.getString(YiDuConfig.TITLE);
        siteKeywords = languageConf.getString(YiDuConfig.SITEKEYWORDS);
        siteDescription = languageConf.getString(YiDuConfig.SITEDESCRIPTION);
        name = languageConf.getString(YiDuConfig.NAME);
        url = languageConf.getString(YiDuConfig.URL);
        copyright = languageConf.getString(YiDuConfig.COPYRIGHT);
        beianNo = languageConf.getString(YiDuConfig.BEIANNO);
        analyticscode = languageConf.getString(YiDuConfig.ANALYTICSCODE);

    } catch (ConfigurationException e) {
        logger.error(e);
    }
    logger.debug("execute normally end.");
    return INPUT;
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:41,代码来源:IndexAction.java

示例3: upgrade

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("nls")
@Override
public void upgrade(UpgradeResult result, File tleInstallDir) throws Exception
{
	PropertyFileModifier modifier = new PropertyFileModifier(new File(new File(tleInstallDir, CONFIG_FOLDER),
		PropertyFileModifier.HIBERNATE_CONFIG))
	{
		@Override
		protected boolean modifyProperties(PropertiesConfiguration props)
		{
			String dialect = props.getString(HIBERNATE_DIALECT);
			String newdialect = null;
			if( dialect.equals("org.hibernate.dialect.PostgreSQLDialect") )
			{
				newdialect = "com.tle.hibernate.dialect.ExtendedPostgresDialect";
			}
			else if( dialect.equals("org.hibernate.dialect.Oracle10gDialect") )
			{
				newdialect = "com.tle.hibernate.dialect.ExtendedOracle10gDialect";
			}
			else if( dialect.equals("org.hibernate.dialect.Oracle9iDialect")
				|| dialect.equals("org.hibernate.dialect.Oracle9Dialect") )
			{
				newdialect = "com.tle.hibernate.dialect.ExtendedOracle9iDialect";
			}
			if( newdialect != null )
			{
				props.setProperty(HIBERNATE_DIALECT, newdialect);
				return true;
			}
			return false;
		}
	};
	modifier.updateProperties();
}
 
开发者ID:equella,项目名称:Equella,代码行数:36,代码来源:UpdateHibernateProperties.java

示例4: getSecretValues

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
private void getSecretValues(){
    String secretConfigFile = "config.properties";
    try {
        PropertiesConfiguration secretConfig = new PropertiesConfiguration(secretConfigFile);
        if (secretConfig != null) {
            //Extract secret credentials
            MyShowsClientId = secretConfig.getString("MyShowsClientId");
            MyShowsSecret = secretConfig.getString("MyShowsSecret");
        } else {
            throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
        }
    } catch (Exception e) {
        logger(logger,"error","Exception: " + e);
    }
}
 
开发者ID:symphonicon,项目名称:Fav-Track,代码行数:16,代码来源:GetPropetries.java

示例5: getUserValues

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
private void getUserValues(){
    try {
        PropertiesConfiguration config = new PropertiesConfiguration(extFolder+propFileName);
        user_pref_player = config.getString("user_pref_player");
        user_login = config.getString("user_login");
        user_password = config.getString("user_password");
        user_rememberMe = config.getBoolean("user_rememberMe");
        user_autologin = config.getBoolean("user_autologin");
        user_showtime = config.getInt("user_showtime");
        /*logger.info(config.getPath());*/
    } catch (Exception e) {
        System.out.println("Exception: " + e);
    }
}
 
开发者ID:symphonicon,项目名称:Fav-Track,代码行数:15,代码来源:GetPropetries.java

示例6: getPlayerValues

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
private void getPlayerValues(){
    try {
        //getUserValues();
        PropertiesConfiguration config = new PropertiesConfiguration(extFolder+propFileName);
        MPC_host = config.getString("MPC_host");
        MPC_port = config.getString("MPC_port");
        VLC_host = config.getString("VLC_host");
        VLC_port = config.getString("VLC_port");
        VLC_password = config.getString("VLC_password");
        VLC_login = config.getString("VLC_login");
        /*//Extract player setup
        switch (user_pref_player){
            case "MPC":
                MPC_host = config.getString("MPC_host");
                MPC_port = config.getString("MPC_port");
                break;
            case "VLC":
                VLC_host = config.getString("VLC_host");
                VLC_port = config.getString("VLC_port");
                VLC_password = config.getString("VLC_password");
                VLC_login = config.getString("VLC_login");

                break;
        }*/

    } catch (Exception e) {
        System.out.println("Exception: " + e);
    }
}
 
开发者ID:symphonicon,项目名称:Fav-Track,代码行数:30,代码来源:GetPropetries.java

示例7: loadData

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@Override
protected void loadData() {
    initCollections(new String[] { "collectionProperties.boolean" });
    uri = YiDuConstants.yiduConf.getString(YiDuConfig.URI);
    mobileUri = YiDuConstants.yiduConf.getString(YiDuConfig.MOBILE_URI);
    filePath = YiDuConstants.yiduConf.getString(YiDuConfig.FILE_PATH);
    relativeIamgePath = YiDuConstants.yiduConf.getString(YiDuConfig.RELATIVE_IAMGE_PATH);
    rootImagePath =  YiDuConstants.yiduConf.getString(YiDuConfig.ROOT_IMAGE_PATH);
    cacheEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CACHE_EFFECTIVE, true);
    cleanUrl = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CLEAN_URL, true);
    gzipEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.GZIP_EFFECTIVE, true);
    adEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.AD_EFFECTIVE, true);
    countPerPage = YiDuConstants.yiduConf.getInt(YiDuConfig.COUNT_PER_PAGE, 15);
    maxBookcase = YiDuConstants.yiduConf.getInt(YiDuConfig.MAX_BOOKCASE, 15);
    themeName = YiDuConstants.yiduConf.getString(YiDuConfig.THEME_NAME);
    createIndexPage = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_INDEXPAGE, true);
    createSiteMap = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_SITEMAP, true);
    siteMapType = YiDuConstants.yiduConf.getString(YiDuConfig.SITEMAP_TYPE);
    xmlSiteMapListWithNoPageURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_LIST_WITH_NO_PAGE_URL);
    xmlSiteMapListURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_LIST_URL);
    xmlSiteMapInfoURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_INFO_URL);
    xmlSiteMapChaterListURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_CHATERLIST_URL);
    xmlSiteMapReaderURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_READER_URL);
    compressEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.COMPRESS_EFFECTIVE,false);
    txtEncoding = YiDuConstants.yiduConf.getString(YiDuConfig.TXT_ENCODING);

    addReviewWithoutLogin = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ADD_REVIEW_WITHOUT_LOGIN, true);
    enableMobileSite = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_MOBILE_SITE, true);
    judgmobilesitebydomian = YiDuConstants.yiduConf.getBoolean(YiDuConfig.JUDG_MOBILESITE_BY_DOMIAN, true);
    mobilesitedomian = YiDuConstants.yiduConf.getString(YiDuConfig.MOBILESITE_DOMIAN);
    enablePseudo = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PSEUDO, false);
    enableQQLogin = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_QQLOGIN, false);
    enableCacheArticleCount = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CACHE_ARTICLE_COUNT, false);
    enableChapterIndexPage = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CHAPTER_INDEX_PAGE, false);
    enableGenerateHtmlFile = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_GENERATE_HTML_FILE, false);
    enableMailAuth = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_MAIL_AUTH, false);
    mailSmtpAuth = YiDuConstants.yiduConf.getBoolean(YiDuConfig.MAIL_SMTP_AUTH, false);
    mailSmtpStarttlsEnable = YiDuConstants.yiduConf.getBoolean(YiDuConfig.MAIL_SMTP_STARTTLS_ENABLE, false);
    mailSmtpHost = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_HOST);
    mailSmtpPort = YiDuConstants.yiduConf.getInt(YiDuConfig.MAIL_SMTP_PORT, 25);
    mailSmtpUsername = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_USERNAME);
    mailSmtpPassword = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_PASSWORD);
    mailSmtpFrom = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_FROM);
    maxSubscribe = YiDuConstants.yiduConf.getInt(YiDuConfig.MAX_SUBSCRIBE, 30);
    sendSubscribeInteval = YiDuConstants.yiduConf.getInt(YiDuConfig.SEND_SUBSCRIBE_INTEVAL, 15);
    enableSingleBook = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_SINGLE_BOOK, false);
    rootDomain = YiDuConstants.yiduConf.getString(YiDuConfig.ROOT_DOMAIN);
    excludeSubDomain = YiDuConstants.yiduConf.getString(YiDuConfig.EXCLUDE_SUB_DOMAIN);
    reloadSingleBookInterval = YiDuConstants.yiduConf.getInt(YiDuConfig.RELOAD_SINGLE_BOOK_INTERVAL, 120);
    enableCleanImageUrl = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CLEAN_IMAGE_URL, false);
    filterKeyWord = YiDuConstants.yiduConf.getString(YiDuConfig.FILTER_KEYWORD);
    enablePinyinUrl = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false);

    // 设定文件初期读入
    try {
        PropertiesConfiguration jdbcConf = new PropertiesConfiguration("jdbc.properties");

        dburl = jdbcConf.getString(YiDuConfig.JDBC_URL);
        username = jdbcConf.getString(YiDuConfig.JDBC_USERNAME);
        password = jdbcConf.getString(YiDuConfig.JDBC_PASSWORD);

        PropertiesConfiguration qqconnectConfig = new PropertiesConfiguration("qqconnectconfig.properties");
        appId = qqconnectConfig.getString(YiDuConfig.APP_ID);
        appKey = qqconnectConfig.getString(YiDuConfig.APP_KEY);

    } catch (ConfigurationException e) {
        logger.error(e);
    }

}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:71,代码来源:ConfigEditAction.java

示例8: PluginManager

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
public PluginManager() {
	File dir = new File(PluginManager.dirPath);
	if (!dir.exists() && !dir.isDirectory()) {
		dir.delete();
		dir.mkdir();
	}

	for (File f : dir.listFiles()) {
		try {
			if (f.isDirectory()) {
				// find config file
				if (!new File(f.getAbsolutePath() + "/"
						+ PluginManager.configFileName).exists()) {
					Gui.log("Skipping directory: " + f.getName()
							+ ": config file not found");
					continue;
				}

				PropertiesConfiguration config = new PropertiesConfiguration(
						f.getAbsolutePath() + "/" + PluginManager.configFileName);
				String mainClassName = config.getString("main");
				String jarName = config.getString("jar");

				if (mainClassName == null && jarName == null) {
					Gui.log("Skipping directory: " + f.getName()
							+ ": config file broken");
					continue;
				}
				// load main class
				URL url1 = new URL("file:" + dir.getAbsolutePath()
						+ jarName);
				URLClassLoader myClassLoader1 = new URLClassLoader(
						new URL[] { url1 }, Thread.currentThread()
								.getContextClassLoader());
				Class<?> myClass1 = myClassLoader1.loadClass(mainClassName);
				Enterence.PluginPool
						.add((IRCPlugin) myClass1.newInstance());
				myClassLoader1.close();
				// call init

			}
		} catch (Exception e) {
			Gui.log("Error handling dir:");
		}
	}

}
 
开发者ID:D0048,项目名称:irc-helper,代码行数:48,代码来源:PluginManager.java

示例9: loadData

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@Override
protected void loadData() {
    initCollections(new String[] { "collectionProperties.boolean" });
    uri = YiDuConstants.yiduConf.getString(YiDuConfig.URI);
    mobileUri = YiDuConstants.yiduConf.getString(YiDuConfig.MOBILE_URI);
    filePath = YiDuConstants.yiduConf.getString(YiDuConfig.FILE_PATH);
    relativeIamgePath = YiDuConstants.yiduConf.getString(YiDuConfig.RELATIVE_IAMGE_PATH);
    cacheEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CACHE_EFFECTIVE, true);
    cleanUrl = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CLEAN_URL, true);
    gzipEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.GZIP_EFFECTIVE, true);
    adEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.AD_EFFECTIVE, true);
    countPerPage = YiDuConstants.yiduConf.getInt(YiDuConfig.COUNT_PER_PAGE, 15);
    maxBookcase = YiDuConstants.yiduConf.getInt(YiDuConfig.MAX_BOOKCASE, 15);
    themeName = YiDuConstants.yiduConf.getString(YiDuConfig.THEME_NAME);
    createIndexPage = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_INDEXPAGE, true);
    createSiteMap = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_SITEMAP, true);
    createStructuringData = YiDuConstants.yiduConf.getBoolean(YiDuConfig.CREATE_STRUCTURINGDATA, true);
    siteMapType = YiDuConstants.yiduConf.getString(YiDuConfig.SITEMAP_TYPE);
    xmlSiteMapListWithNoPageURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_LIST_WITH_NO_PAGE_URL);
    xmlSiteMapListURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_LIST_URL);
    xmlSiteMapInfoURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_INFO_URL);
    xmlSiteMapChaterListURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_CHATERLIST_URL);
    xmlSiteMapReaderURL = YiDuConstants.yiduConf.getString(YiDuConfig.XML_SITEMAP_READER_URL);
    compressEffective = YiDuConstants.yiduConf.getBoolean(YiDuConfig.COMPRESS_EFFECTIVE,false);
    txtEncoding = YiDuConstants.yiduConf.getString(YiDuConfig.TXT_ENCODING);

    addReviewWithoutLogin = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ADD_REVIEW_WITHOUT_LOGIN, true);
    enableMobileSite = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_MOBILE_SITE, true);
    judgmobilesitebydomian = YiDuConstants.yiduConf.getBoolean(YiDuConfig.JUDG_MOBILESITE_BY_DOMIAN, true);
    mobilesitedomian = YiDuConstants.yiduConf.getString(YiDuConfig.MOBILESITE_DOMIAN);
    enablePseudo = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PSEUDO, false);
    enableQQLogin = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_QQLOGIN, false);
    enableCacheArticleCount = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CACHE_ARTICLE_COUNT, false);
    enableChapterIndexPage = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CHAPTER_INDEX_PAGE, false);
    enableGenerateHtmlFile = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_GENERATE_HTML_FILE, false);
    enableMailAuth = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_MAIL_AUTH, false);
    mailSmtpAuth = YiDuConstants.yiduConf.getBoolean(YiDuConfig.MAIL_SMTP_AUTH, false);
    mailSmtpStarttlsEnable = YiDuConstants.yiduConf.getBoolean(YiDuConfig.MAIL_SMTP_STARTTLS_ENABLE, false);
    mailSmtpHost = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_HOST);
    mailSmtpPort = YiDuConstants.yiduConf.getInt(YiDuConfig.MAIL_SMTP_PORT, 25);
    mailSmtpUsername = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_USERNAME);
    mailSmtpPassword = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_PASSWORD);
    mailSmtpFrom = YiDuConstants.yiduConf.getString(YiDuConfig.MAIL_SMTP_FROM);
    maxSubscribe = YiDuConstants.yiduConf.getInt(YiDuConfig.MAX_SUBSCRIBE, 30);
    sendSubscribeInteval = YiDuConstants.yiduConf.getInt(YiDuConfig.SEND_SUBSCRIBE_INTEVAL, 15);
    enableSingleBook = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_SINGLE_BOOK, false);
    rootDomain = YiDuConstants.yiduConf.getString(YiDuConfig.ROOT_DOMAIN);
    excludeSubDomain = YiDuConstants.yiduConf.getString(YiDuConfig.EXCLUDE_SUB_DOMAIN);
    reloadSingleBookInterval = YiDuConstants.yiduConf.getInt(YiDuConfig.RELOAD_SINGLE_BOOK_INTERVAL, 120);
    enableCleanImageUrl = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CLEAN_IMAGE_URL, false);
    filterKeyWord = YiDuConstants.yiduConf.getString(YiDuConfig.FILTER_KEYWORD);
    enablePinyinUrl = YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_PINYINURL, false);

    // 设定文件初期读入
    try {
        PropertiesConfiguration jdbcConf = new PropertiesConfiguration("jdbc.properties");

        dburl = jdbcConf.getString(YiDuConfig.JDBC_URL);
        username = jdbcConf.getString(YiDuConfig.JDBC_USERNAME);
        password = jdbcConf.getString(YiDuConfig.JDBC_PASSWORD);

        PropertiesConfiguration qqconnectConfig = new PropertiesConfiguration("qqconnectconfig.properties");
        appId = qqconnectConfig.getString(YiDuConfig.APP_ID);
        appKey = qqconnectConfig.getString(YiDuConfig.APP_KEY);

    } catch (ConfigurationException e) {
        logger.error(e);
    }

}
 
开发者ID:Chihpin,项目名称:Yidu,代码行数:71,代码来源:ConfigEditAction.java

示例10: main

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  // create the parser
  CommandLineParser parser = new DefaultParser();
  CommandLine line = parser.parse(getOptions(), args);

  // config file
  PropertiesConfiguration config = new PropertiesConfiguration(
      line.getOptionValue("config", "config/tracker.properties"));

  // storage
  PostgreStorage storage = new PostgreStorage(config.getString("storage.url"),
      config.getString("storage.username"), config.getString("storage.password"));

  // target market
  String market = line.getOptionValue("market", "all");

  // clear
  if (line.hasOption("clear")) {
    storage.clear(market);
    logger.info("Data has been cleared");
  }

  // update
  if (line.hasOption("update")) {
    // files directory
    String directory = line.getOptionValue("directory", "hkex/");

    // parse date range and update storage
    Date startDate = DateUtils.parseDate(line.getOptionValue("start"), "yyyy/MM/dd");
    Date endDate = DateUtils.parseDate(line.getOptionValue("end"), "yyyy/MM/dd");

    // create tracker instance
    Tracker tracker = new Tracker(directory, storage);

    // target market
    switch (market) {
      case "all":
        tracker.parseRangeForAll(startDate, endDate);
        break;
      case "shanghai":
        tracker.parseRangeForShanghai(startDate, endDate);
        break;
      case "shenzhen":
        tracker.parseRangeForShenZhen(startDate, endDate);
        break;
      case "hongkong":
        tracker.parseRangeForHongKong(startDate, endDate);
        break;
      default:
        throw new IllegalArgumentException(
            "Unexpected value for line option 'market': " + market);
    }

    logger.info("Market {} date {} to {} data has been updated", market,
        line.getOptionValue("start"), line.getOptionValue("end"));
  }
}
 
开发者ID:longkerdandy,项目名称:qfii-tracker,代码行数:58,代码来源:Tracker.java

示例11: changeKey

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
private boolean changeKey(PropertiesConfiguration props, String suffix, boolean clearOnly)
{
	String eventServiceVal = props.getString(EVENT_SERVICE_PREFIX + suffix);
	String sessionServiceVal = props.getString(USER_SESSION_SERVICE_PREFIX + suffix);

	String useVal = (eventServiceVal == null ? sessionServiceVal : eventServiceVal);
	if( useVal != null )
	{
		if( !clearOnly )
		{
			props.setProperty(CHANNEL_SERVICE_PREFIX + suffix, useVal);
		}
		props.clearProperty(EVENT_SERVICE_PREFIX + suffix);
		props.clearProperty(USER_SESSION_SERVICE_PREFIX + suffix);
		return true;
	}
	return false;
}
 
开发者ID:equella,项目名称:Equella,代码行数:19,代码来源:UpdateClusterConfig.java


注:本文中的org.apache.commons.configuration.PropertiesConfiguration.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。