diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /container-di/src/main/scala/com/yahoo/container/di/Osgi.scala |
Publish
Diffstat (limited to 'container-di/src/main/scala/com/yahoo/container/di/Osgi.scala')
-rw-r--r-- | container-di/src/main/scala/com/yahoo/container/di/Osgi.scala | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/container-di/src/main/scala/com/yahoo/container/di/Osgi.scala b/container-di/src/main/scala/com/yahoo/container/di/Osgi.scala new file mode 100644 index 00000000000..6752559fde6 --- /dev/null +++ b/container-di/src/main/scala/com/yahoo/container/di/Osgi.scala @@ -0,0 +1,40 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.container.di + +import com.yahoo.config.FileReference +import com.yahoo.container.bundle.{MockBundle, BundleInstantiationSpecification} +import com.yahoo.container.di.Osgi.BundleClasses +import org.osgi.framework.Bundle +import com.yahoo.component.ComponentSpecification + +/** + * + * @author gjoranv + * @author tonytv + */ +trait Osgi { + + def getBundleClasses(bundle: ComponentSpecification, packagesToScan: Set[String]): BundleClasses = { + BundleClasses(new MockBundle, List()) + } + + def useBundles(bundles: java.util.Collection[FileReference]) { + println("useBundles " + bundles.toArray.mkString(", ")) + } + + def resolveClass(spec: BundleInstantiationSpecification): Class[AnyRef] = { + println("resolving class " + spec.classId) + Class.forName(spec.classId.getName).asInstanceOf[Class[AnyRef]] + } + + def getBundle(spec: ComponentSpecification): Bundle = { + println("resolving bundle " + spec) + new MockBundle() + } + +} + +object Osgi { + type RelativePath = String //e.g. "com/yahoo/MyClass.class" + case class BundleClasses(bundle: Bundle, classEntries: Iterable[RelativePath]) +} |