Struts 2
  1. Struts 2
  2. WW-3870

Allow Package Inheritance in Plugins

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.7
    • Component/s: XML Configuration
    • Labels:
      None

      Description

      Allow packages in plugins to have packages defined in a different plugin as a parent. This is currently not supported (http://struts.apache.org/2.3.4.1/docs/plugins.html). My team is creating a plugin with some base features for our organization. It would be nice to be able to use result types and other configuration defined in other plugins.

        Issue Links

          Activity

          Hide
          Hudson added a comment -

          Integrated in Struts2 #522 (See https://builds.apache.org/job/Struts2/522/)
          WW-3870 Adds package inheritance in plugins (Revision 1380129)

          Result = SUCCESS
          lukaszlenart :
          Files :

          • /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/ConfigurationUtil.java
          • /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/CycleDetector.java
          • /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/DirectedGraph.java
          • /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
          • /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderPackagesTest.java
          • /struts/struts2/trunk/xwork-core/src/test/resources/com/opensymphony/xwork2/config/providers/xwork-test-package-inheritance.xml
          Show
          Hudson added a comment - Integrated in Struts2 #522 (See https://builds.apache.org/job/Struts2/522/ ) WW-3870 Adds package inheritance in plugins (Revision 1380129) Result = SUCCESS lukaszlenart : Files : /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/ConfigurationUtil.java /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/CycleDetector.java /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/DirectedGraph.java /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderPackagesTest.java /struts/struts2/trunk/xwork-core/src/test/resources/com/opensymphony/xwork2/config/providers/xwork-test-package-inheritance.xml
          Hide
          Lukasz Lenart added a comment - - edited

          Patch applied, docs updated! Thanks!

          https://cwiki.apache.org/confluence/display/WW/Plugins

          Show
          Lukasz Lenart added a comment - - edited Patch applied, docs updated! Thanks! https://cwiki.apache.org/confluence/display/WW/Plugins
          Hide
          Aaron Johnson added a comment -

          It might be slightly clearer to use the 'parent' name instead of 'depends' since 'parent' is the XML element's attribute.

          Packages defined in a plugin can have parent packages that are defined in another plugin. Plugins may define configuration elements with classes not contained in the plugin. Any classes not included in the plugin's JAR must be on the application's classpath at runtime.

          I'm not sure how you version the wiki, but it should be clear which version of Struts 2 the behavior changes.

          Show
          Aaron Johnson added a comment - It might be slightly clearer to use the 'parent' name instead of 'depends' since 'parent' is the XML element's attribute. Packages defined in a plugin can have parent packages that are defined in another plugin. Plugins may define configuration elements with classes not contained in the plugin. Any classes not included in the plugin's JAR must be on the application's classpath at runtime. I'm not sure how you version the wiki, but it should be clear which version of Struts 2 the behavior changes.
          Hide
          Lukasz Lenart added a comment -

          So after applying the patch, the note should sound like this:

          Packages defined in a plugin can depend on other packages defined in different plugins. There is no issue with depending on different classes provided by different plugins as it isn't Struts 2 responsibility to handle class loading but a class loader.

          Show
          Lukasz Lenart added a comment - So after applying the patch, the note should sound like this: Packages defined in a plugin can depend on other packages defined in different plugins. There is no issue with depending on different classes provided by different plugins as it isn't Struts 2 responsibility to handle class loading but a class loader.
          Hide
          Aaron Johnson added a comment -

          The spirit of the note would no longer be correct. The patch would allow plugins to depend on package configuration defined in other plugins. The wording about classes is a little confusing. Loading of classes isn't the responsibility of struts. You can always define configuration that includes classes that aren't a part of your plugin. As long as the class is in the class loader, the configuration would load.

          Show
          Aaron Johnson added a comment - The spirit of the note would no longer be correct. The patch would allow plugins to depend on package configuration defined in other plugins. The wording about classes is a little confusing. Loading of classes isn't the responsibility of struts. You can always define configuration that includes classes that aren't a part of your plugin. As long as the class is in the class loader, the configuration would load.
          Hide
          Lukasz Lenart added a comment - - edited

          Nice, so as I understand right now the note from [1]

          Plugins are not loaded in any particular order. Plugins should not have dependencies on each other. A plugin may depend on classes provided by Struts Core, but it should not depend on classes loaded by another plugin.

          isn't valid any more and plugins can depend on each other in case of packages ?

          [1] http://struts.apache.org/2.x/docs/plugins.html

          Show
          Lukasz Lenart added a comment - - edited Nice, so as I understand right now the note from [1] Plugins are not loaded in any particular order. Plugins should not have dependencies on each other. A plugin may depend on classes provided by Struts Core, but it should not depend on classes loaded by another plugin. isn't valid any more and plugins can depend on each other in case of packages ? [1] http://struts.apache.org/2.x/docs/plugins.html
          Hide
          Aaron Johnson added a comment -

          Patch

          Show
          Aaron Johnson added a comment - Patch

            People

            • Assignee:
              Lukasz Lenart
              Reporter:
              Aaron Johnson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development