| DA-Launcher Overview |
|
|
|
Dynamic Application Launcher (DA-Launcher) is a project that simplifies launching and managing OSGi-based applications by handling common tasks and problems that face developers who work on launching OSGi based applications. As long as application's bundles exist, creating an OSGi-based application that is consumable by end users with DA-Launcher is a matter of seconds if the developer is familiar with DA-Launcher or a matter of minutes if not. DA-Launcher is designed to be extensible and very lightweight (it weighs less than 250 kilobytes), so it wouldn't affect the size or the performance of the application. It's worth mentioning that all of the examples and applications on DynamicJava.org are launched using DA-Launcher so visitors of this site could run the examples with a double click if they have a GUI or by typing a single command in the command line interface.Why Use DA-Launcher?Why you might find DA-Launcher the best solution for launching your OSGi-based application?
Use CasesBelow are some of the use cases where DA-Launcher can prove to be very useful compared to other approaches for launching OSGi-based applications.
DA-Launcher's Directory StructureIf you've downloaded one of the examples above you would probably have noticed the uniformed directory structure of OSGi-based applications run using DA-Launcher. Application's root directory which contains the directories (bin, lib, bundles, etc.) is called “DA-Launcher Home Dir”. Every Application that is run using DA-Launcher has a home directory. For standalone OSGi-based applications, it will be the root directory of the application, for ones embedded in Web Applications it will be the “/WEB-INF/da-launcher” directory of the Web Application by default. Bundles exist in the “/bundles” directory – For the rest of the article I will refer to “DA-Launcher Home Dir” by “/”. There are three categories of bundles in DA-Launcher:
Bundles can be installed and uninstalled at runtime by simply copying them to the specified directory or removing them from there. It's up to you to decide whether to place a bundle in the system or the application bundles directory, you just need to take into account that Non-bundled libraries are run and installed first, System Bundles second and Application Bundles third. The “/config” directory contains DA-Launcher's configuration files. From there you can configure the behavior of different bundles categories, the OSGi framework, logging behavior and extensions to DA-Launcher. New configuration files for future releases of DA-Launcher will be placed in this directory. The “/logs” directory contains the log files, the “/lib” directory contains library files needed for the DA-Launcher to run and the “/runtime” directory contains files generated at runtime (caches for example). These three directories plus the “/bin” directory are not intended to be modified by developers. When DA-Launcher is embedded in a Web Application, the directory structure differs in that the “DA-Launcher Home Dir” doesn't contain the “/bin” directory which is not needed and the contents of the “/lib” directory are moved to Web Application's directory “/WEB-INF/lib”. How DA-Launcher works?The batch/script files in the “/bin” directory are intended for users to run the application. The script/batch files run the application from JAR files in the “/lib” directory. DA-Launcher first verifies the existence of needed directories and files then loads the configuration files and based on the OSGi Framework configuration file it runs the OSGi Framework (Equinox or Felix). Having the OSGi Environment ready, it generates bundles from non-bundled libraries and installs them in the environment, then installs System bundles and starts them (unless configured not to start them automatically) followed by Application bundles. Having the bundles installed and running, the directory watchers are started to detect any changes to bundle archives so bundles could be installed, updated and uninstalled at runtime. When DA-Launcher is embedded in a Web Application, a Servlet Context Listener provided by DA-Launcher need to be registered in the web.xml file. The context listener interacts with DA-Launcher's internals to launch the OSGi-based application and provide the Bundle Context of the launched application to Web Application's Servlets using the Servlet Context object. Getting StartedGetting started with DA-Launcher usually takes less than three minutes. If you would like to try DA-Launcher for your own application, please check the Getting Started page. |