org.apache.struts2.osgi

## Class BundlePackageLoader

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

- All Implemented Interfaces:
    PackageLoader

      public class BundlePackageLoader
      extends Object
      implements PackageLoader

  Package loader implementation that loads resources from a bundle

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BundlePackageLoader()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Container` | `getContextContainer()` Method to get the ActionContext (or other) Container instance required for the FileManagerFactory to work.
    `List<PackageConfig>` | `loadPackages(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleContext bundleContext, ObjectFactory objectFactory, FileManagerFactory fileManagerFactory, Map<String,PackageConfig> pkgConfigs)` Deprecated.
    `List<PackageConfig>` | `loadPackages(Container container, org.osgi.framework.Bundle bundle, org.osgi.framework.BundleContext bundleContext, ObjectFactory objectFactory, FileManagerFactory fileManagerFactory, Map<String,PackageConfig> pkgConfigs)` This method loads all of the package configurations for the specified Bundle and BundleContext.
    `protected void` | `setContextContainer(Container contextContainer)` Method to set the ActionContext (or other) Container instance required for the FileManagerFactory to work.

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

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

- - ### Constructor Detail

    - #### BundlePackageLoader

          public BundlePackageLoader()

  - ### Method Detail

    - #### loadPackages

          @Deprecated
          public List<PackageConfig> loadPackages(org.osgi.framework.Bundle bundle,
                                                              org.osgi.framework.BundleContext bundleContext,
                                                              ObjectFactory objectFactory,
                                                              FileManagerFactory fileManagerFactory,
                                                              Map<String,PackageConfig> pkgConfigs)
                                                       throws ConfigurationException

      Deprecated.
      Description copied from interface: `PackageLoader`
      This method loads all of the package configurations for the specified Bundle and BundleContext. This method signature is retained for ensuring backwards-compatibility Interface-wise, but is Deprecated as it cannot provide the now-necessary Container reference.
      Specified by:
        `loadPackages` in interface `PackageLoader`
      Parameters:
        `bundle` - The OSGi bundle.
        `bundleContext` - The OSGi bundle BundleContext.
        `objectFactory` - The ObjectFactory to create object instances.
        `fileManagerFactory` - The FileManagerFactory to access files.
        `pkgConfigs` - The Map of PackageConfigs (by String name).
      Returns:
        A List of PackageConfigs that contains the packages loaded for the bundle.
      Throws:
        `ConfigurationException` - When the package load operation fails due to configuration errors.

    - #### loadPackages

          public List<PackageConfig> loadPackages(Container container,
                                                  org.osgi.framework.Bundle bundle,
                                                  org.osgi.framework.BundleContext bundleContext,
                                                  ObjectFactory objectFactory,
                                                  FileManagerFactory fileManagerFactory,
                                                  Map<String,PackageConfig> pkgConfigs)
                                           throws ConfigurationException

      Description copied from interface: `PackageLoader`
      This method loads all of the package configurations for the specified Bundle and BundleContext. Introduces a new loadPackages method signature including a Container reference. This is necessary as the FileManagerFactory depends on access to an initialized Container reference to function properly.
      Specified by:
        `loadPackages` in interface `PackageLoader`
      Parameters:
        `container` - The Container from the ActionContext (or another context).
        `bundle` - The OSGi bundle.
        `bundleContext` - The OSGi bundle BundleContext.
        `objectFactory` - The ObjectFactory to create object instances.
        `fileManagerFactory` - The FileManagerFactory to access files.
        `pkgConfigs` - The Map of PackageConfigs (by String name).
      Returns:
        A List of PackageConfigs that contains the packages loaded for the bundle.
      Throws:
        `ConfigurationException` - When the package load operation fails due to configuration errors.

    - #### getContextContainer

          protected Container getContextContainer()

      Method to get the ActionContext (or other) Container instance required for the FileManagerFactory to work. Cheap workaround for keeping the deprecated signature version of loadPackages() around. Used by the new signature and can be used standalone with the old signature (developer's choice).
      Returns:
        The Container associated with this PackageLoader.

    - #### setContextContainer

          protected void setContextContainer(Container contextContainer)

      Method to set the ActionContext (or other) Container instance required for the FileManagerFactory to work. Cheap workaround for keeping the deprecated signature version of loadPackages() around. Used by the new signature and can be used standalone with the old signature (developer's choice).
      Parameters:
        `contextContainer` - The Container associated with this PackageLoader.

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