Package com.avast.syringe.config.internal

Examples of com.avast.syringe.config.internal.XmlConfigParser$ErrorHandlerImplementation


        configFileName = completeFileName(configFileName, contextDir);

        LOGGER.info("Loading XML configuration from {}", configFileName);

        T instance;
        XmlConfigParser xmlConfigParser = new XmlConfigParser();
        InputStream input;
        final File configFile = new File(contextDir, configFileName);
        if (configFileName.endsWith(".ftl")) {
            // the input file is a FreeMarker template, so process it
            // TODO:could be used normalize from file
            // configFileName can be in form ../configuration/Template.ftl, we have to remove ../ so fm can recognize path
            String trimedConfigFileName = configFileName;
            while(trimedConfigFileName.startsWith("../")) {
                trimedConfigFileName = trimedConfigFileName.substring(3);
            }
            input = processFreeMarkerTemplate(trimedConfigFileName);
        } else {
            input = new FileInputStream(configFile);
        }

        final XmlConfig xmlConfig;
        try {
            xmlConfig = xmlConfigParser.loadConfig(input);
        } finally {
            input.close();
        }

        Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(xmlConfig.getClassName());
View Full Code Here


        if (!configFile.exists() && !configInjector.containsMandatory()) {
            // the default config
            configBean = configClass.newInstance();
        } else {
            URL schemaUrl = getSchemaUrl(configClass);
            Map<String, Property> props = new XmlConfigParser(schemaUrl).loadProperties(configFile);
            configBean = configInjector.inject(props, new Injection.ContextualPropertyResolver() {
                @Override
                public Object getProperty(InjectableProperty property, Value configValue) throws Exception {
                    // Allow injection of this configuration loader
                    if (ConfigurationLoader.class.isAssignableFrom(property.getType())) {
View Full Code Here

TOP

Related Classes of com.avast.syringe.config.internal.XmlConfigParser$ErrorHandlerImplementation

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.