{"id":34606806,"url":"https://github.com/bcdev/senbox-osgi-sandbox","last_synced_at":"2026-05-22T23:32:53.628Z","repository":{"id":17167549,"uuid":"19934675","full_name":"bcdev/senbox-osgi-sandbox","owner":"bcdev","description":"An OSGi-based application which covers various use cases from the Sentinel Toolbox.","archived":false,"fork":false,"pushed_at":"2014-05-21T07:26:01.000Z","size":270,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-09T14:15:14.506Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-19T08:40:55.000Z","updated_at":"2023-04-26T13:55:25.000Z","dependencies_parsed_at":"2022-09-01T12:20:50.040Z","dependency_job_id":null,"html_url":"https://github.com/bcdev/senbox-osgi-sandbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bcdev/senbox-osgi-sandbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcdev%2Fsenbox-osgi-sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcdev%2Fsenbox-osgi-sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcdev%2Fsenbox-osgi-sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcdev%2Fsenbox-osgi-sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcdev","download_url":"https://codeload.github.com/bcdev/senbox-osgi-sandbox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcdev%2Fsenbox-osgi-sandbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33376130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-22T21:56:13.512Z","status":"ssl_error","status_checked_at":"2026-05-22T21:56:10.769Z","response_time":265,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T13:57:14.978Z","updated_at":"2026-05-22T23:32:53.622Z","avatar_url":"https://github.com/bcdev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Project Description\n===================\n\nThis is _Teo_, an application is used to get in contact with OSGi programming and most importantly, as a mean to\nmake a decision if OSGi should be used as a fundamental architectural layer of the Sentinel Toolbox. In particular,\nTeo covers the following use cases.\n\n*UC-1*: Launch a GUI app and also a CLI app from a set of shared bundles\nThe current Ceres solution is to have a launcher that operates in two ways. For GUI apps, it works similar to OSGi,\nthat is, all JARs in the `modules` folder of the app's installation directory are started as dynamic modules.\nFor CLI apps, the launcher that constructs a classpath from all JARs in the `modules` folder.\n\n    Result: This is no problem. See code org.teo.TeoCli and org.teo.TeoGui code. For the CLI,\n    less bundles are needed. Therefore a special launch configuration could be used or we could\n    use special Bundle requirements, see _Bundle Requirements_ in chapter 3.3.6 of the OSGi core spec.\n\n\n*UC-2*: Run multiple app instances at the same time. This is mandatory for the CLI, desired for the GUI.\nThere is no problem with Ceres in this case, because Ceres does not persistently maintain module state.\n\n    Result: with Felix there seems to be no problem as long as the framework property `org.osgi.framework.storage.clean`\n    is not set. It's only value can be `onFirstInit` which will clear the cache before the framework is initialised and therefore\n    causing multiple framework instances to fail. The current startup time is around 600ms.\n\n*UC-3*: Use the Toolbox API in non-OSGi based environments such as as Calvalus and MERCI. Use the API from other languages, such as the Python API wrapper.\nThere is no problem with Ceres in this case, because Ceres does not persistently maintain module state. However,\nwe currently provide app services via two mechanisms: Java SPI and our Ceres extension registry. The latter is not\naccessible in CLI mode. In CLI mode, we are restricted to Java SPI which requires a non-configurable\nSPI implementation in Java.\n\n    Result: Embed the OSGi framework. Bundles expose client API, other bundles implement them as services. The client API bundles\n    are put on the classpath of the host app. Then a configured \n    framework instance is started. It allows the framework to delegate class loading to the app class loader\n    for exposed client APIs. Then we access services via the framework's bundle context. \n    TODO: can we run OSGi embedded in a Tomcat servlet?\n\n*UC-4*: Find out how OSGi can help implementing the _Toolbox Concept_, which is set of modules within a host application.\n\n    Result: Excellent support using the _Package Deployment Admin_ of the compendium specs. See code in `teo-gui-obr` module.\n    See also module `obr-maven-plugin` which can create spec-conform deployment packages. \n   \n*UC-5*: Find out how OSGi can help implementing the _Stand-Alone Tools Adapter_, which is an an environment for the\nintegration external executables in the a host application.\n\n    Result: Probably good support using the _Application Admin_ of the compendium specs. See code in `teo-gui-apps`\n    module.\n    \n*UC-6*: Find out how to setup an OSGi framework, so that users can both install plugins by copying them into a \n`modules` folder and using a module manager. \n\n    Result: See `teo-launcher` which installs a directory watcher on `modules` folder. Module changes can easily be \n    translated into bundle install, update, and uninstall actions. \n    \n*UC-7*: Find out how OSGi integrates with Maven and IDEs, namely IntelliJ IDEA. We must be able to easily analyse dependencies,\nrun and debug in different configurations directly from generated artifacts.\n\n    Result: `maven-bundle-plugin` allows to create bundles JARs or create bundle manifest files using POM information.\n    IDEA has OSGi framework support through specific facets.\n\n\nProject Structure\n=================\n\n_Teo_ is composed of multiple sub projects which mainly generate OSGi bundles.\n\n* `teo-launcher` - Teo's launcher. It is a bundle so that we can update it.\n* `teo-appadmin` - A bundle that registers an OSGi Application Admin service implementation.\n* `teo-core` - Represents Teo's core library and core API\n* `teo-gui` - Represents Teo's (empty) desktop GUI application and GUI API. Registers the 'gui' service.\n* `teo-gui-obr` - Uses the OSGi OSGi Repository Admin and and Deployment Admin services (tools will appear in \"Help\" menu)\n* `teo-gui-apps` - Uses the OSGi OSGi Application Admin service (tool will appear in \"Tools\" menu)\n* `com.acme.toolbox` - Generates a deployment package comprising the `teo-gui-acme1` and `teo-gui-acme2` bundles.\n** `teo-gui-acme1` - GUI extension #1 from ACME (will appear in \"View\" menu)\n** `teo-gui-acme2` - GUI extension #2 from ACME (will appear in \"View\" menu)\n* `odp-maven-plugin` - OSGi Deployment Package Maven Plugin (goal `odp` is required because none of the Maven plugins can create ZIPs with entries in a defined order)\n\n\nSetup\n=====\n\n_Teo_ uses the Apache Felix OSGi framework v4.4. In addition to Felix 4.4 you need download the following\nbundles from http://felix.apache.org/ and copy their JARs to `$FELIX_HOME/bundles`.\n\n* org.apache.felix.bundlerepository-1.6.6  (if not contained in framework by default)\n* org.apache.felix.deploymentadmin-0.9.6\n* org.apache.felix.dependencymanager-3.1.0\n\n\nBuilding\n========\n\n`mvn install` does the job. All OSGi bundles (*.jar) are copied into the `modules` folder.\n\nFor deployment admin testing, a separate deployment package `com.acme.toolbox.dp` can be generated in\n`com.acme.toolbox/target` by using the Maven goal `odp:odp`.\n\n\nLaunching\n=========\n\nYou can use IDEA's OSGi Framework integration to launch Teo or directly using the `org.teo.cli.Main` class. \nIn the latter case copy the exiting `teo.config.txt` and rename it to `teo.config`. It is a standard Java properties file. \nIf you want to use different configurations set the Java system property `teo.config` to your configuration file.\n\nTo test package deployment, delete the ACME directories and JARs in the `modules` folder. As deployment package select\n`com.acme.toolbox/target/com.acme.toolbox.dp.jar`.\n\n\nExisting Problems and Questions\n===============================\n\nMultiple instances at the same time\n-----------------------------------\n\nProblem: We must be able to launch multiple instances of the CLI application (e.g. ten parallel processes in batch mode)\nfrom the same installation. Afaik OSGi framework instances will then need independent bundle caches which introduces a\nconsiderable file I/O overhead and may also occupy a lot of disk space. This is although the CLI applications has a \nlimited lifetime.\n\nSolution: None so far. May hack Felix in order to use Java 7 FileSystem and support a RAM disk. May then avoid \ncopying JAR files into the cache by using links.\n\n\nCLI/GUI at the same time\n------------------------\n\nProblem: We must be able to launch multiple applications from the same installation,\nat least a single CLI and GUI. A CLI must start up fast, it should not require\nall the GUI-related modules which might also require processing lots of\nextension point configuration from their module descriptors.\n\nSolution 1: Run CLI with lower start level than GUI.\n\nSolution 1 problem: Plugins must know their start levels. A reader plugins should be\nrecognised by both CLI and GUI modes, while a tool window extension only applies to\na GUI.\n\nSolution 2: A configuration property tells plugin activators whether we are in\nGUI mode or headless CLI mode. Expensive extension point parsing occurs only\nif required and applicable. E.g. tool windows \u0026 action processing does not take\nplace in CLI mode.\n\nSolution 3: Plugin activators must actively register their extension services.\nThe activator will only register its service if a certain service registry is available\n(--\u003e OSGi ServiceTracker).\n\nSolution 2/3 problem: Requires activators which is generally a bad idea because class\nloaders are always created and Java code is executed even if never needed. Writing of\nactivators also forces intrusion of OSGi specific API which should be avoided.\nMuch better to use declarative services (DS).\n\nProblem 1/2/3: Bundle cache is for a single framework instance. Each instance requires\nits own bundle cache (is that true?)\n\nCLI arguments passing\n---------------------\n\nSolution 1: Write own main and embed OSGi framework instance.\nSolution 2: Use Equinox IApplication extension point.\nSolution 3: Use bnd tool and the 'launcher.arguments' service property.\nSolution 4: Use \"Framework Launching\" as of OSGi spec 4.2\n* http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html\n* http://stackoverflow.com/questions/434664/accessing-command-line-arguments-from-osgi-bundle\n* http://stackoverflow.com/questions/19515773/command-line-arguments-and-jvm-parameters-for-osgi-bundles\n\n\nOSGi Development\n----------------\n\nProblem: When using the Felix Maven Bundle Plugin, the MANIFEST.MF is created only after during \ncompilation. This prevents an IDE from detected configuration errors at compile time.\n\n\n\nPros and Cons for Sentinel Toolbox\n==================================\n\nPros\n----\n\n* Open specifications, documentation, widely used, lots of fora and discussion groups\n** Bundle repository admin\n** Bundle format\n** Deployment admin for Toolbox installation (cool features such as fixes, rollback, icon)\n** Deployment package format\n* Efficiently solves plugins dependency conflicts\n* Felix or Equinox OS framework implementations, both can be used\n* OSGi framework APIs are not very invasive (can be limited to org.osgi.framework.BundleActivator sub classes)\n* Replace all libraries in the `libs` folder of the app's installation directory by dynamical\n  bundles.\n* Modules can deployed to the user's home directory, so individual app configurations can exist in parallel\n  for a single host application installed for all users\n\n\nCons\n----\n\n* Core specs are already complex, the compendium specs are overwhelming\n* Using maven bundle plugin prevents IDEA from telling (import/export dependency) problems at compile time\n* Framework runtime (import/export dependency, class loader) errors are very hard to trace\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcdev%2Fsenbox-osgi-sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcdev%2Fsenbox-osgi-sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcdev%2Fsenbox-osgi-sandbox/lists"}