Package play

Examples of play.Configuration


        }

        public void run() {
            MailerAPI email = play.Play.application().plugin(MailerPlugin.class).email();

            final Configuration root = Configuration.root();
            final String mailFrom = root.getString("mail.from");
            email.addFrom(mailFrom);
            email.setSubject(envelop.subject);
            for (String toEmail : envelop.toEmails) {
                email.addRecipient(toEmail);
                log.debug("Mail will be sent to {}", toEmail);
            }

            String message = envelop.message.body();
            log.debug("Mail Message: [{}]", message);
            email.sendHtml(message);

            log.debug("SMTP:" + root.getString("smtp.host")
                    + ":" + root.getString("smtp.port")
                    + " SSL:" + root.getString("smtp.ssl")
                    + " user:" + root.getString("smtp.user"));
        }
View Full Code Here


    /**
     * Load additional mappings from config entry "elasticsearch.index.mapping"
     * @param indexName
     */
    private void loadMappingFromConfig(String indexName) {
        Configuration mappingConfig = application.configuration().getConfig("elasticsearch." + indexName + ".mappings");
        if (mappingConfig != null) {
            Map<String, Object> mappings = mappingConfig.asMap();
            for (String indexType : mappings.keySet()) {
                IndexQueryPath indexQueryPath = new IndexQueryPath(indexName, indexType);
                if (mappings.get(indexType) instanceof String) {
                    indexMappings.put(indexQueryPath, (String) mappings.get(indexType));
                } else {
View Full Code Here

    /**
     * Load additional mappings from config entry "elasticsearch.index.mapping"
     * @param indexName
     */
    private void loadMappingFromConfig(String indexName) {
        Configuration mappingConfig = application.configuration().getConfig("elasticsearch." + indexName + ".mappings");
        if (mappingConfig != null) {
            Map<String, Object> mappings = mappingConfig.asMap();
            for (String indexType : mappings.keySet()) {
                IndexQueryPath indexQueryPath = new IndexQueryPath(indexName, indexType);
                if (mappings.get(indexType) instanceof String) {
                    indexMappings.put(indexQueryPath, (String) mappings.get(indexType));
                } else {
View Full Code Here

        private final JPAConfig jpaConfig;

        @Inject
        public JPAConfigProvider(Configuration configuration) {
            ImmutableSet.Builder<JPAConfig.PersistenceUnit> persistenceUnits = new ImmutableSet.Builder<JPAConfig.PersistenceUnit>();
            Configuration jpa = configuration.getConfig("jpa");
            if (jpa != null) {
                for (String name : jpa.keys()) {
                    String unitName = jpa.getString(name);
                    persistenceUnits.add(new JPAConfig.PersistenceUnit(name, unitName));
                }
            }
            jpaConfig = new DefaultJPAConfig(persistenceUnits.build());
        }
View Full Code Here

            String defaultServer = configuration.getString("ebeanconfig.datasource.default", "default");

            Model.setDefaultServer(defaultServer);

            Configuration ebeanConf = configuration.getConfig("ebean");

            Map<String, ServerConfig> serverConfigs = new HashMap<String, ServerConfig>();

            if (ebeanConf != null) {
                for (String key: ebeanConf.keys()) {

                    ServerConfig config = new ServerConfig();
                    config.setName(key);
                    config.loadFromProperties();
                    try {
                        config.setDataSource(new WrappingDatasource(dbApi.getDatabase(key).getDataSource()));
                    } catch(Exception e) {
                        throw ebeanConf.reportError(
                            key,
                            e.getMessage(),
                            e
                        );
                    }

                    if (defaultServer.equals(key)) {
                        config.setDefaultServer(true);
                    }

                    String[] toLoad = ebeanConf.getString(key).split(",");
                    Set<String> classes = new HashSet<String>();
                    for (String load: toLoad) {
                        load = load.trim();
                        if (load.endsWith(".*")) {
                            classes.addAll(play.libs.Classpath.getTypes(environment, load.substring(0, load.length()-2)));
                        } else {
                            classes.add(load);
                        }
                    }
                    for (String clazz: classes) {
                        try {
                            config.addClass(Class.forName(clazz, true, environment.classLoader()));
                        } catch (Throwable e) {
                            throw ebeanConf.reportError(
                                key,
                                "Cannot register class [" + clazz + "] in Ebean server",
                                e
                            );
                        }
View Full Code Here

TOP

Related Classes of play.Configuration

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.