Details

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

      Description

      Importer
      from(String)
      from(new File(String))

      from(File)
      File.isFile -> LookupImporterType -> ZipImporter
      File.isDirectory -> ExplodedImporter
      from(URL)
      URL.getFile.isDirectory -> ExplodedImporter
      URL.getExtension -> LookupImporterType -> ZipImporter

        Gliffy Diagrams

          Activity

          Hide
          alrubinger Andrew Rubinger added a comment -

          Let's discuss on forum:

          Why interpret String as new File() ?
          Why assume a URL is local and can be represented as a File?

          In an attempt to add user-friendly hooks I fear we become too opinionated at best and unpredictable at worst.

          Show
          alrubinger Andrew Rubinger added a comment - Let's discuss on forum: Why interpret String as new File() ? Why assume a URL is local and can be represented as a File? In an attempt to add user-friendly hooks I fear we become too opinionated at best and unpredictable at worst.
          Hide
          aslak Aslak Knutsen added a comment -

          Easier said then done atm since the forums seems to be down..

          This is the current impl:
          http://shrinkwrap.pastebin.com/m58f16a3a

          from(String)

          • from(new File(String))
            from(File)
          • File.isFile -> (should delegate to a lookup of a supported importer( based on extension?)) -> ZipImporter
          • File.isDirectory -> ExplodedImporter
            from(URL)
          • URL.getProtocol == file:// -> from(new File(url))
          • URL.getName -> (should delegate to a lookup of a supported importer( based on extension?)) -> ZipImporter

          Looking at the current usage (http://pastie.org/763558); not supporting this creates a lot of useless/boilerplate code.

          It would be more consistent with the rest of the apis use of String if it is a lookup in the ClassLoader instead..

          Show
          aslak Aslak Knutsen added a comment - Easier said then done atm since the forums seems to be down.. This is the current impl: http://shrinkwrap.pastebin.com/m58f16a3a from(String) from(new File(String)) from(File) File.isFile -> (should delegate to a lookup of a supported importer( based on extension?)) -> ZipImporter File.isDirectory -> ExplodedImporter from(URL) URL.getProtocol == file:// -> from(new File(url)) URL.getName -> (should delegate to a lookup of a supported importer( based on extension?)) -> ZipImporter Looking at the current usage ( http://pastie.org/763558 ); not supporting this creates a lot of useless/boilerplate code. It would be more consistent with the rest of the apis use of String if it is a lookup in the ClassLoader instead..
          Hide
          adriancole Adrian Cole added a comment -

          I think that from(String) should be reasonably capable of determining if it is a url or not.

          Having this in shrinkwrap would really help reduce the effort needed, and libraries needed, for things like ant task writing dramatically

          Show
          adriancole Adrian Cole added a comment - I think that from(String) should be reasonably capable of determining if it is a url or not. Having this in shrinkwrap would really help reduce the effort needed, and libraries needed, for things like ant task writing dramatically
          Hide
          alrubinger Andrew Rubinger added a comment -

          Given:

          from(String) > from(new File(String))

          ...what would you expect of:

          from("http://mydomain.com/resource.xml")

          ...? We need to support both URL and File representations of the accepted String, and do it correctly.

          ------
          Given:

          from(URL) > from(new File(URL))

          ...what would you expect of:

          from(new URL("http://mydomain.com/resource.xml"))

          ...?

          In short, I like this feature. Let's iron out a way to make it work consistently for all cases when the forums become available again.

          Show
          alrubinger Andrew Rubinger added a comment - Given: from(String) > from(new File(String)) ...what would you expect of: from("http://mydomain.com/resource.xml") ...? We need to support both URL and File representations of the accepted String, and do it correctly. ------ Given: from(URL) > from(new File(URL)) ...what would you expect of: from(new URL("http://mydomain.com/resource.xml")) ...? In short, I like this feature. Let's iron out a way to make it work consistently for all cases when the forums become available again.
          Hide
          aslak Aslak Knutsen added a comment -

          quote:
          Given:

          from(URL) > from(new File(URL))

          ...what would you expect of:

          from(new URL("http://mydomain.com/resource.xml"))

          ...?

          'http://mydomain.com/resource.xml' is not a file:// protocol, so it won't be delegated to from(new File(url)).
          It should try to get the file name 'resource.xml' and lookup the extension 'xml' for a known Import handler. and use url.openStream to fetch the content. This will open up support for any URLStreamHandler(webdav, ssh, ftp) defined for the JVM.
          If no one found, we could hope for Zip or fail..

          Show
          aslak Aslak Knutsen added a comment - quote: Given: from(URL) > from(new File(URL)) ...what would you expect of: from(new URL("http://mydomain.com/resource.xml")) ...? 'http://mydomain.com/resource.xml' is not a file:// protocol, so it won't be delegated to from(new File(url)). It should try to get the file name 'resource.xml' and lookup the extension 'xml' for a known Import handler. and use url.openStream to fetch the content. This will open up support for any URLStreamHandler(webdav, ssh, ftp) defined for the JVM. If no one found, we could hope for Zip or fail..

            People

            • Assignee:
              aslak Aslak Knutsen
              Reporter:
              aslak Aslak Knutsen
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Development