In this step the application will be tested using the OSGi console commands.
ss to display as
short status report of the installed bundles.
This can be a little tricky at
first, since the Console is constantly changing as the
org.eclipse.soda.sat.tutorial.customer bundle logs a
message once per second, but don't let this bother you.
System.out, being used to write, and
System.in, being used to read, are distinct and do not
interact.
osgi> ss Framework is launched. id State Bundle 0 ACTIVE system.bundle_3.2.2.R32x_v20070118 1 ACTIVE org.eclipse.equinox.servlet.api_1.0.0.v20060601 2 ACTIVE org.eclipse.osgi.services_3.1.100.v20060601 3 ACTIVE org.eclipse.soda.sat.core_1.0.0.200702192231 4 ACTIVE org.eclipse.soda.sat.tutorial.customer_1.0.0 5 ACTIVE org.eclipse.soda.sat.tutorial.vendor.hotdog_1.0.0 6 ACTIVE org.eclipse.soda.sat.tutorial.vendor.popcorn_1.0.0 7 ACTIVE org.eclipse.soda.sat.tutorial.vendor.service_1.0.0
org.eclipse.soda.sat.tutorial.customer bundle came in
before any of its prerequisite bundles does not prevent it
from working.
Not only is this something
required of OSGi bundles, but it is also something with which
SAT assists by ensuring that a bundle that imports a service from
the OSGi framework is notified as a matching available service is
registered and unregistered.
bundle 5 to display the details of the
org.eclipse.soda.sat.tutorial.vendor.hotdog bundle. You
will see that it has registered a VendorService that has
the OSGi framework has given a service.id of
22.
osgi> bundle 5
initial@reference:file:../../../../workspace/org.eclipse.soda.sat.tutorial.vendor.hotdog/ [5]
Id=5, Status=ACTIVE
Registered Services
{org.eclipse.soda.sat.tutorial.vendor.service.VendorService}={bundle.version=1.0.0,
service.registration.timestamp=1171816001659, service.id=22}
No services in use.
No exported packages
Imported packages
org.eclipse.soda.sat.core.framework; version="1.0.0"
org.eclipse.soda.sat.tutorial.vendor.service; version="0.0.0"
No fragment bundles
Named class space
org.eclipse.soda.sat.tutorial.vendor.hotdog; bundle-version="1.0.0"[provided]
No required bundles
bundle 6 to display the details of the
org.eclipse.soda.sat.tutorial.vendor.popcorn bundle. You
will see that it has registered a VendorService that has
the OSGi framework has given a service.id of
23.
osgi> bundle 6
initial@reference:file:../../../../home/workspace/org.eclipse.soda.sat.tutorial.vendor.popcorn/ [6]
Id=6, Status=ACTIVE
Registered Services
{org.eclipse.soda.sat.tutorial.vendor.service.VendorService}={bundle.version=1.0.0,
service.registration.timestamp=1172374204942, service.id=23}
No services in use.
No exported packages
Imported packages
org.eclipse.soda.sat.core.framework; version="1.0.0"
org.eclipse.soda.sat.core.util; version="1.0.0"
org.eclipse.soda.sat.tutorial.vendor.service; version="0.0.0"
No fragment bundles
Named class space
org.eclipse.soda.sat.tutorial.vendor.popcorn; bundle-version="1.0.0"[provided]
No required bundles
bundle 4 to display the details of the
org.eclipse.soda.sat.tutorial.customer bundle. You will
see that it has acquired a VendorService that the OSGi
framework has given a service.id of 22.
osgi> bundle 4
initial@reference:file:../../../../home/workspace/org.eclipse.soda.sat.tutorial.customer/ [4]
Id=4, Status=ACTIVE
No registered services.
Services in use:
{org.eclipse.soda.sat.tutorial.vendor.service.VendorService}={bundle.version=1.0.0,
service.registration.timestamp=1172374204942, service.id=22}
No exported packages
Imported packages
org.eclipse.soda.sat.core.framework; version="1.0.0"
org.eclipse.soda.sat.core.util; version="1.0.0"
org.eclipse.soda.sat.tutorial.vendor.service; version="0.0.0"
No fragment bundles
Named class space
org.eclipse.soda.sat.tutorial.customer; bundle-version="1.0.0"[provided]
No required bundles
org.eclipse.soda.sat.tutorial.customer bundle's
logging to the console and the fact that it has acquired a
VendorService with a service.id of
22 indicates that it is using the
org.eclipse.soda.sat.tutorial.vendor.hotdog
bundle's implementation of the VendorService interface.
org.eclipse.soda.sat.tutorial.vendor.hotdog bundle?
org.eclipse.soda.sat.tutorial.customer bundle that is
using the org.eclipse.soda.sat.tutorial.vendor.hotdog
bundle's implementation of the VendorService.
stop 5.
osgi> stop 5 [INFO] 2007-02-24 22:47:13.251 - The Customer bundle has been deactivated [INFO] 2007-02-24 22:47:13.251 - The Customer bundle has been activated [INFO] 2007-02-24 22:47:13.251 - The Customer bought popcorn from Orville Redenbacher [INFO] 2007-02-24 22:47:13.251 - The Hotdog Vendor bundle has been deactivated
org.eclipse.soda.sat.tutorial.vendor.hotdog bundle
caused the
org.eclipse.soda.sat.tutorial.customer bundle to be
deactivated since it lost its acquired VendorService.
Notice that the
org.eclipse.soda.sat.tutorial.customer bundle was
immediately activated again since it was able to acquire a
replacement VendorService from the OSGi framework.
VendorService implementation acquired by the
org.eclipse.soda.sat.tutorial.customer bundle was
registered by the
org.eclipse.soda.sat.tutorial.vendor.popcorn bundle.
bundle 4 to display the
details of the
org.eclipse.soda.sat.tutorial.customer bundle.
osgi> bundle 4
initial@reference:file:../../../../home/workspace/org.eclipse.soda.sat.tutorial.customer/ [4]
Id=4, Status=ACTIVE
No registered services.
Services in use:
{org.eclipse.soda.sat.tutorial.vendor.service.VendorService}={bundle.version=1.0.0,
service.registration.timestamp=1172374642541, service.id=23}
No exported packages
Imported packages
org.eclipse.soda.sat.core.framework; version="1.0.0"
org.eclipse.soda.sat.core.util; version="1.0.0"
org.eclipse.soda.sat.tutorial.vendor.service; version="0.0.0"
No fragment bundles
Named class space
org.eclipse.soda.sat.tutorial.customer; bundle-version="1.0.0"[provided]
No required bundles
org.eclipse.soda.sat.tutorial.customer bundle is now using
an implementation of the VendorService with a
service.id of 23, which you may recall from
earlier, is the service.id given to the
VendorService registered by the
org.eclipse.soda.sat.tutorial.vendor.popcorn bundle.
org.eclipse.soda.sat.tutorial.vendor.popcorn bundle?
Give it a try by typing stop 6.
osgi> stop 6 [INFO] 2007-02-24 22:49:41.674 - The Customer bundle has been deactivated [INFO] 2007-02-24 22:49:41.674 - The Popcorn Vendor bundle has been deactivated
org.eclipse.soda.sat.tutorial.vendor.popcorn bundle
caused the
org.eclipse.soda.sat.tutorial.customer bundle to be
deactivated since it lost its acquired VendorService.
Notice that the
org.eclipse.soda.sat.tutorial.customer bundle remained
deactivated since it was unable to acquire a replacement
VendorService from the OSGi framework.
bundle 4 to display the
details of the
org.eclipse.soda.sat.tutorial.customer bundle.
osgi> bundle 4
initial@reference:file:../../../../home/workspace/org.eclipse.soda.sat.tutorial.customer/ [4]
Id=4, Status=ACTIVE
No registered services.
No services in use.
No exported packages
Imported packages
org.eclipse.soda.sat.core.framework; version="1.0.0"
org.eclipse.soda.sat.core.util; version="1.0.0"
org.eclipse.soda.sat.tutorial.vendor.service; version="0.0.0"
No fragment bundles
Named class space
org.eclipse.soda.sat.tutorial.customer; bundle-version="1.0.0"[provided]
No required bundles
org.eclipse.soda.sat.tutorial.customer bundle is no longer
using a VendorService.
org.eclipse.soda.sat.tutorial.vendor.hotdog
bundle and/or the
org.eclipse.soda.sat.tutorial.vendor.popcorn bundle will
cause the org.eclipse.soda.sat.tutorial.customer bundle to
be activated once more.
start 5 6.
osgi> start 5 6 [INFO] 2007-02-24 22:51:29.149 - The Hotdog Vendor bundle has been activated [INFO] 2007-02-24 22:51:29.149 - The Customer bundle has been activated [INFO] 2007-02-24 22:51:29.149 - The Customer bought hotdog from Ball Park [INFO] 2007-02-24 22:51:29.149 - The Popcorn Vendor bundle has been activated
org.eclipse.soda.sat.tutorial.customer bundle was activated
once more since it was able to acquire the VendorService
registered by the
org.eclipse.soda.sat.tutorial.vendor.hotdog bundle.
shutdown to
shutdown the OSGi framework.
osgi> shutdown [INFO] 2007-02-24 22:52:10.087 - The Popcorn Vendor bundle has been deactivated [INFO] 2007-02-24 22:52:10.087 - The Customer bundle has been deactivated [INFO] 2007-02-24 22:52:10.087 - The Hotdog Vendor bundle has been deactivated [INFO] 2007-02-24 22:52:10.087 - The Customer bundle has been stopped
ss to get a short status of the bundles.
osgi> ss Framework is shutdown. id State Bundle 0 RESOLVED system.bundle_3.2.2.R32x_v20070118 1 INSTALLED org.eclipse.equinox.servlet.api_1.0.0.v20060601 2 INSTALLED org.eclipse.osgi.services_3.1.100.v20060601 3 INSTALLED org.eclipse.soda.sat.core_1.0.0.200702192231 4 INSTALLED org.eclipse.soda.sat.tutorial.customer_1.0.0 5 INSTALLED org.eclipse.soda.sat.tutorial.vendor.hotdog_1.0.0 6 INSTALLED org.eclipse.soda.sat.tutorial.vendor.popcorn_1.0.0 7 INSTALLED org.eclipse.soda.sat.tutorial.vendor.service_1.0.0
INSTALLED state.
launch, and then set the
framework's start level to 6 by typing setfwsl 6.
osgi> launch osgi> setfwsl 6 Framework Active Start Level = 6 osgi> [INFO] 2007-02-24 22:53:04.686 - The Customer bundle has been started [INFO] 2007-02-24 22:53:04.686 - The Hotdog Vendor bundle has been activated [INFO] 2007-02-24 22:53:04.696 - The Customer bundle has been activated [INFO] 2007-02-24 22:53:04.696 - The Customer bought hotdog from Ball Park [INFO] 2007-02-24 22:53:04.696 - The Popcorn Vendor bundle has been activated
close.
osgi> close [INFO] 2007-02-24 22:53:31.575 - The Popcorn Vendor bundle has been deactivated [INFO] 2007-02-24 22:53:31.575 - The Customer bundle has been deactivated [INFO] 2007-02-24 22:53:31.575 - The Hotdog Vendor bundle has been deactivated [INFO] 2007-02-24 22:53:31.575 - The Customer bundle has been stopped
Copyright © 2001, 2007 IBM Corporation and others. All Rights Reserved.