[jira] [Resolved] (JAMES-4128) Improve mailet encapsulation by removing getMailetConfig
"Jean Helou (Jira)" <[email protected]>
| Newsgroups | gmane.comp.jakarta.james.devel |
|---|---|
| Message-ID | <[email protected]> |
[ https://issues.apache.org/jira/browse/JAMES-4128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jean Helou resolved JAMES-4128.
-------------------------------
Resolution: Fixed
> Improve mailet encapsulation by removing getMailetConfig
> --------------------------------------------------------
>
> Key: JAMES-4128
> URL: https://issues.apache.org/jira/browse/JAMES-4128
> Project: James Server
> Issue Type: Sub-task
> Reporter: Jean Helou
> Assignee: Jean Helou
> Priority: Major
> Fix For: 3.9.0
>
> Time Spent: 2h
> Remaining Estimate: 0h
>
> The mailet configuration is injected from the mailet container, exposing it back publicly breaks encapsulation.
>
> We propose to remove the `getMailetConfig` method ( yes this is a breaking api change ) and add 3 methods to the interface to clarify the contract:
> * `String getName()` returns the name of the mailet. a default implementation is `GenericMailet#getMailetName()` though we want to avoid repeating `Mailet` in the interface.
> * `Option<String> onMailetException()` should the mailet want to expose a processor to be used in case of errors ( currently this used through a convention in [AbstractStateCompositeProcessor|https://github.com/apache/james-project/blob/master/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java#L154] )
> * `Option<String> onMatchException()` should the mailet want to expose a processor to be used in case of errors ( currently this is used through a convention in [AbstractStateCompositeProcessor|https://github.com/apache/james-project/blob/master/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java#L154] and in [MatcherMailetPair|https://github.com/apache/james-project/blob/master/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/MatcherMailetPair.java#L54] in both case the parameter can have a null value)
> The last 2 methods have an obvious implementation of using Option.empty but we would not use a default implementation on the interface. The GenericMailet would provide an implementation matching the current behaviour that extracts the value from the config.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)