summaryrefslogtreecommitdiffstats
path: root/bundle-plugin/src/main/scala/com/yahoo/container/plugin/osgi/ExportPackages.scala
diff options
context:
space:
mode:
Diffstat (limited to 'bundle-plugin/src/main/scala/com/yahoo/container/plugin/osgi/ExportPackages.scala')
-rw-r--r--bundle-plugin/src/main/scala/com/yahoo/container/plugin/osgi/ExportPackages.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/bundle-plugin/src/main/scala/com/yahoo/container/plugin/osgi/ExportPackages.scala b/bundle-plugin/src/main/scala/com/yahoo/container/plugin/osgi/ExportPackages.scala
new file mode 100644
index 00000000000..d0e63cdc212
--- /dev/null
+++ b/bundle-plugin/src/main/scala/com/yahoo/container/plugin/osgi/ExportPackages.scala
@@ -0,0 +1,27 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.container.plugin.osgi
+
+/**
+ * @author tonytv
+ */
+object ExportPackages {
+
+ case class Export(packageNames: List[String], parameters: List[Parameter]) {
+ def version: Option[String] = {
+ (for (
+ param <- parameters if param.name == "version"
+ ) yield param.value).
+ headOption
+ }
+ }
+
+ case class Parameter(name: String, value: String)
+
+ def exportsByPackageName(exports: Seq[Export]): Map[String, Export] = {
+ (for {
+ export <- exports.reverse //ensure that earlier exports of a package overrides later exports.
+ packageName <- export.packageNames
+ } yield packageName -> export).
+ toMap
+ }
+}