diff --git a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependency.scala b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependency.scala index 6fa3edb347..85347ee27f 100644 --- a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependency.scala +++ b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependency.scala @@ -1,9 +1,8 @@ package ch.epfl.bluebrain.nexus.delta.dependency import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.ServiceDependency -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.sourcing.Transactors import doobie.syntax.all._ @@ -14,7 +13,7 @@ import doobie.syntax.all._ class PostgresServiceDependency(xas: Transactors) extends ServiceDependency { private val regex = "( ?PostgreSQL )([^ ]+)(.*)".r - private val serviceName = Name.unsafe("postgres") + private val serviceName = "postgres" override def serviceDescription: IO[ServiceDescription] = sql"select version()" .query[String] diff --git a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutes.scala b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutes.scala index d3b8b9e4c9..6ef0d9b882 100644 --- a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutes.scala +++ b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutes.scala @@ -3,23 +3,23 @@ package ch.epfl.bluebrain.nexus.delta.routes import akka.http.scaladsl.server.Route import cats.syntax.all._ import ch.epfl.bluebrain.nexus.delta.config.DescriptionConfig +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.{PluginDescription, ServiceDescription} +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.{ComponentDescription, ServiceDependency} import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution} import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering import ch.epfl.bluebrain.nexus.delta.routes.VersionRoutes.VersionBundle -import ch.epfl.bluebrain.nexus.delta.sdk.ServiceDependency import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclCheck import ch.epfl.bluebrain.nexus.delta.sdk.acls.model.AclAddress import ch.epfl.bluebrain.nexus.delta.sdk.directives.AuthDirectives import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives._ import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.{HttpResponseFields, RdfMarshalling} -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.{PluginDescription, ServiceDescription} -import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, ComponentDescription, Name} +import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, Name} import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.version -import io.circe.syntax._ import io.circe.{Encoder, JsonObject} +import io.circe.syntax._ import scala.collection.immutable.Iterable @@ -63,15 +63,15 @@ object VersionRoutes { private[routes] object VersionBundle { private def toMap(values: Iterable[ComponentDescription]): Map[String, String] = - values.map(desc => desc.name.value -> desc.version).toMap + values.map(desc => desc.name -> desc.version).toMap implicit private val versionBundleEncoder: Encoder.AsObject[VersionBundle] = Encoder.encodeJsonObject.contramapObject { case VersionBundle(main, dependencies, plugins, env) => JsonObject( - main.name.value -> main.version.asJson, - "dependencies" -> toMap(dependencies).asJson, - "plugins" -> toMap(plugins).asJson, - "environment" -> env.asJson + main.name -> main.version.asJson, + "dependencies" -> toMap(dependencies).asJson, + "plugins" -> toMap(plugins).asJson, + "environment" -> env.asJson ) } @@ -95,6 +95,13 @@ object VersionRoutes { cr: RemoteContextResolution, ordering: JsonKeyOrdering ): VersionRoutes = { - new VersionRoutes(identities, aclCheck, ServiceDescription(cfg.name, cfg.version), plugins, dependencies, cfg.env) + new VersionRoutes( + identities, + aclCheck, + ServiceDescription(cfg.name.value, cfg.version), + plugins, + dependencies, + cfg.env + ) } } diff --git a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala index 90876e7264..62b1654b5b 100644 --- a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala +++ b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala @@ -9,6 +9,7 @@ import cats.data.NonEmptyList import cats.effect.{Clock, IO, Resource, Sync} import ch.epfl.bluebrain.nexus.delta.Main.pluginsMaxPriority import ch.epfl.bluebrain.nexus.delta.config.AppConfig +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.kernel.utils.{ClasspathResourceLoader, IOFuture, UUIDF} import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.contexts import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.{JsonLdApi, JsonLdJavaApi} @@ -23,7 +24,6 @@ import ch.epfl.bluebrain.nexus.delta.sdk.http.StrictEntity import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.ServiceAccount import ch.epfl.bluebrain.nexus.delta.sdk.jws.JWSPayloadHelper import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.{RdfExceptionHandler, RdfRejectionHandler} -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.model._ import ch.epfl.bluebrain.nexus.delta.sdk.plugin.PluginDef import ch.epfl.bluebrain.nexus.delta.sdk.projects.{OwnerPermissionsScopeInitialization, ProjectsConfig, ScopeInitializationErrorStore} diff --git a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/VersionModule.scala b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/VersionModule.scala index 5ec366dd22..088fee713c 100644 --- a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/VersionModule.scala +++ b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/VersionModule.scala @@ -3,13 +3,14 @@ package ch.epfl.bluebrain.nexus.delta.wiring import ch.epfl.bluebrain.nexus.delta.Main.pluginsMaxPriority import ch.epfl.bluebrain.nexus.delta.config.AppConfig import ch.epfl.bluebrain.nexus.delta.dependency.PostgresServiceDependency +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering import ch.epfl.bluebrain.nexus.delta.routes.VersionRoutes +import ch.epfl.bluebrain.nexus.delta.sdk.PriorityRoute import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclCheck import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.{PriorityRoute, ServiceDependency} import ch.epfl.bluebrain.nexus.delta.sourcing.Transactors import izumi.distage.model.definition.{Id, ModuleDef} diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependencySpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependencySpec.scala index 0086ea309e..62fb05f468 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependencySpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/dependency/PostgresServiceDependencySpec.scala @@ -1,7 +1,6 @@ package ch.epfl.bluebrain.nexus.delta.dependency -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription import ch.epfl.bluebrain.nexus.delta.sourcing.postgres.{DoobieScalaTestFixture, PostgresDocker} import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec @@ -10,8 +9,7 @@ class PostgresServiceDependencySpec extends CatsEffectSpec with DoobieScalaTestF "PostgresServiceDependency" should { "fetch its service name and version" in { - new PostgresServiceDependency(xas).serviceDescription.accepted shouldEqual - ServiceDescription(Name.unsafe("postgres"), "16.4") + new PostgresServiceDependency(xas).serviceDescription.accepted shouldEqual ServiceDescription("postgres", "16.4") } } diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutesSpec.scala index 0349d72ed6..4ccf3bc1eb 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/VersionRoutesSpec.scala @@ -5,12 +5,12 @@ import akka.http.scaladsl.model.headers.OAuth2BearerToken import akka.http.scaladsl.server.Route import cats.effect.IO import ch.epfl.bluebrain.nexus.delta.config.DescriptionConfig -import ch.epfl.bluebrain.nexus.delta.sdk.ServiceDependency +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.{PluginDescription, ServiceDescription} +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclSimpleCheck import ch.epfl.bluebrain.nexus.delta.sdk.acls.model.AclAddress import ch.epfl.bluebrain.nexus.delta.sdk.identities.IdentitiesDummy import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.{PluginDescription, ServiceDescription} import ch.epfl.bluebrain.nexus.delta.sdk.model.Name import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.{events, version} import ch.epfl.bluebrain.nexus.delta.sdk.utils.BaseRouteSpec @@ -24,17 +24,14 @@ class VersionRoutesSpec extends BaseRouteSpec { private val asAlice = addCredentials(OAuth2BearerToken("alice")) - private val pluginsInfo = - List(PluginDescription(Name.unsafe("pluginA"), "1.0"), PluginDescription(Name.unsafe("pluginB"), "2.0")) + private val pluginsInfo = List(PluginDescription("pluginA", "1.0"), PluginDescription("pluginB", "2.0")) private val dependency1 = new ServiceDependency { - override def serviceDescription: IO[ServiceDescription] = - IO.pure(ServiceDescription.unresolved(Name.unsafe("elasticsearch"))) + override def serviceDescription: IO[ServiceDescription] = IO.pure(ServiceDescription.unresolved("elasticsearch")) } private val dependency2 = new ServiceDependency { - override def serviceDescription: IO[ServiceDescription] = - IO.pure(ServiceDescription(Name.unsafe("remoteStorage"), "1.0.0")) + override def serviceDescription: IO[ServiceDescription] = IO.pure(ServiceDescription("remoteStorage", "1.0.0")) } private val descriptionConfig = DescriptionConfig(Name.unsafe("delta"), Name.unsafe("dev")) diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/model/ComponentDescription.scala b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/dependency/ComponentDescription.scala similarity index 68% rename from delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/model/ComponentDescription.scala rename to delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/dependency/ComponentDescription.scala index 2c21a025fd..2aa56c2a1e 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/model/ComponentDescription.scala +++ b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/dependency/ComponentDescription.scala @@ -1,4 +1,4 @@ -package ch.epfl.bluebrain.nexus.delta.sdk.model +package ch.epfl.bluebrain.nexus.delta.kernel.dependency /** * The description of a component of the system (service or plugin) @@ -9,7 +9,7 @@ sealed trait ComponentDescription extends Product with Serializable { * @return * the name of the component */ - def name: Name + def name: String /** * @return @@ -28,28 +28,28 @@ object ComponentDescription { sealed trait ServiceDescription extends ComponentDescription object ServiceDescription { - final case class ResolvedServiceDescription private (name: Name, version: String) extends ServiceDescription - final case class UnresolvedServiceDescription private (name: Name) extends ServiceDescription { + final case class ResolvedServiceDescription private (name: String, version: String) extends ServiceDescription + final case class UnresolvedServiceDescription private (name: String) extends ServiceDescription { override val version: String = unknownVersion } /** * Creates a [[ResolvedServiceDescription]] from the passed ''name'' and ''version''. */ - def apply(name: Name, version: String): ResolvedServiceDescription = + def apply(name: String, version: String): ResolvedServiceDescription = ResolvedServiceDescription(name, version) /** * Creates a [[UnresolvedServiceDescription]] with the passed ''name''. */ - def unresolved(name: Name): UnresolvedServiceDescription = + def unresolved(name: String): UnresolvedServiceDescription = UnresolvedServiceDescription(name) } /** * The description of a plugin */ - final case class PluginDescription(name: Name, version: String) extends ComponentDescription { + final case class PluginDescription(name: String, version: String) extends ComponentDescription { override def toString: String = s"$name-$version" } diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/ServiceDependency.scala b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/dependency/ServiceDependency.scala similarity index 62% rename from delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/ServiceDependency.scala rename to delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/dependency/ServiceDependency.scala index fb1e9f9d27..f68b5bc75b 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/ServiceDependency.scala +++ b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/dependency/ServiceDependency.scala @@ -1,7 +1,7 @@ -package ch.epfl.bluebrain.nexus.delta.sdk +package ch.epfl.bluebrain.nexus.delta.kernel.dependency import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription /** * A description of a service that is used by the system diff --git a/delta/plugins/archive/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/ArchivePluginDef.scala b/delta/plugins/archive/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/ArchivePluginDef.scala index 073cb9ea2e..f2474b5116 100644 --- a/delta/plugins/archive/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/ArchivePluginDef.scala +++ b/delta/plugins/archive/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/ArchivePluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.archive import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -10,7 +9,7 @@ class ArchivePluginDef extends PluginDef { override val module: ModuleDef = ArchivePluginModule - override val info: PluginDescription = PluginDescription(Name.unsafe("archive"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("archive", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(ArchivePlugin) } diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginDef.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginDef.scala index c71ff36844..7fae135e61 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginDef.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -11,7 +10,7 @@ class BlazegraphPluginDef extends PluginDef { override def module: ModuleDef = new BlazegraphPluginModule(priority) - override val info: PluginDescription = PluginDescription(Name.unsafe("blazegraph"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("blazegraph", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(BlazegraphPlugin) diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginModule.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginModule.scala index 273603c847..ef3831a9a8 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginModule.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphPluginModule.scala @@ -2,6 +2,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph import akka.actor.ActorSystem import cats.effect.{Clock, IO} +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.kernel.utils.{ClasspathResourceLoader, UUIDF} import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.BlazegraphClient import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.config.BlazegraphViewsConfig diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphServiceDependency.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphServiceDependency.scala index a5ee8d36c6..c14dbf27fa 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphServiceDependency.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/BlazegraphServiceDependency.scala @@ -1,9 +1,9 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph import cats.effect.IO +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.BlazegraphClient -import ch.epfl.bluebrain.nexus.delta.sdk.ServiceDependency -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription /** * Describes the remote storage [[ServiceDependency]] providing a way to extract the [[ServiceDescription]] from a diff --git a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClient.scala b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClient.scala index b2f117b95e..f2472d0e51 100644 --- a/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClient.scala +++ b/delta/plugins/blazegraph/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClient.scala @@ -10,6 +10,8 @@ import akka.http.scaladsl.unmarshalling.FromEntityUnmarshaller import akka.http.scaladsl.unmarshalling.PredefinedFromEntityUnmarshallers.stringUnmarshaller import cats.effect.IO import cats.syntax.all._ +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription.ResolvedServiceDescription import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.BlazegraphClient.timeoutHeader import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.SparqlClientError.{InvalidCountRequest, WrappedHttpClientError} import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.SparqlQueryResponseType.{Aux, SparqlResultsJson} @@ -17,9 +19,6 @@ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.config.BlazegraphViewsCo import ch.epfl.bluebrain.nexus.delta.rdf.query.SparqlQuery import ch.epfl.bluebrain.nexus.delta.rdf.query.SparqlQuery.SparqlConstructQuery import ch.epfl.bluebrain.nexus.delta.sdk.http.{HttpClient, HttpClientError} -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription.ResolvedServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name import ch.epfl.bluebrain.nexus.delta.sdk.syntax._ import scala.concurrent.duration._ @@ -36,7 +35,7 @@ class BlazegraphClient( extends SparqlClient(client, SparqlQueryEndpoint.blazegraph(endpoint)) { private val serviceVersion = """(buildVersion">)([^<]*)""".r - private val serviceName = Name.unsafe("blazegraph") + private val serviceName = "blazegraph" override def query[R <: SparqlQueryResponse]( indices: Iterable[String], diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala index fa54899318..bfbe69c102 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala @@ -3,6 +3,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client import akka.actor.ActorSystem import akka.http.scaladsl.model.Uri import akka.testkit.TestKit +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.Fixtures.defaultProperties import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.PatchStrategy._ import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.SparqlClientError.WrappedHttpClientError @@ -19,8 +20,6 @@ import ch.epfl.bluebrain.nexus.delta.rdf.query.SparqlQuery.SparqlConstructQuery import ch.epfl.bluebrain.nexus.delta.sdk.ConfigFixtures import ch.epfl.bluebrain.nexus.delta.sdk.http.HttpClientError.{HttpClientStatusError, HttpServerStatusError} import ch.epfl.bluebrain.nexus.delta.sdk.http.{HttpClient, HttpClientConfig} -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name import ch.epfl.bluebrain.nexus.delta.sdk.syntax._ import ch.epfl.bluebrain.nexus.testkit.blazegraph.BlazegraphDocker import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec @@ -114,7 +113,7 @@ class BlazegraphClientSpec(docker: BlazegraphDocker) "A Blazegraph Client" should { "fetch the service description" in { - client.serviceDescription.accepted shouldEqual ServiceDescription(Name.unsafe("blazegraph"), "2.1.6-SNAPSHOT") + client.serviceDescription.accepted shouldEqual ServiceDescription("blazegraph", "2.1.6-SNAPSHOT") } "verify a namespace does not exist" in { diff --git a/delta/plugins/composite-views/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/CompositeViewsPluginDef.scala b/delta/plugins/composite-views/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/CompositeViewsPluginDef.scala index 7a19929d87..141ee5b919 100644 --- a/delta/plugins/composite-views/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/CompositeViewsPluginDef.scala +++ b/delta/plugins/composite-views/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/CompositeViewsPluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.compositeviews import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -11,7 +10,7 @@ class CompositeViewsPluginDef extends PluginDef { override def module: ModuleDef = new CompositeViewsPluginModule(priority) - override val info: PluginDescription = PluginDescription(Name.unsafe("composite-views"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("composite-views", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(CompositeViewsPlugin) diff --git a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginDef.scala b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginDef.scala index 5f63dd911c..3b20f45ff7 100644 --- a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginDef.scala +++ b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -11,7 +10,7 @@ class ElasticSearchPluginDef extends PluginDef { override def module: ModuleDef = new ElasticSearchPluginModule(priority) - override val info: PluginDescription = PluginDescription(Name.unsafe("elasticsearch"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("elasticsearch", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(ElasticSearchPlugin) } diff --git a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginModule.scala b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginModule.scala index a5eb5728bf..44ee44fb6e 100644 --- a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginModule.scala +++ b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchPluginModule.scala @@ -2,6 +2,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch import akka.actor.ActorSystem import cats.effect.{Clock, IO} +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.kernel.utils.{ClasspathResourceLoader, UUIDF} import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.client.ElasticSearchClient import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.config.ElasticSearchViewsConfig @@ -10,7 +11,7 @@ import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.indexing.{ElasticSear import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.metrics.{EventMetricsProjection, EventMetricsQuery} import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.model.{contexts, schema => viewsSchemaId, ElasticSearchFiles, ElasticSearchView, ElasticSearchViewEvent} import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.query.DefaultViewsQuery -import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.routes.{ElasticSearchHistoryRoutes, _} +import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.routes._ import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.api.JsonLdApi import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.ContextValue.ContextObject diff --git a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchServiceDependency.scala b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchServiceDependency.scala index 6deb870dae..648ab13510 100644 --- a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchServiceDependency.scala +++ b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/ElasticSearchServiceDependency.scala @@ -1,9 +1,9 @@ package ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch import cats.effect.IO +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.client.ElasticSearchClient -import ch.epfl.bluebrain.nexus.delta.sdk.ServiceDependency -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription /** * Describes the remote storage [[ServiceDependency]] providing a way to extract the [[ServiceDescription]] from a diff --git a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClient.scala b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClient.scala index 80c517573c..edc97210b9 100644 --- a/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClient.scala +++ b/delta/plugins/elasticsearch/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClient.scala @@ -9,6 +9,8 @@ import akka.http.scaladsl.model.headers.BasicHttpCredentials import cats.effect.IO import cats.syntax.all._ import ch.epfl.bluebrain.nexus.delta.kernel.RetryStrategy.logError +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription.ResolvedServiceDescription import ch.epfl.bluebrain.nexus.delta.kernel.search.Pagination import ch.epfl.bluebrain.nexus.delta.kernel.utils.UrlUtils import ch.epfl.bluebrain.nexus.delta.kernel.{Logger, RetryStrategy} @@ -18,12 +20,10 @@ import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.model.{EmptyResults, import ch.epfl.bluebrain.nexus.delta.sdk.circe.CirceMarshalling._ import ch.epfl.bluebrain.nexus.delta.sdk.http.HttpClientError.{HttpClientStatusError, HttpUnexpectedError} import ch.epfl.bluebrain.nexus.delta.sdk.http.{HttpClient, HttpClientError} -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription.ResolvedServiceDescription +import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri import ch.epfl.bluebrain.nexus.delta.sdk.model.search.ResultEntry.{ScoredResultEntry, UnscoredResultEntry} import ch.epfl.bluebrain.nexus.delta.sdk.model.search.SearchResults.{ScoredSearchResults, UnscoredSearchResults} import ch.epfl.bluebrain.nexus.delta.sdk.model.search.{AggregationResult, ResultEntry, SearchResults, SortList} -import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, Name} import ch.epfl.bluebrain.nexus.delta.sdk.syntax._ import io.circe._ import io.circe.syntax._ @@ -41,7 +41,7 @@ class ElasticSearchClient(client: HttpClient, endpoint: Uri, maxIndexPathLength: ) { import as.dispatcher private val logger = Logger[ElasticSearchClient] - private val serviceName = Name.unsafe("elasticsearch") + private val serviceName = "elasticsearch" private val scriptPath = "_scripts" private val docPath = "_doc" private val allIndexPath = "_all" diff --git a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClientSpec.scala b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClientSpec.scala index c5761ec56e..21fd83f4ca 100644 --- a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClientSpec.scala +++ b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/client/ElasticSearchClientSpec.scala @@ -6,6 +6,7 @@ import akka.http.scaladsl.model.Uri.Query import akka.testkit.TestKit import cats.effect.IO import cats.implicits._ +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription import ch.epfl.bluebrain.nexus.delta.kernel.search.Pagination.FromPagination import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.ScalaTestElasticSearchClientSetup import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.client.ElasticSearchClient.BulkResponse.MixedOutcomes.Outcome @@ -13,11 +14,10 @@ import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.client.ElasticSearchC import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.model.ResourcesSearchParams import ch.epfl.bluebrain.nexus.delta.sdk.http.HttpClientError import ch.epfl.bluebrain.nexus.delta.sdk.http.HttpClientError.HttpClientStatusError -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri import ch.epfl.bluebrain.nexus.delta.sdk.model.search.ResultEntry.ScoredResultEntry import ch.epfl.bluebrain.nexus.delta.sdk.model.search.SearchResults.ScoredSearchResults import ch.epfl.bluebrain.nexus.delta.sdk.model.search.{AggregationResult, SearchResults, Sort, SortList} -import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, Name} import ch.epfl.bluebrain.nexus.delta.sdk.syntax._ import ch.epfl.bluebrain.nexus.delta.sourcing.model.Label import ch.epfl.bluebrain.nexus.testkit.CirceLiteral @@ -50,10 +50,7 @@ class ElasticSearchClientSpec "An ElasticSearch Client" should { "fetch the service description" in { - esClient.serviceDescription.accepted shouldEqual ServiceDescription( - Name.unsafe("elasticsearch"), - docker.version - ) + esClient.serviceDescription.accepted shouldEqual ServiceDescription("elasticsearch", docker.version) } "verify that an index does not exist" in { diff --git a/delta/plugins/graph-analytics/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/graph/analytics/GraphAnalyticsPluginDef.scala b/delta/plugins/graph-analytics/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/graph/analytics/GraphAnalyticsPluginDef.scala index c4b741922c..374140cdb0 100644 --- a/delta/plugins/graph-analytics/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/graph/analytics/GraphAnalyticsPluginDef.scala +++ b/delta/plugins/graph-analytics/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/graph/analytics/GraphAnalyticsPluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.graph.analytics import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -11,7 +10,7 @@ class GraphAnalyticsPluginDef extends PluginDef { override def module: ModuleDef = new GraphAnalyticsPluginModule(priority) - override val info: PluginDescription = PluginDescription(Name.unsafe("graph-analytics"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("graph-analytics", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(GraphAnalyticsPlugin) diff --git a/delta/plugins/jira/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/jira/JiraPluginDef.scala b/delta/plugins/jira/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/jira/JiraPluginDef.scala index 4152cddf11..f1de6d030a 100644 --- a/delta/plugins/jira/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/jira/JiraPluginDef.scala +++ b/delta/plugins/jira/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/jira/JiraPluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.jira import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -11,7 +10,7 @@ class JiraPluginDef extends PluginDef { override def module: ModuleDef = new JiraPluginModule(priority) - override val info: PluginDescription = PluginDescription(Name.unsafe("jira"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("jira", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(JiraPlugin) diff --git a/delta/plugins/project-deletion/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/projectdeletion/ProjectDeletionPluginDef.scala b/delta/plugins/project-deletion/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/projectdeletion/ProjectDeletionPluginDef.scala index f787ee34a7..1b8e99cff5 100644 --- a/delta/plugins/project-deletion/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/projectdeletion/ProjectDeletionPluginDef.scala +++ b/delta/plugins/project-deletion/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/projectdeletion/ProjectDeletionPluginDef.scala @@ -1,9 +1,8 @@ package ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion import cats.effect.IO +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion.model.ProjectDeletionConfig -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -29,7 +28,7 @@ class ProjectDeletionPluginDef extends PluginDef { * Plugin description */ override def info: PluginDescription = - PluginDescription(Name.unsafe("project-deletion"), BuildInfo.version) + PluginDescription("project-deletion", BuildInfo.version) /** * Initialize the plugin. diff --git a/delta/plugins/search/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchPluginDef.scala b/delta/plugins/search/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchPluginDef.scala index 291ce6998c..7b15b16d97 100644 --- a/delta/plugins/search/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchPluginDef.scala +++ b/delta/plugins/search/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/search/SearchPluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.search import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -11,7 +10,7 @@ class SearchPluginDef extends PluginDef { override def module: ModuleDef = new SearchPluginModule(priority) - override val info: PluginDescription = PluginDescription(Name.unsafe("search"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("search", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(SearchPlugin) diff --git a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteStorageServiceDependency.scala b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteStorageServiceDependency.scala index 5a793dbf15..25fbea5a6a 100644 --- a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteStorageServiceDependency.scala +++ b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteStorageServiceDependency.scala @@ -1,9 +1,9 @@ package ch.epfl.bluebrain.nexus.delta.plugins.storage import cats.effect.IO +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.operations.remote.client.RemoteDiskStorageClient -import ch.epfl.bluebrain.nexus.delta.sdk.ServiceDependency -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription /** * Describes the remote storage [[ServiceDependency]] providing a way to extract the [[ServiceDescription]] from a diff --git a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginDef.scala b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginDef.scala index 5e79f02fc8..14c79a7035 100644 --- a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginDef.scala +++ b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.storage import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -11,7 +10,7 @@ class StoragePluginDef extends PluginDef { override def module: ModuleDef = new StoragePluginModule(priority) - override val info: PluginDescription = PluginDescription(Name.unsafe("storage"), BuildInfo.version) + override val info: PluginDescription = PluginDescription("storage", BuildInfo.version) override def initialize(locator: Locator): IO[Plugin] = IO.pure(StoragePlugin) diff --git a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginModule.scala b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginModule.scala index a69b342719..16fa22b3ed 100644 --- a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginModule.scala +++ b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginModule.scala @@ -4,6 +4,7 @@ import akka.actor.ActorSystem import akka.http.scaladsl.model.Uri.Path import akka.http.scaladsl.server.Directives.concat import cats.effect.{Clock, IO} +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ServiceDependency import ch.epfl.bluebrain.nexus.delta.kernel.utils.{ClasspathResourceLoader, UUIDF} import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.client.ElasticSearchClient import ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch.config.ElasticSearchViewsConfig diff --git a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteDiskStorageClient.scala b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteDiskStorageClient.scala index 93d04dcec3..b7b8bdc626 100644 --- a/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteDiskStorageClient.scala +++ b/delta/plugins/storage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteDiskStorageClient.scala @@ -9,6 +9,8 @@ import akka.http.scaladsl.model.StatusCodes._ import akka.http.scaladsl.model.Uri.Path import cats.effect.IO import cats.implicits._ +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription.ResolvedServiceDescription import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.StoragesConfig.RemoteDiskStorageConfig import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.operations.StorageFileRejection.FetchFileRejection.UnexpectedFetchError import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.operations.StorageFileRejection.MoveFileRejection.UnexpectedMoveError @@ -21,9 +23,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.circe.CirceMarshalling._ import ch.epfl.bluebrain.nexus.delta.sdk.error.ServiceError.FeatureDisabled import ch.epfl.bluebrain.nexus.delta.sdk.http.HttpClientError._ import ch.epfl.bluebrain.nexus.delta.sdk.http.{HttpClient, HttpClientError} -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription.ResolvedServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, Name} +import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri import ch.epfl.bluebrain.nexus.delta.sdk.syntax._ import ch.epfl.bluebrain.nexus.delta.sourcing.model.Label import io.circe.generic.semiauto.deriveDecoder @@ -118,7 +118,7 @@ object RemoteDiskStorageClient { import as.dispatcher - private val serviceName = Name.unsafe("remoteStorage") + private val serviceName = "remoteStorage" def serviceDescription: IO[ServiceDescription] = client diff --git a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteStorageClientSpec.scala b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteStorageClientSpec.scala index 1a2e98a025..c76a9412ce 100644 --- a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteStorageClientSpec.scala +++ b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/operations/remote/client/RemoteStorageClientSpec.scala @@ -4,6 +4,7 @@ import akka.actor.ActorSystem import akka.http.scaladsl.model.ContentTypes.`text/plain(UTF-8)` import akka.http.scaladsl.model.{HttpEntity, StatusCodes, Uri} import akka.testkit.TestKit +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.ServiceDescription import ch.epfl.bluebrain.nexus.delta.plugins.storage.files.model.Digest.{ComputedDigest, NotComputedDigest} import ch.epfl.bluebrain.nexus.delta.plugins.storage.remotestorage.RemoteStorageClientFixtures import ch.epfl.bluebrain.nexus.delta.plugins.storage.remotestorage.RemoteStorageClientFixtures.BucketName @@ -12,8 +13,6 @@ import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.operations.AkkaSou import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.operations.StorageFileRejection.{FetchFileRejection, MoveFileRejection} import ch.epfl.bluebrain.nexus.delta.plugins.storage.storages.operations.remote.client.model.RemoteDiskStorageFileAttributes import ch.epfl.bluebrain.nexus.delta.sdk.http.HttpClientError.HttpClientStatusError -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.ServiceDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name import ch.epfl.bluebrain.nexus.delta.sourcing.model.Label import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec import org.scalatest.concurrent.Eventually @@ -43,10 +42,7 @@ class RemoteStorageClientSpec(fixture: RemoteStorageClientFixtures) ) "fetch the service description" in eventually { - client.serviceDescription.accepted shouldEqual ServiceDescription( - Name.unsafe("remoteStorage"), - fixture.storageVersion - ) + client.serviceDescription.accepted shouldEqual ServiceDescription("remoteStorage", fixture.storageVersion) } "check if a bucket exists" in { diff --git a/delta/plugins/test-plugin/src/main/scala/ch/epfl/bluebrain/nexus/delta/testplugin/TestPluginDef.scala b/delta/plugins/test-plugin/src/main/scala/ch/epfl/bluebrain/nexus/delta/testplugin/TestPluginDef.scala index 669d8fb8fd..52c2b7a2f6 100755 --- a/delta/plugins/test-plugin/src/main/scala/ch/epfl/bluebrain/nexus/delta/testplugin/TestPluginDef.scala +++ b/delta/plugins/test-plugin/src/main/scala/ch/epfl/bluebrain/nexus/delta/testplugin/TestPluginDef.scala @@ -1,9 +1,9 @@ package ch.epfl.bluebrain.nexus.delta.testplugin import cats.effect.IO +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import ch.epfl.bluebrain.nexus.delta.sdk.PriorityRoute -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, Name} +import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri import ch.epfl.bluebrain.nexus.delta.sdk.plugin.{Plugin, PluginDef} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -21,7 +21,7 @@ case class TestPluginDef() extends PluginDef { ) } - override val info: PluginDescription = PluginDescription(Name.unsafe("testplugin"), "0.1.0") + override val info: PluginDescription = PluginDescription("testplugin", "0.1.0") override def initialize(locator: Locator): IO[Plugin] = IO.pure(locator.get[TestPlugin]) diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/plugin/PluginDef.scala b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/plugin/PluginDef.scala index fca442e2ab..d1d76af9a5 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/plugin/PluginDef.scala +++ b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/plugin/PluginDef.scala @@ -1,8 +1,7 @@ package ch.epfl.bluebrain.nexus.delta.sdk.plugin import cats.effect.IO -import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.PluginDescription -import ch.epfl.bluebrain.nexus.delta.sdk.model.Name +import ch.epfl.bluebrain.nexus.delta.kernel.dependency.ComponentDescription.PluginDescription import com.typesafe.config.{Config, ConfigFactory, ConfigParseOptions, ConfigResolveOptions} import izumi.distage.model.Locator import izumi.distage.model.definition.ModuleDef @@ -66,14 +65,14 @@ object PluginDef { ConfigFactory.parseFile(new File(p), parseOptions) } - private[plugin] def load(classLoader: ClassLoader, name: Name, configFileName: String) = ConfigFactory + private[plugin] def load(classLoader: ClassLoader, name: String, configFileName: String) = ConfigFactory .defaultOverrides() .withFallback(externalConfig) .withFallback( ConfigFactory.parseResources(classLoader, configFileName, parseOptions) ) .resolve(resolveOptions) - .getConfig(s"plugins.${name.value}") + .getConfig(s"plugins.$name") implicit val pluginDefOrdering: Ordering[PluginDef] = Ordering.by(_.priority) }