1 /****************************************************************
2 * Licensed to the Apache Software Foundation (ASF) under one *
3 * or more contributor license agreements. See the NOTICE file *
4 * distributed with this work for additional information *
5 * regarding copyright ownership. The ASF licenses this file *
6 * to you under the Apache License, Version 2.0 (the *
7 * "License"); you may not use this file except in compliance *
8 * with the License. You may obtain a copy of the License at *
9 * *
10 * http://www.apache.org/licenses/LICENSE-2.0 *
11 * *
12 * Unless required by applicable law or agreed to in writing, *
13 * software distributed under the License is distributed on an *
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15 * KIND, either express or implied. See the License for the *
16 * specific language governing permissions and limitations *
17 * under the License. *
18 ****************************************************************/
19
20
21
22
23 package org.apache.james.smtpserver.junkscore;
24
25 import java.util.Map;
26
27 public interface JunkScore {
28
29 /**
30 * The key for the JunkScore Object which holds scores per SMTPSession
31 */
32 public final String JUNK_SCORE_SESSION = "JUNK_SCORE_SESSION";
33
34 /**
35 * The key for the JunkScore Object which holds scores per mail
36 */
37 public final String JUNK_SCORE = "JUNK_SCORE";
38
39 public final String JUNK_SCORE_SESSION_ATTR = "org.apache.james.junkscore.session";
40
41 public final String JUNK_SCORE_ATTR = "org.apache.james.junkscore";
42
43 public final String JUNK_SCORE_COMPOSED_ATTR = "org.apache.james.junkscore.composed";
44
45 /**
46 * Return the summary of stored scores
47 *
48 * @return score the summary of all stored scores
49 */
50 public double getCompleteStoredScores();
51
52
53 /**
54 * Return a copy of the Map which contains the keys with the correspending scores
55 *
56 * @return scoreMape the map which holds all keys and scores
57 */
58 public Map getStoredScores();
59
60 /**
61 * Return the score for the given key. Returns 0 if no score with the given key exist
62 *
63 * @param key the key to get the score for
64 * @return score the score
65 */
66 public double getStoredScore(String key);
67
68 /**
69 * Set the score for the given key. Return the previous stored score for the key.
70 *
71 * @param key the key under which the score should be stored
72 * @param score the store to score
73 * @return oldScore the previous scored stored under the given key
74 */
75 public double setStoredScore(String key, double score);
76
77 /**
78 * Reset the all stored scores in the map. Return the summary of the previous stored scores.
79 *
80 * @return oldScore the summary of the old score;
81 */
82 public double resetStoredScores();
83 }