このコンテンツは選択した言語では利用できません。

2.2. Sample OSGi Application


Example of bundle dependencies

Figure 2.2, “Sample OSGi Application” shows an overview of a sample OSGi application consisting of five bundles, which illustrates the basic bundle types discussed in the previous section. The application is driven by the hello-consumer bundle, which imports a HelloParis service from the hello-paris bundle and imports a HelloBoston service from the hello-boston bundle.

Figure 2.2. Sample OSGi Application

Sample OSGi Application

The sample bundles

The sample OSGi application consists of the following bundles:
time-util
Fits the pattern of a library bundle. The time-util bundle is a utility library that can create Clock instances that tell the time in a particular time zone.
The time-util bundle is implemented using classes from the JDK and thus has no external package dependencies.
hello-paris
Fits the pattern of an API bundle. The hello-paris bundle consists of a single Java interface, which returns a greeting, getGreeting(), and gives the local time in Paris, getLocalTime().
The hello-paris bundle has the following external package dependency:
org.fusesource.example.time
hello-paris-impl
Fits the pattern of a provider bundle. The hello-paris-impl bundle implements the hello-paris API bundle.
The hello-paris-impl bundle has the following external package dependencies:
org.fusesource.example.hello.paris
org.fusesource.example.time
hello-boston
Fits the pattern of an API/provider combination bundle. The hello-boston bundle combines a Java interface and its implementation, where the Java interface returns a greeting, getGreeting(), and gives the local time in Boston, getLocalTime().
The hello-boston bundle has the following external package dependency:
org.fusesource.example.time
hello-consumer
Fits the pattern of a consumer bundle. The hello-consumer bundle imports the HelloParis OSGi service and the HelloBoston OSGi service and then invokes on these services to report the local times in Paris and in Boston.
The hello-consumer bundle has the following external package dependencies:
org.fusesource.example.hello.paris
org.fusesource.example.hello.boston
org.fusesource.example.time
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.