Fix #9750: Refactor interfaces into openmetadata-spec module (#9751)

This commit is contained in:
Sriharsha Chintalapani 2023-01-30 11:47:30 -08:00 committed by GitHub
parent 406ea35845
commit 28c8ce1386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 39 additions and 21 deletions

View File

@ -28,16 +28,11 @@
<artifactId>common</artifactId>
<dependencies>
<!-- Required dependency for logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- Required dependency for @Slf4j annotation -->
<dependency>
<groupId>org.projectlombok</groupId>
@ -70,6 +65,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jersey</artifactId>
<version>2.1.4</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -28,10 +28,10 @@ import org.openmetadata.schema.api.services.ingestionPipelines.TestServiceConnec
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineStatus;
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineType;
import org.openmetadata.sdk.PipelineServiceClient;
import org.openmetadata.sdk.exception.PipelineServiceClientException;
import org.openmetadata.service.exception.IngestionPipelineDeploymentException;
import org.openmetadata.service.exception.PipelineServiceClientException;
import org.openmetadata.service.util.JsonUtils;
import org.openmetadata.service.util.PipelineServiceClient;
@Slf4j
public class AirflowRESTClient extends PipelineServiceClient {

View File

@ -14,6 +14,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public final class BadRequestException extends WebServiceException {
private static final String DEFAULT_MESSAGE = "Bad request.";

View File

@ -30,6 +30,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import lombok.extern.slf4j.Slf4j;
import org.jdbi.v3.core.statement.UnableToExecuteStatementException;
import org.openmetadata.sdk.exception.WebServiceException;
import org.openmetadata.service.security.AuthenticationException;
import org.openmetadata.service.security.AuthorizationException;
import org.postgresql.util.PSQLException;

View File

@ -1,6 +1,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public class CustomExceptionMessage extends WebServiceException {
public CustomExceptionMessage(Response.Status status, String message) {

View File

@ -14,6 +14,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public class EntityNotFoundException extends WebServiceException {
private static final String BY_ID_MESSAGE = "Entity with id [%s] not found.";

View File

@ -14,6 +14,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public class IngestionPipelineDeploymentException extends WebServiceException {

View File

@ -1,6 +1,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public class InvalidServiceConnectionException extends WebServiceException {
private static final String BY_NAME_MESSAGE = "InvalidServiceConnectionException for service [%s] due to [%s].";

View File

@ -1,6 +1,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public class OpenMetadataClientSecurityConfigException extends WebServiceException {
private static final String BY_NAME_MESSAGE = "Airflow Exception [%s] due to [%s].";

View File

@ -14,6 +14,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public class SecretsManagerException extends WebServiceException {
private static final String BY_NAME_MESSAGE =

View File

@ -14,6 +14,7 @@
package org.openmetadata.service.exception;
import javax.ws.rs.core.Response;
import org.openmetadata.sdk.exception.WebServiceException;
public class UnhandledServerException extends WebServiceException {
private static final String MESSAGE = "An exception with message [%s] was thrown while processing request.";

View File

@ -33,6 +33,7 @@ import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.EventType;
import org.openmetadata.schema.type.FieldChange;
import org.openmetadata.schema.type.Relationship;
import org.openmetadata.sdk.PipelineServiceClient;
import org.openmetadata.service.Entity;
import org.openmetadata.service.resources.services.ingestionpipelines.IngestionPipelineResource;
import org.openmetadata.service.secrets.SecretsManager;
@ -40,7 +41,6 @@ import org.openmetadata.service.secrets.SecretsManagerFactory;
import org.openmetadata.service.util.EntityUtil.Fields;
import org.openmetadata.service.util.FullyQualifiedName;
import org.openmetadata.service.util.JsonUtils;
import org.openmetadata.service.util.PipelineServiceClient;
import org.openmetadata.service.util.RestUtil;
import org.openmetadata.service.util.ResultList;

View File

@ -60,6 +60,7 @@ import org.openmetadata.schema.services.connections.metadata.OpenMetadataConnect
import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.MetadataOperation;
import org.openmetadata.sdk.PipelineServiceClient;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.airflow.AirflowRESTClient;
@ -75,7 +76,6 @@ import org.openmetadata.service.security.Authorizer;
import org.openmetadata.service.security.policyevaluator.OperationContext;
import org.openmetadata.service.util.EntityUtil.Fields;
import org.openmetadata.service.util.OpenMetadataConnectionBuilder;
import org.openmetadata.service.util.PipelineServiceClient;
import org.openmetadata.service.util.ResultList;
@Slf4j

View File

@ -7,7 +7,7 @@ import javax.ws.rs.core.Response;
import org.openmetadata.schema.api.services.ingestionPipelines.TestServiceConnection;
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineStatus;
import org.openmetadata.service.util.PipelineServiceClient;
import org.openmetadata.sdk.PipelineServiceClient;
public class MockPipelineServiceClient extends PipelineServiceClient {

View File

@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import org.openmetadata.service.exception.PipelineServiceVersionException;
import org.openmetadata.sdk.exception.PipelineServiceVersionException;
public class PipelineServiceClientTest {

View File

@ -30,8 +30,8 @@ import org.openmetadata.schema.api.configuration.airflow.AirflowConfiguration;
import org.openmetadata.schema.entity.services.ingestionPipelines.AirflowConfig;
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineType;
import org.openmetadata.sdk.exception.PipelineServiceClientException;
import org.openmetadata.service.airflow.AirflowRESTClient;
import org.openmetadata.service.exception.PipelineServiceClientException;
@ExtendWith(MockitoExtension.class)
class AirflowRESTClientIntegrationTest {

View File

@ -24,6 +24,15 @@
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>

View File

@ -1,4 +1,4 @@
package org.openmetadata.service.util;
package org.openmetadata.sdk;
import java.io.IOException;
import java.io.InputStream;
@ -20,9 +20,8 @@ import org.openmetadata.common.utils.CommonUtil;
import org.openmetadata.schema.api.services.ingestionPipelines.TestServiceConnection;
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineStatus;
import org.openmetadata.service.OpenMetadataApplication;
import org.openmetadata.service.exception.PipelineServiceClientException;
import org.openmetadata.service.exception.PipelineServiceVersionException;
import org.openmetadata.sdk.exception.PipelineServiceClientException;
import org.openmetadata.sdk.exception.PipelineServiceVersionException;
/**
* Client to make API calls to add, deleted, and deploy pipelines on a PipelineService, such as Airflow. Core
@ -97,7 +96,7 @@ public abstract class PipelineServiceClient {
}
public static String getServerVersion() throws IOException {
InputStream fileInput = OpenMetadataApplication.class.getResourceAsStream("/catalog/VERSION");
InputStream fileInput = PipelineServiceClient.class.getResourceAsStream("/catalog/VERSION");
Properties props = new Properties();
props.load(fileInput);
return props.getProperty("version", "unknown");

View File

@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.openmetadata.service.exception;
package org.openmetadata.sdk.exception;
import javax.ws.rs.core.Response;

View File

@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.openmetadata.service.exception;
package org.openmetadata.sdk.exception;
import javax.ws.rs.core.Response;

View File

@ -11,7 +11,7 @@
* limitations under the License.
*/
package org.openmetadata.service.exception;
package org.openmetadata.sdk.exception;
import io.dropwizard.jersey.errors.ErrorMessage;
import javax.ws.rs.core.MediaType;

View File

@ -29,8 +29,8 @@
<version>0.13.2-SNAPSHOT</version>
<url>https://github.com/open-metadata/OpenMetadata</url>
<modules>
<module>common</module>
<module>openmetadata-spec</module>
<module>common</module>
<module>openmetadata-service</module>
<module>openmetadata-ui</module>
<module>openmetadata-dist</module>