You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Jean Helou (Jira)" <se...@james.apache.org> on 2025/04/02 13:26:00 UTC

[jira] [Updated] (JAMES-4128) Improve mailet encapsulation by removing getMailetConfig

     [ https://issues.apache.org/jira/browse/JAMES-4128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean Helou updated JAMES-4128:
------------------------------
    Fix Version/s: 3.9.0

> 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
>            Priority: Major
>             Fix For: 3.9.0
>
>          Time Spent: 1h 50m
>  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)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org