mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 18:36:08 +00:00
parent
e44c8d4f31
commit
7ae81272b3
@ -15,6 +15,7 @@ package org.openmetadata.service;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
|
||||
import static org.openmetadata.service.resources.CollectionRegistry.PACKAGES;
|
||||
import static org.openmetadata.service.resources.tags.TagLabelUtil.addDerivedTags;
|
||||
import static org.openmetadata.service.util.EntityUtil.getFlattenedEntityField;
|
||||
|
||||
@ -560,7 +561,11 @@ public final class Entity {
|
||||
|
||||
/** Compile a list of REST collections based on Resource classes marked with {@code Repository} annotation */
|
||||
private static List<Class<?>> getRepositories() {
|
||||
try (ScanResult scanResult = new ClassGraph().enableAnnotationInfo().scan()) {
|
||||
try (ScanResult scanResult =
|
||||
new ClassGraph()
|
||||
.enableAnnotationInfo()
|
||||
.acceptPackages(PACKAGES.toArray(new String[0]))
|
||||
.scan()) {
|
||||
ClassInfoList classList = scanResult.getClassesWithAnnotation(Repository.class);
|
||||
return classList.loadClasses();
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ import org.openmetadata.service.util.ReflectionUtil;
|
||||
*/
|
||||
@Slf4j
|
||||
public final class CollectionRegistry {
|
||||
public static final List<String> PACKAGES = List.of("org.openmetadata", "io.collate");
|
||||
private static CollectionRegistry instance = null;
|
||||
private static volatile boolean initialized = false;
|
||||
|
||||
@ -110,7 +111,8 @@ public final class CollectionRegistry {
|
||||
* those conditions and makes it available for listing them over API to author expressions in Rules.
|
||||
*/
|
||||
private void loadConditionFunctions() {
|
||||
try (ScanResult scanResult = new ClassGraph().enableAllInfo().scan()) {
|
||||
try (ScanResult scanResult =
|
||||
new ClassGraph().enableAllInfo().acceptPackages(PACKAGES.toArray(new String[0])).scan()) {
|
||||
for (ClassInfo classInfo : scanResult.getClassesWithMethodAnnotation(Function.class)) {
|
||||
List<Method> methods =
|
||||
ReflectionUtil.getMethodsAnnotatedWith(classInfo.loadClass(), Function.class);
|
||||
@ -220,7 +222,11 @@ public final class CollectionRegistry {
|
||||
|
||||
/** Compile a list of REST collections based on Resource classes marked with {@code Collection} annotation */
|
||||
private static List<CollectionDetails> getCollections() {
|
||||
try (ScanResult scanResult = new ClassGraph().enableAnnotationInfo().scan()) {
|
||||
try (ScanResult scanResult =
|
||||
new ClassGraph()
|
||||
.enableAnnotationInfo()
|
||||
.acceptPackages(PACKAGES.toArray(new String[0]))
|
||||
.scan()) {
|
||||
ClassInfoList classList = scanResult.getClassesWithAnnotation(Collection.class);
|
||||
List<Class<?>> collectionClasses = classList.loadClasses();
|
||||
List<CollectionDetails> collections = new ArrayList<>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user