From 0f68f861147d7417a9575f05aa1bc8756c875099 Mon Sep 17 00:00:00 2001 From: Mars Lan Date: Tue, 6 Oct 2020 15:21:34 -0700 Subject: [PATCH] refactor(gms): reorganize GMS factory namespace (#1916) Fixes https://github.com/linkedin/datahub/issues/1658 --- docs/how/entity-onboarding.md | 2 +- .../factory/common}/KafkaEventProducerFactory.java | 2 +- .../factory/common}/LocalEbeanServerConfigFactory.java | 2 +- .../factory => gms/factory/common}/Neo4jDriverFactory.java | 2 +- .../factory/common}/RestHighLevelClientFactory.java | 2 +- .../factory/common}/TopicConventionFactory.java | 2 +- .../factory/dataplatform}/DataPlatformLocalDaoFactory.java | 2 +- .../factory/dataprocess}/DataProcessDAOFactory.java | 4 ++-- .../factory/dataprocess}/DataProcessSearchDAOFactory.java | 2 +- .../factory/dataset}/DatasetBrowseDAOFactory.java | 2 +- .../factory => gms/factory/dataset}/DatasetDaoFactory.java | 4 ++-- .../factory/dataset}/DatasetQueryDaoFactory.java | 2 +- .../factory/dataset}/DatasetSearchDAOFactory.java | 2 +- .../factory => gms/factory/identity}/CorpGroupDaoFactory.java | 4 ++-- .../factory/identity}/CorpGroupSearchDaoFactory.java | 2 +- .../factory => gms/factory/identity}/CorpUserDaoFactory.java | 4 ++-- .../factory/identity}/CorpUserSearchDaoFactory.java | 2 +- gms/war/src/main/webapp/WEB-INF/beans.xml | 2 +- .../linkedin/metadata/kafka/config/ElasticSearchConfig.java | 2 +- .../java/com/linkedin/metadata/kafka/config/Neo4jConfig.java | 2 +- 20 files changed, 24 insertions(+), 24 deletions(-) rename gms/factories/src/main/java/com/linkedin/{common/factory => gms/factory/common}/KafkaEventProducerFactory.java (97%) rename gms/factories/src/main/java/com/linkedin/{common/factory => gms/factory/common}/LocalEbeanServerConfigFactory.java (98%) rename gms/factories/src/main/java/com/linkedin/{common/factory => gms/factory/common}/Neo4jDriverFactory.java (94%) rename gms/factories/src/main/java/com/linkedin/{common/factory => gms/factory/common}/RestHighLevelClientFactory.java (98%) rename gms/factories/src/main/java/com/linkedin/{common/factory => gms/factory/common}/TopicConventionFactory.java (97%) rename gms/factories/src/main/java/com/linkedin/{dataplatform/factory => gms/factory/dataplatform}/DataPlatformLocalDaoFactory.java (94%) rename gms/factories/src/main/java/com/linkedin/{dataprocess/factory => gms/factory/dataprocess}/DataProcessDAOFactory.java (93%) rename gms/factories/src/main/java/com/linkedin/{dataprocess/factory => gms/factory/dataprocess}/DataProcessSearchDAOFactory.java (95%) rename gms/factories/src/main/java/com/linkedin/{dataset/factory => gms/factory/dataset}/DatasetBrowseDAOFactory.java (95%) rename gms/factories/src/main/java/com/linkedin/{dataset/factory => gms/factory/dataset}/DatasetDaoFactory.java (93%) rename gms/factories/src/main/java/com/linkedin/{dataset/factory => gms/factory/dataset}/DatasetQueryDaoFactory.java (94%) rename gms/factories/src/main/java/com/linkedin/{dataset/factory => gms/factory/dataset}/DatasetSearchDAOFactory.java (95%) rename gms/factories/src/main/java/com/linkedin/{identity/factory => gms/factory/identity}/CorpGroupDaoFactory.java (93%) rename gms/factories/src/main/java/com/linkedin/{identity/factory => gms/factory/identity}/CorpGroupSearchDaoFactory.java (95%) rename gms/factories/src/main/java/com/linkedin/{identity/factory => gms/factory/identity}/CorpUserDaoFactory.java (93%) rename gms/factories/src/main/java/com/linkedin/{identity/factory => gms/factory/identity}/CorpUserSearchDaoFactory.java (95%) diff --git a/docs/how/entity-onboarding.md b/docs/how/entity-onboarding.md index 611255364ca25..c7d7dac1d1d36 100644 --- a/docs/how/entity-onboarding.md +++ b/docs/how/entity-onboarding.md @@ -29,7 +29,7 @@ Refer to [graph onboarding](graph-onboarding.md) if you need to perform graph qu See [`CorpUsers`] for an example of top-level [resource endpoint]. Optionally add an aspect-specific [sub-resource endpoint] such as [`CorpUsersEditableInfoResource`]. ## 6. Configure dependency injection -GMS uses [Spring Framework](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#beans) for dependency injection. You'll need to add [various factories](https://github.com/linkedin/datahub/tree/master/gms/factories/src/main/java/com/linkedin/identity/factory) to create any custom DAOs used by the rest.li endpoint. You'll also need to add any custom package to the `base-package` of `` tag in [beans.xml](https://github.com/linkedin/datahub/blob/master/gms/war/src/main/webapp/WEB-INF/beans.xml) +GMS uses [Spring Framework](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#beans) for dependency injection. You'll need to add [various factories](https://github.com/linkedin/datahub/tree/master/gms/factories/src/main/java/com/linkedin/gms/factory) to create any custom DAOs used by the rest.li endpoint. You'll also need to add any custom package to the `base-package` of `` tag in [beans.xml](https://github.com/linkedin/datahub/blob/master/gms/war/src/main/webapp/WEB-INF/beans.xml) ## 7. UI for entity onboarding [WIP] diff --git a/gms/factories/src/main/java/com/linkedin/common/factory/KafkaEventProducerFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/common/KafkaEventProducerFactory.java similarity index 97% rename from gms/factories/src/main/java/com/linkedin/common/factory/KafkaEventProducerFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/common/KafkaEventProducerFactory.java index 56d2842dd38f2..6b168eb7317e8 100644 --- a/gms/factories/src/main/java/com/linkedin/common/factory/KafkaEventProducerFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/common/KafkaEventProducerFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.common.factory; +package com.linkedin.gms.factory.common; import io.confluent.kafka.serializers.KafkaAvroSerializer; import io.confluent.kafka.serializers.AbstractKafkaAvroSerDeConfig; diff --git a/gms/factories/src/main/java/com/linkedin/common/factory/LocalEbeanServerConfigFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/common/LocalEbeanServerConfigFactory.java similarity index 98% rename from gms/factories/src/main/java/com/linkedin/common/factory/LocalEbeanServerConfigFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/common/LocalEbeanServerConfigFactory.java index 9106915ae3e98..d5420e5af9fc5 100644 --- a/gms/factories/src/main/java/com/linkedin/common/factory/LocalEbeanServerConfigFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/common/LocalEbeanServerConfigFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.common.factory; +package com.linkedin.gms.factory.common; import io.ebean.config.ServerConfig; import io.ebean.datasource.DataSourceConfig; diff --git a/gms/factories/src/main/java/com/linkedin/common/factory/Neo4jDriverFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/common/Neo4jDriverFactory.java similarity index 94% rename from gms/factories/src/main/java/com/linkedin/common/factory/Neo4jDriverFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/common/Neo4jDriverFactory.java index d6e41fa14aa0c..0ca726560e8a2 100644 --- a/gms/factories/src/main/java/com/linkedin/common/factory/Neo4jDriverFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/common/Neo4jDriverFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.common.factory; +package com.linkedin.gms.factory.common; import org.neo4j.driver.AuthTokens; import org.neo4j.driver.Driver; diff --git a/gms/factories/src/main/java/com/linkedin/common/factory/RestHighLevelClientFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/common/RestHighLevelClientFactory.java similarity index 98% rename from gms/factories/src/main/java/com/linkedin/common/factory/RestHighLevelClientFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/common/RestHighLevelClientFactory.java index 8f083b2e596f4..d978cdf41c2e7 100644 --- a/gms/factories/src/main/java/com/linkedin/common/factory/RestHighLevelClientFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/common/RestHighLevelClientFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.common.factory; +package com.linkedin.gms.factory.common; import javax.annotation.Nonnull; diff --git a/gms/factories/src/main/java/com/linkedin/common/factory/TopicConventionFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/common/TopicConventionFactory.java similarity index 97% rename from gms/factories/src/main/java/com/linkedin/common/factory/TopicConventionFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/common/TopicConventionFactory.java index 660da069ddc63..d2f770e6ee5c4 100644 --- a/gms/factories/src/main/java/com/linkedin/common/factory/TopicConventionFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/common/TopicConventionFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.common.factory; +package com.linkedin.gms.factory.common; import com.linkedin.mxe.TopicConvention; import com.linkedin.mxe.TopicConventionImpl; diff --git a/gms/factories/src/main/java/com/linkedin/dataplatform/factory/DataPlatformLocalDaoFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/dataplatform/DataPlatformLocalDaoFactory.java similarity index 94% rename from gms/factories/src/main/java/com/linkedin/dataplatform/factory/DataPlatformLocalDaoFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/dataplatform/DataPlatformLocalDaoFactory.java index 74cea35aa638e..5fdc3c8d3ddea 100644 --- a/gms/factories/src/main/java/com/linkedin/dataplatform/factory/DataPlatformLocalDaoFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/dataplatform/DataPlatformLocalDaoFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.dataplatform.factory; +package com.linkedin.gms.factory.dataplatform; import com.linkedin.common.urn.DataPlatformUrn; import com.linkedin.metadata.aspect.DataPlatformAspect; diff --git a/gms/factories/src/main/java/com/linkedin/dataprocess/factory/DataProcessDAOFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/dataprocess/DataProcessDAOFactory.java similarity index 93% rename from gms/factories/src/main/java/com/linkedin/dataprocess/factory/DataProcessDAOFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/dataprocess/DataProcessDAOFactory.java index fde1aa60755d6..8e25647f9ff87 100644 --- a/gms/factories/src/main/java/com/linkedin/dataprocess/factory/DataProcessDAOFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/dataprocess/DataProcessDAOFactory.java @@ -1,6 +1,6 @@ -package com.linkedin.dataprocess.factory; +package com.linkedin.gms.factory.dataprocess; -import com.linkedin.common.factory.TopicConventionFactory; +import com.linkedin.gms.factory.common.TopicConventionFactory; import com.linkedin.common.urn.DataProcessUrn; import com.linkedin.metadata.aspect.DataProcessAspect; import com.linkedin.metadata.dao.EbeanLocalDAO; diff --git a/gms/factories/src/main/java/com/linkedin/dataprocess/factory/DataProcessSearchDAOFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/dataprocess/DataProcessSearchDAOFactory.java similarity index 95% rename from gms/factories/src/main/java/com/linkedin/dataprocess/factory/DataProcessSearchDAOFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/dataprocess/DataProcessSearchDAOFactory.java index f20569192f958..7f475734c5c7d 100644 --- a/gms/factories/src/main/java/com/linkedin/dataprocess/factory/DataProcessSearchDAOFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/dataprocess/DataProcessSearchDAOFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.dataprocess.factory; +package com.linkedin.gms.factory.dataprocess; import com.linkedin.metadata.configs.DataProcessSearchConfig; import com.linkedin.metadata.dao.search.ESSearchDAO; diff --git a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetBrowseDAOFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetBrowseDAOFactory.java similarity index 95% rename from gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetBrowseDAOFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetBrowseDAOFactory.java index 2eca49ca5d408..d097e58474903 100644 --- a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetBrowseDAOFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetBrowseDAOFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.dataset.factory; +package com.linkedin.gms.factory.dataset; import com.linkedin.metadata.configs.DatasetBrowseConfig; import com.linkedin.metadata.dao.browse.ESBrowseDAO; diff --git a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetDaoFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetDaoFactory.java similarity index 93% rename from gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetDaoFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetDaoFactory.java index 7c50256356ff1..7d574e396c020 100644 --- a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetDaoFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetDaoFactory.java @@ -1,6 +1,6 @@ -package com.linkedin.dataset.factory; +package com.linkedin.gms.factory.dataset; -import com.linkedin.common.factory.TopicConventionFactory; +import com.linkedin.gms.factory.common.TopicConventionFactory; import com.linkedin.common.urn.DatasetUrn; import com.linkedin.metadata.aspect.DatasetAspect; import com.linkedin.metadata.dao.EbeanLocalDAO; diff --git a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetQueryDaoFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetQueryDaoFactory.java similarity index 94% rename from gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetQueryDaoFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetQueryDaoFactory.java index 5ebe3f984dd2c..fed274a4bf850 100644 --- a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetQueryDaoFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetQueryDaoFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.dataset.factory; +package com.linkedin.gms.factory.dataset; import com.linkedin.metadata.dao.Neo4jQueryDAO; import org.neo4j.driver.Driver; diff --git a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetSearchDAOFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetSearchDAOFactory.java similarity index 95% rename from gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetSearchDAOFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetSearchDAOFactory.java index 64888dc1b3cfe..49c139bf79bd6 100644 --- a/gms/factories/src/main/java/com/linkedin/dataset/factory/DatasetSearchDAOFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/dataset/DatasetSearchDAOFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.dataset.factory; +package com.linkedin.gms.factory.dataset; import com.linkedin.metadata.configs.DatasetSearchConfig; import com.linkedin.metadata.dao.search.ESSearchDAO; diff --git a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpGroupDaoFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpGroupDaoFactory.java similarity index 93% rename from gms/factories/src/main/java/com/linkedin/identity/factory/CorpGroupDaoFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpGroupDaoFactory.java index da2f706d72247..57509c97eb1f7 100644 --- a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpGroupDaoFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpGroupDaoFactory.java @@ -1,6 +1,6 @@ -package com.linkedin.identity.factory; +package com.linkedin.gms.factory.identity; -import com.linkedin.common.factory.TopicConventionFactory; +import com.linkedin.gms.factory.common.TopicConventionFactory; import com.linkedin.common.urn.CorpGroupUrn; import com.linkedin.metadata.aspect.CorpGroupAspect; import com.linkedin.metadata.dao.EbeanLocalDAO; diff --git a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpGroupSearchDaoFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpGroupSearchDaoFactory.java similarity index 95% rename from gms/factories/src/main/java/com/linkedin/identity/factory/CorpGroupSearchDaoFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpGroupSearchDaoFactory.java index 1ca382ad3bc2b..4adeb50c68bcf 100644 --- a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpGroupSearchDaoFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpGroupSearchDaoFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.identity.factory; +package com.linkedin.gms.factory.identity; import com.linkedin.metadata.configs.CorpGroupSearchConfig; import com.linkedin.metadata.dao.search.ESSearchDAO; diff --git a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpUserDaoFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpUserDaoFactory.java similarity index 93% rename from gms/factories/src/main/java/com/linkedin/identity/factory/CorpUserDaoFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpUserDaoFactory.java index 9310b3f4f4c44..ad5f95378ae88 100644 --- a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpUserDaoFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpUserDaoFactory.java @@ -1,6 +1,6 @@ -package com.linkedin.identity.factory; +package com.linkedin.gms.factory.identity; -import com.linkedin.common.factory.TopicConventionFactory; +import com.linkedin.gms.factory.common.TopicConventionFactory; import com.linkedin.common.urn.CorpuserUrn; import com.linkedin.metadata.aspect.CorpUserAspect; import com.linkedin.metadata.dao.EbeanLocalDAO; diff --git a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpUserSearchDaoFactory.java b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpUserSearchDaoFactory.java similarity index 95% rename from gms/factories/src/main/java/com/linkedin/identity/factory/CorpUserSearchDaoFactory.java rename to gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpUserSearchDaoFactory.java index 152775d695717..7d137360b0776 100644 --- a/gms/factories/src/main/java/com/linkedin/identity/factory/CorpUserSearchDaoFactory.java +++ b/gms/factories/src/main/java/com/linkedin/gms/factory/identity/CorpUserSearchDaoFactory.java @@ -1,4 +1,4 @@ -package com.linkedin.identity.factory; +package com.linkedin.gms.factory.identity; import com.linkedin.metadata.configs.CorpUserSearchConfig; import com.linkedin.metadata.dao.search.ESSearchDAO; diff --git a/gms/war/src/main/webapp/WEB-INF/beans.xml b/gms/war/src/main/webapp/WEB-INF/beans.xml index 79e15c237abd3..e75babb61e54a 100644 --- a/gms/war/src/main/webapp/WEB-INF/beans.xml +++ b/gms/war/src/main/webapp/WEB-INF/beans.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true"> - + diff --git a/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/ElasticSearchConfig.java b/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/ElasticSearchConfig.java index f5544e7e615df..c7f1e1669d5e6 100644 --- a/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/ElasticSearchConfig.java +++ b/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/ElasticSearchConfig.java @@ -5,7 +5,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import com.linkedin.common.factory.RestHighLevelClientFactory; +import com.linkedin.gms.factory.common.RestHighLevelClientFactory; import com.linkedin.metadata.builders.search.RegisteredIndexBuilders; import com.linkedin.metadata.builders.search.SnapshotProcessor; import com.linkedin.metadata.utils.elasticsearch.ElasticsearchConnector; diff --git a/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/Neo4jConfig.java b/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/Neo4jConfig.java index 9ca2be2459f43..6d0cfb6f55f54 100644 --- a/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/Neo4jConfig.java +++ b/metadata-jobs/mae-consumer-job/src/main/java/com/linkedin/metadata/kafka/config/Neo4jConfig.java @@ -5,7 +5,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import com.linkedin.common.factory.Neo4jDriverFactory; +import com.linkedin.gms.factory.common.Neo4jDriverFactory; import com.linkedin.metadata.dao.internal.BaseGraphWriterDAO; import com.linkedin.metadata.dao.internal.Neo4jGraphWriterDAO;