Hi Wie,

Your proposed change would remove the ability to load the config from classpath 
as you can't reference a classpath resource with a File.
However we could get an url from a File ... perhaps that's a way to go. In 
general perhaps using a File object and accessing that objects: "new 
File("").toURI().toURL()" instead would allow both.
I also noticed my PR wasn't merged as I submitted it. By changing:

    // If the url doesn't contain a ":" it's provided as a normal path.
    // So we need to add the prefix "file:" to make it a real URL.
    if(!urlString.contains(":")) {
      urlString = "file:" + urlString;
    }

To:

    // If the url doesn't start with "file:" it's provided as a normal path.
    // So we need to add it to make it a real URL.
    if(!urlString.startsWith("file:")) {
      urlString = "file:" + urlString;
    }

Again the ability to use a classpath resource is eliminated as a classpath 
resource is referenced via:

classpath:/path/to/resource.properties

Instead of:

file:/path/to/resource.properties

But I can imaging that particularly in combination with windows systems it 
might be better to use:

    // If the url doesn't start with "file:" or "classpath:" it's provided as a 
normal path.
    // So we need to add it to make it a real URL.
    if(!urlString.startsWith("file:") && !urlString.startsWith("classpath:")) {
      urlString = "file:" + urlString;
    }

This should avoid the problem.


Chris



Am 09.09.20, 12:41 schrieb "Wei Shao" <kofsh...@163.com>:

    Hi Chris,


    When I was looking into issue [1], I discovered that IoTDB failed to load 
iotdb-engine.properties file on Windows.
    It looks like in IoTDBDescriptor getPropsUrl() line 127, Windows file path 
like "D:\\path" will not be accepted by URL constructor, thus an exception 
thrown.


    I've submitted a PR [2] for this case. Would you please take a look and 
check this PR? I suppose it is the same cause with your Windows VM failure.
    Also, I haven't got a SprintBoot environment to test URLs like 
"classpath:path". It would be great if you could test the "classpath" scenario 
on your machine, in case it made some regression. :D


    [1] https://issues.apache.org/jira/browse/IOTDB-869
    [2] https://github.com/apache/incubator-iotdb/pull/1714




    Thanks,
    ------------------
    Wei





    At 2020-08-31 17:10:11, "Christofer Dutz" <christofer.d...@c-ware.de> wrote:
    >I'm currently working on fine-tuning it ... not sure however why it's 
failing on Windows ...
    >I could reproduce the failure on my Windows 10 VM however. So I'll setup 
an IDE there and investigate.
    >
    >Chris
    >
    >
    >Am 31.08.20, 05:32 schrieb "Xiangdong Huang" <saint...@gmail.com>:
    >
    >    Hi,
    >
    >    It makes sense to support claiming a file path or a classpath.
    >    Thanks for seeing your PR once again @Chris.
    >
    >    And ... just read the readme of Merlot. An interesting project!
    >
    >    Best,
    >    -----------------------------------
    >    Xiangdong Huang
    >    School of Software, Tsinghua University
    >
    >     黄向东
    >    清华大学 软件学院
    >
    >
    >    Cesar Garcia <cesar.gar...@ceos.com.ve> 于2020年8月31日周一 上午6:13写道:
    >
    >    > Interesting proposal,
    >    >
    >    > I did some tests for the one to run in embedded mode, declaring the 
IOTDB
    >    > system variables in a bundle. All directories are within the Karaf
    >    > structure. IoTDB Rock !.
    >    >
    >    > https://github.com/glcj/Merlot/tree/master/com.ceos.merlot.iotdb.svr
    >    >
    >    > If the proposal facilitates integration, I would try to evaluate it 
in
    >    > Karaf.
    >    >
    >    > Best regards,
    >    >
    >    > El dom., 30 ago. 2020 a las 17:31, Christofer Dutz (<
    >    > christofer.d...@c-ware.de>) escribió:
    >    >
    >    > > Yeah ...
    >    > >
    >    > > already committed ... wanted to create the PR but Dinner 
interrupted ...
    >    > > but I think in general a little cleanup of the getPropsUrl() to 
also
    >    > allow
    >    > > explicitly naming the property file differently.
    >    > >
    >    > > With my changes I have to name the config-url "classpath:" which 
sort of
    >    > > feels silly ;-)
    >    > >
    >    > > Chris
    >    > >
    >    > >
    >    > > Am 30.08.20, 17:23 schrieb "Julian Feinauer" <
    >    > > j.feina...@pragmaticminds.de>:
    >    > >
    >    > >     Hey Chris,
    >    > >
    >    > >     Good idea... What about... A PR? :D
    >    > >
    >    > >     Julian
    >    > >
    >    > >     Von meinem Mobiltelefon gesendet
    >    > >
    >    > >
    >    > >     -------- Ursprüngliche Nachricht --------
    >    > >     Von: Christofer Dutz <christofer.d...@c-ware.de>
    >    > >     Datum: So., 30. Aug. 2020, 17:19
    >    > >     An: dev@iotdb.apache.org
    >    > >     Betreff: Configuring IoTDB when run programatically
    >    > >     Hi all,
    >    > >
    >    > >     I’m currently doing my first steps with IoTDB and am currently
    >    > > struggling to get IoTDB to startup in an embedded mode.
    >    > >     I am setting up IoTDB to be setup as a service in my SpringBoot
    >    > > application. For this I have my iotdb-engine.properties in my 
classpath.
    >    > >     However I want IoTDB to have all of its files in my 
applications home
    >    > > directory.
    >    > >
    >    > >     Now it seems as if this szenario isn’t supported nicely as If I
    >    > > specify the IOTDB_HOME, it wants to load the properties from there 
too,
    >    > but
    >    > > I would like to leave the properties in my classpath.
    >    > >     The reason for this is that I don’t need any setup steps to 
prepare
    >    > > the directories.
    >    > >
    >    > >     It would be cool if in IoTDBDescriptor line 128 wouldn’t 
expect the
    >    > > URL to be a File URL. I could also have a classpath URL
    >    > > “classpath:/iotdb-engine.properties” but that causes trouble ;-)
    >    > >
    >    > >     Chris
    >    > >
    >    > >
    >    >
    >    > --
    >    > *CEOS Automatización, C.A.*
    >    > *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
    >    > *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*
    >    >
    >    > *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
    >    > *Ing. César García*
    >    >
    >    > *Cel: +58 414-760.98.95*
    >    >
    >    > *Hotline Técnica SIEMENS: 0800 1005080*
    >    >
    >    > *Email: support.aan.automat...@siemens.com
    >    > <support.aan.automat...@siemens.com>*
    >    >
    >

Reply via email to