Benoit Tellier created JSIEVE-116: ------------------------------------- Summary: Simplify JSieve API Key: JSIEVE-116 URL: https://issues.apache.org/jira/browse/JSIEVE-116 Project: James jSieve Issue Type: Improvement Components: JSieve (Main) Affects Versions: 0.7 Reporter: Benoit Tellier Fix For: 1.0.0
Currently, JSieve requires a library user to implement a *MailAdapter* in order to interact with the *SieveFactory*. The MailAdapter mixes concerns: - It allows access to a mail properties as per RFC-822 - It allows running actions defined by Sieve RFC-5228, namely fileinto, keep, reject and the like This makes the API hard to discover and play with, as this mailing list thread proved it: https://www.mail-archive.com/server-dev@james.apache.org/msg65858.html During this thread, an enhencement proposal emerged: - As part of JSieve provide a `MailAdapter` class, that "just represent" a mail. It would be a Plain Old Java Object (POJO) along with it's builder. (it adapts a mail within JSieve context) - The SieveFactory takes a SieveScript inputstream, and a Mail adapter, and returns a list of Action that results from the sieve script execution against the supplied email. Here is an usage examples: {code:java} void runSieveScript(JamesMail jamesMail, InputStream sieveScript) { MailAdapter mailAdapter = MailAdapter.builder() .subject(jamesMail.getSubject) .to(jamesMail.headers().to()) ... .build(); List<Action> actions = sieveFactory.evaluate(sieveScript, mailAdapter); // Do stuff with the actions } {code} That way library users don't need to extend anything, interacts with a simple POJO they need to populate, and can implement the actions they want to support. This makes the entire API easier to discover. And it looks achievable with limited investment. This would further more ease JSieve documentation effort. Also, an API improvment is a blocker toward a potential *1.0.0* release. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org