Java Reference
In-Depth Information
How can you influence and control relative activation and deactivation ordering among
bundles? By using the standard Start Level Service provided by the OSG i framework.
10.2.1
Introducing the Start Level Service
The Start Level Service allows a management agent to control the relative activation/
deactivation order among bundles as well as when transitions should occur. The idea
is simple, and you may already be familiar with it from other contexts, such as in
UNIX environments where system services are started or stopped based on the sys-
tem's current run level.
In OSG i, the framework has an active start level associated with it, which is a non-
negative integer indicating the start level in which it's executing. The framework starts
with an active start level of zero and, by default, transitions to an active start level of
one when it's fully running. Each bundle also has an integer start level associated with
it, which indicates the required start level of the bundle. Only bundles with a start
level less than or equal to the framework's active start level are allowed to be in the
ACTIVE state. The Start Level Service is represented by the following interface:
public interface StartLevel {
int getStartLevel();
void setStartLevel(int startlevel);
int getBundleStartLevel(Bundle bundle);
void setBundleStartLevel(Bundle bundle, int startlevel);
int getInitialBundleStartLevel();
void setInitialBundleStartLevel(int startlevel);
boolean isBundlePersistentlyStarted(Bundle bundle);
boolean isBundleActivationPolicyUsed(Bundle bundle);
}
This service interface supports the following operations:
Modifying the active start level of the framework —You can change the framework's
active start level with setStartLevel() . Doing so results in all active bundles
with a higher start level being stopped, and bundles with a lower or equal start
level that are persistently marked as started being activated.
Assigning a specific start level to a bundle —You can change an individual bundle's
start level with setBundleStartLevel() . The framework activates the bundle if
it's persistently marked as started and the new start level is less than or equal to
the active start level or stops the bundle if the new start level is greater than the
active start level.
Setting the initial start level for newly installed bundles —All bundles are installed
with a default start level of 1. With setInitialBundleStartLevel() , you can
change this default value to any desired initial start level. This only impacts sub-
sequently installed bundles.
Querying relevant values —You can query the framework's active start level, the
start level of a bundle, and the initial bundle start level. Additionally, you can
query whether a given bundle is persistently marked as started.
Search WWH ::




Custom Search