Hi,

What I have done is the reverse (clerezza in karaf) and might be of
interest to others:

I have created a custom karaf based distribution containing:
- clerezza components
- stanbol rulestore and ontology manager
- karaf cli commands to manipulate stanbol rulestore
- custom components of my own

For both clerezza and stanbol I created karaf features to only contain
components used by me. This however can be easily extended to contain
all features. It is still up to the distribution to decide which
features to load on startup.

If there is any interest please let me know. Then I will ask my client
if I can share details with the community.

Regards,

Minto

Op 11-2-2013 21:56, Reto Bachmann-Gmür schreef:
> My experiments today.
>
> Goal: Be able to install Karaf features within clerezza
>
> Approach: use the service org.apache.karaf.features.FeaturesService provided 
> by
> the bundle Apache Karaf :: Features :: Core
> (org.apache.karaf.features.core) [1].
>
> Unfortunately this bundle has quite some dependencies which need to be
> satisfied. I've chosen a brute force approach and installed the list
> of bundles of the karaf-framework feature. Because of chicken and egg
> I can't yet install features. So  I needed the following scala on the
> command line:
>
> import java.net._
> val url = new 
> URL("mvn:org.apache.karaf.assemblies.features/standard/2.3.0/xml/features")
> val conn = url.openConnection
> import xml._
> val doc = XML.load(conn.getInputStream)
>
> for (b <- doc\"feature"\"bundle") {
>  val mvnUri = b.text
>  try {
>  val bundle = bundleContext.installBundle(mvnUri)
>  bundle.start()
>  } catch {
>    case ex => out.println("Exception installing bundle", ex)
>  }
> }
>
> The bundle org.apache.karaf.features.core is now satisfied but not
> exposing any service. For some reason the blueprint service bundle
> wasn't activated, activating it over the webconsole made the service
> available. As new packages aren't avaiable on already open shells I
> have to reconnect via ssh.
>
> Now I can access the service:
>
> zz>val fs = $[org.apache.karaf.features.FeaturesService]
> fs: org.apache.karaf.features.FeaturesService =
> org.apache.karaf.features.internal.FeaturesServiceImpl@9d8957d
> zz>fs.[TAB]
> addRepository           asInstanceOf            getFeature
>  installFeature          installFeatures         isInstalled
>   isInstanceOf            listFeatures
> listInstalledFeatures   listRepositories        removeRepository
>  restoreRepository       toString                uninstallFeature
>   validateRepository
> zz>fs.listFeatures
> res0: Array[org.apache.karaf.features.Feature] = Array()
> zz>fs.listRepositories
> res1: Array[org.apache.karaf.features.Repository] = Array()
>
> The next step will be to add a repository.
>
> Reto
>
> 1. Thanks to Krzysztoffor pointing me to this:
> http://mail-archives.apache.org/mod_mbox/karaf-user/201302.mbox/%3C2960186.kKK1vM5F7L%40dracula%3E
>
>


-- 
ir. ing. Minto van der Sluis
Software innovator / renovator
Xup BV

Mobiel: +31 (0) 626 014541

Reply via email to