📄 recipientisoverfixedquota.java
字号:
/*********************************************************************** * Copyright (c) 2000-2004 The Apache Software Foundation. * * All rights reserved. * * ------------------------------------------------------------------- * * Licensed under the Apache License, Version 2.0 (the "License"); you * * may not use this file except in compliance with the License. You * * may obtain a copy of the License at: * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * * implied. See the License for the specific language governing * * permissions and limitations under the License. * ***********************************************************************/package org.apache.james.transport.matchers;import org.apache.mailet.Mail;import org.apache.mailet.MailetContext;import org.apache.mailet.MailAddress;import javax.mail.MessagingException;import java.util.Locale;/** * <P>Checks whether a recipient has exceeded a maximum allowed quota for messages * standing in his inbox. Such quota is <I>the same</I> for all users.</P> * <P>Will check if the total size of all his messages in the inbox are greater * than a certain number of bytes. You can use 'k' and 'm' as optional postfixes. * In other words, "1m" is the same as writing "1024k", which is the same as * "1048576".</P> * <P>Here follows an example of a config.xml definition:</P> * <PRE><CODE> * <processor name="transport"> * . * . * . * <mailet match=match="RecipientIsOverFixedQuota=40M" class="ToProcessor"> * <processor> error </processor> * <notice>The recipient has exceeded maximum allowed size quota</notice> * </mailet> * . * . * . * </processor> * </CODE></PRE> * * @version 1.0.0, 2003-05-11 */public class RecipientIsOverFixedQuota extends AbstractStorageQuota { private long quota = 0; /** * Standard matcher initialization. * Does a <CODE>super.init()</CODE> and parses the common storage quota amount from * <I>config.xml</I> for later use. */ public void init() throws MessagingException { super.init(); quota = parseQuota(getCondition().trim().toLowerCase(Locale.US)); } protected long getQuota(MailAddress recipient, Mail _) throws MessagingException { return quota; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -