1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.james.impl.vut;
23
24 import java.util.Collection;
25 import java.util.Map;
26
27 import org.apache.avalon.framework.activity.Initializable;
28 import org.apache.avalon.framework.service.ServiceException;
29 import org.apache.avalon.framework.service.ServiceManager;
30 import org.apache.avalon.framework.service.Serviceable;
31 import org.apache.james.api.vut.ErrorMappingException;
32 import org.apache.james.api.vut.VirtualUserTableStore;
33 import org.apache.james.api.vut.management.InvalidMappingException;
34 import org.apache.james.api.vut.management.VirtualUserTableManagement;
35
36
37
38
39 public class DefaultVirtualUserTable implements VirtualUserTableManagement, Serviceable, Initializable {
40
41 VirtualUserTableManagement vut = null;
42
43 VirtualUserTableStore store = null;
44
45
46
47
48 public void initialize() throws Exception {
49 vut = (VirtualUserTableManagement) store.getTable("DefaultVirtualUserTable");
50 if (vut == null) {
51 throw new ServiceException("","The DefaultVirtualUserTable could not be found.");
52 }
53 }
54
55
56
57
58 public void service(ServiceManager arg0) throws ServiceException {
59 store = (VirtualUserTableStore) arg0.lookup(VirtualUserTableStore.ROLE);
60 }
61
62
63
64
65 public boolean addAddressMapping(String user, String domain, String address) throws InvalidMappingException {
66 return vut.addAddressMapping(user, domain, address);
67 }
68
69
70
71
72 public boolean addErrorMapping(String user, String domain, String error) throws InvalidMappingException {
73 return vut.addErrorMapping(user, domain, error);
74 }
75
76
77
78
79 public boolean addRegexMapping(String user, String domain, String regex) throws InvalidMappingException {
80 return vut.addRegexMapping(user, domain, regex);
81 }
82
83
84
85
86 public Collection getUserDomainMappings(String user, String domain) throws InvalidMappingException {
87 return vut.getUserDomainMappings(user, domain);
88 }
89
90
91
92
93 public boolean removeAddressMapping(String user, String domain, String address) throws InvalidMappingException {
94 return vut.removeAddressMapping(user, domain, address);
95 }
96
97
98
99
100 public boolean removeErrorMapping(String user, String domain, String error) throws InvalidMappingException {
101 return vut.removeErrorMapping(user, domain, error);
102 }
103
104
105
106
107 public boolean removeRegexMapping(String user, String domain, String regex) throws InvalidMappingException {
108 return vut.removeRegexMapping(user, domain, regex);
109 }
110
111
112
113
114 public Collection getMappings(String user, String domain) throws ErrorMappingException {
115 return vut.getMappings(user, domain);
116 }
117
118
119
120
121 public boolean addMapping(String user, String domain, String mapping) throws InvalidMappingException {
122 return vut.addMapping(user, domain, mapping);
123 }
124
125
126
127
128 public boolean removeMapping(String user, String domain, String mapping) throws InvalidMappingException {
129 return vut.removeMapping(user, domain, mapping);
130 }
131
132
133
134
135 public Map getAllMappings() {
136 return vut.getAllMappings();
137 }
138
139
140
141
142 public boolean addAliasDomainMapping(String aliasDomain, String realDomain) throws InvalidMappingException {
143 return vut.addAliasDomainMapping(aliasDomain, realDomain);
144 }
145
146
147
148
149 public boolean removeAliasDomainMapping(String aliasDomain, String realDomain) throws InvalidMappingException {
150 return vut.removeAliasDomainMapping(aliasDomain, realDomain);
151 }
152 }