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 Boris Burtin <bb...@zimbra.com> on 2009/07/02 02:00:20 UTC

How to access CommandStateManager in jSieve 0.3?

I'm upgrading from jSieve 0.2 to 0.3 and hit a compile problem with CommandStateManager. My implementation of MailAdapter needs to know whether the keep is implicit or explicit. I used to do this with 0.2: 

public void executeActions() throws SieveException { 
... 
// Handle explicit and implicit delivery actions 
for (Action action : deliveryActions) { 
if (action instanceof ActionKeep) { 
CommandStateManager state = CommandStateManager.getInstance(); 
if (state.isImplicitKeep()) { 
// implicit keep: this means that none of the user's rules have been matched 
// we need to check system spam filter to see if the mail is spam 
doDefaultFiling(); 
} else { 
explicitKeep(); 
} 

CommandStateManager.getInstance() was removed in 0.3. I can't figure out how to get an instance of CommandStateManager or SieveContext from my MailAdapter code. Can someone point me in the right direction? 


Re: How to access CommandStateManager in jSieve 0.3?

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Thu, Jul 2, 2009 at 1:00 AM, Boris Burtin<bb...@zimbra.com> wrote:
> I'm upgrading from jSieve 0.2 to 0.3 and hit a compile problem with CommandStateManager. My implementation of MailAdapter needs to know whether the keep is implicit or explicit. I used to do this with 0.2:
>
> public void executeActions() throws SieveException {
> ...
> // Handle explicit and implicit delivery actions
> for (Action action : deliveryActions) {
> if (action instanceof ActionKeep) {
> CommandStateManager state = CommandStateManager.getInstance();
> if (state.isImplicitKeep()) {
> // implicit keep: this means that none of the user's rules have been matched
> // we need to check system spam filter to see if the mail is spam
> doDefaultFiling();
> } else {
> explicitKeep();
> }
>
> CommandStateManager.getInstance() was removed in 0.3. I can't figure out how to get an instance of CommandStateManager or SieveContext from my MailAdapter code. Can someone point me in the right direction?

the singletons have been replaced by an IoC structure

i think the right solution would be change
MailAdapter.executeActions() so that it takes a SieveContext

opinions?

i've had a bit of dig around but haven't come up with a good workaround

unless there are any objections, i think it'd be best just to alter
executeActions()

- robert

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