diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/AbstractMetaDataProducerBasedQQQApplication.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/AbstractMetaDataProducerBasedQQQApplication.java index 9b7fd619..1b30f82e 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/AbstractMetaDataProducerBasedQQQApplication.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/AbstractMetaDataProducerBasedQQQApplication.java @@ -29,7 +29,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.QInstance; /******************************************************************************* ** Version of AbstractQQQApplication that assumes all meta-data is produced - ** by MetaDataProducers in a single package. + ** by MetaDataProducers in (or under) a single package. *******************************************************************************/ public abstract class AbstractMetaDataProducerBasedQQQApplication extends AbstractQQQApplication { diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/ConfigFilesBasedQQQApplication.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/ConfigFilesBasedQQQApplication.java new file mode 100644 index 00000000..633c34d4 --- /dev/null +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/ConfigFilesBasedQQQApplication.java @@ -0,0 +1,61 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2025. Kingsrook, LLC + * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States + * contact@kingsrook.com + * https://github.com/Kingsrook/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.kingsrook.qqq.backend.core.instances; + + +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.instances.loaders.MetaDataLoaderHelper; +import com.kingsrook.qqq.backend.core.model.metadata.QInstance; + + +/******************************************************************************* + ** Version of AbstractQQQApplication that assumes all meta-data is defined in + ** config files (yaml, json, etc) under a given directory path. + *******************************************************************************/ +public class ConfigFilesBasedQQQApplication extends AbstractQQQApplication +{ + private final String path; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public ConfigFilesBasedQQQApplication(String path) + { + this.path = path; + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @Override + public QInstance defineQInstance() throws QException + { + QInstance qInstance = new QInstance(); + MetaDataLoaderHelper.processAllMetaDataFilesInDirectory(qInstance, path); + return (qInstance); + } +} diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/MetaDataProducerBasedQQQApplication.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/MetaDataProducerBasedQQQApplication.java new file mode 100644 index 00000000..91577042 --- /dev/null +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/instances/MetaDataProducerBasedQQQApplication.java @@ -0,0 +1,67 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2025. Kingsrook, LLC + * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States + * contact@kingsrook.com + * https://github.com/Kingsrook/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.kingsrook.qqq.backend.core.instances; + + +/******************************************************************************* + ** Version of AbstractQQQApplication that assumes all meta-data is produced + ** by MetaDataProducers in (or under) a single package (where you can pass that + ** package into the constructor, vs. the abstract base class, where you extend + ** it and override the getMetaDataPackageName method. + *******************************************************************************/ +public class MetaDataProducerBasedQQQApplication extends AbstractMetaDataProducerBasedQQQApplication +{ + private final String metaDataPackageName; + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public MetaDataProducerBasedQQQApplication(String metaDataPackageName) + { + this.metaDataPackageName = metaDataPackageName; + } + + + + /******************************************************************************* + ** Constructor + ** + *******************************************************************************/ + public MetaDataProducerBasedQQQApplication(Class aClassInMetaDataPackage) + { + this(aClassInMetaDataPackage.getPackageName()); + } + + + + /*************************************************************************** + ** + ***************************************************************************/ + @Override + public String getMetaDataPackageName() + { + return (this.metaDataPackageName); + } +}