接口 StartLevel
-
- 所有已知实现类:
StartLevelImpl
public interface StartLevel已过时。This service has been replaced by theorg.osgi.framework.startlevelpackage.The StartLevel service allows management agents to manage a start level assigned to each bundle and the active start level of the Framework. There is at most one StartLevel service present in the OSGi environment.A start level is defined to be a state of execution in which the Framework exists. StartLevel values are defined as unsigned integers with 0 (zero) being the state where the Framework is not launched. Progressively higher integral values represent progressively higher start levels. e.g. 2 is a higher start level than 1.
Access to the StartLevel service is protected by corresponding
ServicePermission. In additionAdminPermissionis required to actually modify start level information.Start Level support in the Framework includes the ability to control the beginning start level of the Framework, to modify the active start level of the Framework and to assign a specific start level to a bundle. How the beginning start level of a Framework is specified is implementation dependent. It may be a command line argument when invoking the Framework implementation.
When the Framework is first started it must be at start level zero. In this state, no bundles are running. This is the initial state of the Framework before it is launched. When the Framework is launched, the Framework will enter start level one and all bundles which are assigned to start level one and whose autostart setting indicates the bundle should be started are started as described in the
Bundle.startmethod. The Framework will continue to increase the start level, starting bundles at each start level, until the Framework has reached a beginning start level. At this point the Framework has completed starting bundles and will then fire a Framework event of typeFrameworkEvent.STARTEDto announce it has completed its launch.Within a start level, bundles may be started in an order defined by the Framework implementation. This may be something like ascending
Bundle.getBundleIdorder or an order based upon dependencies between bundles. A similar but reversed order may be used when stopping bundles within a start level.The StartLevel service can be used by management bundles to alter the active start level of the framework.
- 作者:
- $Id: 42f3c6bbf682a69ea3914c737d5b0001694383db $
-
-
方法概要
所有方法 实例方法 抽象方法 已过时的方法 修饰符和类型 方法 说明 intgetBundleStartLevel(Bundle bundle)已过时。Return the assigned start level value for the specified Bundle.intgetInitialBundleStartLevel()已过时。Return the initial start level value that is assigned to a Bundle when it is first installed.intgetStartLevel()已过时。Return the active start level value of the Framework.booleanisBundleActivationPolicyUsed(Bundle bundle)已过时。Returns whether the specified bundle's autostart setting indicates that the activation policy declared in the bundle's manifest must be used.booleanisBundlePersistentlyStarted(Bundle bundle)已过时。Returns whether the specified bundle's autostart setting indicates the bundle must be started.voidsetBundleStartLevel(Bundle bundle, int startlevel)已过时。Assign a start level value to the specified Bundle.voidsetInitialBundleStartLevel(int startlevel)已过时。Set the initial start level value that is assigned to a Bundle when it is first installed.voidsetStartLevel(int startlevel)已过时。Modify the active start level of the Framework.
-
-
-
方法详细资料
-
getStartLevel
int getStartLevel()
已过时。Return the active start level value of the Framework. If the Framework is in the process of changing the start level this method must return the active start level if this differs from the requested start level.- 返回:
- The active start level value of the Framework.
-
setStartLevel
void setStartLevel(int startlevel)
已过时。Modify the active start level of the Framework.The Framework will move to the requested start level. This method will return immediately to the caller and the start level change will occur asynchronously on another thread.
If the specified start level is higher than the active start level, the Framework will continue to increase the start level until the Framework has reached the specified start level. At each intermediate start level value on the way to and including the target start level, the Framework must:
- Change the active start level to the intermediate start level value.
- Start bundles at the intermediate start level whose autostart setting
indicate they must be started. They are started as described in the
Bundle.start(int)method using theBundle.START_TRANSIENToption. TheBundle.START_ACTIVATION_POLICYoption must also be used ifisBundleActivationPolicyUsed(Bundle)returnstruefor the bundle.
FrameworkEvent.STARTLEVEL_CHANGEDto announce it has moved to the specified start level.If the specified start level is lower than the active start level, the Framework will continue to decrease the start level until the Framework has reached the specified start level. At each intermediate start level value on the way to and including the specified start level, the framework must:
- Stop bundles at the intermediate start level as described in the
Bundle.stop(int)method using theBundle.STOP_TRANSIENToption. - Change the active start level to the intermediate start level value.
FrameworkEvent.STARTLEVEL_CHANGEDto announce it has moved to the specified start level.If the specified start level is equal to the active start level, then no bundles are started or stopped, however, the Framework must fire a Framework event of type
FrameworkEvent.STARTLEVEL_CHANGEDto announce it has finished moving to the specified start level. This event may arrive before this method return.- 参数:
startlevel- The requested start level for the Framework.- 抛出:
java.lang.IllegalArgumentException- If the specified start level is less than or equal to zero.java.lang.SecurityException- If the caller does not haveAdminPermission[System Bundle,STARTLEVEL]and the Java runtime environment supports permissions.
-
getBundleStartLevel
int getBundleStartLevel(Bundle bundle)
已过时。Return the assigned start level value for the specified Bundle.- 参数:
bundle- The target bundle.- 返回:
- The start level value of the specified Bundle.
- 抛出:
java.lang.IllegalArgumentException- If the specified bundle has been uninstalled or if the specified bundle was not created by the same framework instance that registered thisStartLevelservice.
-
setBundleStartLevel
void setBundleStartLevel(Bundle bundle, int startlevel)
已过时。Assign a start level value to the specified Bundle.The specified bundle will be assigned the specified start level. The start level value assigned to the bundle will be persistently recorded by the Framework.
If the new start level for the bundle is lower than or equal to the active start level of the Framework and the bundle's autostart setting indicates the bundle must be started, the Framework will start the specified bundle as described in the
Bundle.start(int)method using theBundle.START_TRANSIENToption. TheBundle.START_ACTIVATION_POLICYoption must also be used ifisBundleActivationPolicyUsed(Bundle)returnstruefor the bundle. The actual starting of this bundle must occur asynchronously.If the new start level for the bundle is higher than the active start level of the Framework, the Framework will stop the specified bundle as described in the
Bundle.stop(int)method using theBundle.STOP_TRANSIENToption. The actual stopping of this bundle must occur asynchronously.- 参数:
bundle- The target bundle.startlevel- The new start level for the specified Bundle.- 抛出:
java.lang.IllegalArgumentException- If the specified bundle has been uninstalled, or if the specified start level is less than or equal to zero, or if the specified bundle is the system bundle, or if the specified bundle was not created by the same framework instance that registered thisStartLevelservice.java.lang.SecurityException- If the caller does not haveAdminPermission[bundle,EXECUTE]and the Java runtime environment supports permissions.
-
getInitialBundleStartLevel
int getInitialBundleStartLevel()
已过时。Return the initial start level value that is assigned to a Bundle when it is first installed.- 返回:
- The initial start level value for Bundles.
- 另请参阅:
setInitialBundleStartLevel(int)
-
setInitialBundleStartLevel
void setInitialBundleStartLevel(int startlevel)
已过时。Set the initial start level value that is assigned to a Bundle when it is first installed.The initial bundle start level will be set to the specified start level. The initial bundle start level value will be persistently recorded by the Framework.
When a Bundle is installed via
BundleContext.installBundle, it is assigned the initial bundle start level value.The default initial bundle start level value is 1 unless this method has been called to assign a different initial bundle start level value.
This method does not change the start level values of installed bundles.
- 参数:
startlevel- The initial start level for newly installed bundles.- 抛出:
java.lang.IllegalArgumentException- If the specified start level is less than or equal to zero.java.lang.SecurityException- If the caller does not haveAdminPermission[System Bundle,STARTLEVEL]and the Java runtime environment supports permissions.
-
isBundlePersistentlyStarted
boolean isBundlePersistentlyStarted(Bundle bundle)
已过时。Returns whether the specified bundle's autostart setting indicates the bundle must be started.The autostart setting of a bundle indicates whether the bundle is to be started when its start level is reached.
- 参数:
bundle- The bundle whose autostart setting is to be examined.- 返回:
trueif the autostart setting of the bundle indicates the bundle is to be started.falseotherwise.- 抛出:
java.lang.IllegalArgumentException- If the specified bundle has been uninstalled or if the specified bundle was not created by the same framework instance that registered thisStartLevelservice.- 另请参阅:
Bundle.START_TRANSIENT
-
isBundleActivationPolicyUsed
boolean isBundleActivationPolicyUsed(Bundle bundle)
已过时。Returns whether the specified bundle's autostart setting indicates that the activation policy declared in the bundle's manifest must be used.The autostart setting of a bundle indicates whether the bundle's declared activation policy is to be used when the bundle is started.
- 参数:
bundle- The bundle whose autostart setting is to be examined.- 返回:
trueif the bundle's autostart setting indicates the activation policy declared in the manifest must be used.falseif the bundle must be eagerly activated.- 抛出:
java.lang.IllegalArgumentException- If the specified bundle has been uninstalled or if the specified bundle was not created by the same framework instance that registered thisStartLevelservice.- 从以下版本开始:
- 1.1
- 另请参阅:
Bundle.START_ACTIVATION_POLICY
-
-