org.apache.struts2.osgi

## Class OsgiConfigurationProvider

- java.lang.Object
- - org.apache.struts2.osgi.OsgiConfigurationProvider

- All Implemented Interfaces:
    PackageProvider, EventListener, org.osgi.framework.BundleListener

      public class OsgiConfigurationProvider
      extends Object
      implements PackageProvider, org.osgi.framework.BundleListener

  Struts package provider that starts the OSGi container and delegates package loading

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OsgiConfigurationProvider()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bundleChanged(org.osgi.framework.BundleEvent bundleEvent)` Listens to bundle event to load/unload config
    `protected ActionContext` | `createActionContext()` Creates a new empty ActionContext instance and binds it to the current thread.
    `void` | `destroy()`
    `void` | `init(Configuration configuration)`
    `protected void` | `loadConfigFromBundle(org.osgi.framework.Bundle bundle)` Loads XML config as well as Convention config from a bundle Limitation: Constants and Beans are ignored on XML config
    `void` | `loadPackages()`
    `boolean` | `needsReload()`
    `protected void` | `onBundleStopped(org.osgi.framework.Bundle bundle)` This method is called when a bundle is stopped, so the config that is related to it is removed
    `void` | `setBundleAccessor(BundleAccessor acc)`
    `void` | `setFileManagerFactory(FileManagerFactory fmFactory)`
    `void` | `setObjectFactory(ObjectFactory factory)`
    `void` | `setServletContext(javax.servlet.ServletContext servletContext)`
    `void` | `setVelocityManager(VelocityManager mgr)` Deprecated. since 6.4.0
    `void` | `setVelocityManager(VelocityManagerInterface vmi)`
    `protected boolean` | `shouldProcessBundle(org.osgi.framework.Bundle bundle)` Checks for "Struts2-Enabled" header in the bundle

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OsgiConfigurationProvider

          public OsgiConfigurationProvider()

  - ### Method Detail

    - #### init

          public void init(Configuration configuration)
                    throws ConfigurationException

      Specified by:
        `init` in interface `PackageProvider`
      Throws:
        `ConfigurationException`

    - #### loadPackages

          public void loadPackages()
                            throws ConfigurationException

      Specified by:
        `loadPackages` in interface `PackageProvider`
      Throws:
        `ConfigurationException`

    - #### createActionContext

          protected ActionContext createActionContext()

      Creates a new empty ActionContext instance and binds it to the current thread.

    - #### loadConfigFromBundle

          protected void loadConfigFromBundle(org.osgi.framework.Bundle bundle)

      Loads XML config as well as Convention config from a bundle Limitation: Constants and Beans are ignored on XML config
      Parameters:
        `bundle` - the bundle

    - #### shouldProcessBundle

          protected boolean shouldProcessBundle(org.osgi.framework.Bundle bundle)

      Checks for "Struts2-Enabled" header in the bundle
      Parameters:
        `bundle` - the bundle
      Returns:
        true is struts2 enabled

    - #### needsReload

          public boolean needsReload()

      Specified by:
        `needsReload` in interface `PackageProvider`

    - #### setObjectFactory

          public void setObjectFactory(ObjectFactory factory)

    - #### setBundleAccessor

          public void setBundleAccessor(BundleAccessor acc)

    - #### setVelocityManager

          public void setVelocityManager(VelocityManagerInterface vmi)

    - #### setVelocityManager

          @Deprecated
          public void setVelocityManager(VelocityManager mgr)

      Deprecated. since 6.4.0

    - #### setServletContext

          public void setServletContext(javax.servlet.ServletContext servletContext)

    - #### setFileManagerFactory

          public void setFileManagerFactory(FileManagerFactory fmFactory)

    - #### destroy

          public void destroy()

    - #### bundleChanged

          public void bundleChanged(org.osgi.framework.BundleEvent bundleEvent)

      Listens to bundle event to load/unload config
      Specified by:
        `bundleChanged` in interface `org.osgi.framework.BundleListener`
      Parameters:
        `bundleEvent` - the bundle event

    - #### onBundleStopped

          protected void onBundleStopped(org.osgi.framework.Bundle bundle)

      This method is called when a bundle is stopped, so the config that is related to it is removed
      Parameters:
        `bundle` - the bundle that stopped

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.