concept user in category osgi

appears as: users, user, A user, A user, user, The user, users
OSGi in Depth

This is an excerpt from Manning's book OSGi in Depth.

Particularly interesting to us are application frameworks. An application framework is a type of software framework whose purpose is to provide a structure for the creation of software applications. Applications are programs that allow users to perform related tasks together. Examples of software applications are document editors and antivirus software.

Putting it all together, a development platform allows a developer to create applications and to host these applications so that end users can use them. Throughout this book, it’s important to keep these two players in mind: the developer (you) and the end user, as illustrated in figure 1.2. Software development platforms are also called toolkits or SDKs (software development kits).

Figure 1.2. A developer creates an application, which is used by a user, and develops to a framework.

Yes, you can create your own application management API. First, let’s look at the details of installing an application’s extension. When a user hosts an extension bundle in the OSGi framework, it essentially means that the bundle bits have been installed and started. We’ll name this combination of actions extension deployment. Conversely, a user can stop and uninstall the extension; this we’ll call extension undeployment. In summary, we’ve defined two management tasks: deployment and undeployment. Finally, a user should be able to list all extensions that are currently being hosted by the application; we’ll call this extension listing. Different applications will have different application management tasks; for example, for some applications it may be worthwhile to separate the steps of installing and starting.

Our next job is to provide a user interface to execute the deployment, undeployment, and listing of tasks and to map these to the underlying OSGi commands, as shown in figure 11.5. The latter is actually trivial; deployment maps to the OSGi bundle install and start commands, and undeployment maps to the OSGi uninstall command (in this case, you don’t need to stop it first). The list task maps to the retrieval of all application extension bundles. In other words, bundles installed by the user as extensions shouldn’t include any of the system or infrastructure bundles.

Figure 11.5. Application framework’s management tasks and their mapping to OSGi commands

With regard to the user interface, the first idea that comes to mind is to provide a web page for these tasks. This is generally the best approach. But because this isn’t a book about web page development, we’ll try to find another simpler option that still demonstrates the point. The simpler option is to use the filesystem itself as our user interface. When a user wants to deploy an extension, the user copies the extension’s JAR file, which is defined as being an OSGi bundle, into a specific directory in the application’s home directory. When the user wants to undeploy an extension, the user can then delete the extension JAR file from this directory. Finally, listings of all the extensions are done by listing the files contained in this directory. At first, this approach may seem somewhat clumsy, but it’s actually quite flexible; not only does it shield the user from dealing with OSGi, but it’s also easy to use and integrate into another tool, such as Ant.

We’d like to configure Felix so that when launched it automatically starts the bundle manning.osgi.mysystembundle. Should we just include this bundle in the load directory as we did in the previous section? We shouldn’t, because if we place it in the load directory, this bundle would be considered an extension, and the user would be able to remove it from the OSGi framework by deleting the file from the load directory, which isn’t what we want. In addition, we don’t want Felix to start its standard shell console or the OBR implementation that’s part of Felix out of the box. Finally, we do want to include the File Install bundle as part of our application. How do we configure which bundles should be installed and started out of the box in a fresh OSGi framework instance when it’s launched for the first time?