mmiklavc commented on a change in pull request #1458: METRON-2177 Upgrade
Profiler for HBase 2.0.2
URL: https://github.com/apache/metron/pull/1458#discussion_r308910926
##########
File path:
metron-analytics/metron-profiler-client/src/main/java/org/apache/metron/profiler/client/stellar/VerboseProfile.java
##########
@@ -167,56 +167,8 @@ public Object apply(List<Object> args, Context context)
throws ParseException {
return view;
}
- /**
- * Creates the ColumnBuilder to use in accessing the profile data.
- * @param global The global configuration.
- */
- private ColumnBuilder getColumnBuilder(Map<String, Object> global) {
- String columnFamily = PROFILER_COLUMN_FAMILY.get(global, String.class);
- return new ValueOnlyColumnBuilder(columnFamily);
- }
-
- /**
- * Creates the ColumnBuilder to use in accessing the profile data.
- * @param global The global configuration.
- */
- private RowKeyBuilder getRowKeyBuilder(Map<String, Object> global) {
- Integer saltDivisor = PROFILER_SALT_DIVISOR.get(global, Integer.class);
- return new SaltyRowKeyBuilder(saltDivisor,
getPeriodDurationInMillis(global), TimeUnit.MILLISECONDS);
- }
-
- /**
- * Create an HBase table used when accessing HBase.
- * @param global The global configuration.
- * @return
- */
- private HTableInterface getTable(Map<String, Object> global) {
- String tableName = PROFILER_HBASE_TABLE.get(global, String.class);
- TableProvider provider = getTableProvider(global);
- try {
- return provider.getTable(HBaseConfiguration.create(), tableName);
-
- } catch (IOException e) {
- throw new IllegalArgumentException(String.format("Unable to access
table: %s", tableName), e);
- }
- }
-
- /**
- * Create the TableProvider to use when accessing HBase.
- * @param global The global configuration.
- */
- private TableProvider getTableProvider(Map<String, Object> global) {
- String clazzName = PROFILER_HBASE_TABLE_PROVIDER.get(global, String.class);
- TableProvider provider;
- try {
- @SuppressWarnings("unchecked")
- Class<? extends TableProvider> clazz = (Class<? extends TableProvider>)
Class.forName(clazzName);
- provider = clazz.getConstructor().newInstance();
-
- } catch (Exception e) {
- provider = new HTableProvider();
- }
-
- return provider;
+ public VerboseProfile withProfilerClientFactory(ProfilerClientFactory
factory) {
Review comment:
What's the benefit of opening up this class for modification after
construction vs providing a supplemental constructor that has the arg for dep
injection?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services