Package net.csdn.common.env

Examples of net.csdn.common.env.Environment


    private Logger createLogger(String name) {
        Logger logger = Logger.getLogger(name);
        Layout layout = new PatternLayout("%m%n");
        Appender appender = null;
        try {
            Environment environment = new Environment(settings);
            appender = new DailyRollingFileAppender(layout, environment.logsFile().getPath() + "/" + name + "/" + name, "'.'yyyy-MM-dd");
        } catch (IOException e) {
            e.printStackTrace();
        }
        logger.addAppender(appender);
        return logger;
View Full Code Here


        this.systemLogger = systemLogger;
        this.restController = restController;
        this.api = api;
        registerHttpStartProcessor(new DefaultHttpStartProcessor());
        registerHttpFinishProcessor(new DefaultHttpFinishProcessor());
        Environment environment = new Environment(settings);
        disableMysql = settings.getAsBoolean(ServiceFramwork.mode + ".datasources.mysql.disable", false);
        server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        QueuedThreadPool threadPool = new QueuedThreadPool();
        threadPool.setMinThreads(settings.getAsInt("http.threads.min", 100));
        threadPool.setMaxThreads(settings.getAsInt("http.threads.max", 1000));
        connector.setThreadPool(threadPool);
        connector.setPort(settings.getAsInt("http.port", 8080));
        server.addConnector(connector);

        HandlerList handlers = new HandlerList();
        if (settings.getAsBoolean("application.static.enable", false)) {
            ResourceHandler resource_handler = new ResourceHandler();
            resource_handler.setDirectoriesListed(false);
            try {
                resource_handler.setBaseResource(Resource.newResource(environment.templateDirFile().getPath() + "/assets/"));
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (settings.getAsBoolean("application.session.enable", false)) {
                SessionManager sessionManager = new HashSessionManager();
View Full Code Here

* 6/29/13 WilliamZhu(allwefantasy@gmail.com)
*/
public class TemplateLoader implements Loader {
    @Override
    public void load(Settings settings) throws Exception {
        Environment environment = new Environment(settings);
        if (settings.getAsBoolean("application.template.engine.enable", false)) {
            Properties properties = new Properties();
            properties.setProperty("file.resource.loader.path", environment.templateDirFile().getPath());
            properties.setProperty("input.encoding", "utf-8");
            properties.setProperty("output.encoding", "utf-8");
            properties.setProperty("runtime.log", environment.logsFile().getPath() + "/template");
            Velocity.init(properties);
        }
    }
View Full Code Here

    public static void configure(Settings settings) {
        if (loaded) {
            return;
        }
        loaded = true;
        Environment environment = new Environment(settings);
        ImmutableSettings.Builder settingsBuilder = settingsBuilder().put(settings);

        settingsBuilder.loadFromUrl(environment.resolveConfig("logging.yml"))
                .replacePropertyPlaceholders();

        Properties props = new Properties();
        for (Map.Entry<String, String> entry : settingsBuilder.build().getAsMap().entrySet()) {
            String key = "log4j." + entry.getKey();
View Full Code Here

        if (settingsBuilder.get("cluster.name") == null) {
            settingsBuilder.put("cluster.name", "csdn_search");
        }

        Environment environment = new Environment(settingsBuilder.build());
        settingsBuilder.loadFromUrl(environment.resolveConfig("application.yml"));

        Settings v1 = settingsBuilder.build();

        environment = new Environment(v1);

        // put back the env settings
        settingsBuilder = settingsBuilder().put(v1);
        settingsBuilder.put("path.home", cleanPath(environment.homeFile().getAbsolutePath()));
        settingsBuilder.put("path.work", cleanPath(environment.workFile().getAbsolutePath()));
        settingsBuilder.put("path.work_with_cluster", cleanPath(environment.workWithClusterFile().getAbsolutePath()));
        settingsBuilder.put("path.data", cleanPath(environment.dataFile().getAbsolutePath()));
        settingsBuilder.put("path.data_with_cluster", cleanPath(environment.dataWithClusterFile().getAbsolutePath()));
        settingsBuilder.put("path.logs", cleanPath(environment.logsFile().getAbsolutePath()));


        return new Tuple<Settings, Environment>(settingsBuilder.build(), environment);

    }
View Full Code Here

TOP

Related Classes of net.csdn.common.env.Environment

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.