Uploaded image for project: 'Magnolia Resources Module'
  1. Magnolia Resources Module
  2. MGNLRES-42

Issues with InstallResourcesTask and InstallResourceTask

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 2.2.1
    • 1.5, 2.0.1
    • management

    Description

      The 1.5 release of the resources module introduced two things

      • support for binaries
      • new templates (i.e same changes as for M4.5, STK2.0 etc)

      Following those changes, I have a couple of issues with InstallResourcesTask and InstallResourceTask

      1. Why do I need to know the "template" used for binaries ?
      2. There is a whole bunch of code branching off in InstallResourceTask if binary is true
        It seems to me that the template parameter is meaningless when binary is true. At the very least, the defaults should be known by the Task, and the user should not have to know about it. Instead of adding a boolean flag to every variation of InstallResourceTask constructors:
        • Just have a different Task class altogether for binary resource, OR
        • Have static factory methods, with meaningful names and meaningful parameters.
      3. InstallResourcesTask.determineTemplate is wrong. Has per it's javadoc: "If no template has been defined the file extension is used.". That was valid up until 1.4, since the templates were called js and css respectively.
        • The method needs to be updated to reflect new template IDs
        • The method might be just as relevant in InstallResourceTask instead (i.e no need to know the template name when installing a single resource either) - move it ! (moved to ResourceTypes - MGNLRES-89)
        • The method is irrelevant for binaries (same template name for all kinds of binaries)

      In fact, if the module comes with predefined templates for css, js, binaries, and nothing else, it might even be a good idea to use static factory methods as suggested above, with explicit method names for each kind of resource we want to support, instead of relying on a file's extension ?

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                rkovarik Roman Kovařík
                gjoseph Magnolia International
                Nucleus
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD