mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-01 11:09:14 +00:00
Initialize REST collections based on @Collection annotation
This commit is contained in:
parent
ad8210e286
commit
642ca13411
@ -89,7 +89,7 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
|
||||
SqlLogger sqlLogger = new SqlLogger() {
|
||||
@Override
|
||||
public void logAfterExecution(StatementContext context) {
|
||||
LOG.info("sql {}, parameters {}, timeTaken {} ms", context.getRenderedSql(),
|
||||
LOG.debug("sql {}, parameters {}, timeTaken {} ms", context.getRenderedSql(),
|
||||
context.getBinding().toString(), context.getElapsedTime(ChronoUnit.MILLIS));
|
||||
}
|
||||
};
|
||||
@ -175,7 +175,7 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
|
||||
}
|
||||
|
||||
private void registerResources(CatalogApplicationConfig config, Environment environment, Jdbi jdbi) throws IOException {
|
||||
CollectionRegistry.getInstance().registerResources3(jdbi, environment, authorizer);
|
||||
CollectionRegistry.getInstance().registerResources(jdbi, environment, authorizer);
|
||||
|
||||
environment.lifecycle().manage(new Managed() {
|
||||
@Override
|
||||
|
||||
@ -18,6 +18,7 @@ package org.openmetadata.catalog;
|
||||
|
||||
import com.codahale.metrics.health.HealthCheck;
|
||||
import org.jdbi.v3.core.Jdbi;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.UserRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.UserRepositoryHelper;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
@ -32,7 +33,7 @@ public class CatalogHealthCheck extends HealthCheck {
|
||||
|
||||
public CatalogHealthCheck(CatalogApplicationConfig config, Jdbi jdbi) {
|
||||
super();
|
||||
UserRepository3 repo = jdbi.onDemand(UserRepository3.class);
|
||||
CollectionDAO repo = jdbi.onDemand(CollectionDAO.class);
|
||||
this.userRepositoryHelper = new UserRepositoryHelper(repo);
|
||||
}
|
||||
|
||||
|
||||
@ -26,9 +26,9 @@ import java.util.List;
|
||||
|
||||
public class BotsRepositoryHelper {
|
||||
|
||||
public BotsRepositoryHelper(BotsRepository3 repo3) { this.repo3 = repo3; }
|
||||
public BotsRepositoryHelper(CollectionDAO repo3) { this.repo3 = repo3; }
|
||||
|
||||
private final BotsRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public Bots insert(Bots bots) throws JsonProcessingException {
|
||||
bots.setHref(null);
|
||||
|
||||
@ -50,12 +50,12 @@ public class ChartRepositoryHelper extends EntityRepository<Chart>{
|
||||
private static final Fields CHART_UPDATE_FIELDS = new Fields(ChartResource.FIELD_LIST, "owner");
|
||||
private static final Fields CHART_PATCH_FIELDS = new Fields(ChartResource.FIELD_LIST, "owner,service,tags");
|
||||
|
||||
public ChartRepositoryHelper(ChartRepository3 repo3) {
|
||||
public ChartRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Chart.class, repo3.chartDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final ChartRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public static String getFQN(Chart chart) {
|
||||
return (chart.getService().getName() + "." + chart.getName());
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package org.openmetadata.catalog.jdbi3;
|
||||
|
||||
import org.jdbi.v3.sqlobject.CreateSqlObject;
|
||||
import org.openmetadata.catalog.entity.data.Chart;
|
||||
import org.openmetadata.catalog.entity.data.Metrics;
|
||||
import org.openmetadata.catalog.entity.data.Pipeline;
|
||||
import org.openmetadata.catalog.entity.data.Task;
|
||||
import org.openmetadata.catalog.entity.services.MessagingService;
|
||||
import org.openmetadata.catalog.jdbi3.AuditLogRepository.AuditLogDAO;
|
||||
|
||||
public interface CollectionDAO {
|
||||
@CreateSqlObject
|
||||
DatabaseDAO3 databaseDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
EntityRelationshipDAO3 relationshipDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
FieldRelationshipDAO3 fieldRelationshipDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
EntityExtensionDAO3 entityExtensionDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
UserDAO3 userDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
TeamDAO3 teamDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
TagDAO3 tagDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
TableDAO3 tableDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
UsageDAO3 usageDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
MetricsDAO3 metricsDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
TaskDAO3 taskDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
ChartDAO3 chartDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
PipelineDAO3 pipelineDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
DashboardDAO3 dashboardDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
ReportDAO3 reportDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
TopicDAO3 topicDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
ModelDAO3 modelDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
BotsDAO3 botsDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
DatabaseServiceDAO3 dbServiceDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
PipelineServiceDAO3 pipelineServiceDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
DashboardServiceDAO3 dashboardServiceDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
MessagingServiceDAO3 messagingServiceDAO();
|
||||
|
||||
@CreateSqlObject
|
||||
FeedDAO3 feedDAO();
|
||||
}
|
||||
@ -55,12 +55,12 @@ public class DashboardRepositoryHelper extends EntityRepository<Dashboard> {
|
||||
private static final Fields DASHBOARD_PATCH_FIELDS = new Fields(DashboardResource.FIELD_LIST,
|
||||
"owner,service,tags,charts");
|
||||
|
||||
public DashboardRepositoryHelper(DashboardRepository3 repo3) {
|
||||
public DashboardRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Dashboard.class, repo3.dashboardDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final DashboardRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public static String getFQN(Dashboard dashboard) {
|
||||
return (dashboard.getService().getName() + "." + dashboard.getName());
|
||||
|
||||
@ -39,9 +39,9 @@ import static org.openmetadata.catalog.exception.CatalogExceptionMessage.entityN
|
||||
|
||||
|
||||
public class DashboardServiceRepositoryHelper extends EntityRepository<DashboardService> {
|
||||
private final DashboardServiceRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public DashboardServiceRepositoryHelper(DashboardServiceRepository3 repo3) {
|
||||
public DashboardServiceRepositoryHelper(CollectionDAO repo3) {
|
||||
super(DashboardService.class, repo3.dashboardServiceDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
@ -57,12 +57,12 @@ public class DatabaseRepositoryHelper extends EntityRepository<Database> {
|
||||
private static final Fields DATABASE_PATCH_FIELDS = new Fields(DatabaseResource.FIELD_LIST,
|
||||
"owner,service, usageSummary");
|
||||
|
||||
public DatabaseRepositoryHelper(DatabaseRepository3 repo3) {
|
||||
public DatabaseRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Database.class, repo3.databaseDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final DatabaseRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public static String getFQN(Database database) {
|
||||
return (database.getService().getName() + "." + database.getName());
|
||||
|
||||
@ -39,9 +39,9 @@ import static org.openmetadata.catalog.exception.CatalogExceptionMessage.entityN
|
||||
|
||||
|
||||
public class DatabaseServiceRepositoryHelper extends EntityRepository<DatabaseService> {
|
||||
private final DatabaseServiceRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public DatabaseServiceRepositoryHelper(DatabaseServiceRepository3 repo3) {
|
||||
public DatabaseServiceRepositoryHelper(CollectionDAO repo3) {
|
||||
super(DatabaseService.class, repo3.dbServiceDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
@ -36,9 +36,9 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class FeedRepositoryHelper {
|
||||
public FeedRepositoryHelper(FeedRepository3 repo3) { this.repo3 = repo3; }
|
||||
public FeedRepositoryHelper(CollectionDAO repo3) { this.repo3 = repo3; }
|
||||
|
||||
private final FeedRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Transaction
|
||||
public Thread create(Thread thread) throws IOException {
|
||||
|
||||
@ -36,9 +36,9 @@ import static org.openmetadata.catalog.util.EntityUtil.getEntityReference;
|
||||
public class LineageRepositoryHelper {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LineageRepositoryHelper.class);
|
||||
|
||||
public LineageRepositoryHelper(LineageRepository3 repo3) { this.repo3 = repo3; }
|
||||
public LineageRepositoryHelper(CollectionDAO repo3) { this.repo3 = repo3; }
|
||||
|
||||
private final LineageRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Transaction
|
||||
public EntityLineage get(String entityType, String id, int upstreamDepth, int downstreamDepth) throws IOException {
|
||||
|
||||
@ -38,9 +38,9 @@ import java.util.List;
|
||||
import static org.openmetadata.catalog.exception.CatalogExceptionMessage.entityNotFound;
|
||||
|
||||
public class MessagingServiceRepositoryHelper extends EntityRepository<MessagingService> {
|
||||
private final MessagingServiceRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public MessagingServiceRepositoryHelper(MessagingServiceRepository3 repo3) {
|
||||
public MessagingServiceRepositoryHelper(CollectionDAO repo3) {
|
||||
super(MessagingService.class, repo3.messagingServiceDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
@ -43,12 +43,12 @@ import java.util.UUID;
|
||||
public class MetricsRepositoryHelper extends EntityRepository<Metrics> {
|
||||
private static final Fields METRICS_UPDATE_FIELDS = new Fields(MetricsResource.FIELD_LIST, "owner,service");
|
||||
|
||||
public MetricsRepositoryHelper(MetricsRepository3 repo3) {
|
||||
public MetricsRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Metrics.class, repo3.metricsDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final MetricsRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public static String getFQN(Metrics metrics) {
|
||||
return (metrics.getService().getName() + "." + metrics.getName());
|
||||
|
||||
@ -55,12 +55,12 @@ public class ModelRepositoryHelper extends EntityRepository<Model> {
|
||||
private static final Fields MODEL_PATCH_FIELDS = new Fields(ModelResource.FIELD_LIST,
|
||||
"owner,dashboard,tags");
|
||||
|
||||
public ModelRepositoryHelper(ModelRepository3 repo3) {
|
||||
public ModelRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Model.class, repo3.modelDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final ModelRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public static String getFQN(Model model) {
|
||||
return (model.getName());
|
||||
|
||||
@ -54,12 +54,12 @@ public class PipelineRepositoryHelper extends EntityRepository<Pipeline> {
|
||||
private static final Fields PIPELINE_PATCH_FIELDS = new Fields(PipelineResource.FIELD_LIST,
|
||||
"owner,service,tags,tasks");
|
||||
|
||||
public PipelineRepositoryHelper(PipelineRepository3 repo3) {
|
||||
public PipelineRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Pipeline.class, repo3.pipelineDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final PipelineRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
public static String getFQN(Pipeline pipeline) {
|
||||
return (pipeline.getService().getName() + "." + pipeline.getName());
|
||||
|
||||
@ -39,12 +39,12 @@ import static org.openmetadata.catalog.exception.CatalogExceptionMessage.entityN
|
||||
|
||||
|
||||
public class PipelineServiceRepositoryHelper extends EntityRepository<PipelineService> {
|
||||
public PipelineServiceRepositoryHelper(PipelineServiceRepository3 repo3) {
|
||||
public PipelineServiceRepositoryHelper(CollectionDAO repo3) {
|
||||
super(PipelineService.class, repo3.pipelineServiceDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final PipelineServiceRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Transaction
|
||||
public PipelineService create(PipelineService pipelineService) throws JsonProcessingException {
|
||||
|
||||
@ -39,12 +39,12 @@ import java.util.List;
|
||||
public class ReportRepositoryHelper extends EntityRepository<Report>{
|
||||
private static final Fields REPORT_UPDATE_FIELDS = new Fields(ReportResource.FIELD_LIST, "owner,service");
|
||||
|
||||
public ReportRepositoryHelper(ReportRepository3 repo3) {
|
||||
public ReportRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Report.class, repo3.reportDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final ReportRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Transaction
|
||||
public Report create(Report report, EntityReference service, EntityReference owner) throws IOException {
|
||||
|
||||
@ -80,12 +80,12 @@ public class TableRepositoryHelper extends EntityRepository<Table> {
|
||||
static final Fields TABLE_UPDATE_FIELDS = new Fields(TableResource.FIELD_LIST,
|
||||
"owner,columns,database,tags,tableConstraints");
|
||||
|
||||
public TableRepositoryHelper(TableRepository3 repo3) {
|
||||
public TableRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Table.class, repo3.tableDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final TableRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName(Table entity) {
|
||||
|
||||
@ -40,9 +40,9 @@ import java.util.Optional;
|
||||
public class TagRepositoryHelper {
|
||||
public static final Logger LOG = LoggerFactory.getLogger(TagRepositoryHelper.class);
|
||||
|
||||
public TagRepositoryHelper(TagRepository3 repo3) { this.repo3 = repo3; }
|
||||
public TagRepositoryHelper(CollectionDAO repo3) { this.repo3 = repo3; }
|
||||
|
||||
private final TagRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
/**
|
||||
* Initialize a category one time when the service comes up for the first time
|
||||
|
||||
@ -57,12 +57,12 @@ public class TaskRepositoryHelper extends EntityRepository<Task>{
|
||||
return (task.getService().getName() + "." + task.getName());
|
||||
}
|
||||
|
||||
public TaskRepositoryHelper(TaskRepository3 repo3) {
|
||||
public TaskRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Task.class,repo3.taskDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final TaskRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Transaction
|
||||
public Task create(Task task) throws IOException {
|
||||
|
||||
@ -50,12 +50,12 @@ import static org.openmetadata.catalog.jdbi3.Relationship.OWNS;
|
||||
public class TeamRepositoryHelper extends EntityRepository<Team> {
|
||||
static final Fields TEAM_PATCH_FIELDS = new Fields(TeamResource.FIELD_LIST, "profile,users");
|
||||
|
||||
public TeamRepositoryHelper(TeamRepository3 repo3) {
|
||||
public TeamRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Team.class,repo3.teamDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final TeamRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
|
||||
public static List<EntityReference> toEntityReference(List<User> users) {
|
||||
|
||||
@ -58,12 +58,12 @@ public class TopicRepositoryHelper extends EntityRepository<Topic> {
|
||||
return (topic.getService().getName() + "." + topic.getName());
|
||||
}
|
||||
|
||||
public TopicRepositoryHelper(TopicRepository3 repo3) {
|
||||
public TopicRepositoryHelper(CollectionDAO repo3) {
|
||||
super(Topic.class, repo3.topicDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
private final TopicRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Transaction
|
||||
public Topic create(Topic topic) throws IOException {
|
||||
@ -214,7 +214,7 @@ public class TopicRepositoryHelper extends EntityRepository<Topic> {
|
||||
private EntityReference getService(EntityReference service) throws IOException {
|
||||
String id = service.getId().toString();
|
||||
if (service.getType().equalsIgnoreCase(Entity.MESSAGING_SERVICE)) {
|
||||
MessagingService serviceInstance = repo3.messageServiceDAO().findEntityById(id);
|
||||
MessagingService serviceInstance = repo3.messagingServiceDAO().findEntityById(id);
|
||||
service.setDescription(serviceInstance.getDescription());
|
||||
service.setName(serviceInstance.getName());
|
||||
} else {
|
||||
|
||||
@ -40,9 +40,9 @@ import static org.openmetadata.catalog.util.EntityUtil.getEntityReference;
|
||||
public class UsageRepositoryHelper {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UsageRepositoryHelper.class);
|
||||
|
||||
public UsageRepositoryHelper(UsageRepository3 repo3) { this.repo3 = repo3; }
|
||||
public UsageRepositoryHelper(CollectionDAO repo3) { this.repo3 = repo3; }
|
||||
|
||||
private final UsageRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
@Transaction
|
||||
public EntityUsage get(String entityType, String id, String date, int days) throws IOException {
|
||||
|
||||
@ -42,7 +42,6 @@ import javax.ws.rs.core.Response.Status;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
@ -59,10 +58,10 @@ public class UserRepositoryHelper extends EntityRepository<User> {
|
||||
static final Fields USER_PATCH_FIELDS = new Fields(UserResource.FIELD_LIST, "profile,teams");
|
||||
static final Fields USER_UPDATE_FIELDS = new Fields(UserResource.FIELD_LIST, "profile,teams");
|
||||
|
||||
private final UserRepository3 repo3;
|
||||
private final CollectionDAO repo3;
|
||||
|
||||
|
||||
public UserRepositoryHelper(UserRepository3 repo3) {
|
||||
public UserRepositoryHelper(CollectionDAO repo3) {
|
||||
super(User.class,repo3.userDAO());
|
||||
this.repo3 = repo3;
|
||||
}
|
||||
|
||||
@ -25,6 +25,4 @@ import java.lang.annotation.Target;
|
||||
@Target(value = ElementType.TYPE)
|
||||
public @interface Collection {
|
||||
String name();
|
||||
|
||||
String repositoryClass() default "";
|
||||
}
|
||||
|
||||
@ -19,73 +19,11 @@ package org.openmetadata.catalog.resources;
|
||||
import io.dropwizard.setup.Environment;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.jdbi.v3.core.Jdbi;
|
||||
import org.openmetadata.catalog.jdbi3.BotsRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.BotsRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.ChartRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.ChartRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.DashboardRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.DashboardRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.DashboardServiceRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.DashboardServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.DatabaseRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.DatabaseRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.DatabaseServiceRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.DatabaseServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.FeedRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.FeedRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.LineageRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.LineageRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.MessagingServiceRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.MessagingServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.MetricsRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.MetricsRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.ModelRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.ModelRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.PipelineRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.PipelineRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.PipelineServiceRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.PipelineServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.ReportRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.ReportRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.TableRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.TableRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.TagRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.TagRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.TaskRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.TaskRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.TeamRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.TeamRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.TopicRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.TopicRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.UsageRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.UsageRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.UserRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.UserRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.bots.BotsResource;
|
||||
import org.openmetadata.catalog.resources.charts.ChartResource;
|
||||
import org.openmetadata.catalog.resources.dashboards.DashboardResource;
|
||||
import org.openmetadata.catalog.resources.databases.DatabaseResource;
|
||||
import org.openmetadata.catalog.resources.databases.TableResource;
|
||||
import org.openmetadata.catalog.resources.feeds.FeedResource;
|
||||
import org.openmetadata.catalog.resources.lineage.LineageResource;
|
||||
import org.openmetadata.catalog.resources.metrics.MetricsResource;
|
||||
import org.openmetadata.catalog.resources.models.ModelResource;
|
||||
import org.openmetadata.catalog.resources.pipelines.PipelineResource;
|
||||
import org.openmetadata.catalog.resources.reports.ReportResource;
|
||||
import org.openmetadata.catalog.resources.services.dashboard.DashboardServiceResource;
|
||||
import org.openmetadata.catalog.resources.services.database.DatabaseServiceResource;
|
||||
import org.openmetadata.catalog.resources.services.messaging.MessagingServiceResource;
|
||||
import org.openmetadata.catalog.resources.services.pipeline.PipelineServiceResource;
|
||||
import org.openmetadata.catalog.resources.tags.TagResource;
|
||||
import org.openmetadata.catalog.resources.tasks.TaskResource;
|
||||
import org.openmetadata.catalog.resources.teams.TeamResource;
|
||||
import org.openmetadata.catalog.resources.teams.UserResource;
|
||||
import org.openmetadata.catalog.resources.topics.TopicResource;
|
||||
import org.openmetadata.catalog.resources.usage.UsageResource;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.type.CollectionDescriptor;
|
||||
import org.openmetadata.catalog.type.CollectionInfo;
|
||||
import org.openmetadata.catalog.util.RestUtil;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.reflections.Reflections;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -93,7 +31,6 @@ import org.slf4j.LoggerFactory;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -117,14 +54,12 @@ public final class CollectionRegistry {
|
||||
|
||||
public static class CollectionDetails {
|
||||
private final String resourceClass;
|
||||
private final String repoClass;
|
||||
private final CollectionDescriptor cd;
|
||||
private final List<CollectionDescriptor> childCollections = new ArrayList<>();
|
||||
|
||||
CollectionDetails(CollectionDescriptor cd, String resourceClass, String repoClass) {
|
||||
CollectionDetails(CollectionDescriptor cd, String resourceClass) {
|
||||
this.cd = cd;
|
||||
this.resourceClass = resourceClass;
|
||||
this.repoClass = repoClass;
|
||||
}
|
||||
|
||||
public void addChildCollection(CollectionDetails child) {
|
||||
@ -211,9 +146,8 @@ public final class CollectionRegistry {
|
||||
for (Map.Entry<String, CollectionDetails> e : collectionMap.entrySet()) {
|
||||
CollectionDetails details = e.getValue();
|
||||
String resourceClass = details.resourceClass;
|
||||
String repositoryClass = details.repoClass;
|
||||
try {
|
||||
Object resource = createResource(jdbi, resourceClass, repositoryClass, authorizer);
|
||||
Object resource = createResource(jdbi, resourceClass, authorizer);
|
||||
environment.jersey().register(resource);
|
||||
LOG.info("Registering {}", resourceClass);
|
||||
} catch (Exception ex) {
|
||||
@ -222,164 +156,12 @@ public final class CollectionRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register resources from CollectionRegistry
|
||||
*/
|
||||
public void registerResources3(Jdbi jdbi, Environment environment, CatalogAuthorizer authorizer) throws IOException {
|
||||
LOG.info("Initializing jdbi3");
|
||||
|
||||
final TableRepository3 daoObject = jdbi.onDemand(TableRepository3.class);
|
||||
TableRepositoryHelper helper = new TableRepositoryHelper(daoObject);
|
||||
TableResource resource = new TableResource(helper, authorizer);
|
||||
environment.jersey().register(resource);
|
||||
LOG.info("Registering {}", resource);
|
||||
|
||||
final DatabaseRepository3 daoObject1 = jdbi.onDemand(DatabaseRepository3.class);
|
||||
DatabaseRepositoryHelper helper1 = new DatabaseRepositoryHelper(daoObject1);
|
||||
DatabaseResource resource1 = new DatabaseResource(helper1, authorizer);
|
||||
environment.jersey().register(resource1);
|
||||
LOG.info("Registering {}", resource1);
|
||||
|
||||
final TopicRepository3 topicRepository3 = jdbi.onDemand(TopicRepository3.class);
|
||||
TopicRepositoryHelper topicRepositoryHelper = new TopicRepositoryHelper(topicRepository3);
|
||||
TopicResource topicResource = new TopicResource(topicRepositoryHelper, authorizer);
|
||||
environment.jersey().register(topicResource);
|
||||
LOG.info("Registering {}", topicResource);
|
||||
|
||||
final ChartRepository3 chartRepository3 = jdbi.onDemand(ChartRepository3.class);
|
||||
ChartRepositoryHelper chartRepositoryHelper = new ChartRepositoryHelper(chartRepository3);
|
||||
ChartResource chartResource = new ChartResource(chartRepositoryHelper, authorizer);
|
||||
environment.jersey().register(chartResource);
|
||||
LOG.info("Registering {}", chartResource);
|
||||
|
||||
final BotsRepository3 botsRepository3 = jdbi.onDemand(BotsRepository3.class);
|
||||
BotsRepositoryHelper botsRepositoryHelper = new BotsRepositoryHelper(botsRepository3);
|
||||
BotsResource botsResource = new BotsResource(botsRepositoryHelper, authorizer);
|
||||
environment.jersey().register(botsResource);
|
||||
LOG.info("Registering {}", botsResource);
|
||||
|
||||
final DashboardRepository3 dashboardRepository3 = jdbi.onDemand(DashboardRepository3.class);
|
||||
DashboardRepositoryHelper dashboardRepositoryHelper = new DashboardRepositoryHelper(dashboardRepository3);
|
||||
DashboardResource dashboardResource = new DashboardResource(dashboardRepositoryHelper, authorizer);
|
||||
environment.jersey().register(dashboardResource);
|
||||
LOG.info("Registering {}", dashboardResource);
|
||||
|
||||
final DashboardServiceRepository3 dashboardServiceRepository3 = jdbi.onDemand(DashboardServiceRepository3.class);
|
||||
DashboardServiceRepositoryHelper dashboardServiceRepositoryHelper = new DashboardServiceRepositoryHelper(dashboardServiceRepository3);
|
||||
DashboardServiceResource dashboardServiceResource = new DashboardServiceResource(dashboardServiceRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(dashboardServiceResource);
|
||||
LOG.info("Registering {}", dashboardServiceResource);
|
||||
|
||||
final DatabaseServiceRepository3 databaseServiceRepository3 = jdbi.onDemand(DatabaseServiceRepository3.class);
|
||||
DatabaseServiceRepositoryHelper databaseServiceRepositoryHelper = new DatabaseServiceRepositoryHelper(databaseServiceRepository3);
|
||||
DatabaseServiceResource databaseServiceResource = new DatabaseServiceResource(databaseServiceRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(databaseServiceResource);
|
||||
LOG.info("Registering {}", databaseServiceResource);
|
||||
|
||||
final MessagingServiceRepository3 messagingServiceRepository3 = jdbi.onDemand(MessagingServiceRepository3.class);
|
||||
MessagingServiceRepositoryHelper messagingServiceRepositoryHelper = new MessagingServiceRepositoryHelper(messagingServiceRepository3);
|
||||
MessagingServiceResource messagingServiceResource = new MessagingServiceResource(messagingServiceRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(messagingServiceResource);
|
||||
LOG.info("Registering {}", messagingServiceResource);
|
||||
|
||||
final MetricsRepository3 metricsRepository3 = jdbi.onDemand(MetricsRepository3.class);
|
||||
MetricsRepositoryHelper metricsRepositoryHelper = new MetricsRepositoryHelper(metricsRepository3);
|
||||
MetricsResource metricsResource = new MetricsResource(metricsRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(metricsResource);
|
||||
LOG.info("Registering {}", metricsResource);
|
||||
|
||||
final ModelRepository3 modelRepository3 = jdbi.onDemand(ModelRepository3.class);
|
||||
ModelRepositoryHelper modelRepositoryHelper = new ModelRepositoryHelper(modelRepository3);
|
||||
ModelResource modelResource = new ModelResource(modelRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(modelResource);
|
||||
LOG.info("Registering {}", modelResource);
|
||||
|
||||
final PipelineRepository3 pipelineRepository3 = jdbi.onDemand(PipelineRepository3.class);
|
||||
PipelineRepositoryHelper pipelineRepositoryHelper = new PipelineRepositoryHelper(pipelineRepository3);
|
||||
PipelineResource pipelineResource = new PipelineResource(pipelineRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(pipelineResource);
|
||||
LOG.info("Registering {}", pipelineResource);
|
||||
|
||||
final PipelineServiceRepository3 pipelineServiceRepository3 = jdbi.onDemand(PipelineServiceRepository3.class);
|
||||
PipelineServiceRepositoryHelper pipelineServiceRepositoryHelper = new PipelineServiceRepositoryHelper(pipelineServiceRepository3);
|
||||
PipelineServiceResource pipelineServiceResource = new PipelineServiceResource(pipelineServiceRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(pipelineServiceResource);
|
||||
LOG.info("Registering {}", pipelineServiceResource);
|
||||
|
||||
final ReportRepository3 reportRepository3 = jdbi.onDemand(ReportRepository3.class);
|
||||
ReportRepositoryHelper reportRepositoryHelper = new ReportRepositoryHelper(reportRepository3);
|
||||
ReportResource reportResource = new ReportResource(reportRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(reportResource);
|
||||
LOG.info("Registering {}", reportResource);
|
||||
|
||||
final TaskRepository3 taskRepository3 = jdbi.onDemand(TaskRepository3.class);
|
||||
TaskRepositoryHelper taskRepositoryHelper = new TaskRepositoryHelper(taskRepository3);
|
||||
TaskResource taskResource = new TaskResource(taskRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(taskResource);
|
||||
LOG.info("Registering {}", taskResource);
|
||||
|
||||
final TeamRepository3 teamRepository3 = jdbi.onDemand(TeamRepository3.class);
|
||||
TeamRepositoryHelper teamRepositoryHelper = new TeamRepositoryHelper(teamRepository3);
|
||||
TeamResource teamResource = new TeamResource(teamRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(teamResource);
|
||||
LOG.info("Registering {}", teamResource);
|
||||
|
||||
final UserRepository3 userRepository3 = jdbi.onDemand(UserRepository3.class);
|
||||
UserRepositoryHelper userRepositoryHelper = new UserRepositoryHelper(userRepository3);
|
||||
UserResource userResource = new UserResource(userRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(userResource);
|
||||
LOG.info("Registering {}", userResource);
|
||||
|
||||
final LineageRepository3 lineageRepository3 = jdbi.onDemand(LineageRepository3.class);
|
||||
LineageRepositoryHelper lineageRepositoryHelper = new LineageRepositoryHelper(lineageRepository3);
|
||||
LineageResource lineageResource = new LineageResource(lineageRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(lineageResource);
|
||||
LOG.info("Registering {}", lineageResource);
|
||||
|
||||
final FeedRepository3 feedRepository3 = jdbi.onDemand(FeedRepository3.class);
|
||||
FeedRepositoryHelper feedRepositoryHelper = new FeedRepositoryHelper(feedRepository3);
|
||||
FeedResource feedResource = new FeedResource(feedRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(feedResource);
|
||||
LOG.info("Registering {}", feedResource);
|
||||
|
||||
final UsageRepository3 usageRepository3 = jdbi.onDemand(UsageRepository3.class);
|
||||
UsageRepositoryHelper usageRepositoryHelper = new UsageRepositoryHelper(usageRepository3);
|
||||
UsageResource usageResource = new UsageResource(usageRepositoryHelper,
|
||||
authorizer);
|
||||
environment.jersey().register(usageResource);
|
||||
LOG.info("Registering {}", usageResource);
|
||||
|
||||
final TagRepository3 tagRepository3 = jdbi.onDemand(TagRepository3.class);
|
||||
TagRepositoryHelper tagRepositoryHelper = new TagRepositoryHelper(tagRepository3);
|
||||
TagResource tagResource = new TagResource(tagRepositoryHelper,
|
||||
authorizer);
|
||||
tagResource.initialize();
|
||||
environment.jersey().register(tagResource);
|
||||
LOG.info("Registering {}", tagResource);
|
||||
|
||||
LOG.info("Initialized jdbi3");
|
||||
}
|
||||
|
||||
/** Get collection details based on annotations in Resource classes */
|
||||
private static CollectionDetails getCollection(Class<?> cl) {
|
||||
String href, doc, name, repoClass;
|
||||
String href, doc, name;
|
||||
href = null;
|
||||
doc = null;
|
||||
name = null;
|
||||
repoClass = null;
|
||||
for (Annotation a : cl.getAnnotations()) {
|
||||
if (a instanceof Path) {
|
||||
// Use @Path annotation to compile href
|
||||
@ -390,13 +172,11 @@ public final class CollectionRegistry {
|
||||
} else if (a instanceof Collection) {
|
||||
// Use @Collection annotation to get initialization information for the class
|
||||
name = ((Collection) a).name();
|
||||
repoClass = ((Collection) a).repositoryClass();
|
||||
repoClass = repoClass.isEmpty() ? null : repoClass;
|
||||
}
|
||||
}
|
||||
CollectionDescriptor cd = new CollectionDescriptor();
|
||||
cd.setCollection(new CollectionInfo().withName(name).withDocumentation(doc).withHref(URI.create(href)));
|
||||
return new CollectionDetails(cd, cl.getCanonicalName(), repoClass);
|
||||
return new CollectionDetails(cd, cl.getCanonicalName());
|
||||
}
|
||||
|
||||
/** Compile a list of REST collection based on Resource classes marked with {@code Collection} annotation */
|
||||
@ -414,21 +194,20 @@ public final class CollectionRegistry {
|
||||
}
|
||||
|
||||
/** Create a resource class based on dependencies declared in @Collection annotation */
|
||||
private static Object createResource(Jdbi jdbi, String resourceClass, String repositoryClass,
|
||||
CatalogAuthorizer authorizer) throws
|
||||
private static Object createResource(Jdbi jdbi, String resourceClass, CatalogAuthorizer authorizer) throws
|
||||
ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException,
|
||||
InstantiationException {
|
||||
Object resource;
|
||||
Class<?> clz = Class.forName(resourceClass);
|
||||
|
||||
// Create the resource identified by resourceClass
|
||||
if (repositoryClass != null) {
|
||||
Class<?> repositoryClz = Class.forName(repositoryClass);
|
||||
final Object daoObject = jdbi.onDemand(repositoryClz);
|
||||
LOG.info("Creating resource {} with repository {}", resourceClass, repositoryClass);
|
||||
resource = clz.getDeclaredConstructor(repositoryClz, CatalogAuthorizer.class).newInstance(daoObject, authorizer);
|
||||
} else {
|
||||
LOG.info("Creating resource {} without repository", resourceClass);
|
||||
final CollectionDAO daoObject = jdbi.onDemand(CollectionDAO.class);
|
||||
try {
|
||||
LOG.info("Creating resource {}", resourceClass);
|
||||
resource = clz.getDeclaredConstructor(CollectionDAO.class, CatalogAuthorizer.class).newInstance(daoObject,
|
||||
authorizer);
|
||||
} catch(NoSuchMethodException ex) {
|
||||
LOG.info("Creating resource {} with default constructor", resourceClass);
|
||||
resource = Class.forName(resourceClass).getConstructor().newInstance();
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.entity.Bots;
|
||||
import org.openmetadata.catalog.jdbi3.BotsRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
import org.openmetadata.catalog.util.RestUtil;
|
||||
@ -54,7 +56,7 @@ import java.util.UUID;
|
||||
@Api(value = "Bots collection", tags = "Bots collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "bots", repositoryClass = "org.openmetadata.catalog.jdbi3.BotsRepository3")
|
||||
@Collection(name = "bots")
|
||||
public class BotsResource {
|
||||
public static final String COLLECTION_PATH = "/v1/bots/";
|
||||
private final BotsRepositoryHelper dao;
|
||||
@ -71,9 +73,9 @@ public class BotsResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public BotsResource(BotsRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "BotsRepository3 must not be null");
|
||||
this.dao = dao;
|
||||
public BotsResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "CollectionDAO must not be null");
|
||||
this.dao = new BotsRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreateChart;
|
||||
import org.openmetadata.catalog.entity.data.Chart;
|
||||
import org.openmetadata.catalog.jdbi3.ChartRepositoryHelper;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
@ -77,7 +78,7 @@ import java.util.UUID;
|
||||
@Api(value = "Chart data asset collection", tags = "Chart data asset collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "charts", repositoryClass = "org.openmetadata.catalog.jdbi3.ChartRepository3")
|
||||
@Collection(name = "charts")
|
||||
public class ChartResource {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChartResource.class);
|
||||
private static final String CHART_COLLECTION_PATH = "v1/charts/";
|
||||
@ -103,9 +104,9 @@ public class ChartResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public ChartResource(ChartRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public ChartResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "ChartRepository3 must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new ChartRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,6 @@ public class ConfigResource {
|
||||
this.catalogApplicationConfig = catalogApplicationConfig;
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path(("/auth"))
|
||||
@Operation(summary = "Get auth configuration", tags = "general",
|
||||
|
||||
@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreateDashboard;
|
||||
import org.openmetadata.catalog.entity.data.Dashboard;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.DashboardRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -75,7 +76,7 @@ import java.util.UUID;
|
||||
@Api(value = "Dashboards collection", tags = "Dashboards collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "dashboards", repositoryClass = "org.openmetadata.catalog.jdbi3.DashboardRepositoryHelper")
|
||||
@Collection(name = "dashboards")
|
||||
public class DashboardResource {
|
||||
public static final String DASHBOARD_COLLECTION_PATH = "v1/dashboards/";
|
||||
private final DashboardRepositoryHelper dao;
|
||||
@ -102,9 +103,9 @@ public class DashboardResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public DashboardResource(DashboardRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public DashboardResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "DashboardRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new DashboardRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,9 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreateDatabase;
|
||||
import org.openmetadata.catalog.entity.data.Database;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.DatabaseRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -76,7 +78,7 @@ import java.util.UUID;
|
||||
@Api(value = "Databases collection", tags = "Databases collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "databases", repositoryClass = "org.openmetadata.catalog.jdbi3.DatabaseRepository3")
|
||||
@Collection(name = "databases")
|
||||
public class DatabaseResource {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DatabaseResource.class);
|
||||
private static final String DATABASE_COLLECTION_PATH = "v1/databases/";
|
||||
@ -105,9 +107,9 @@ public class DatabaseResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public DatabaseResource(DatabaseRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public DatabaseResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "DatabaseRepository3 must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new DatabaseRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreateTable;
|
||||
import org.openmetadata.catalog.entity.data.Table;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.TableRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.TableRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
@ -80,7 +81,7 @@ import java.util.UUID;
|
||||
@Api(value = "Tables collection", tags = "Tables collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "tables", repositoryClass = "org.openmetadata.catalog.jdbi3.TableRepository3")
|
||||
@Collection(name = "tables")
|
||||
public class TableResource {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TableResource.class);
|
||||
private static final String TABLE_COLLECTION_PATH = "v1/tables/";
|
||||
@ -102,9 +103,9 @@ public class TableResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public TableResource(TableRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public TableResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "TableRepository3 must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new TableRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.feed.CreateThread;
|
||||
import org.openmetadata.catalog.entity.feed.Thread;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.FeedRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -54,7 +55,7 @@ import java.util.UUID;
|
||||
@Api(value = "Feeds collection", tags = "Feeds collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "feeds", repositoryClass = "org.openmetadata.catalog.jdbi3.FeedRepositoryHelper")
|
||||
@Collection(name = "feeds")
|
||||
public class FeedResource {
|
||||
// TODO add /v1/feed?user=userid
|
||||
public static final String COLLECTION_PATH = "/v1/feed/";
|
||||
@ -71,9 +72,9 @@ public class FeedResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public FeedResource(FeedRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public FeedResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "FeedRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new FeedRepositoryHelper(dao);
|
||||
}
|
||||
|
||||
static class ThreadList extends ResultList<Thread> {
|
||||
|
||||
@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.lineage.AddLineage;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.LineageRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.resources.teams.UserResource;
|
||||
@ -56,15 +57,15 @@ import java.util.Objects;
|
||||
@Api(value = "Lineage resource", tags = "Lineage resource")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "lineage", repositoryClass = "org.openmetadata.catalog.jdbi3.LineageRepositoryHelper")
|
||||
@Collection(name = "lineage")
|
||||
public class LineageResource {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UserResource.class);
|
||||
private final LineageRepositoryHelper dao;
|
||||
|
||||
@Inject
|
||||
public LineageResource(LineageRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public LineageResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "LineageRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new LineageRepositoryHelper(dao);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
@ -24,7 +24,9 @@ import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.entity.data.Metrics;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.MetricsRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.RestUtil;
|
||||
@ -58,7 +60,7 @@ import java.util.UUID;
|
||||
@Api(value = "Metrics collection", tags = "Metrics collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "metrics", repositoryClass = "org.openmetadata.catalog.jdbi3.MetricsRepositoryHelper")
|
||||
@Collection(name = "metrics")
|
||||
public class MetricsResource {
|
||||
public static final String COLLECTION_PATH = "/v1/metrics/";
|
||||
private final MetricsRepositoryHelper dao;
|
||||
@ -69,9 +71,9 @@ public class MetricsResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public MetricsResource(MetricsRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public MetricsResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "MetricsRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new MetricsRepositoryHelper(dao);
|
||||
}
|
||||
|
||||
public static class MetricsList extends ResultList<Metrics> {
|
||||
|
||||
@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreateModel;
|
||||
import org.openmetadata.catalog.entity.data.Model;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.ModelRepositoryHelper;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
@ -98,9 +99,9 @@ public class ModelResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public ModelResource(ModelRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public ModelResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "ModelRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new ModelRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreatePipeline;
|
||||
import org.openmetadata.catalog.entity.data.Pipeline;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.PipelineRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -75,7 +76,7 @@ import java.util.UUID;
|
||||
@Api(value = "Pipelines collection", tags = "Pipelines collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "pipelines", repositoryClass = "org.openmetadata.catalog.jdbi3.PipelineRepositoryHelper")
|
||||
@Collection(name = "pipelines")
|
||||
public class PipelineResource {
|
||||
public static final String PIPELINE_COLLECTION_PATH = "v1/pipelines/";
|
||||
private final PipelineRepositoryHelper dao;
|
||||
@ -102,9 +103,9 @@ public class PipelineResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public PipelineResource(PipelineRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public PipelineResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "PipelineRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new PipelineRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.entity.data.Report;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.ReportRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -58,7 +59,7 @@ import java.util.UUID;
|
||||
@Api(value = "Reports collection", tags = "Reports collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "reports", repositoryClass = "org.openmetadata.catalog.jdbi3.ReportRepositoryHelper")
|
||||
@Collection(name = "reports")
|
||||
public class ReportResource {
|
||||
public static final String COLLECTION_PATH = "/v1/bots/";
|
||||
private final ReportRepositoryHelper dao;
|
||||
@ -74,9 +75,9 @@ public class ReportResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public ReportResource(ReportRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public ReportResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "ReportRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new ReportRepositoryHelper(dao);
|
||||
}
|
||||
|
||||
public static class ReportList extends ResultList<Report> {
|
||||
|
||||
@ -27,7 +27,9 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.services.CreateDashboardService;
|
||||
import org.openmetadata.catalog.api.services.UpdateDashboardService;
|
||||
import org.openmetadata.catalog.entity.services.DashboardService;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.DashboardServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -61,7 +63,7 @@ import java.util.UUID;
|
||||
@Api(value = "Dashboard service collection", tags = "Services -> Dashboard service collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "dashboardServices", repositoryClass = "org.openmetadata.catalog.jdbi3.DashboardServiceRepositoryHelper")
|
||||
@Collection(name = "dashboardServices")
|
||||
public class DashboardServiceResource {
|
||||
private final DashboardServiceRepositoryHelper dao;
|
||||
private final CatalogAuthorizer authorizer;
|
||||
@ -82,9 +84,9 @@ public class DashboardServiceResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public DashboardServiceResource(DashboardServiceRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public DashboardServiceResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "DashboardServiceRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new DashboardServiceRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.services.CreateDatabaseService;
|
||||
import org.openmetadata.catalog.api.services.UpdateDatabaseService;
|
||||
import org.openmetadata.catalog.entity.services.DatabaseService;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.DatabaseServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -62,7 +63,7 @@ import java.util.UUID;
|
||||
@Api(value = "Database service collection", tags = "Services -> Database service collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "databaseServices", repositoryClass = "org.openmetadata.catalog.jdbi3.DatabaseServiceRepositoryHelper")
|
||||
@Collection(name = "databaseServices")
|
||||
public class DatabaseServiceResource {
|
||||
private final DatabaseServiceRepositoryHelper dao;
|
||||
private final CatalogAuthorizer authorizer;
|
||||
@ -82,9 +83,9 @@ public class DatabaseServiceResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public DatabaseServiceResource(DatabaseServiceRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public DatabaseServiceResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "DatabaseServiceRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new DatabaseServiceRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,9 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.services.CreateMessagingService;
|
||||
import org.openmetadata.catalog.api.services.UpdateMessagingService;
|
||||
import org.openmetadata.catalog.entity.services.MessagingService;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.MessagingServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -61,7 +63,7 @@ import java.util.UUID;
|
||||
@Api(value = "Messaging service collection", tags = "Services -> Messaging service collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "messagingServices", repositoryClass = "org.openmetadata.catalog.jdbi3.MessagingServiceRepositoryHelper")
|
||||
@Collection(name = "messagingServices")
|
||||
public class MessagingServiceResource {
|
||||
private final MessagingServiceRepositoryHelper dao;
|
||||
private final CatalogAuthorizer authorizer;
|
||||
@ -81,9 +83,9 @@ public class MessagingServiceResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public MessagingServiceResource(MessagingServiceRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public MessagingServiceResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "MessagingServiceRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new MessagingServiceRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,9 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.services.CreatePipelineService;
|
||||
import org.openmetadata.catalog.api.services.UpdatePipelineService;
|
||||
import org.openmetadata.catalog.entity.services.PipelineService;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.PipelineServiceRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -61,7 +63,7 @@ import java.util.UUID;
|
||||
@Api(value = "Pipeline service collection", tags = "Services -> Pipeline service collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "pipelineServices", repositoryClass = "org.openmetadata.catalog.jdbi3.PipelineServiceRepositoryHelper")
|
||||
@Collection(name = "pipelineServices")
|
||||
public class PipelineServiceResource {
|
||||
private final PipelineServiceRepositoryHelper dao;
|
||||
private final CatalogAuthorizer authorizer;
|
||||
@ -82,9 +84,9 @@ public class PipelineServiceResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public PipelineServiceResource(PipelineServiceRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public PipelineServiceResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "PipelineServiceRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new PipelineServiceRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.apache.maven.shared.utils.io.IOUtil;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.TagRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -67,7 +68,7 @@ import java.util.regex.Pattern;
|
||||
@Path("/v1/tags")
|
||||
@Api(value = "Tags resources collection", tags = "Tags resources collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "tags", repositoryClass = "org.openmetadata.catalog.jdbi3.TagRepositoryHelper")
|
||||
@Collection(name = "tags")
|
||||
public class TagResource {
|
||||
public static final Logger LOG = LoggerFactory.getLogger(TagResource.class);
|
||||
public static final String TAG_COLLECTION_PATH = "/v1/tags/";
|
||||
@ -85,9 +86,9 @@ public class TagResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public TagResource(TagRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public TagResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "TagRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new TagRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,9 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreateTask;
|
||||
import org.openmetadata.catalog.entity.data.Task;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.TaskRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -76,7 +78,7 @@ import java.util.UUID;
|
||||
@Api(value = "tasks data asset collection", tags = "Task data asset collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "tasks", repositoryClass = "org.openmetadata.catalog.jdbi3.TaskRepositoryHelper")
|
||||
@Collection(name = "tasks")
|
||||
public class TaskResource {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TaskResource.class);
|
||||
private static final String TASK_COLLECTION_PATH = "v1/tasks/";
|
||||
@ -101,9 +103,9 @@ public class TaskResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public TaskResource(TaskRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public TaskResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "TaskRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new TaskRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.teams.CreateTeam;
|
||||
import org.openmetadata.catalog.entity.teams.Team;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.TeamRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -72,7 +73,7 @@ import java.util.UUID;
|
||||
@Api(value = "Teams collection", tags = "Teams collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "teams", repositoryClass = "org.openmetadata.catalog.jdbi3.TeamRepositoryHelper")
|
||||
@Collection(name = "teams")
|
||||
public class TeamResource {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TeamResource.class);
|
||||
public static final String TEAM_COLLECTION_PATH = "/v1/teams/";
|
||||
@ -92,9 +93,9 @@ public class TeamResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public TeamResource(TeamRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public TeamResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "TeamRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new TeamRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.teams.CreateUser;
|
||||
import org.openmetadata.catalog.entity.teams.User;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.UserRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
@ -76,7 +77,7 @@ import java.util.UUID;
|
||||
@Api(value = "User collection", tags = "User collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "users", repositoryClass = "org.openmetadata.catalog.jdbi3.UserRepositoryHelper")
|
||||
@Collection(name = "users")
|
||||
public class UserResource {
|
||||
public static final Logger LOG = LoggerFactory.getLogger(UserResource.class);
|
||||
public static final String USER_COLLECTION_PATH = "v1/users/";
|
||||
@ -96,9 +97,9 @@ public class UserResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public UserResource(UserRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public UserResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "UserRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new UserRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,9 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import org.openmetadata.catalog.api.data.CreateTopic;
|
||||
import org.openmetadata.catalog.entity.data.Topic;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.TopicRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
import org.openmetadata.catalog.security.CatalogAuthorizer;
|
||||
import org.openmetadata.catalog.security.SecurityUtil;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -76,7 +78,7 @@ import java.util.UUID;
|
||||
@Api(value = "Topic data asset collection", tags = "Topic data asset collection")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "topics", repositoryClass = "org.openmetadata.catalog.jdbi3.TopicRepository3")
|
||||
@Collection(name = "topics")
|
||||
public class TopicResource {
|
||||
private static final String TOPIC_COLLECTION_PATH = "v1/topics/";
|
||||
private final TopicRepositoryHelper dao;
|
||||
@ -100,9 +102,9 @@ public class TopicResource {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public TopicResource(TopicRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public TopicResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "TopicRepository3 must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new TopicRepositoryHelper(dao);
|
||||
this.authorizer = authorizer;
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
package org.openmetadata.catalog.resources.usage;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.UsageRepositoryHelper;
|
||||
import org.openmetadata.catalog.resources.teams.UserResource;
|
||||
import org.openmetadata.catalog.resources.Collection;
|
||||
@ -54,15 +55,15 @@ import java.util.Objects;
|
||||
@Api(value = "Usage resource", tags = "Usage resource")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
//@Collection(name = "usage", repositoryClass = "org.openmetadata.catalog.jdbi3.UsageRepositoryHelper")
|
||||
@Collection(name = "usage")
|
||||
public class UsageResource {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UserResource.class);
|
||||
private final UsageRepositoryHelper dao;
|
||||
|
||||
@Inject
|
||||
public UsageResource(UsageRepositoryHelper dao, CatalogAuthorizer authorizer) {
|
||||
public UsageResource(CollectionDAO dao, CatalogAuthorizer authorizer) {
|
||||
Objects.requireNonNull(dao, "UsageRepositoryHelper must not be null");
|
||||
this.dao = dao;
|
||||
this.dao = new UsageRepositoryHelper(dao);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
@ -22,6 +22,7 @@ import org.openmetadata.catalog.Entity;
|
||||
import org.openmetadata.catalog.entity.teams.User;
|
||||
import org.openmetadata.catalog.exception.DuplicateEntityException;
|
||||
import org.openmetadata.catalog.exception.EntityNotFoundException;
|
||||
import org.openmetadata.catalog.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.catalog.jdbi3.UserRepository3;
|
||||
import org.openmetadata.catalog.jdbi3.UserRepositoryHelper;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
@ -56,7 +57,7 @@ public class DefaultCatalogAuthorizer implements CatalogAuthorizer {
|
||||
this.botUsers = new HashSet<>(config.getBotPrincipals());
|
||||
this.principalDomain = config.getPrincipalDomain();
|
||||
LOG.debug("Admin users: {}", adminUsers);
|
||||
UserRepository3 repo = dbi.onDemand(UserRepository3.class);
|
||||
CollectionDAO repo = dbi.onDemand(CollectionDAO.class);
|
||||
this.userRepositoryHelper = new UserRepositoryHelper(repo);
|
||||
mayBeAddAdminUsers();
|
||||
mayBeAddBotUsers();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user