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

    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()`
    `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 vm)`
    `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()

    - #### 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(VelocityManager vm)

    - #### 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–2021 Apache Software Foundation. All rights reserved.