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 Marco Tedone <mt...@jemos.org> on 2003/05/14 22:30:33 UTC

AbtractQuotaMatcher extending GenericMatcher

Noel, Vincenzo,

attached you will find a version of AbstractQuotaMatcher which extends
GenericMatcher, in which also the postmaster check is performed.

WFYI,

Marco

RE: AbtractQuotaMatcher extending GenericMatcher

Posted by "Noel J. Bergman" <no...@devtech.com>.
> Are you going to submit a patch

Already sent.  :-)  Let me know how it looks.

	--- Noel

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


Re: AbtractQuotaMatcher extending GenericMatcher

Posted by Marco Tedone <mt...@jemos.org>.
Are you going to submit a patch or shall we manually insert:

if (!isSenderChecked(mail.getSender())) {
matching = null;
}

instead of :

if (!isSenderChecked(mail.getSender())) {
matching = mail.getRecipients();
}

?

Marco
----- Original Message ----- 
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Wednesday, May 14, 2003 10:56 PM
Subject: RE: AbtractQuotaMatcher extending GenericMatcher


> > > FYI, something is broken in this code.
> > In which code? The last you sent, or the one I sent?
>
> The one I sent.  I just found it.  About to build and test.  The problem
was
> in handling the isSenderChecked condition.  We want to return null if the
> sender is not checked, not everyone.
>
> --- Noel
>
>  I'm running with the
> one I sent and it everything seems ok. I'm running my own Digester
> implementation, with a XML configuration file.
>
> Marco
> ----- Original Message -----
> From: "Noel J. Bergman" <no...@devtech.com>
> To: "James Developers List" <ja...@jakarta.apache.org>
> Sent: Wednesday, May 14, 2003 10:42 PM
> Subject: RE: AbtractQuotaMatcher extending GenericMatcher
>
>
> > FYI, something is broken in this code.  I don't know what, yet.  Wanted
to
> > give a heads up.
> >
> > --- Noel
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-dev-help@jakarta.apache.org
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>




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


RE: AbtractQuotaMatcher extending GenericMatcher

Posted by "Noel J. Bergman" <no...@devtech.com>.
>> The problem was in handling the isSenderChecked condition.
>> We want to return null if the sender is not checked, not
>> everyone.

> You are correct.

Yes, I know ... I own up to my stupid mistakes.  :-)  [New code attached]

> I like your solution, it's very clean and tidy and the
> AbstractStorageQuota opens possibility to future and more
> complicated checks, if needed.

I would expect, for example, someone to write a matcher that checks a daily
quota for senders to mimimize spamming.  It could even count the number of
recipients, as well as the number of messages.

> What about to move there also isSenderChecked() method?

The isSenderChecked method can be overriden, but I wanted a default
implementation that ensures that mail from the postmaster gets through.
Anyone who overrides it will have to take that into account (something for
the javadocs).

	--- Noel

Re: AbtractQuotaMatcher extending GenericMatcher

Posted by Marco Tedone <mt...@jemos.org>.
You are correct. In any case, I like your solution, it's very clean and tidy
and the AbstractStorageQuota opens possibility to future and more
complicated checks, if needed. What about to move there also
isSenderChecked() method? This way, we would define a sort of *pattern* in
definining checkings.

My 2 cents.

Marco
----- Original Message ----- 
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Wednesday, May 14, 2003 10:56 PM
Subject: RE: AbtractQuotaMatcher extending GenericMatcher


> > > FYI, something is broken in this code.
> > In which code? The last you sent, or the one I sent?
>
> The one I sent.  I just found it.  About to build and test.  The problem
was
> in handling the isSenderChecked condition.  We want to return null if the
> sender is not checked, not everyone.
>
> --- Noel
>
>  I'm running with the
> one I sent and it everything seems ok. I'm running my own Digester
> implementation, with a XML configuration file.
>
> Marco
> ----- Original Message -----
> From: "Noel J. Bergman" <no...@devtech.com>
> To: "James Developers List" <ja...@jakarta.apache.org>
> Sent: Wednesday, May 14, 2003 10:42 PM
> Subject: RE: AbtractQuotaMatcher extending GenericMatcher
>
>
> > FYI, something is broken in this code.  I don't know what, yet.  Wanted
to
> > give a heads up.
> >
> > --- Noel
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-dev-help@jakarta.apache.org
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>




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


RE: AbtractQuotaMatcher extending GenericMatcher

Posted by "Noel J. Bergman" <no...@devtech.com>.
> > FYI, something is broken in this code.
> In which code? The last you sent, or the one I sent?

The one I sent.  I just found it.  About to build and test.  The problem was
in handling the isSenderChecked condition.  We want to return null if the
sender is not checked, not everyone.

	--- Noel

 I'm running with the
one I sent and it everything seems ok. I'm running my own Digester
implementation, with a XML configuration file.

Marco
----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Wednesday, May 14, 2003 10:42 PM
Subject: RE: AbtractQuotaMatcher extending GenericMatcher


> FYI, something is broken in this code.  I don't know what, yet.  Wanted to
> give a heads up.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>




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


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


Re: AbtractQuotaMatcher extending GenericMatcher

Posted by Marco Tedone <mt...@jemos.org>.
In which code? The last you sent, or the one I sent? I'm running with the
one I sent and it everything seems ok. I'm running my own Digester
implementation, with a XML configuration file.

Marco
----- Original Message ----- 
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Wednesday, May 14, 2003 10:42 PM
Subject: RE: AbtractQuotaMatcher extending GenericMatcher


> FYI, something is broken in this code.  I don't know what, yet.  Wanted to
> give a heads up.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>




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


RE: AbtractQuotaMatcher extending GenericMatcher

Posted by "Noel J. Bergman" <no...@devtech.com>.
> > For James v3, I would expect the quota to be an attribute of the user.
> Do you mean in the database?

JNDI, if that's how we standardize it.

	--- Noel

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


Re: AbtractQuotaMatcher extending GenericMatcher

Posted by Marco Tedone <mt...@jemos.org>.
Do you mean in the database?

Marco
----- Original Message ----- 
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Wednesday, May 14, 2003 11:13 PM
Subject: RE: AbtractQuotaMatcher extending GenericMatcher


> > Noel, from what I can see, if you are using RecipientIsOverFixedQuota
> there
> > is no mapping between a mail recipient and the maximum storage allowed
for
> > him.
>
> Correct.  Vincenzo submitted that class for the simple case, which may be
> the common case, where all users have the same quota.
>
> A class like yours would provide per-user quotas, at the expense of
> additional work on the part of the administrator.  For James v3, I would
> expect the quota to be an attribute of the user.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
>




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


RE: AbtractQuotaMatcher extending GenericMatcher

Posted by "Noel J. Bergman" <no...@devtech.com>.
> Noel, from what I can see, if you are using RecipientIsOverFixedQuota
there
> is no mapping between a mail recipient and the maximum storage allowed for
> him.

Correct.  Vincenzo submitted that class for the simple case, which may be
the common case, where all users have the same quota.

A class like yours would provide per-user quotas, at the expense of
additional work on the part of the administrator.  For James v3, I would
expect the quota to be an attribute of the user.

	--- Noel


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


Re: AbtractQuotaMatcher extending GenericMatcher

Posted by Marco Tedone <mt...@jemos.org>.
Noel, from what I can see, if you are using RecipientIsOverFixedQuota there
is no mapping between a mail recipient and the maximum storage allowed for
him. This class supposes to receive only one parameter with the maximum
storage allowed; if you are using it as it is, you've two choices: to define
a matcher for each user (which I would strongly avoid) and to assume for
each user the same storage quota (which wouldn't make sense since we created
a matcher to configure this functionality).

Marco

----- Original Message ----- 
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Wednesday, May 14, 2003 10:42 PM
Subject: RE: AbtractQuotaMatcher extending GenericMatcher


> FYI, something is broken in this code.  I don't know what, yet.  Wanted to
> give a heads up.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>




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


RE: AbtractQuotaMatcher extending GenericMatcher

Posted by "Noel J. Bergman" <no...@devtech.com>.
FYI, something is broken in this code.  I don't know what, yet.  Wanted to
give a heads up.

	--- Noel


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


RE: AbtractQuotaMatcher extending GenericMatcher

Posted by "Noel J. Bergman" <no...@devtech.com>.
Marco,

> attached you will find a version of AbstractQuotaMatcher which extends
> GenericMatcher, in which also the postmaster check is performed.

What do you think of this revision?  Instead of doing the sender check each
time through the loop, we do it once.  That is much faster, since we don't
have to do any checks if the sender is immune to quotas.

I also factored out the storage checks into an intermediate class,
AbstractStorageQuota, so we have
GenericMatcher->AbstractQuotaMatcher->AbstractStorageQuota->RecipientIsOverF
ixedQuota.  I thought that would make it even cleaner for introducing other
types of Quota Matchers that are not storage based.

I still need to test it, but wanted to you take a look at it.

	--- Noel