BundleStartLevel
Date: 2016-06-24

org.osgi.framework.startlevel

## Interface BundleStartLevel

- All Superinterfaces:
    BundleReference

      @ProviderType
      public interface BundleStartLevel
      extends BundleReference

  Query and modify the start level information for a bundle. The start level object for a bundle can be obtained by calling `bundle.adapt(BundleStartLevel.class)` on the bundle.

  The bundle associated with this BundleStartLevel object can be obtained by calling `BundleReference.getBundle()`.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getStartLevel()` Return the assigned start level value for the bundle.
    `boolean` | `isActivationPolicyUsed()` Returns whether the bundle's autostart setting indicates that the activation policy declared in the bundle manifest must be used.
    `boolean` | `isPersistentlyStarted()` Returns whether the bundle's autostart setting indicates it must be started.
    `void` | `setStartLevel(int startlevel)` Assign a start level value to the bundle.

    - ### Methods inherited from interface org.osgi.framework.BundleReference

      `getBundle`

- - ### Method Detail

    - #### getStartLevel

          int getStartLevel()

      Return the assigned start level value for the bundle.
      Returns:
        The start level value of the bundle.
      Throws:
        `java.lang.IllegalStateException` - If the bundle has been uninstalled.
      See Also:
        `setStartLevel(int)`

    - #### setStartLevel

          void setStartLevel(int startlevel)

      Assign a start level value to the bundle.

      The 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 this bundle must be started, the Framework will start the bundle as described in the `Bundle.start(int)` method using the `Bundle.START_TRANSIENT` option. The `Bundle.START_ACTIVATION_POLICY` option must also be used if `isActivationPolicyUsed()` returns `true`. The actual starting of the 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 bundle as described in the `Bundle.stop(int)` method using the `Bundle.STOP_TRANSIENT` option. The actual stopping of the bundle must occur asynchronously.

      Parameters:
        `startlevel` - The new start level for the bundle.
      Throws:
        `java.lang.IllegalArgumentException` - If the specified start level is less than or equal to zero, or if the bundle is the system bundle.
        `java.lang.IllegalStateException` - If the bundle has been uninstalled.
        `java.lang.SecurityException` - If the caller does not have `AdminPermission[bundle,EXECUTE]` and the Java runtime environment supports permissions.

    - #### isPersistentlyStarted

          boolean isPersistentlyStarted()

      Returns whether the bundle's autostart setting indicates it must be started.

      The autostart setting of a bundle indicates whether the bundle is to be started when its start level is reached.

      Returns:
        `true` if the autostart setting of the bundle indicates it is to be started. `false` otherwise.
      Throws:
        `java.lang.IllegalStateException` - If this bundle has been uninstalled.
      See Also:
        `Bundle.START_TRANSIENT`

    - #### isActivationPolicyUsed

          boolean isActivationPolicyUsed()

      Returns whether the bundle's autostart setting indicates that the activation policy declared in the bundle 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.

      Returns:
        `true` if the bundle's autostart setting indicates the activation policy declared in the manifest must be used. `false` if the bundle must be eagerly activated.
      Throws:
        `java.lang.IllegalStateException` - If the bundle has been uninstalled.
      See Also:
        `Bundle.START_ACTIVATION_POLICY`