-
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.
- Loading branch information
Showing
29 changed files
with
163 additions
and
149 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
16 changes: 16 additions & 0 deletions
16
...-config-api/src/main/scala/pl/touk/nussknacker/ui/loadableconfig/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package pl.touk.nussknacker.ui.loadableconfig | ||
|
||
import com.typesafe.config.Config | ||
import pl.touk.nussknacker.engine.ConfigWithUnresolvedVersion | ||
|
||
// TODO: We should extract a class for all configuration options that should be available to designer instead of returning raw hocon config. | ||
// Thanks to that it will be easier to split processing type config from rest of configs and use this interface programmatically | ||
final case class DesignerRootConfig(rawConfig: ConfigWithUnresolvedVersion) | ||
|
||
object DesignerRootConfig { | ||
|
||
def from(config: Config): DesignerRootConfig = { | ||
DesignerRootConfig(ConfigWithUnresolvedVersion(config)) | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
.../src/main/scala/pl/touk/nussknacker/ui/loadableconfig/LoadableProcessingTypeConfigs.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,26 @@ | ||
package pl.touk.nussknacker.ui.loadableconfig | ||
|
||
import com.typesafe.scalalogging.LazyLogging | ||
import pl.touk.nussknacker.engine.ProcessingTypeConfig | ||
import pl.touk.nussknacker.engine.util.Implicits.RichScalaMap | ||
import cats.effect.IO | ||
|
||
trait LoadableProcessingTypeConfigs { | ||
|
||
// rootConfigLoadedAtStart is used for external project purpose - don't remove it | ||
def loadProcessingTypeConfigs(rootConfigLoadedAtStart: DesignerRootConfig): IO[Map[String, ProcessingTypeConfig]] | ||
|
||
} | ||
|
||
object LoadableProcessingTypeConfigs extends LazyLogging { | ||
|
||
def extractProcessingTypeConfigs(rootConfig: DesignerRootConfig): Map[String, ProcessingTypeConfig] = { | ||
rootConfig.rawConfig | ||
.readMap("scenarioTypes") | ||
.getOrElse { | ||
throw new RuntimeException("No scenario types configuration provided") | ||
} | ||
.mapValuesNow(ProcessingTypeConfig.read) | ||
} | ||
|
||
} |
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
4 changes: 2 additions & 2 deletions
4
designer/server/src/main/scala/pl/touk/nussknacker/ui/NussknackerApp.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
18 changes: 18 additions & 0 deletions
18
...ker/ui/config/processingtype/EachTimeLoadingRootConfigLoadableProcessingTypeConfigs.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,18 @@ | ||
package pl.touk.nussknacker.ui.config.processingtype | ||
|
||
import cats.effect.IO | ||
import pl.touk.nussknacker.engine.ProcessingTypeConfig | ||
import pl.touk.nussknacker.ui.config.root.LoadableDesignerRootConfig | ||
import pl.touk.nussknacker.ui.loadableconfig.{DesignerRootConfig, LoadableProcessingTypeConfigs} | ||
|
||
class EachTimeLoadingRootConfigLoadableProcessingTypeConfigs(loadableDesignerRootConfig: LoadableDesignerRootConfig) | ||
extends LoadableProcessingTypeConfigs { | ||
|
||
def loadProcessingTypeConfigs( | ||
rootConfigLoadedAtStart: DesignerRootConfig | ||
): IO[Map[String, ProcessingTypeConfig]] = | ||
loadableDesignerRootConfig | ||
.loadDesignerRootConfig() | ||
.map(LoadableProcessingTypeConfigs.extractProcessingTypeConfigs) | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...a/pl/touk/nussknacker/ui/config/processingtype/LoadableProcessingTypeConfigsFactory.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,25 @@ | ||
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.LoadableDesignerRootConfig | ||
import pl.touk.nussknacker.ui.loadableconfig.LoadableProcessingTypeConfigs | ||
|
||
object LoadableProcessingTypeConfigsFactory extends LazyLogging { | ||
|
||
def create(loadableDesignerRootConfig: LoadableDesignerRootConfig): LoadableProcessingTypeConfigs = { | ||
ScalaServiceLoader.load[LoadableProcessingTypeConfigs](getClass.getClassLoader) match { | ||
case one :: Nil => | ||
logger.debug( | ||
s"Found custom ${classOf[LoadableProcessingTypeConfigs].getSimpleName}: ${one.getClass.getName}. Using it for configuration loading" | ||
) | ||
one | ||
case Nil => | ||
logger.debug(s"No custom ${classOf[LoadableProcessingTypeConfigs].getSimpleName} found. Using the default one") | ||
new EachTimeLoadingRootConfigLoadableProcessingTypeConfigs(loadableDesignerRootConfig) | ||
case _ => | ||
throw new IllegalStateException(s"More than one ${classOf[LoadableProcessingTypeConfigs].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
4 changes: 2 additions & 2 deletions
4
...leconfig/LoadableDesignerRootConfig.scala → ...fig/root/LoadableDesignerRootConfig.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
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
56 changes: 0 additions & 56 deletions
56
.../src/main/scala/pl/touk/nussknacker/ui/loadableconfig/LoadableProcessingTypeConfigs.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
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
Oops, something went wrong.