Package play

Examples of play.Configuration


         * The application.conf must always be empty when packaged so there is nothing hidden from the user.
         * We are merging, because the Configuration object already contains some information the web-interface needs.
         *
         */
        }
        return new Configuration(
                config.withFallback(configuration.getWrappedConfiguration().underlying())
        );
    }
View Full Code Here


                config.withFallback(configuration.getWrappedConfiguration().underlying())
        );
    }

    private void setupLocalUser(ApiClient api, SimpleAccountRealm realm, Application app) {
        final Configuration config = app.configuration();
        final String username = config.getString("local-user.name", "localadmin");
        final String passwordHash = config.getString("local-user.password-sha2");
        if (passwordHash == null) {
            log.warn("No password hash for local user {} set. " +
                            "If you lose connection to the graylog2-server at {}, you will be unable to log in!",
                    username, config.getString("graylog2-server"));
            return;
        }
        realm.addAccount(
                username,
                passwordHash,
View Full Code Here

            this.envelop = envelop;
        }

        public void run() {

            final Configuration root = Configuration.root();
            final String mailFrom = root.getString("mail.from");

            final String mailSign = root.getString("mail.sign");
      String messageText = envelop.message + "\n\n " + mailSign;
      String messageHtml = envelop.message + "<br><br>--<br>" + mailSign;

      for (String toEmail : envelop.toEmails) {
        sendEmail(mailFrom, messageText, messageHtml, envelop.subject,
            toEmail);
      }

            Logger.debug("Mail sent - SMTP: {} : {} SSL: {} user: {} password: {} message: {}",
                    root.getString("smtp.host"),
                    root.getString("smtp.port"),
                    root.getString("smtp.ssl"),
                    root.getString("smtp.user"),
                    root.getString("smtp.password"),
                    messageText);
        }
View Full Code Here

        }

        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.setFrom(mailFrom);
            email.setSubject(envelop.subject);
            for (String toEmail : envelop.toEmails) {
                email.setRecipient(toEmail);
                Logger.debug("Mail.sendMail: Mail will be sent to " + toEmail);
            }

            final String mailSign = root.getString("mail.sign");
            email.send(envelop.message + "\n\n " + mailSign,
                    envelop.message + "<br><br>--<br>" + mailSign);

            Logger.debug("Mail sent - SMTP:" + root.getString("smtp.host")
                    + ":" + root.getString("smtp.port")
                    + " SSL:" + root.getString("smtp.ssl")
                    + " user:" + root.getString("smtp.user")
                    + " password:" + root.getString("smtp.password"));
        }
View Full Code Here

  @Override
  public void onStart() {

    final List<String> neededSettings = neededSettingKeys();
    if (neededSettings != null) {
      final Configuration c = getConfiguration();
      if (c == null) {
        throw new RuntimeException("No settings for provider '"
            + getKey() + "' available at all!");
      }
      for (final String key : neededSettings) {
        final String setting = c.getString(key);
        if (setting == null || "".equals(setting)) {
          throw new RuntimeException("Provider '" + getKey()
              + "' missing needed setting '" + key + "'");
        }
      }
View Full Code Here

        return Collections.<String, String>emptyMap();
    }

  protected I getAccessToken(final String code, final Request request)
            throws AccessTokenException, ResolverMissingException {
    final Configuration c = getConfiguration();
    final String params = getAccessTokenParams(c, code, request);
    final String url = c.getString(SettingKeys.ACCESS_TOKEN_URL);
        final WSRequestHolder wrh = WS.url(url);
        wrh.setHeader(CONTENT_TYPE, "application/x-www-form-urlencoded");
        for(final Map.Entry<String, String> header : getHeaders().entrySet()) {
            wrh.setHeader(header.getKey(), header.getValue());
        }
View Full Code Here

  protected abstract I buildInfo(final WSResponse r)
      throws AccessTokenException;

  protected String getAuthUrl(final Request request, final String state)
      throws AuthException {
    final Configuration c = getConfiguration();
    final List<NameValuePair> params = getAuthParams(c, request, state);
    return generateURI(c.getString(SettingKeys.AUTHORIZATION_URL), params);
  }
View Full Code Here

    if (Logger.isDebugEnabled()) {
      Logger.debug("Returned with URL: '" + uri + "'");
    }

    final Configuration c = getConfiguration();

    final ConsumerKey key = new ConsumerKey(
        c.getString(SettingKeys.CONSUMER_KEY),
        c.getString(SettingKeys.CONSUMER_SECRET));
    final String requestTokenURL = c
        .getString(SettingKeys.REQUEST_TOKEN_URL);
    final String accessTokenURL = c.getString(SettingKeys.ACCESS_TOKEN_URL);
    final String authorizationURL = c
        .getString(SettingKeys.AUTHORIZATION_URL);
    final ServiceInfo info = new ServiceInfo(requestTokenURL,
        accessTokenURL, authorizationURL, key);
    final OAuth service = new OAuth(info, true);
View Full Code Here

  }

  protected OAuthCalculator getOAuthCalculator(final OAuth1AuthInfo info) {
    final RequestToken token = new RequestToken(info.getAccessToken(),
        info.getAccessTokenSecret());
    final Configuration c = getConfiguration();
    final ConsumerKey cK = new ConsumerKey(
        c.getString(SettingKeys.CONSUMER_KEY),
        c.getString(SettingKeys.CONSUMER_SECRET));

        return new OAuthCalculator(cK, token);
  }
View Full Code Here

      }
    }
  }

  private Map<String, String> getAttributes(final String subKey) {
    final Configuration attributes = getConfiguration().getConfig(
        SettingKeys.ATTRIBUTES + "." + subKey);
    if (attributes != null) {
      final Set<String> keys = attributes.keys();
      final Map<String, String> ret = new HashMap<String, String>(
          keys.size());
      for (final String key : keys) {
        ret.put(key, attributes.getString(key));
      }
      return ret;
    }

    return null;
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.