Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-32925

Make possible to load a RunnerFeature dynamically

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2025.x
    • Component/s: Tests
    • Release Notes Summary:
      Features can now dynamically loads another features
    • Release Notes Description:
      Hide

      A feature can depend on other features by annotation them with @Features but this mechanism is static, ie: we can not condition a feature dependency for instance.

      We have introduce DynamicFeaturesLoader to be able to depend on a feature with a simple programmatic API, for instance MyFeature can now depends on MyOtherFeature depending on some conditions, this is accomplished by created a constructor with a DynamicFeaturesLoader parameter in your feature, see an example below:

      public class MyFeature implements RunnerFeature {
      
          public MyFeature(DynamicFeaturesLoader loader) {
              if (Boolean.parseBoolean(System.getProperty("nuxeo.test.with.other.feature", "false"))) {
                  loader.loadFeature(MyOtherFeature.class);
              }
          }
      }
      
      Show
      A feature can depend on other features by annotation them with @Features but this mechanism is static, ie: we can not condition a feature dependency for instance. We have introduce DynamicFeaturesLoader to be able to depend on a feature with a simple programmatic API, for instance MyFeature can now depends on MyOtherFeature depending on some conditions, this is accomplished by created a constructor with a DynamicFeaturesLoader parameter in your feature, see an example below: public class MyFeature implements RunnerFeature { public MyFeature(DynamicFeaturesLoader loader) { if ( Boolean .parseBoolean( System .getProperty( "nuxeo.test.with.other.feature" , " false " ))) { loader.loadFeature(MyOtherFeature.class); } } }
    • Tags:
    • Team:
      PLATFORM
    • Sprint:
      nxplatform #123
    • Story Points:
      2

      Description

      It would be interesting to be able to dynamically load a RunnerFeature from another feature.

      For instance this could be used in features that deploys specific contributions in order to target different DBs.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: