You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Tim Mitsch <t....@pragmaticindustries.de> on 2019/08/11 11:31:01 UTC

[Driver/Connection] Connection String Validation possibility, implicit connect

Hey everybody

First topic:
I just faced the problem of validating a given connection string to a PlcField (in general) for syntactical correctness.
For S7Field we implemented some static functionality (“matches(String)”) to check if the given string matches the PATTERNs , but i think we should implement something similar for all other implemented Devices/FieldTypes; as Java does not offer to override a static method defined in interface in an implemented class we should think about another solution.
I had a chat with Julian on slack and he suggested to acquire at first a Driver from DriverManager whereas the given driver (or connection) offers a method where the validation of a connection string to a field (“validateQuery(String)“) could be performed. Furthermore also DriverManager could offer a method to validate a field-connection-string and returning for what kind of Driver that string could be used.
I would highly appreciate to have a connection-string-validation as soon as possible; I also can start implementing that (@Chris,@Julian I promise to finish that in an appropriate amount of time, not like with my scraper-branch --> Sorry for that).

Second topic:
Close related is another topic I had some issues with: when fetching a Connection via getConnection() from a DriverManager we currently perform an implicit connect() to that connection. I think we should offer the user the possibility to connect to the connection on his request.

What do u think about these two topics?

Best
Tim

Re: [Driver/Connection] Connection String Validation possibility, implicit connect

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Full ack!

I suggest to play around a bit here: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=122917423

Over time I created several Issues (listed there) and I think it would be good to check them and discuss them.

Julian

Am 11.08.19, 13:31 schrieb "Tim Mitsch" <t....@pragmaticindustries.de>:

    Hey everybody
    
    First topic:
    I just faced the problem of validating a given connection string to a PlcField (in general) for syntactical correctness.
    For S7Field we implemented some static functionality (“matches(String)”) to check if the given string matches the PATTERNs , but i think we should implement something similar for all other implemented Devices/FieldTypes; as Java does not offer to override a static method defined in interface in an implemented class we should think about another solution.
    I had a chat with Julian on slack and he suggested to acquire at first a Driver from DriverManager whereas the given driver (or connection) offers a method where the validation of a connection string to a field (“validateQuery(String)“) could be performed. Furthermore also DriverManager could offer a method to validate a field-connection-string and returning for what kind of Driver that string could be used.
    I would highly appreciate to have a connection-string-validation as soon as possible; I also can start implementing that (@Chris,@Julian I promise to finish that in an appropriate amount of time, not like with my scraper-branch --> Sorry for that).
    
    Second topic:
    Close related is another topic I had some issues with: when fetching a Connection via getConnection() from a DriverManager we currently perform an implicit connect() to that connection. I think we should offer the user the possibility to connect to the connection on his request.
    
    What do u think about these two topics?
    
    Best
    Tim