You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flume.apache.org by "Brock Noland (Commented) (JIRA)" <ji...@apache.org> on 2012/02/20 00:42:34 UTC

[jira] [Commented] (FLUME-978) Context interface is too basic requiring boilerplate user code

    [ https://issues.apache.org/jira/browse/FLUME-978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13211602#comment-13211602 ] 

Brock Noland commented on FLUME-978:
------------------------------------

Give that the properties file will populate the Context will Strings but the users want to get fully typed objects, I think it makes sense to internally change the structure to be String storage.
                
> Context interface is too basic requiring boilerplate user code
> --------------------------------------------------------------
>
>                 Key: FLUME-978
>                 URL: https://issues.apache.org/jira/browse/FLUME-978
>             Project: Flume
>          Issue Type: Improvement
>            Reporter: Brock Noland
>            Assignee: Brock Noland
>
> Flume is filled with examples like so:
> batchSize = Integer.parseInt(context.get("batch-size", String.class));
> if (batchSize == null) {
>    batchSize = defaultBatchSize;
> }
> from AvroSink. The Context object should provide at a minimum:
> * getBoolean(key)
> * getBoolean(key, default)
> * getInteger(key)
> * getInteger(key, default)
> * getLong(key)
> * getLong(key, default)
> Additionally, the Context object outside of tests, is populated via FlumeConfiguration which in the end is a properties file. In this common case, all the values in the Context object will be Strings. In this case, if we do the obvious and simply provide wrappers for getBoolean, we end up executing:
>       return Boolean.class.cast(String);
> Users of the Context object should not care where the values come from, only that they will be returned the correct object type.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira