View Javadoc

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  package org.apache.james.management;
23  
24  
25  public interface BayesianAnalyzerManagementService {
26  
27      public static final String ROLE = "org.apache.james.management.BayesianAnalyzerManagementService";
28      
29      /**
30       * Feed the BayesianAnalyter with spam. The given directory  contain the mail files
31       * 
32       * @param dir The directory in which the spam is located
33       * @return count The count of added spam
34       * @throws IllegalArgumentException If the provided directory is not valid
35       * @throws BayesianAnalyzerManagementException If the service is not configured
36       */
37      public int addSpamFromDir(String dir) throws BayesianAnalyzerManagementException;
38      
39      /**
40       * Feed the BayesianAnalyzer with ham. The given directory  contain the mail files
41       * 
42       * @param dir The directory in which the ham is located
43       * @return count The count of added ham
44       * @throws IllegalArgumentException If the provided directory is not valid
45       * @throws BayesianAnalyzerManagementException If the service is not configured
46       */
47      public int addHamFromDir(String dir) throws  BayesianAnalyzerManagementException;
48      
49      /**
50       * Feed the BayesianAnalyzer with ham. The given file must be a valid mbox file
51       * 
52       * @param file The mbox file
53       * @return count The count of added ham
54       * @throws IllegalArgumentException If the provided file is not a valid mbox file
55       * @throws BayesianAnalyzerManagementException If the service is not configured
56       */
57      public int addSpamFromMbox(String file) throws  BayesianAnalyzerManagementException;
58      
59      /**
60       * Feed the BayesianAnalyzer with ham. The given file must be a valid mbox file
61       * 
62       * @param file The mbox file
63       * @return count The count of added ham
64       * @throws IllegalArgumentException If the provided file is not a valid mbox file
65       * @throws BayesianAnalyzerManagementException If the service is not configured
66       */
67      public int addHamFromMbox(String file) throws BayesianAnalyzerManagementException;
68  
69      /**
70       * Export the data to a xml file
71       * 
72       * @param file The filename to store the data
73       * @throws BayesianAnalyzerManagementException If the service is not configured
74       */
75      public void exportData(String file) throws BayesianAnalyzerManagementException;
76      
77      /**
78       * Import the data from a xml file
79       * 
80       * @param file The filename to export data from
81       * 
82       * @throws BayesianAnalyzerManagementException IF the service is not configured
83       */
84      public void importData(String file) throws  BayesianAnalyzerManagementException;
85      
86      /**
87       * Reset the trained data
88       * 
89       * @throws BayesianAnalyzerManagementException
90       */
91      public void resetData() throws  BayesianAnalyzerManagementException;
92  }