01: /****************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one *
03: * or more contributor license agreements. See the NOTICE file *
04: * distributed with this work for additional information *
05: * regarding copyright ownership. The ASF licenses this file *
06: * to you under the Apache License, Version 2.0 (the *
07: * "License"); you may not use this file except in compliance *
08: * with the License. You may obtain a copy of the License at *
09: * *
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: ****************************************************************/package org.apache.james.fetchmail;
19:
20: import javax.mail.Session;
21:
22: import org.apache.avalon.framework.configuration.ConfigurationException;
23:
24: public class DynamicAccount extends Account {
25:
26: /**
27: * Constructor for DynamicAccount.
28: * @param sequenceNumber
29: * @param parsedConfiguration
30: * @param user
31: * @param password
32: * @param recipient
33: * @param ignoreRecipientHeader
34: * @param session
35: * @throws ConfigurationException
36: */
37: private DynamicAccount(int sequenceNumber,
38: ParsedConfiguration parsedConfiguration, String user,
39: String password, String recipient,
40: boolean ignoreRecipientHeader,
41: String customRecipientHeader, Session session)
42: throws ConfigurationException {
43: super (sequenceNumber, parsedConfiguration, user, password,
44: recipient, ignoreRecipientHeader,
45: customRecipientHeader, session);
46: }
47:
48: /**
49: * Constructor for DynamicAccount.
50: * @param sequenceNumber
51: * @param parsedConfiguration
52: * @param userName
53: * @param userPrefix
54: * @param userSuffix
55: * @param password
56: * @param recipientPrefix
57: * @param recipientSuffix
58: * @param ignoreRecipientHeader
59: * @param session
60: * @throws ConfigurationException
61: */
62: public DynamicAccount(int sequenceNumber,
63: ParsedConfiguration parsedConfiguration, String userName,
64: String userPrefix, String userSuffix, String password,
65: String recipientPrefix, String recipientSuffix,
66: boolean ignoreRecipientHeader,
67: String customRecipientHeader, Session session)
68: throws ConfigurationException {
69: this (sequenceNumber, parsedConfiguration, null, password, null,
70: ignoreRecipientHeader, customRecipientHeader, session);
71:
72: StringBuffer userBuffer = new StringBuffer(userPrefix);
73: userBuffer.append(userName);
74: userBuffer.append(userSuffix);
75: setUser(userBuffer.toString());
76:
77: StringBuffer recipientBuffer = new StringBuffer(recipientPrefix);
78: recipientBuffer.append(userName);
79: recipientBuffer.append(recipientSuffix);
80: setRecipient(recipientBuffer.toString());
81: }
82: }
|