Package com.norconex.committer.core.acl
Class AclCodec
java.lang.Object
com.norconex.committer.core.acl.AclCodec
Writes an
Acl as the JSON text documents carry, and reads it back.
The text is canonical: the same permissions always give the same text
(entries sorted, map keys sorted), so a crawler can tell whether a
document's permissions changed by comparing it.-
Method Summary
-
Method Details
-
toJson
- Parameters:
acl- the ACL- Returns:
- its canonical JSON text
-
fromJson
- Parameters:
json- JSON text written bytoJson(Acl)- Returns:
- the ACL
- Throws:
IllegalArgumentException- if the text is not a readable ACL
-
read
Reads a document's ACL.- Parameters:
metadata- the document's metadata- Returns:
- the ACL, or empty if the document has none
- Throws:
IllegalArgumentException- if the document's ACL is not readable, or it has more than one
-
write
Sets a document's ACL, replacing any it had.- Parameters:
metadata- the document's metadataacl- the ACL
-