當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。