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

Adam Fuchs commented on ACCUMULO-2946:
--------------------------------------

Since the two Helper classes implement two different interfaces the common 
methods should be put into a third class, and the abstract *Helper classes 
should extend the third class and implement the respective interfaces:

{code}
public class TableOrNamespaceConfigurator {
  public void attachIterator(String tableName, IteratorSetting setting) throws 
AccumuloSecurityException, AccumuloException, TableNotFoundException {
    attachIterator(tableName, setting, EnumSet.allOf(IteratorScope.class));
  }
  ...
}

public abstract class TableOperationsHelper extends 
TableOrNamespaceOperationsHelper implements TableOperations {
  // anything table-specific here
}

public abstract class NamespaceOperationsHelper extends 
TableOrNamespaceOperationsHelper implements NamespaceOperations {
  // anything namespace-specific here
}
{code}

Assuming the namespace and/or table specific parts are small, there might be 
another alternative that gets rid of the two abstract Helper classes and just 
uses the concrete class. That would be preferable if it would remove complexity.

> refactor namespace / table operations code to share more code
> -------------------------------------------------------------
>
>                 Key: ACCUMULO-2946
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-2946
>             Project: Accumulo
>          Issue Type: Improvement
>          Components: client
>            Reporter: Adam Fuchs
>            Assignee: Adam Fuchs
>            Priority: Trivial
>             Fix For: 1.8.0
>
>
> o.a.a.core.client.impl.NamespaceOperationsHelper and 
> o.a.a.core.client.impl.TableOperationsHelper have a lot of repeated code 
> between them. Refactor them to remove the duplication. Maybe this could be 
> done by adding a boolean to the method signatures, representing whether we're 
> configuring a namespace or a table?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to