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.api.vut.management;
23  
24  import java.util.Collection;
25  
26  import org.apache.james.api.vut.management.VirtualUserTableManagementException;
27  
28  /**
29   * Expose virtualusertable management functionality through JMX.
30   * 
31   * @phoenix:mx-topic name="VirtualUserTableAdministration"
32   */
33  public interface VirtualUserTableManagementMBean {
34      
35      /**
36       * Add regex mapping
37       * @phoenix:mx-operation
38       * @phoenix:mx-description Add regex mapping
39       * 
40       * @param virtualUserTable The virtualUserTable 
41       * @param user the username. Null if no username should be used
42       * @param domain the domain. Null if no domain should be used
43       * @param regex the regex.
44       * @return true if successfully
45       * @throws VirtualUserTableManagementException TODO
46       */
47      public boolean addRegexMapping(String virtualUserTable, String user, String domain, String regex) throws VirtualUserTableManagementException;
48      
49      /**
50       * Remove regex mapping
51       * @phoenix:mx-operation
52       * @phoenix:mx-description Remove regex mapping
53       * 
54       * @param virtualUserTable The virtualUserTable 
55       * @param user the username. Null if no username should be used
56       * @param domain the domain. Null if no domain should be used
57       * @param regex the regex.
58       * @return true if successfully
59       * @throws VirtualUserTableManagementException TODO
60       */
61      public boolean removeRegexMapping(String virtualUserTable, String user,String domain, String regex) throws VirtualUserTableManagementException;
62      
63      /***
64       * Add address mapping
65       * @phoenix:mx-operation
66       * @phoenix:mx-description Add address mapping
67       * 
68       * @param virtualUserTable The virtualUserTable 
69       * @param user the username. Null if no username should be used
70       * @param domain the domain. Null if no domain should be used
71       * @param address the address.
72       * @return true if successfully
73       * @throws VirtualUserTableManagementException TODO
74       */
75      public boolean addAddressMapping(String virtualUserTable, String user, String domain, String address) throws VirtualUserTableManagementException;
76      
77      /**
78       * Remove address mapping
79       * @phoenix:mx-operation
80       * @phoenix:mx-description Remove address mapping
81       * 
82       * @param virtualUserTable The virtualUserTable 
83       * @param user the username. Null if no username should be used
84       * @param domain the domain. Null if no domain should be used
85       * @param address
86       * @return true if successfully
87       * @throws VirtualUserTableManagementException TODO
88       */
89      public boolean removeAddressMapping(String virtualUserTable, String user,String domain, String address) throws VirtualUserTableManagementException;
90      
91      /**
92       * Add error mapping
93       * @phoenix:mx-operation
94       * @phoenix:mx-description Add error mapping
95       * 
96       * @param virtualUserTable The virtualUserTable 
97       * @param user the username. Null if no username should be used
98       * @param domain the domain. Null if no domain should be used
99       * @param error
100      * @return true if successfully
101      * @throws VirtualUserTableManagementException TODO
102      */
103     public boolean addErrorMapping(String virtualUserTable, String user, String domain, String error) throws VirtualUserTableManagementException;
104 
105     /**
106      * Remove error mapping
107      * @phoenix:mx-operation
108      * @phoenix:mx-description Remove error mapping
109      * 
110      * @param virtualUserTable The virtualUserTable 
111      * @param user the username. Null if no username should be used
112      * @param domain the domain. Null if no domain should be used
113      * @param error
114      * @return true if successfully
115      * @throws VirtualUserTableManagementException TODO
116      */
117     public boolean removeErrorMapping(String virtualUserTable, String user,String domain, String error) throws VirtualUserTableManagementException;
118     
119     /**
120      * Return the explicit mapping stored for the given user and domain. Return null
121      * if no mapping was found
122      * @phoenix:mx-operation
123      * @phoenix:mx-description Return the explicit mapping stored for the given user and domain. Return null
124      *                         if no mapping was found
125      *
126      * @param virtualUserTable The virtualUserTable     
127      * @param user the username
128      * @param domain the domain
129      * @return the collection which holds the mappings. 
130      * @throws VirtualUserTableManagementException TODO
131      */
132     public Collection getUserDomainMappings(String virtualUserTable, String user, String domain) throws VirtualUserTableManagementException;
133     
134     /**
135     * Try to identify the right method based on the prefix of the mapping and add it.
136     * @phoenix:mx-operation
137     * @phoenix:mx-description Try to identify the right method based on the prefix of the mapping and add it
138     * 
139     * @param virtualUserTable The virtualUserTable 
140     * @param user the username. Null if no username should be used
141     * @param domain the domain. Null if no domain should be used
142     * @param mapping the mapping.
143     * @return true if successfully
144      * @throws VirtualUserTableManagementException TODO
145     */
146     public boolean addMapping(String virtualUserTable, String user, String domain, String mapping) throws VirtualUserTableManagementException;
147     
148     /**
149      * Try to identify the right method based on the prefix of the mapping and remove it.
150      * @phoenix:mx-operation
151      * @phoenix:mx-description Try to identify the right method based on the prefix of the mapping and remove it
152      *
153      * @param virtualUserTable The virtualUserTable 
154      * @param user the username. Null if no username should be used
155      * @param domain the domain. Null if no domain should be used
156      * @param mapping the mapping.
157      * @return true if successfully
158      * @throws VirtualUserTableManagementException TODO
159      */
160     public boolean removeMapping(String virtualUserTable, String user, String domain, String mapping) throws VirtualUserTableManagementException;
161 }