當前位置: 首頁>>代碼示例>>Java>>正文


Java HierarchicalConfiguration.getLong方法代碼示例

本文整理匯總了Java中org.apache.commons.configuration.HierarchicalConfiguration.getLong方法的典型用法代碼示例。如果您正苦於以下問題:Java HierarchicalConfiguration.getLong方法的具體用法?Java HierarchicalConfiguration.getLong怎麽用?Java HierarchicalConfiguration.getLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.configuration.HierarchicalConfiguration的用法示例。


在下文中一共展示了HierarchicalConfiguration.getLong方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildStoreConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) {
    StringBuilder sb = new StringBuilder();
    String name = configuration.getString("name");
    if ( name == null ) sb.append("store name is not defined ");
    String path = configuration.getString("path","data");
    String filename = configuration.getString("filename", name);
    boolean delay = configuration.getBoolean("delay", true);
    int mode = configuration.getInt("mode", 0);
    int freq = configuration.getInt("freq", this.freq == 0 ? 1 : this.freq );
    int batchSize = configuration.getInt("batchSize", 10);
    String logPath = configuration.getString("logPath","log");
    List<String> replicaUrl = configuration.getList("replicaUrl");
    long replciaTimeout = configuration.getLong("replicaTimeout", 60000);
    if (replicaUrl == null ) sb.append("no replicaUrl is defined");
    boolean sorted = configuration.getBoolean("sorted", false);
    if ( sb.length() > 0 ) {
        throw new RuntimeException("error on buildStoreConfig "+sb.toString());
    }
    else {
        StoreConfig storeConfig = new StoreConfig(name, path, freq, replicaUrl, batchSize, delay, mode, sorted);
        storeConfig.setGetTriggerName( configuration.getString("getTrigger"));
        storeConfig.setPutTriggerName( configuration.getString("putTrigger"));
        storeConfig.setDeleteTriggerName( configuration.getString("deleteTrigger"));
        storeConfig.setUseMaxCache(configuration.getBoolean("useMaxCache", false));
        storeConfig.setMaxCacheMemory(configuration.getInt("maxCacheMemory", 20000));
        storeConfig.setUseLRU(configuration.getBoolean("useLRU", false));
        storeConfig.setLogPath( logPath);
        storeConfig.setReplicaTimeout( replciaTimeout);
        //add pstReplicaURl
        storeConfig.setPstReplicaUrl( configuration.getList("pstReplicaUrl"));
        storeConfig.setSerializeClass(configuration.getString("serializeClass"));
        return storeConfig ;
    }

}
 
開發者ID:viant,項目名稱:CacheStore,代碼行數:36,代碼來源:BuildRemoteConfig.java

示例2: buildStoreConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) {
        StringBuilder sb = new StringBuilder();
        String name = configuration.getString("name");
        if ( name == null ) sb.append("store name is not defined ");
        String path = configuration.getString("path","data");
        String filename = configuration.getString("filename", name);
        boolean delay = configuration.getBoolean("delayWrite", true);
        int mode = configuration.getInt("mode", 0);
        int delayThread = configuration.getInt("delayThread", 2);
        String serializeClass = configuration.getString("serializer", "com.sm.localstore.impl.HessianSerializer");
        String blockSizeClass = configuration.getString("blockSize");
        BlockSize blockSize = null;
        if ( blockSizeClass != null ) {
            try {
                blockSize = (BlockSize) Class.forName(blockSizeClass).newInstance();
            } catch (Exception ex) {
                sb.append(("unable to load "+blockSizeClass+" "+ex.getMessage()));
            }
        }
        boolean useCache = configuration.getBoolean("useCache", false);
        long maxCache = configuration.getLong("maxCache", 1000 * 1000 * 1000L);
        String logPath = configuration.getString("logPath", "log");
        String replicaUrl = configuration.getString("replicaUrl");
        String purgeClass = configuration.getString("purgeClass");
        if ( sb.length() > 0 ) {
            throw new RuntimeException("error on buildStoreConfig "+sb.toString());
        }
        else {
            StoreConfig storeConfig = new StoreConfig(name, path, 10, null );
            storeConfig.setDelay( delay);
            storeConfig.setDelayThread(delayThread);
            storeConfig.setLogPath( logPath);
            storeConfig.setBlockSize( blockSize);
            storeConfig.setPurgeClass(purgeClass);
//            return new StoreConfig(name, path, filename, delay, mode, writeThread, useCache, maxCache, maxCache,
//                    logPath, serializeClass, blockSize, replicaUrl);
            return storeConfig;
        }
    }
 
開發者ID:viant,項目名稱:CacheStore,代碼行數:40,代碼來源:BuildStoreConfig.java

示例3: create

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
public static EodDataProvider create(HierarchicalConfiguration appConfig, String type) throws EodDataProviderException {
  
  // TODO: Use reflection here.  Probably need a Builder to abstract away different construction arguments
  if (type.compareTo(EODDATADATAPROVIDER_KEY) == 0) {

    String serviceUrl = appConfig.getString("eodDataProviders.eodDataProvider(0).serviceUrl");
    String username = appConfig.getString("eodDataProviders.eodDataProvider(0).username");
    String password = appConfig.getString("eodDataProviders.eodDataProvider(0).password");
    long timeout = appConfig.getLong("eodDataProviders.eodDataProvider(0).timeout");
    
    return new EodDataEodDataProvider(serviceUrl,
		     username,
		     password,
		     timeout);

  }
  else {
    
    StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append("Unknown data provider type [ ");
    stringBuffer.append(type);
    stringBuffer.append(" ] ");
    throw new EodDataProviderException(stringBuffer.toString());

  }

}
 
開發者ID:jsr38,項目名稱:ds3,代碼行數:28,代碼來源:EodDataProviderFactory.java


注:本文中的org.apache.commons.configuration.HierarchicalConfiguration.getLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。