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.management;
24
25 /**
26 * Expose spool management functionality through JMX.
27 *
28 * @phoenix:mx-topic name="SpoolAdministration"
29 */
30 public interface SpoolManagementMBean {
31
32 /**
33 * Move all mails from the given repository to another repository matching the given filter criteria
34 *
35 * @phoenix:mx-operation
36 * @phoenix:mx-description Move mails from a spool to another
37 *
38 * @param srcSpoolRepositoryURL the spool whose item are listed
39 * @param srcState if not NULL, only mails with matching state are returned
40 * @param dstSpoolRepositoryURL the destination spool
41 * @param dstState if not NULL, the state will be changed before storing the message to the new repository.
42 * @param header if not NULL, only mails with at least one header with a value matching headerValueRegex are returned
43 * @param headerValueRegex the regular expression the header must match
44 * @return a counter of moved mails
45 * @throws SpoolManagementException
46 */
47 public int moveSpoolItems(String srcSpoolRepositoryURL, String srcState, String dstSpoolRepositoryURL, String dstState, String header, String headerValueRegex)
48 throws SpoolManagementException;
49
50 /**
51 * List mails on the spool matching the given criteria
52 *
53 * @phoenix:mx-operation
54 * @phoenix:mx-description List mails on the spool matching the given criteria
55 *
56 * @param spoolRepositoryURL specifies the spool
57 * @param state only mails in the given state are processed, or ALL if NULL
58 * @param header the header whose value should be checked
59 * @param headerValueRegex regular expression matched against header value. only matching mails are processed
60 * @return number of removed items
61 *
62 * @throws SpoolManagementException
63 */
64 String[] listSpoolItems(String spoolRepositoryURL, String state, String header, String headerValueRegex)
65 throws SpoolManagementException;
66
67 /**
68 * Removes one specific or all mails from the given spool repository matching the given criteria
69 *
70 * @phoenix:mx-operation
71 * @phoenix:mx-description Removes one specific or all mails from the given spool repository matching
72 * the given criteria
73 *
74 * @param spoolRepositoryURL specifies the spool
75 * @param key identifies the item to be removed. if NULL, all items are removed
76 * @param state only mails in the given state are processed, or ALL if NULL
77 * @param header the header whose value should be checked
78 * @param headerValueRegex regular expression matched against header value. only matching mails are processed
79 * @return number of removed items
80 */
81 int removeSpoolItems(String spoolRepositoryURL, String key, String state, String header, String headerValueRegex)
82 throws SpoolManagementException;
83
84 /**
85 * (Re-)tries to send one specific or all mails in the given spool repository matching the given criteria
86 *
87 * @phoenix:mx-operation
88 * @phoenix:mx-description (Re-)tries to send one specific or all mails in the given spool repository
89 * matching the given criteria
90 *
91 * @param spoolRepositoryURL specifies the spool
92 * @param key identifies the item to be sent. if NULL, all items with status ERROR are sent
93 * @param state only mails in the given state are processed, or ALL if NULL
94 * @param header the header whose value should be checked
95 * @param headerValueRegex regular expression matched against header value. only matching mails are processed
96 * @return number of processed items
97 */
98 int resendSpoolItems(String spoolRepositoryURL, String key, String state, String header, String headerValueRegex)
99 throws SpoolManagementException;
100
101 }