-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
loadable config -> config loader + factory
- Loading branch information
Showing
35 changed files
with
215 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...i/loadableconfig/DesignerRootConfig.scala → .../ui/configloader/DesignerRootConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
...onfig/LoadableProcessingTypeConfigs.scala → ...gloader/ProcessingTypeConfigsLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...c/main/scala/pl/touk/nussknacker/ui/configloader/ProcessingTypeConfigsLoaderFactory.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package pl.touk.nussknacker.ui.configloader | ||
|
||
import sttp.client3.SttpBackend | ||
|
||
import scala.concurrent.{ExecutionContext, Future} | ||
|
||
trait ProcessingTypeConfigsLoaderFactory { | ||
|
||
def create( | ||
designerRootConfigLoadedAtStart: DesignerRootConfig, | ||
sttpBackend: SttpBackend[Future, Any], | ||
ec: ExecutionContext | ||
): ProcessingTypeConfigsLoader | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...ker/ui/config/processingtype/EachTimeLoadingRootConfigLoadableProcessingTypeConfigs.scala
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...acker/ui/config/processingtype/EachTimeLoadingRootConfigProcessingTypeConfigsLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package pl.touk.nussknacker.ui.config.processingtype | ||
|
||
import cats.effect.IO | ||
import pl.touk.nussknacker.engine.ProcessingTypeConfig | ||
import pl.touk.nussknacker.ui.config.root.DesignerRootConfigLoader | ||
import pl.touk.nussknacker.ui.configloader.ProcessingTypeConfigsLoader | ||
|
||
class EachTimeLoadingRootConfigProcessingTypeConfigsLoader(designerRootConfigLoader: DesignerRootConfigLoader) | ||
extends ProcessingTypeConfigsLoader { | ||
|
||
def loadProcessingTypeConfigs(): IO[Map[String, ProcessingTypeConfig]] = | ||
designerRootConfigLoader | ||
.loadDesignerRootConfig() | ||
.map(ProcessingTypeConfigsLoader.extractProcessingTypeConfigs) | ||
|
||
} |
25 changes: 0 additions & 25 deletions
25
...a/pl/touk/nussknacker/ui/config/processingtype/LoadableProcessingTypeConfigsFactory.scala
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...ussknacker/ui/config/processingtype/ProcessingTypeConfigsLoaderFactoryServiceLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package pl.touk.nussknacker.ui.config.processingtype | ||
|
||
import com.typesafe.scalalogging.LazyLogging | ||
import pl.touk.nussknacker.engine.util.loader.ScalaServiceLoader | ||
import pl.touk.nussknacker.ui.config.root.DesignerRootConfigLoader | ||
import pl.touk.nussknacker.ui.configloader.{ | ||
DesignerRootConfig, | ||
ProcessingTypeConfigsLoader, | ||
ProcessingTypeConfigsLoaderFactory | ||
} | ||
import sttp.client3.SttpBackend | ||
|
||
import scala.concurrent.{ExecutionContext, Future} | ||
|
||
object ProcessingTypeConfigsLoaderFactoryServiceLoader extends LazyLogging { | ||
|
||
def loadService(designerRootConfigLoader: DesignerRootConfigLoader): ProcessingTypeConfigsLoaderFactory = { | ||
ScalaServiceLoader.load[ProcessingTypeConfigsLoaderFactory](getClass.getClassLoader) match { | ||
case one :: Nil => | ||
logger.debug( | ||
s"Found custom ${classOf[ProcessingTypeConfigsLoaderFactory].getSimpleName}: ${one.getClass.getName}. Using it for configuration loading" | ||
) | ||
one | ||
case Nil => | ||
logger.debug( | ||
s"No custom ${classOf[ProcessingTypeConfigsLoaderFactory].getSimpleName} found. Using the default one" | ||
) | ||
(_: DesignerRootConfig, _: SttpBackend[Future, Any], _: ExecutionContext) => | ||
new EachTimeLoadingRootConfigProcessingTypeConfigsLoader(designerRootConfigLoader) | ||
case _ => | ||
throw new IllegalStateException(s"More than one ${classOf[ProcessingTypeConfigsLoader].getSimpleName} found") | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...server/src/main/scala/pl/touk/nussknacker/ui/config/root/LoadableDesignerRootConfig.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
designer/server/src/main/scala/pl/touk/nussknacker/ui/db/entity/ProcessEntityFactory.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.