Package org.jmxtrans.embedded.config

Examples of org.jmxtrans.embedded.config.ConfigurationParser


        EmbeddedJmxTransIntegrationTest integrationTest = new EmbeddedJmxTransIntegrationTest();
        integrationTest.integrationTest();
    }

    public void integrationTest() throws Exception {
        EmbeddedJmxTrans embeddedJmxTrans = new ConfigurationParser().newEmbeddedJmxTrans("classpath:org/jmxtrans/embedded/embedded-integ-test.json");
        embeddedJmxTrans.start();

        generateJvmActivity();

        System.out.println("bye");
View Full Code Here


    public void contextInitialized(ServletContextEvent sce) {
        sce.getServletContext().log("Start embedded-jmxtrans ...");

        mbeanServer = ManagementFactory.getPlatformMBeanServer();

        ConfigurationParser configurationParser = new ConfigurationParser();

        String configuration = configureFromSystemProperty(sce);
        if (configuration == null || configuration.isEmpty()){
            configuration = configureFromWebXmlParam(sce);
            if (configuration == null || configuration.isEmpty()){
                configuration = "classpath:jmxtrans.json, classpath:org/jmxtrans/embedded/config/jmxtrans-internals-servlet-container.json";
            }
        }

        List<String> configurationUrls = StringUtils2.delimitedStringToList(configuration);
        embeddedJmxTrans = configurationParser.newEmbeddedJmxTrans(configurationUrls);
        String on = "org.jmxtrans.embedded:type=EmbeddedJmxTrans,name=jmxtrans,path=" + sce.getServletContext().getContextPath();
        try {
            objectName = mbeanServer.registerMBean(embeddedJmxTrans, new ObjectName(on)).getObjectName();
        } catch (Exception e) {
            throw new EmbeddedJmxTransException("Exception registering '" + objectName + "'", e);
View Full Code Here

        if (embeddedJmxTrans == null) {

            if (configurationUrls == null) {
                configurationUrls = Collections.singletonList(DEFAULT_CONFIGURATION_URL);
            }
            ConfigurationParser parser = new ConfigurationParser();
            SpringEmbeddedJmxTrans newJmxTrans = new SpringEmbeddedJmxTrans();
            newJmxTrans.setObjectName("org.jmxtrans.embedded:type=EmbeddedJmxTrans,name=" + beanName);

            for (String delimitedConfigurationUrl : configurationUrls) {
                String[] tokens = StringUtils.commaDelimitedListToStringArray(delimitedConfigurationUrl);
                tokens = StringUtils.trimArrayElements(tokens);
                for (String configurationUrl : tokens) {
                    configurationUrl = configurationUrl.trim();
                    logger.debug("Load configuration {}", configurationUrl);
                    Resource configuration = resourceLoader.getResource(configurationUrl);
                    if (configuration.exists()) {
                        try {
                            parser.mergeEmbeddedJmxTransConfiguration(configuration.getInputStream(), newJmxTrans);
                        } catch (Exception e) {
                            throw new EmbeddedJmxTransException("Exception loading configuration " + configuration, e);
                        }
                    } else if (ignoreConfigurationNotFound) {
                        logger.debug("Ignore missing configuration file {}", configuration);
View Full Code Here

TOP

Related Classes of org.jmxtrans.embedded.config.ConfigurationParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.