All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dimajix.flowman.spec.NamespaceSpec.scala Maven / Gradle / Ivy

There is a newer version: 1.2.0-synapse3.3-spark3.3-hadoop3.3
Show newest version
/*
 * Copyright (C) 2018 The Flowman Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.dimajix.flowman.spec

import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle

import com.dimajix.flowman.common.ParserUtils.splitSettings
import com.dimajix.flowman.model.Namespace
import com.dimajix.flowman.spec.catalog.CatalogSpec
import com.dimajix.flowman.spec.connection.ConnectionSpec
import com.dimajix.flowman.spec.history.HistorySpec
import com.dimajix.flowman.spec.hook.HookSpec
import com.dimajix.flowman.spec.metric.MetricSinkSpec
import com.dimajix.flowman.spec.storage.StoreSpec


@JsonSchemaTitle("Flowman Namespace Schema")
final class NamespaceSpec {
    @JsonProperty(value="name") private var name: String = "default"
    @JsonProperty(value="environment") private var environment: Seq[String] = Seq()
    @JsonProperty(value="config") private var config: Seq[String] = Seq()
    @JsonDeserialize(converter=classOf[ProfileSpec.NameResolver])
    @JsonProperty(value="profiles") private var profiles: Map[String,ProfileSpec] = Map()
    @JsonDeserialize(converter=classOf[ConnectionSpec.NameResolver])
    @JsonProperty(value="connections") private var connections: Map[String,ConnectionSpec] = Map()
    @JsonProperty(value="store") private var store: Option[StoreSpec] = None
    @JsonProperty(value="catalog") private var catalogs: Seq[CatalogSpec] = Seq()
    @JsonProperty(value="history") private var history : Option[HistorySpec] = None
    @JsonProperty(value="metrics") private var metrics : Seq[MetricSinkSpec] = Seq()
    @JsonProperty(value="plugins") private var plugins: Seq[String] = Seq()
    @JsonProperty(value="hooks") private var hooks: Seq[HookSpec] = Seq()

    def instantiate() : Namespace = {
        Namespace(
            name = name,
            config = splitSettings(config).toMap,
            environment = splitSettings(environment).toMap,
            profiles = profiles.map { case(k,v) => k -> v.instantiate() },
            connections = connections,
            store = store,
            catalogs = catalogs,
            history = history,
            metrics = metrics,
            plugins = plugins,
            hooks = hooks
        )
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy