Uploaded image for project: 'ShrinkWrap Descriptors'
  1. ShrinkWrap Descriptors
  2. SHRINKDESC-37

Should set schemaLocation for WebAppDescriptor

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 0.1.4
    • Component/s: None
    • Labels:
      None

      Description

      Must be fixed for all, but in the meantime just fix for WebAppDescriptors

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            aslak Aslak Knutsen added a comment -

            since a descriptor needs a version and schemaLocation is effected by the version. version() could handle the setting of schemaLocation. This will prevent schemaLocation being out of sync with the set version.

               public WebAppDescriptorImpl()
               {
                  this(new Node("web-app")
                        .attribute("xmlns", "http://java.sun.com/xml/ns/javaee")
                        .attribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"));
                  
                  version("3.0");
               }
             
               @Override
               public WebAppDescriptor version(String version)
               {
                  model.attribute(
                        "xsi:schemaLocation", 
                        "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_" + version.replace(".", "_") + ".xsd");
                  model.attribute("version", version);
                  return this;
               }
            
            

            Show
            aslak Aslak Knutsen added a comment - since a descriptor needs a version and schemaLocation is effected by the version. version() could handle the setting of schemaLocation. This will prevent schemaLocation being out of sync with the set version. public WebAppDescriptorImpl() { this(new Node("web-app") .attribute("xmlns", "http://java.sun.com/xml/ns/javaee") .attribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")); version("3.0"); }   @Override public WebAppDescriptor version(String version) { model.attribute( "xsi:schemaLocation", "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_" + version.replace(".", "_") + ".xsd"); model.attribute("version", version); return this; }
            Show
            alrubinger Andrew Rubinger added a comment - Upstream: https://github.com/shrinkwrap/descriptors/commit/d5fc77ad73dec2e287b92747f931151e0504029e
            Hide
            alrubinger Andrew Rubinger added a comment -

            Note that in the new impl, different versions of the schema should use different interfaces (as this is really different metadata).

            Show
            alrubinger Andrew Rubinger added a comment - Note that in the new impl, different versions of the schema should use different interfaces (as this is really different metadata).

              People

              • Assignee:
                alrubinger Andrew Rubinger
                Reporter:
                aslak Aslak Knutsen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development