streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steveblackmon <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: Gplus fix
Date Mon, 17 Nov 2014 23:43:36 GMT
Github user steveblackmon commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/133#discussion_r20475276
  
    --- Diff: streams-contrib/streams-provider-google/google-gplus/src/main/java/com/google/gplus/provider/GPlusConfigurator.java
---
    @@ -18,37 +18,53 @@
     
     package com.google.gplus.provider;
     
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import com.google.common.base.Preconditions;
     import com.typesafe.config.Config;
    +import com.typesafe.config.ConfigRenderOptions;
     import org.apache.streams.config.StreamsConfigurator;
     import org.apache.streams.google.gplus.GPlusConfiguration;
     import org.apache.streams.google.gplus.GPlusOAuthConfiguration;
    +import org.apache.streams.jackson.StreamsJacksonMapper;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
    +import java.io.IOException;
    +
     /**
      * Created by sblackmon on 12/10/13.
      */
     public class GPlusConfigurator {
     
         private final static Logger LOGGER = LoggerFactory.getLogger(GPlusConfigurator.class);
    +    private static final ObjectMapper MAPPER = StreamsJacksonMapper.getInstance();
     
         public static GPlusConfiguration detectConfiguration(Config config) {
    -        Config oauth = StreamsConfigurator.config.getConfig("gplus.oauth");
    -
    -        GPlusConfiguration gplusConfiguration = new GPlusConfiguration();
    -
    -        gplusConfiguration.setProtocol(config.getString("protocol"));
    -        gplusConfiguration.setHost(config.getString("host"));
    -        gplusConfiguration.setPort(config.getLong("port"));
    -        gplusConfiguration.setVersion(config.getString("version"));
    -        GPlusOAuthConfiguration gPlusOAuthConfiguration = new GPlusOAuthConfiguration();
    -        gPlusOAuthConfiguration.setConsumerKey(oauth.getString("consumerKey"));
    -        gPlusOAuthConfiguration.setConsumerSecret(oauth.getString("consumerSecret"));
    -        gPlusOAuthConfiguration.setAccessToken(oauth.getString("accessToken"));
    -        gPlusOAuthConfiguration.setAccessTokenSecret(oauth.getString("accessTokenSecret"));
    -        gplusConfiguration.setOauth(gPlusOAuthConfiguration);
    -
    -        return gplusConfiguration;
    +//        Config oauth = StreamsConfigurator.config.getConfig("gplus.oauth");
    +//
    +//        GPlusConfiguration gplusConfiguration = new GPlusConfiguration();
    +//
    +//        gplusConfiguration.setProtocol(config.getString("protocol"));
    +//        gplusConfiguration.setHost(config.getString("host"));
    +//        gplusConfiguration.setPort(config.getLong("port"));
    +//        gplusConfiguration.setVersion(config.getString("version"));
    +//        GPlusOAuthConfiguration gPlusOAuthConfiguration = new GPlusOAuthConfiguration();
    +//        gPlusOAuthConfiguration.setConsumerKey(oauth.getString("consumerKey"));
    +//        gPlusOAuthConfiguration.setConsumerSecret(oauth.getString("consumerSecret"));
    +//        gPlusOAuthConfiguration.setAccessToken(oauth.getString("accessToken"));
    +//        gPlusOAuthConfiguration.setAccessTokenSecret(oauth.getString("accessTokenSecret"));
    +//        gPlusOAuthConfiguration.setAppName(oauth.getString("appName"));
    +//        gplusConfiguration.setOauth(gPlusOAuthConfiguration);
    +//
    +        GPlusConfiguration configuration = null;
    +        try {
    +            configuration = MAPPER.readValue(config.root().render(ConfigRenderOptions.concise()),
GPlusConfiguration.class);
    --- End diff --
    
    This can now be done by importing streams-config then
    new ComponentConfigurator<GPlusConfiguration>().detectConfiguration(GPlusConfiguration.class)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message