Sqoop
  1. Sqoop
  2. SQOOP-1402

SQOOP2: Move all JSON constants to a single final class

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      JSON constants (i.e. field names) are currently defined all over the place. This leads to duplication, and if we ever decide to rename something it will be a mess.

      I suggest adding a constants class to org.apache.sqoop.json and have everyone use the same constants.

        Activity

        Hide
        Veena Basavaraj added a comment - - edited

        consolidate

        public final class FormSerialization {

        public static final String ALL = "all";
        public static final String ID = "id";
        public static final String NAME = "name";
        public static final String VERSION = "version";
        public static final String DRIVER_VERSION = "driver-version";
        public static final String CLASS = "class";
        public static final String ENABLED = "enabled";
        public static final String CREATION_USER = "creation-user";
        public static final String CREATION_DATE = "creation-date";
        public static final String UPDATE_USER = "update-user";
        public static final String UPDATE_DATE = "update-date";
        public static final String CON_FORMS = "con-forms";
        public static final String JOB_FORMS = "job-forms";

        public static final String FORM_NAME = "name";
        public static final String FORM_TYPE = "type";
        public static final String FORM_INPUTS = "inputs";
        public static final String FORM_INPUT_NAME = "name";
        public static final String FORM_INPUT_TYPE = "type";
        public static final String FORM_INPUT_SENSITIVE = "sensitive";
        public static final String FORM_INPUT_SIZE = "size";
        public static final String FORM_INPUT_VALUE = "value";
        public static final String FORM_INPUT_VALUES = "values";

        and

        public class JobBean implements JsonBean {

        private static final String ALL = "all";
        private static final String ID = "id";
        private static final String NAME = "name";
        private static final String FROM_LINK_ID = "from-link-id";
        private static final String TO_LINK_ID = "to-link-id";
        private static final String FROM_CONNECTOR_ID = "from-connector-id";
        private static final String TO_CONNECTOR_ID = "to-connector-id";
        private static final String FROM_CONNECTOR_PART = "from-connector";
        private static final String TO_CONNECTOR_PART = "to-connector";
        private static final String FRAMEWORK_PART = "framework";

        and
        private static final String CONNECTOR_ID = "connector-id";
        private static final String CONNECTOR_PART = "connector";
        private static final String FRAMEWORK_PART = "framework";

        etc etc ...into one class

        Show
        Veena Basavaraj added a comment - - edited consolidate public final class FormSerialization { public static final String ALL = "all"; public static final String ID = "id"; public static final String NAME = "name"; public static final String VERSION = "version"; public static final String DRIVER_VERSION = "driver-version"; public static final String CLASS = "class"; public static final String ENABLED = "enabled"; public static final String CREATION_USER = "creation-user"; public static final String CREATION_DATE = "creation-date"; public static final String UPDATE_USER = "update-user"; public static final String UPDATE_DATE = "update-date"; public static final String CON_FORMS = "con-forms"; public static final String JOB_FORMS = "job-forms"; public static final String FORM_NAME = "name"; public static final String FORM_TYPE = "type"; public static final String FORM_INPUTS = "inputs"; public static final String FORM_INPUT_NAME = "name"; public static final String FORM_INPUT_TYPE = "type"; public static final String FORM_INPUT_SENSITIVE = "sensitive"; public static final String FORM_INPUT_SIZE = "size"; public static final String FORM_INPUT_VALUE = "value"; public static final String FORM_INPUT_VALUES = "values"; and public class JobBean implements JsonBean { private static final String ALL = "all"; private static final String ID = "id"; private static final String NAME = "name"; private static final String FROM_LINK_ID = "from-link-id"; private static final String TO_LINK_ID = "to-link-id"; private static final String FROM_CONNECTOR_ID = "from-connector-id"; private static final String TO_CONNECTOR_ID = "to-connector-id"; private static final String FROM_CONNECTOR_PART = "from-connector"; private static final String TO_CONNECTOR_PART = "to-connector"; private static final String FRAMEWORK_PART = "framework"; and private static final String CONNECTOR_ID = "connector-id"; private static final String CONNECTOR_PART = "connector"; private static final String FRAMEWORK_PART = "framework"; etc etc ...into one class
        Hide
        Veena Basavaraj added a comment - - edited

        + 1
        It is true for all other constants too, and the tests dont share these values, instead they hard code them, so any kind of refactoring leads to issues with tests

        Show
        Veena Basavaraj added a comment - - edited + 1 It is true for all other constants too, and the tests dont share these values, instead they hard code them, so any kind of refactoring leads to issues with tests
        Gwen Shapira created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Gwen Shapira
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development