-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make LinkParser extensible. #1118
Comments
I created PR #1127 for this issue |
@sbernard31 - what do you think about managing validation errors in #1127 solution? Instead of chain of try/catch I added In my solution I replaced try/catch chain with |
I don't know so much. 🤔 Pros :
Cons :
I guess about a) and c) are hypothetical as long as we don't check if there is a real performance issue. (which is not so easy to check) I'm aware that I don't help you so much 😕 |
I take time this afternoon to think a more about this. There is several kind of validation (like assignation level or applicability) which will be hard to check at Link Parsing time and so we will need a kind of post validation. With this in mind, I currently think that maybe we should we should keep the Link Parser simple. To resolve the question about Link world vs LWM2M attribute world. public class LwM2mLinks {
Map<LwM2mPath, AttributeSet>
} And so maybe something like :
I will try to investigate this more tomorrow. Any opinions about this ? |
According the If we have for example The responsibility for validating link-value is moved from LinkParser to LinkValueParser, so LinkParser doesn't know anything about link-value format. The same thing is for LinkValueparser - it delegates validation of URI-Reference and link-extension to next sub-parsers. According the LwM2mLinkParser and LwM2mLinks classes - the solution sounds good for me in general. But I have only one problem with understanding where it should be used. In bigger picture, where this solution will be used in our applicaiton? I don't see benefits of creating LwM2mLinkParser and LwM2mLinks yet. |
|
This is the right question. I will try to sum up my understanding. CoreLink are used to store some information about object/object instance/resource/ resource instance.
In a pure LWM2M world we handle LWM2M path with some attributes defined in the LWM2M specification. For Bootstrap Discover, Discover and Datatype, I understand that Link used are only pure LWM2M Link. For Registration, I'm not 100% sure but I understand that Links could contains some pure CoAP (not LWM2M) part. So a pure LWM2M API will just need LWM2M path and attributes attached. Currently we just expose "simple Links" which hold all the information.
Some example where we manipulate Links :
So,
|
About LWM2M flavored API for Link, I try some idea :
I create 2 branch with some crappy code about this :
About the second idea :
@Michal-Wadowski you could look at this if you want and If all of those is not too confusing to not hesitate to share your opinion about this. |
@sbernard31 sorry to take it so long, I'll look at your propositions |
Ok, now with your proposition (especially link_idea_2) all is much clearer to me. Previously I was focused on parsing methodology rather than understanding the whole idea. Now I can see what the current topic is about 🙂 I like the second solution. It probably needs separated PR to continue the discussion about it. And we also have to wait with current issue after your proposition is finished. I could help develop it, but I don't want to disturb you 🙂 |
I'm currently working on #1112. Then I will try to go back to that subject.
You're welcome. We both agree that idea 2 seems better, so for now we can drop the first one.
If you have any concern about current idea2 design please do not hesitate to share. |
@Michal-Wadowski any thought/opinion about that ? |
Currently I'm studying oscore branch because this functionality is our priority for now. |
Ok, pushing some efforts on OSCORE sounds a good plan too :) |
I think this is done with #1197. |
Thx a lot @Michal-Wadowski for you help 🙏 |
With #1022 we now have a better default parser and user is able to provide their own parser.
But the LWM2M spec defines some specific grammar for its Attributes. This looks like some kind of
link-extension
.So it seems that
DefaultLinkParser
/LinkParser
should be extensible to allow to parse this kind ofLinkExtention
.Ideally, Link class and Parser should not know about
Attribute
concept which is a pure LWM2M concept but I guess this is OK ifAttributeModel
contains a kind ofLinkExtensionParser
.Implementing this will probably come with solving some raised issues like :
(Bonus question: Not clear to me but Link Parsing is also related to #1042 which I didn't think too much for now)
The text was updated successfully, but these errors were encountered: