mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-26 09:55:52 +00:00
MINOR - Application Preview (#15609)
This commit is contained in:
parent
e6cdd6e9a6
commit
3fb4dbb55a
@ -13,7 +13,7 @@ This approach has been last tested against:
|
|||||||
- Composer version 2.5.4
|
- Composer version 2.5.4
|
||||||
- Airflow version 2.6.3
|
- Airflow version 2.6.3
|
||||||
|
|
||||||
It also requires the ingestion package to be at least `openmetadata-ingestion==1.3.1.0`.
|
It also requires the ingestion package to be at least `openmetadata-ingestion==1.3.0.1`.
|
||||||
|
|
||||||
## Using the Python Operator
|
## Using the Python Operator
|
||||||
|
|
||||||
|
@ -218,6 +218,14 @@ public class AbstractNativeApplication implements NativeApplication {
|
|||||||
/* Not needed by default */
|
/* Not needed by default */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void raisePreviewMessage(App app) {
|
||||||
|
throw AppException.byMessage(
|
||||||
|
app.getName(),
|
||||||
|
"Preview",
|
||||||
|
"App is in Preview Mode. Enable it from the server configuration.");
|
||||||
|
}
|
||||||
|
|
||||||
public static AppRuntime getAppRuntime(App app) {
|
public static AppRuntime getAppRuntime(App app) {
|
||||||
return JsonUtils.convertValue(app.getRuntime(), ScheduledExecutionContext.class);
|
return JsonUtils.convertValue(app.getRuntime(), ScheduledExecutionContext.class);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import org.openmetadata.sdk.exception.WebServiceException;
|
|||||||
public class AppException extends WebServiceException {
|
public class AppException extends WebServiceException {
|
||||||
|
|
||||||
private static final String BY_NAME_MESSAGE = "Application [%s] Exception [%s] due to [%s].";
|
private static final String BY_NAME_MESSAGE = "Application [%s] Exception [%s] due to [%s].";
|
||||||
private static final String ERROR_TYPE = "PIPELINE_SERVICE_ERROR";
|
private static final String ERROR_TYPE = "APPLICATION_ERROR";
|
||||||
|
|
||||||
public AppException(String message) {
|
public AppException(String message) {
|
||||||
super(Response.Status.BAD_REQUEST, ERROR_TYPE, message);
|
super(Response.Status.BAD_REQUEST, ERROR_TYPE, message);
|
||||||
|
@ -45,6 +45,7 @@ public class ApplicationHandler {
|
|||||||
&& !nullOrEmpty(privateConfiguration.getAppsPrivateConfiguration())) {
|
&& !nullOrEmpty(privateConfiguration.getAppsPrivateConfiguration())) {
|
||||||
for (AppPrivateConfig appPrivateConfig : privateConfiguration.getAppsPrivateConfiguration()) {
|
for (AppPrivateConfig appPrivateConfig : privateConfiguration.getAppsPrivateConfiguration()) {
|
||||||
if (app.getName().equals(appPrivateConfig.getName())) {
|
if (app.getName().equals(appPrivateConfig.getName())) {
|
||||||
|
app.setPreview(appPrivateConfig.getPreview());
|
||||||
app.setPrivateConfiguration(appPrivateConfig.getParameters());
|
app.setPrivateConfiguration(appPrivateConfig.getParameters());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,6 +80,12 @@ public class ApplicationHandler {
|
|||||||
clz.getDeclaredConstructor(CollectionDAO.class, SearchRepository.class)
|
clz.getDeclaredConstructor(CollectionDAO.class, SearchRepository.class)
|
||||||
.newInstance(daoCollection, searchRepository);
|
.newInstance(daoCollection, searchRepository);
|
||||||
|
|
||||||
|
// Raise preview message if the app is in Preview mode
|
||||||
|
if (Boolean.TRUE.equals(app.getPreview())) {
|
||||||
|
Method preview = resource.getClass().getMethod("raisePreviewMessage", App.class);
|
||||||
|
preview.invoke(resource, app);
|
||||||
|
}
|
||||||
|
|
||||||
// Call init Method
|
// Call init Method
|
||||||
Method initMethod = resource.getClass().getMethod("init", App.class);
|
Method initMethod = resource.getClass().getMethod("init", App.class);
|
||||||
initMethod.invoke(resource, app);
|
initMethod.invoke(resource, app);
|
||||||
@ -96,14 +103,13 @@ public class ApplicationHandler {
|
|||||||
Method scheduleMethod = resource.getClass().getMethod(methodName);
|
Method scheduleMethod = resource.getClass().getMethod(methodName);
|
||||||
scheduleMethod.invoke(resource);
|
scheduleMethod.invoke(resource);
|
||||||
|
|
||||||
} catch (NoSuchMethodException
|
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException e) {
|
||||||
| InstantiationException
|
|
||||||
| IllegalAccessException
|
|
||||||
| InvocationTargetException e) {
|
|
||||||
LOG.error("Exception encountered", e);
|
LOG.error("Exception encountered", e);
|
||||||
throw new UnhandledServerException(e.getCause().getMessage());
|
throw new UnhandledServerException(e.getMessage());
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new UnhandledServerException(e.getCause().getMessage());
|
throw new UnhandledServerException(e.getMessage());
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
throw new AppException(e.getTargetException().getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,7 @@ public interface NativeApplication extends Job {
|
|||||||
|
|
||||||
void configure();
|
void configure();
|
||||||
|
|
||||||
|
void raisePreviewMessage(App app);
|
||||||
|
|
||||||
default void startApp(JobExecutionContext jobExecutionContext) {}
|
default void startApp(JobExecutionContext jobExecutionContext) {}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Application Name"
|
"description": "Application Name"
|
||||||
},
|
},
|
||||||
|
"preview": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Flag to enable/disable preview for the application. If the app is in preview mode, it can't be installed.",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"javaType": "org.openmetadata.schema.api.configuration.apps.Parameters",
|
"javaType": "org.openmetadata.schema.api.configuration.apps.Parameters",
|
||||||
"description": "Parameters to initialize the Applications.",
|
"description": "Parameters to initialize the Applications.",
|
||||||
|
@ -210,6 +210,11 @@
|
|||||||
"description": "Application Private configuration loaded at runtime.",
|
"description": "Application Private configuration loaded at runtime.",
|
||||||
"$ref": "./configuration/applicationConfig.json#/definitions/privateConfig"
|
"$ref": "./configuration/applicationConfig.json#/definitions/privateConfig"
|
||||||
},
|
},
|
||||||
|
"preview": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Flag to enable/disable preview for the application. If the app is in preview mode, it can't be installed.",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"pipelines": {
|
"pipelines": {
|
||||||
"description": "References to pipelines deployed for this database service to extract metadata, usage, lineage etc..",
|
"description": "References to pipelines deployed for this database service to extract metadata, usage, lineage etc..",
|
||||||
"$ref": "../../type/entityReferenceList.json"
|
"$ref": "../../type/entityReferenceList.json"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user