Remove unused Guice (#2120)

This commit is contained in:
Matt 2022-01-09 21:03:50 -08:00 committed by GitHub
parent 9194b8e4ba
commit ed797dc335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 38 additions and 157 deletions

View File

@ -0,0 +1,36 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="Location" />
</inspection_tool>
</profile>
</component>

View File

@ -82,10 +82,6 @@
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>

View File

@ -13,8 +13,6 @@
package org.openmetadata.catalog;
import com.google.inject.Guice;
import com.google.inject.Injector;
import io.dropwizard.Application;
import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.health.conf.HealthConfiguration;
@ -44,7 +42,6 @@ import org.openmetadata.catalog.events.EventPubSub;
import org.openmetadata.catalog.exception.CatalogGenericExceptionMapper;
import org.openmetadata.catalog.exception.ConstraintViolationExceptionMapper;
import org.openmetadata.catalog.exception.JsonMappingExceptionMapper;
import org.openmetadata.catalog.module.CatalogModule;
import org.openmetadata.catalog.resources.CollectionRegistry;
import org.openmetadata.catalog.resources.config.ConfigResource;
import org.openmetadata.catalog.resources.search.SearchResource;
@ -60,7 +57,6 @@ import org.slf4j.LoggerFactory;
/** Main catalog application */
public class CatalogApplication extends Application<CatalogApplicationConfig> {
public static final Logger LOG = LoggerFactory.getLogger(CatalogApplication.class);
private Injector injector;
private Authorizer authorizer;
@Override
@ -156,7 +152,6 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
ContainerRequestFilter filter = NoopFilter.class.getConstructor().newInstance();
environment.jersey().register(filter);
}
injector = Guice.createInjector(new CatalogModule(authorizer));
}
private void registerEventFilter(CatalogApplicationConfig catalogConfig, Environment environment, Jdbi jdbi) {
@ -168,22 +163,6 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
private void registerResources(CatalogApplicationConfig config, Environment environment, Jdbi jdbi) {
CollectionRegistry.getInstance().registerResources(jdbi, environment, config, authorizer);
environment
.lifecycle()
.manage(
new Managed() {
@Override
public void start() {
LOG.info("Application starting");
}
@Override
public void stop() {
long startTime = System.currentTimeMillis();
LOG.info("Took {} ms to close all the services", (System.currentTimeMillis() - startTime));
}
});
environment.jersey().register(new SearchResource(config.getElasticSearchConfiguration()));
environment.jersey().register(new JsonPatchProvider());
ErrorPageErrorHandler eph = new ErrorPageErrorHandler();
@ -200,14 +179,14 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
@Override
public void start() throws Exception {
LOG.info("starting the application");
LOG.info("Starting the application");
EventPubSub.start();
}
@Override
public void stop() throws Exception {
EventPubSub.shutdown();
LOG.info("stopping the application");
LOG.info("Stopping the application");
}
}
}

View File

@ -1,37 +0,0 @@
/*
* Copyright 2021 Collate
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openmetadata.catalog.module;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import org.openmetadata.catalog.security.Authorizer;
public class CatalogModule extends AbstractModule {
private final Authorizer authorizer;
public CatalogModule(Authorizer authorizer) {
this.authorizer = authorizer;
}
// Authorizer
@Provides
public Authorizer providesAuthorizer() {
return authorizer;
}
@Override
protected void configure() {
// TODO do we need this
}
}

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.bots;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -61,7 +60,6 @@ public class BotsResource {
private final BotsRepository dao;
private final Authorizer authorizer;
@Inject
public BotsResource(CollectionDAO dao, Authorizer authorizer) {
this.dao = new BotsRepository(dao);
this.authorizer = authorizer;

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.charts;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -92,7 +91,6 @@ public class ChartResource {
return chart;
}
@Inject
public ChartResource(CollectionDAO dao, Authorizer authorizer) {
this.dao = new ChartRepository(dao);
this.authorizer = authorizer;

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.dashboards;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -92,7 +91,6 @@ public class DashboardResource {
return dashboard;
}
@Inject
public DashboardResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "DashboardRepository must not be null");
this.dao = new DashboardRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.databases;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -103,7 +102,6 @@ public class DatabaseResource {
databaseEntityReference.withHref(RestUtil.getHref(uriInfo, COLLECTION_PATH, databaseEntityReference.getId()));
}
@Inject
public DatabaseResource(CollectionDAO dao, Authorizer authorizer) {
this.dao = new DatabaseRepository(dao);
this.authorizer = authorizer;

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.databases;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -90,7 +89,6 @@ public class TableResource {
return table;
}
@Inject
public TableResource(CollectionDAO dao, Authorizer authorizer) {
this.dao = new TableRepository(dao);
this.authorizer = authorizer;

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.events;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -65,7 +64,6 @@ public class EventResource {
}
}
@Inject
public EventResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "ChangeEventRepository must not be null");
this.dao = new ChangeEventRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.events;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -82,7 +81,6 @@ public class WebhookResource {
}
}
@Inject
public WebhookResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "ChangeEventRepository must not be null");
this.dao = new WebhookRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.feeds;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -67,7 +66,6 @@ public class FeedResource {
return thread;
}
@Inject
public FeedResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "FeedRepository must not be null");
this.dao = new FeedRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.lineage;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -58,7 +57,6 @@ public class LineageResource {
private static final Logger LOG = LoggerFactory.getLogger(UserResource.class);
private final LineageRepository dao;
@Inject
public LineageResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "LineageRepository must not be null");
this.dao = new LineageRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.locations;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -84,7 +83,6 @@ public class LocationResource {
return location;
}
@Inject
public LocationResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "LocationRepository must not be null");
this.dao = new LocationRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.metrics;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -64,7 +63,6 @@ public class MetricsResource {
public static final String COLLECTION_PATH = "/v1/metrics/";
private final MetricsRepository dao;
@Inject
public MetricsResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "MetricsRepository must not be null");
this.dao = new MetricsRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.mlmodels;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -85,7 +84,6 @@ public class MlModelResource {
return mlmodel;
}
@Inject
public MlModelResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "ModelRepository must not be null");
this.dao = new MlModelRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.operations;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -103,7 +102,6 @@ public class IngestionResource {
return ingestion;
}
@Inject
public IngestionResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "IngestionRepository must not be null");
this.dao = new IngestionRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.pipelines;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -92,7 +91,6 @@ public class PipelineResource {
return pipeline;
}
@Inject
public PipelineResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "PipelineRepository must not be null");
this.dao = new PipelineRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.policies;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
@ -90,7 +89,6 @@ public class PolicyResource {
return policy;
}
@Inject
public PolicyResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "PolicyRepository must not be null");
this.dao = new PolicyRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.reports;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -60,7 +59,6 @@ public class ReportResource {
public static final String COLLECTION_PATH = "/v1/bots/";
private final ReportRepository dao;
@Inject
public ReportResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "ReportRepository must not be null");
this.dao = new ReportRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.services.dashboard;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -68,7 +67,6 @@ public class DashboardServiceResource {
private final DashboardServiceRepository dao;
private final Authorizer authorizer;
@Inject
public DashboardServiceResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "DashboardServiceRepository must not be null");
this.dao = new DashboardServiceRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.services.database;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -68,7 +67,6 @@ public class DatabaseServiceResource {
private final DatabaseServiceRepository dao;
private final Authorizer authorizer;
@Inject
public DatabaseServiceResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "DatabaseServiceRepository must not be null");
this.dao = new DatabaseServiceRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.services.messaging;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -68,7 +67,6 @@ public class MessagingServiceResource {
private final MessagingServiceRepository dao;
private final Authorizer authorizer;
@Inject
public MessagingServiceResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "MessagingServiceRepository must not be null");
this.dao = new MessagingServiceRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.services.pipeline;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -73,7 +72,6 @@ public class PipelineServiceResource {
return service.withHref(RestUtil.getHref(uriInfo, "v1/services/pipelineServices/", service.getId()));
}
@Inject
public PipelineServiceResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "PipelineServiceRepository must not be null");
this.dao = new PipelineServiceRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.services.storage;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -68,7 +67,6 @@ public class StorageServiceResource {
private final StorageServiceRepository dao;
private final Authorizer authorizer;
@Inject
public StorageServiceResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "StorageServiceRepository must not be null");
this.dao = new StorageServiceRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.tags;
import com.google.inject.Inject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
@ -81,7 +80,6 @@ public class TagResource {
}
}
@Inject
public TagResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "TagRepository must not be null");
this.dao = new TagRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.teams;
import com.google.inject.Inject;
import io.dropwizard.jersey.PATCH;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
@ -75,7 +74,6 @@ public class RoleResource {
private final RoleRepository dao;
private final Authorizer authorizer;
@Inject
public RoleResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "RoleRepository must not be null");
this.dao = new RoleRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.teams;
import com.google.inject.Inject;
import io.dropwizard.jersey.PATCH;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
@ -82,7 +81,6 @@ public class TeamResource {
return team;
}
@Inject
public TeamResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "TeamRepository must not be null");
this.dao = new TeamRepository(dao);

View File

@ -13,7 +13,6 @@
package org.openmetadata.catalog.resources.teams;
import com.google.inject.Inject;
import io.dropwizard.jersey.PATCH;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
@ -92,7 +91,6 @@ public class UserResource {
return user;
}
@Inject
public UserResource(CollectionDAO dao, Authorizer authorizer) {
Objects.requireNonNull(dao, "UserRepository must not be null");
this.dao = new UserRepository(dao);

View File

@ -1,37 +0,0 @@
/*
* Copyright 2021 Collate
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openmetadata.common.module;
import java.util.Map;
/**
* Used to define start() and stop() methods for a guice module that expects to start and stop services with creation
* and destruction of a injector
*/
public interface StartableModule {
/**
* Starts up required services before tests are invoked for a test class
*
* @param props properties that were defined as a part of CatalogTest
*/
void start(Map<String, Object> props);
/**
* Stops services that were invoked with start() after all the tests for a class
*
* @param props properties that were defined as a part of CatalogTest
*/
void stop(Map<String, Object> props);
}

View File

@ -44,7 +44,6 @@
<jersey-client.version>2.33</jersey-client.version>
<jersey-media-json-jackson.version>2.33</jersey-media-json-jackson.version>
<ambari-metrics-common.version>2.6.1.0.0</ambari-metrics-common.version>
<google-guice.version>5.0.1</google-guice.version>
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<!-- update from here -->
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
@ -188,11 +187,6 @@
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey-media-multipart.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${google-guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>