Review Board 1.7.22


FLUME-978: Context interface is too basic requiring boilerplate user code

Review Request #3968 - Created Feb. 20, 2012 and submitted

Brock Noland
flime-728
FLUME-978
Reviewers
Flume
flume-git
1) Changing backing structure of Context from object to String
2) Add getBoolean, getInteger, getLong to Context
3) Remove get(key, clazz)
4) Add javadoc to public methods of Context
5) Change backing map of Context to synchronized map since it seems this class could be accessed by multiple threads.
Unit tests added for all new methods and some exiting methods.

All unit tests pass.

Diff revision 4 (Latest)

1 2 3 4
1 2 3 4

  1. flume-ng-channels/flume-jdbc-channel/src/main/java/org/apache/flume/channel/jdbc/impl/JdbcChannelProviderImpl.java: Loading...
  2. flume-ng-core/src/main/java/org/apache/flume/Context.java: Loading...
  3. flume-ng-core/src/main/java/org/apache/flume/channel/ChannelSelectorFactory.java: Loading...
  4. flume-ng-core/src/main/java/org/apache/flume/channel/MemoryChannel.java: Loading...
  5. flume-ng-core/src/main/java/org/apache/flume/channel/MultiplexingChannelSelector.java: Loading...
  6. flume-ng-core/src/main/java/org/apache/flume/channel/PseudoTxnMemoryChannel.java: Loading...
  7. flume-ng-core/src/main/java/org/apache/flume/sink/AvroSink.java: Loading...
  8. flume-ng-core/src/main/java/org/apache/flume/sink/RollingFileSink.java: Loading...
  9. flume-ng-core/src/main/java/org/apache/flume/sink/SinkGroup.java: Loading...
  10. flume-ng-core/src/main/java/org/apache/flume/sink/SinkProcessorFactory.java: Loading...
  11. flume-ng-core/src/main/java/org/apache/flume/source/AvroSource.java: Loading...
  12. flume-ng-core/src/main/java/org/apache/flume/source/ExecSource.java: Loading...
  13. flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java: Loading...
  14. flume-ng-core/src/test/java/org/apache/flume/TestContext.java: Loading...
  15. flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannel.java: Loading...
  16. flume-ng-core/src/test/java/org/apache/flume/sink/TestFailoverSinkProcessor.java: Loading...
  17. flume-ng-legacy-sources/flume-avro-source/src/main/java/org/apache/flume/source/avroLegacy/AvroLegacySource.java: Loading...
  18. flume-ng-legacy-sources/flume-thrift-source/src/main/java/org/apache/flume/source/thriftLegacy/ThriftLegacySource.java: Loading...
  19. flume-ng-sinks/flume-hdfs-sink/src/main/java/org/apache/flume/sink/hdfs/HDFSEventSink.java: Loading...
  20. flume-ng-sinks/flume-irc-sink/src/main/java/org/apache/flume/sink/irc/IRCSink.java: Loading...
flume-ng-channels/flume-jdbc-channel/src/main/java/org/apache/flume/channel/jdbc/impl/JdbcChannelProviderImpl.java
Revision 1cf1c0c New Change
[20] 100 lines
[+20] [+] public void initialize(Context context) {
101
    initializeSchema(context);
101
    initializeSchema(context);
102
    initializeChannelState(context);
102
    initializeChannelState(context);
103
  }
103
  }
104

    
   
104

   
105
  private void initializeSystemProperties(Context context) {
105
  private void initializeSystemProperties(Context context) {
106
    Map<String, Object> sysProps = context.getSubProperties(
106
    Map<String, String> sysProps = context.getSubProperties(
107
        ConfigurationConstants.CONFIG_JDBC_SYSPRO_PREFIX);
107
        ConfigurationConstants.CONFIG_JDBC_SYSPRO_PREFIX);
108

    
   
108

   
109
    for (String key: sysProps.keySet()) {
109
    for (String key: sysProps.keySet()) {
110
      Object object = sysProps.get(key);
110
      String value = sysProps.get(key);
111
      String value = "";
111
      if(key != null && value != null) {
112
      if (object != null) {

   
113
        value = object.toString();

   
114
      }

   
115
      System.setProperty(key, value);
112
        System.setProperty(key, value);
116
    }
113
      }
117
  }
114
    }

    
   
115
  }
118

    
   
116

   
119
  private void initializeChannelState(Context context) {
117
  private void initializeChannelState(Context context) {
120
    String maxCapacityStr = context.getString(
118
    String maxCapacityStr = context.getString(
121
        ConfigurationConstants.CONFIG_MAX_CAPACITY, "0");
119
        ConfigurationConstants.CONFIG_MAX_CAPACITY, "0");
122

    
   
120

   
[+20] [20] 368 lines
flume-ng-core/src/main/java/org/apache/flume/Context.java
Revision f1c8f85 New Change
 
flume-ng-core/src/main/java/org/apache/flume/channel/ChannelSelectorFactory.java
Revision a7d5f94 New Change
 
flume-ng-core/src/main/java/org/apache/flume/channel/MemoryChannel.java
Revision e79490e New Change
 
flume-ng-core/src/main/java/org/apache/flume/channel/MultiplexingChannelSelector.java
Revision c63d0a1 New Change
 
flume-ng-core/src/main/java/org/apache/flume/channel/PseudoTxnMemoryChannel.java
Revision 1df580e New Change
 
flume-ng-core/src/main/java/org/apache/flume/sink/AvroSink.java
Revision 5440631 New Change
 
flume-ng-core/src/main/java/org/apache/flume/sink/RollingFileSink.java
Revision 45c031d New Change
 
flume-ng-core/src/main/java/org/apache/flume/sink/SinkGroup.java
Revision 1adc5ff New Change
 
flume-ng-core/src/main/java/org/apache/flume/sink/SinkProcessorFactory.java
Revision 859f4fd New Change
 
flume-ng-core/src/main/java/org/apache/flume/source/AvroSource.java
Revision 7b079f9 New Change
 
flume-ng-core/src/main/java/org/apache/flume/source/ExecSource.java
Revision a96016c New Change
 
flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java
Revision d205bbc New Change
 
flume-ng-core/src/test/java/org/apache/flume/TestContext.java
Revision a5e6aa8 New Change
 
flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannel.java
Revision 3392dff New Change
 
flume-ng-core/src/test/java/org/apache/flume/sink/TestFailoverSinkProcessor.java
Revision 93ad3bf New Change
 
flume-ng-legacy-sources/flume-avro-source/src/main/java/org/apache/flume/source/avroLegacy/AvroLegacySource.java
Revision b1e67f7 New Change
 
flume-ng-legacy-sources/flume-thrift-source/src/main/java/org/apache/flume/source/thriftLegacy/ThriftLegacySource.java
Revision 5fe270a New Change
 
flume-ng-sinks/flume-hdfs-sink/src/main/java/org/apache/flume/sink/hdfs/HDFSEventSink.java
Revision 3da90a5 New Change
 
flume-ng-sinks/flume-irc-sink/src/main/java/org/apache/flume/sink/irc/IRCSink.java
Revision 0a5498f New Change
 
  1. flume-ng-channels/flume-jdbc-channel/src/main/java/org/apache/flume/channel/jdbc/impl/JdbcChannelProviderImpl.java: Loading...
  2. flume-ng-core/src/main/java/org/apache/flume/Context.java: Loading...
  3. flume-ng-core/src/main/java/org/apache/flume/channel/ChannelSelectorFactory.java: Loading...
  4. flume-ng-core/src/main/java/org/apache/flume/channel/MemoryChannel.java: Loading...
  5. flume-ng-core/src/main/java/org/apache/flume/channel/MultiplexingChannelSelector.java: Loading...
  6. flume-ng-core/src/main/java/org/apache/flume/channel/PseudoTxnMemoryChannel.java: Loading...
  7. flume-ng-core/src/main/java/org/apache/flume/sink/AvroSink.java: Loading...
  8. flume-ng-core/src/main/java/org/apache/flume/sink/RollingFileSink.java: Loading...
  9. flume-ng-core/src/main/java/org/apache/flume/sink/SinkGroup.java: Loading...
  10. flume-ng-core/src/main/java/org/apache/flume/sink/SinkProcessorFactory.java: Loading...
  11. flume-ng-core/src/main/java/org/apache/flume/source/AvroSource.java: Loading...
  12. flume-ng-core/src/main/java/org/apache/flume/source/ExecSource.java: Loading...
  13. flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java: Loading...
  14. flume-ng-core/src/test/java/org/apache/flume/TestContext.java: Loading...
  15. flume-ng-core/src/test/java/org/apache/flume/channel/TestMemoryChannel.java: Loading...
  16. flume-ng-core/src/test/java/org/apache/flume/sink/TestFailoverSinkProcessor.java: Loading...
  17. flume-ng-legacy-sources/flume-avro-source/src/main/java/org/apache/flume/source/avroLegacy/AvroLegacySource.java: Loading...
  18. flume-ng-legacy-sources/flume-thrift-source/src/main/java/org/apache/flume/source/thriftLegacy/ThriftLegacySource.java: Loading...
  19. flume-ng-sinks/flume-hdfs-sink/src/main/java/org/apache/flume/sink/hdfs/HDFSEventSink.java: Loading...
  20. flume-ng-sinks/flume-irc-sink/src/main/java/org/apache/flume/sink/irc/IRCSink.java: Loading...