[
https://issues.apache.org/jira/browse/SQOOP-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Veena Basavaraj updated SQOOP-2009:
-----------------------------------
Summary: Schema Matcher and MatcherFactory code consolidation (was: Schema
Matcher and MatcherFactor code consolidation)
> Schema Matcher and MatcherFactory code consolidation
> ----------------------------------------------------
>
> Key: SQOOP-2009
> URL: https://issues.apache.org/jira/browse/SQOOP-2009
> Project: Sqoop
> Issue Type: Sub-task
> Reporter: Veena Basavaraj
> Fix For: 2.0.0
>
>
> Currently there is some logic in Schema Matcher constructor and some logic in
> MatcherFactory to set up the correct instance of matcher to use.
> These rules should be consolidated in one place in MatcherFactory so its less
> confusing to infer what values for from and to schema go into the concrete
> matcher implementations
> {code}
> public class MatcherFactory {
> public static Matcher getMatcher(Schema fromSchema, Schema toSchema) {
> if (toSchema.isEmpty() || fromSchema.isEmpty()) {
> return new LocationMatcher(fromSchema, toSchema);
> } else {
> return new NameMatcher(fromSchema, toSchema);
> }
> }
> }
> {code}
> public Matcher(Schema fromSchema, Schema toSchema) {
> if (fromSchema.isEmpty() && toSchema.isEmpty()) {
> this.fromSchema = ByteArraySchema.getInstance();
> this.toSchema = ByteArraySchema.getInstance();
> } else if (toSchema.isEmpty()) {
> this.fromSchema = fromSchema;
> this.toSchema = fromSchema;
> } else if (fromSchema.isEmpty()) {
> this.fromSchema = toSchema;
> this.toSchema = toSchema;
> } else {
> this.fromSchema = fromSchema;
> this.toSchema = toSchema;
> }
> }
> {code}
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)