• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XPathExpressionEngine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.configuration.tree.xpath.XPathExpressionEngine的典型用法代码示例。如果您正苦于以下问题:Java XPathExpressionEngine类的具体用法?Java XPathExpressionEngine怎么用?Java XPathExpressionEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XPathExpressionEngine类属于org.apache.commons.configuration.tree.xpath包,在下文中一共展示了XPathExpressionEngine类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadConfiguration

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
private void loadConfiguration() {
    Properties sysProps = System.getProperties();
    String configFileName = sysProps.getProperty("test.config.filename");

    if (StringUtils.isEmpty(configFileName)) {
        configFileName = defaultConfigurationFileName;
    }

    try {
        AllConfiguration = new DefaultConfigurationBuilder(configFileName).getConfiguration();
        ((HierarchicalConfiguration) AllConfiguration).setExpressionEngine(new XPathExpressionEngine());
    } catch (Exception e) {
        Fail.fail("failed to read config file", e);
        log.error("Failed to read config file", e);
    }
}
 
开发者ID:AgileTestingFramework,项目名称:atf-toolbox-java,代码行数:17,代码来源:ConfigurationManager.java


示例2: Configuration

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
/**
 * Loads the configuration from the specified File.
 * 
 * @param file
 *            the file the config is stored in
 * @throws ConfigurationException
 *             if the configuration file can't be read.
 * @throws FileNotFoundException
 *             if the file can't be found
 */
public Configuration(File file) throws ConfigurationException,
        FileNotFoundException {

    LOGGER.info("Loading configuration from file: "
            + file.getAbsolutePath());

    if (!file.exists()) {
        LOGGER.warning("Could not find configuration file: "
                + file.getAbsolutePath());
        throw new FileNotFoundException(file.getAbsolutePath());
    }
    m_configXML = file;
    m_config = new XMLConfiguration(file);

    // set xpath engine for more powerful queries
    m_config.setExpressionEngine(new XPathExpressionEngine());
    loadToMember();
    // save();
}
 
开发者ID:team-grit,项目名称:grit,代码行数:30,代码来源:Configuration.java


示例3: main

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
public static void main (String[]args) throws ConfigurationException, HTAPBException{
    // Initialize log4j
    String log4jPath = System.getProperty("log4j.configuration");
    if (log4jPath != null) {
        org.apache.log4j.PropertyConfigurator.configure(log4jPath);
    } else {
        throw new RuntimeException("Missing log4j.properties file");
    }
    
    String configFile = "config/htapb_config_postgres.xml";
    XMLConfiguration xmlConfig = new XMLConfiguration(configFile);
    xmlConfig.setExpressionEngine(new XPathExpressionEngine());
    
    
    WorkloadSetup setup = new WorkloadSetup(xmlConfig);
    setup.computeWorkloadSetup();
    
    
    DensityConsultant density = new DensityConsultant(10000);
    System.out.println("Density: "+density.getDensity());
    System.out.println("Delta TS: "+density.getDeltaTs());
    System.out.println("Target TPS "+density.getTargetTPS());
    
    long deltaTs = density.getDeltaTs();
    
    Clock clock = new Clock(deltaTs,false);
    
    System.out.println("Clock: current TS "+clock.getCurrentTs());

    int year = RandomParameters.randBetween(1993, 1997);
    int month = RandomParameters.randBetween(1, 12);
    long date1 = RandomParameters.convertDatetoLong(year, month, 1);
    long date2 = RandomParameters.convertDatetoLong(year+1, month, 1);
    Timestamp ts1 = new Timestamp(clock.transformTsFromSpecToLong(date1));  
    Timestamp ts2 = new Timestamp(clock.transformTsFromSpecToLong(date2));
    
    System.out.println(ts1.toString());
    System.out.println(ts2.toString());
    
}
 
开发者ID:faclc4,项目名称:HTAPBench,代码行数:41,代码来源:RandomExecutor.java


示例4: JBrickConfigManager

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
private JBrickConfigManager(String pStrConfigurationFilePath) {
       mXMLConfiguration = new XMLConfiguration();
       mXMLConfiguration.setFileName(pStrConfigurationFilePath);
       mXMLConfiguration.setExpressionEngine(new XPathExpressionEngine());
	try {
		mXMLConfiguration.load();
	} catch (ConfigurationException e) {
		mLog.error(e,"Error while reading configuration from file ",this.getStrConfigFileName());
		throw new JBrickException(e, "jBrickException.configManager.errorWhileReadingConfiguration", e.getMessage());
	}
	mLog.debug("ConfigManager initialized using file ", pStrConfigurationFilePath);
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:13,代码来源:JBrickConfigManager.java


示例5: read

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
public static XMLConfiguration read(String src) {
	try {
		// remove all namespaces from xml
		src = removeNSAndPreamble(src);
		XMLConfiguration config = new XMLConfiguration();
		config.setDelimiterParsingDisabled(true);
		config.load(new ByteArrayInputStream(src.getBytes()));
		config.setExpressionEngine(new XPathExpressionEngine());
		return config;

	} catch (ConfigurationException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:15,代码来源:XPathUtils.java


示例6: ProxymaContext

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
/**
 * Default constructor for this Class
 *
 * @param contextName the name of the context to create
 * @param contextBaseURI Base URI of the context
 * @param configurationFile proxyma configuration file to load
 * @param logsDirectoryPath directory where to write all the logs
 */
public ProxymaContext (String contextName, String contextBaseURI, String configurationFile, String logsDirectoryPath) {
    // Initialize private attributes
    try {
        this.contextName = contextName;
        this.proxymaContextBasePath = contextBaseURI;
        this.logsDirectoryPath = logsDirectoryPath;
        proxyFoldersByURLEncodedName = new ConcurrentHashMap<String, ProxyFolderBean>();
        proxyFoldersByDestinationHost = new ConcurrentHashMap<String, LinkedList<ProxyFolderBean>>();
        config = new XMLConfiguration(configurationFile);
        config.setExpressionEngine(new XPathExpressionEngine());
        if (this.log == null) {
            //create a unique logger for the whole context
            String name = ProxymaTags.DEFAULT_LOGGER_PREFIX + "." + contextName;
            this.log = Logger.getLogger(name);

            String logFile = logsDirectoryPath + "proxyma-" + contextName + ".log";
            String level = getSingleValueParameter(ProxymaTags.GLOBAL_LOGLEVEL);
            int maxSize = Integer.parseInt(getSingleValueParameter(ProxymaTags.GLOBAL_LOGFILE_MAXSIZE));
            int retention = Integer.parseInt(getSingleValueParameter(ProxymaTags.GLOBAL_LOGFILES_RETENTION));
            ProxymaLoggersUtil.initializeContextLogger(this.log, logFile, level, maxSize, retention);
        }
        this.defaultEncoding = getSingleValueParameter(ProxymaTags.GLOBAL_DEFAULT_ENCODING);
        this.proxymaVersion = "Proxyma-NG (Rel. " + getSingleValueParameter(ProxymaTags.CONFIG_FILE_VERSION) + ")";
    } catch (Exception ex) {
        Logger.getLogger("").log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:dpoldrugo,项目名称:proxyma,代码行数:36,代码来源:ProxymaContext.java


示例7: State

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
/**
 * Loads the state from the specified File.
 * 
 * @param file
 *            the file the config is stored in
 * @throws ConfigurationException
 *             if the config file is malformed
 * @throws FileNotFoundException
 *             if the specified file can't be found
 */
public State(File file) throws ConfigurationException,
        FileNotFoundException {
    if (!file.exists()) {
        throw new FileNotFoundException(file.getAbsolutePath());
    }
    m_state = new XMLConfiguration(file);
    m_stateFile = file;

    // set xpath engine for more powerful queries
    m_state.setExpressionEngine(new XPathExpressionEngine());
}
 
开发者ID:team-grit,项目名称:grit,代码行数:22,代码来源:State.java


示例8: readConfig

import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine; //导入依赖的package包/类
/**
     * Constructor pulls file out of the jar or reads from disk and sets up refresh policy.
     * 
     * @param expressionEngine
     *            the expression engine to use. Null results in default expression engine
     */
    protected void readConfig() {
        try {
            ExpressionEngine expressionEngine = new XPathExpressionEngine();
            String configPath = getConfigName();
            FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy();

            File dataDirConfigFile = new File(configPath);
//            LOG.info("Reading settings from " + dataDirConfigFile.getAbsolutePath());
            if (!dataDirConfigFile.exists()) {
                // Load a default from the classpath:
                // Note: we don't let new XMLConfiguration() lookup the resource
                // url directly because it may not be able to find the desired
                // classloader to load the URL from.
                URL configResourceUrl = this.getClass().getClassLoader().getResource(configPath);
                if (configResourceUrl == null) {
                    throw new RuntimeException("unable to load resource: " + configPath);
                }

                XMLConfiguration tmpConfig = new XMLConfiguration(configResourceUrl);
                // Copy over a default configuration since none exists:
                // Ensure data dir location exists:
                if (dataDirConfigFile.getParentFile() != null && !dataDirConfigFile.getParentFile().exists()
                        && !dataDirConfigFile.getParentFile().mkdirs()) {
                    throw new RuntimeException("could not create directories.");
                }
                tmpConfig.save(dataDirConfigFile);
                LOG.info("Saving settings file to " + dataDirConfigFile.getAbsolutePath());
            }

            if (dataDirConfigFile.exists()) {
                config = new XMLConfiguration(dataDirConfigFile);
            } else {
                // extract from jar and write to
                throw new IllegalStateException("Config file does not exist or cannot be created");
            }
            if (expressionEngine != null) {
                config.setExpressionEngine(expressionEngine);
            }
            configFile = dataDirConfigFile;
            // reload at most once per thirty seconds on configuration queries.
            config.setReloadingStrategy(reloadingStrategy);
            initConfig(config);
        } catch (ConfigurationException e) {
            LOG.error("Error reading settings file: " + e, e);
            throw new RuntimeException(e);
        }
    }
 
开发者ID:intuit,项目名称:Tank,代码行数:54,代码来源:BaseCommonsXmlConfig.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TalonControlMode类代码示例发布时间:2022-05-22
下一篇:
Java TimePeriodValues类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap