diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java index 4073da0578ebaa..78fb381b02b115 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java @@ -410,57 +410,41 @@ public class GmsGraphQLEngine { */ public final List> browsableTypes; - public GmsGraphQLEngine(final EntityClient entityClient, final GraphClient graphClient, - final UsageClient usageClient, final AnalyticsService analyticsService, final EntityService entityService, - final RecommendationsService recommendationsService, final StatefulTokenService statefulTokenService, - final TimeseriesAspectService timeseriesAspectService, final EntityRegistry entityRegistry, - final SecretService secretService, final NativeUserService nativeUserService, - final IngestionConfiguration ingestionConfiguration, - final AuthenticationConfiguration authenticationConfiguration, - final AuthorizationConfiguration authorizationConfiguration, final GitVersion gitVersion, - final TimelineService timelineService, final boolean supportsImpactAnalysis, - final VisualConfiguration visualConfiguration, final TelemetryConfiguration telemetryConfiguration, - final TestsConfiguration testsConfiguration, final DataHubConfiguration datahubConfiguration, - final ViewsConfiguration viewsConfiguration, final SiblingGraphService siblingGraphService, - final GroupService groupService, final RoleService roleService, - final InviteTokenService inviteTokenService, final PostService postService, - final ViewService viewService, - final SettingsService settingsService, final LineageService lineageService, - final FeatureFlags featureFlags) { - - this.entityClient = entityClient; - this.graphClient = graphClient; - this.usageClient = usageClient; - this.siblingGraphService = siblingGraphService; - - this.analyticsService = analyticsService; - this.entityService = entityService; - this.recommendationsService = recommendationsService; - this.statefulTokenService = statefulTokenService; - this.secretService = secretService; - this.entityRegistry = entityRegistry; - this.gitVersion = gitVersion; - this.supportsImpactAnalysis = supportsImpactAnalysis; - this.timeseriesAspectService = timeseriesAspectService; - this.timelineService = timelineService; - this.nativeUserService = nativeUserService; - this.groupService = groupService; - this.roleService = roleService; - this.inviteTokenService = inviteTokenService; - this.postService = postService; - this.viewService = viewService; - this.settingsService = settingsService; - this.lineageService = lineageService; - - this.ingestionConfiguration = Objects.requireNonNull(ingestionConfiguration); - this.authenticationConfiguration = Objects.requireNonNull(authenticationConfiguration); - this.authorizationConfiguration = Objects.requireNonNull(authorizationConfiguration); - this.visualConfiguration = visualConfiguration; - this.telemetryConfiguration = telemetryConfiguration; - this.testsConfiguration = testsConfiguration; - this.datahubConfiguration = datahubConfiguration; - this.viewsConfiguration = viewsConfiguration; - this.featureFlags = featureFlags; + public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) { + + this.entityClient = args.entityClient; + this.graphClient = args.graphClient; + this.usageClient = args.usageClient; + this.siblingGraphService = args.siblingGraphService; + + this.analyticsService = args.analyticsService; + this.entityService = args.entityService; + this.recommendationsService = args.recommendationsService; + this.statefulTokenService = args.statefulTokenService; + this.secretService = args.secretService; + this.entityRegistry = args.entityRegistry; + this.gitVersion = args.gitVersion; + this.supportsImpactAnalysis = args.supportsImpactAnalysis; + this.timeseriesAspectService = args.timeseriesAspectService; + this.timelineService = args.timelineService; + this.nativeUserService = args.nativeUserService; + this.groupService = args.groupService; + this.roleService = args.roleService; + this.inviteTokenService = args.inviteTokenService; + this.postService = args.postService; + this.viewService = args.viewService; + this.settingsService = args.settingsService; + this.lineageService = args.lineageService; + + this.ingestionConfiguration = Objects.requireNonNull(args.ingestionConfiguration); + this.authenticationConfiguration = Objects.requireNonNull(args.authenticationConfiguration); + this.authorizationConfiguration = Objects.requireNonNull(args.authorizationConfiguration); + this.visualConfiguration = args.visualConfiguration; + this.telemetryConfiguration = args.telemetryConfiguration; + this.testsConfiguration = args.testsConfiguration; + this.datahubConfiguration = args.datahubConfiguration; + this.viewsConfiguration = args.viewsConfiguration; + this.featureFlags = args.featureFlags; this.datasetType = new DatasetType(entityClient); this.corpUserType = new CorpUserType(entityClient, featureFlags); diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngineArgs.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngineArgs.java new file mode 100644 index 00000000000000..00bda588d8aca3 --- /dev/null +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngineArgs.java @@ -0,0 +1,70 @@ +package com.linkedin.datahub.graphql; + +import com.datahub.authentication.AuthenticationConfiguration; +import com.datahub.authentication.group.GroupService; +import com.datahub.authentication.invite.InviteTokenService; +import com.datahub.authentication.post.PostService; +import com.datahub.authentication.token.StatefulTokenService; +import com.datahub.authentication.user.NativeUserService; +import com.datahub.authorization.AuthorizationConfiguration; +import com.datahub.authorization.role.RoleService; +import com.linkedin.datahub.graphql.analytics.service.AnalyticsService; +import com.linkedin.datahub.graphql.featureflags.FeatureFlags; +import com.linkedin.entity.client.EntityClient; +import com.linkedin.metadata.config.DataHubConfiguration; +import com.linkedin.metadata.config.IngestionConfiguration; +import com.linkedin.metadata.config.TestsConfiguration; +import com.linkedin.metadata.config.ViewsConfiguration; +import com.linkedin.metadata.config.VisualConfiguration; +import com.linkedin.metadata.entity.EntityService; +import com.linkedin.metadata.graph.GraphClient; +import com.linkedin.metadata.graph.SiblingGraphService; +import com.linkedin.metadata.models.registry.EntityRegistry; +import com.linkedin.metadata.recommendation.RecommendationsService; +import com.linkedin.metadata.secret.SecretService; +import com.linkedin.metadata.service.LineageService; +import com.linkedin.metadata.service.SettingsService; +import com.linkedin.metadata.service.ViewService; +import com.linkedin.metadata.telemetry.TelemetryConfiguration; +import com.linkedin.metadata.timeline.TimelineService; +import com.linkedin.metadata.timeseries.TimeseriesAspectService; +import com.linkedin.metadata.version.GitVersion; +import com.linkedin.usage.UsageClient; +import lombok.Data; + +@Data +public class GmsGraphQLEngineArgs { + EntityClient entityClient; + GraphClient graphClient; + UsageClient usageClient; + AnalyticsService analyticsService; + EntityService entityService; + RecommendationsService recommendationsService; + StatefulTokenService statefulTokenService; + TimeseriesAspectService timeseriesAspectService; + EntityRegistry entityRegistry; + SecretService secretService; + NativeUserService nativeUserService; + IngestionConfiguration ingestionConfiguration; + AuthenticationConfiguration authenticationConfiguration; + AuthorizationConfiguration authorizationConfiguration; + GitVersion gitVersion; + TimelineService timelineService; + boolean supportsImpactAnalysis; + VisualConfiguration visualConfiguration; + TelemetryConfiguration telemetryConfiguration; + TestsConfiguration testsConfiguration; + DataHubConfiguration datahubConfiguration; + ViewsConfiguration viewsConfiguration; + SiblingGraphService siblingGraphService; + GroupService groupService; + RoleService roleService; + InviteTokenService inviteTokenService; + PostService postService; + ViewService viewService; + SettingsService settingsService; + LineageService lineageService; + FeatureFlags featureFlags; + + //any fork specific args should go below this line +} diff --git a/metadata-service/factories/src/main/java/com/linkedin/gms/factory/graphql/GraphQLEngineFactory.java b/metadata-service/factories/src/main/java/com/linkedin/gms/factory/graphql/GraphQLEngineFactory.java index 3577550690d733..54255b9f1b0d32 100644 --- a/metadata-service/factories/src/main/java/com/linkedin/gms/factory/graphql/GraphQLEngineFactory.java +++ b/metadata-service/factories/src/main/java/com/linkedin/gms/factory/graphql/GraphQLEngineFactory.java @@ -7,6 +7,7 @@ import com.datahub.authorization.role.RoleService; import com.datahub.authentication.post.PostService; import com.linkedin.datahub.graphql.GmsGraphQLEngine; +import com.linkedin.datahub.graphql.GmsGraphQLEngineArgs; import com.linkedin.datahub.graphql.GraphQLEngine; import com.linkedin.datahub.graphql.analytics.service.AnalyticsService; import com.linkedin.metadata.client.JavaEntityClient; @@ -150,73 +151,42 @@ public class GraphQLEngineFactory { @Bean(name = "graphQLEngine") @Nonnull protected GraphQLEngine getInstance() { + GmsGraphQLEngineArgs args = new GmsGraphQLEngineArgs(); + args.setEntityClient(_entityClient); + args.setGraphClient(_graphClient); + args.setUsageClient(_usageClient); if (isAnalyticsEnabled) { - return new GmsGraphQLEngine( - _entityClient, - _graphClient, - _usageClient, - new AnalyticsService(elasticClient, indexConvention), - _entityService, - _recommendationsService, - _statefulTokenService, - _timeseriesAspectService, - _entityRegistry, - _secretService, - _nativeUserService, - _configProvider.getIngestion(), - _configProvider.getAuthentication(), - _configProvider.getAuthorization(), - _gitVersion, - _timelineService, - _graphService.supportsMultiHop(), - _configProvider.getVisualConfig(), - _configProvider.getTelemetry(), - _configProvider.getMetadataTests(), - _configProvider.getDatahub(), - _configProvider.getViews(), - _siblingGraphService, - _groupService, - _roleService, - _inviteTokenService, - _postService, - _viewService, - _settingsService, - _lineageService, - _configProvider.getFeatureFlags() - ).builder().build(); + args.setAnalyticsService(new AnalyticsService(elasticClient, indexConvention)); } + args.setEntityService(_entityService); + args.setRecommendationsService(_recommendationsService); + args.setStatefulTokenService(_statefulTokenService); + args.setTimeseriesAspectService(_timeseriesAspectService); + args.setEntityRegistry(_entityRegistry); + args.setSecretService(_secretService); + args.setNativeUserService(_nativeUserService); + args.setIngestionConfiguration(_configProvider.getIngestion()); + args.setAuthenticationConfiguration(_configProvider.getAuthentication()); + args.setAuthorizationConfiguration(_configProvider.getAuthorization()); + args.setGitVersion(_gitVersion); + args.setTimelineService(_timelineService); + args.setSupportsImpactAnalysis(_graphService.supportsMultiHop()); + args.setVisualConfiguration(_configProvider.getVisualConfig()); + args.setTelemetryConfiguration(_configProvider.getTelemetry()); + args.setTestsConfiguration(_configProvider.getMetadataTests()); + args.setDatahubConfiguration(_configProvider.getDatahub()); + args.setViewsConfiguration(_configProvider.getViews()); + args.setSiblingGraphService(_siblingGraphService); + args.setGroupService(_groupService); + args.setRoleService(_roleService); + args.setInviteTokenService(_inviteTokenService); + args.setPostService(_postService); + args.setViewService(_viewService); + args.setSettingsService(_settingsService); + args.setLineageService(_lineageService); + args.setFeatureFlags(_configProvider.getFeatureFlags()); return new GmsGraphQLEngine( - _entityClient, - _graphClient, - _usageClient, - null, - _entityService, - _recommendationsService, - _statefulTokenService, - _timeseriesAspectService, - _entityRegistry, - _secretService, - _nativeUserService, - _configProvider.getIngestion(), - _configProvider.getAuthentication(), - _configProvider.getAuthorization(), - _gitVersion, - _timelineService, - _graphService.supportsMultiHop(), - _configProvider.getVisualConfig(), - _configProvider.getTelemetry(), - _configProvider.getMetadataTests(), - _configProvider.getDatahub(), - _configProvider.getViews(), - _siblingGraphService, - _groupService, - _roleService, - _inviteTokenService, - _postService, - _viewService, - _settingsService, - _lineageService, - _configProvider.getFeatureFlags() + args ).builder().build(); } }