Hi All,

According to the SCIM specification for Patch Operations [1] (such as
"add", "replace" & "remove"), "path" attribute is MANDATORY for "remove"
and OPTIONAL for "add" and "replace". The "path" attribute value is a
string which contains an attribute path describing the target of the
operation. As example:

       "path":"name.familyName"
       "path":"addresses[type eq \"work\"]"


This "path" attribute is described using the ABNF syntax rule as follows,


 PATH = attrPath / valuePath [subAttr]


attrPath, valuePath and subAttr are defined under filtering Section
3.4.2.2 <https://tools.ietf.org/html/rfc7644#section-3.4.2.2>.


In order to validate the path syntax and use it, we decided to use ABNF
parser. So that we can easily validate the syntax without performing
complex operations.
I have done research on supported java ABNF parsers and found two parsers,
Please find my findings below.

1. parse2 [2]
This parse2 will produce the "aParse" parser generator that reads Augmented
BNF grammars and produces Java, C++ or C# classes that can build parse
trees for valid instances of those grammars. This is free to download and
use without any obligations or limitations.
I downloaded <http://www.parse2.com/download.shtml> the latest
 aparse-2.5.jar and generated the Java Classes using the specified ABNF
rules. Please find the generated classes in [4] and find the created set of
ABNF rules which use to build the parser in [5].

2. *APG* - ABNF Parser Generator [3]
This *APG* Parser is originally designed to generate recursive-descent
parsers directly from the ABNF grammar. This ABNF Parser Generator is
written completely in the Java language. It is released under the GNU
General Public License v2.0.
By using the same ABNF rules set [5] I have generated parsers in Java.
Please find the parsers in [6].

By comparing both, *we decided to go with parse2 *generated parsers due to
the following concerns,
1. parse2 generated java class doesn't contain any embedded parse2 class,
just depends on pure java, where apg-java generated parsers need to
embedded with apg-java grammar package.
2. *APG *java license (GNU General Public License v2.0.) is not compatible
with our Apache License Version 2.0 license according to [7].

Due to these limitations, we selected parse2 to integrate with our
implementation.
Highly appreciate your feedback and input around this.


[1] https://tools.ietf.org/html/rfc7644#section-3.5.2
[2] http://www.parse2.com/index.shtml
[3] http://www.coasttocoastresearch.com/
[4] https://github.com/sarubi/scim-filter-parse2-parser/tree/master/src
[5]
https://github.com/sarubi/scim-filter-parse2-parser/blob/master/src/scim-filter-rules.abnf
[6] https://github.com/sarubi/scim-filter-apg-parser/tree/master/src/scim
[7] https://www.apache.org/licenses/GPL-compatibility.html

Thanks,
Sarubi.
-- 
*Sarubi Thillainathan* | Software Engineer | WSO2 Inc.
(m) +94 (0) 76 684 9101 | (e) sar...@wso2.com,stsa...@gmail.com

*[image: https://wso2.com/signature] <https://wso2.com/signature>*
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to