Author: norman
Date: Wed Oct 7 10:41:44 2009
New Revision: 822651
URL: http://svn.apache.org/viewvc?rev=822651&view=rev
Log:
Remove deprecated methods (JAMES-915) and Generify
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/JamesSpoolManager.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/LinearProcessor.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetConfigImpl.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetContainer.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/StateAwareProcessorList.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/ToMultiRepository.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/VirtualUserTable.java
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/JamesSpoolManager.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/JamesSpoolManager.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/JamesSpoolManager.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/JamesSpoolManager.java
Wed Oct 7 10:41:44 2009
@@ -39,6 +39,8 @@
import org.apache.james.services.SpoolManager;
import org.apache.james.services.SpoolRepository;
import org.apache.mailet.Mail;
+import org.apache.mailet.MailetConfig;
+import org.apache.mailet.MatcherConfig;
/**
* Manages the mail spool. This class is responsible for retrieving
@@ -291,6 +293,9 @@
ContainerUtil.dispose(processorList);
}
+ /**
+ * @see org.apache.james.services.SpoolManager#getProcessorNames()
+ */
public String[] getProcessorNames() {
if (!(processorList instanceof ProcessorList)) {
return new String[0];
@@ -299,15 +304,21 @@
return processorNames;
}
- public List getMailetConfigs(String processorName) {
+ /**
+ * @see
org.apache.james.services.SpoolManager#getMailetConfigs(java.lang.String)
+ */
+ public List<MailetConfig> getMailetConfigs(String processorName) {
MailetContainer mailetContainer =
getMailetContainerByName(processorName);
- if (mailetContainer == null) return new ArrayList();
+ if (mailetContainer == null) return new ArrayList<MailetConfig>();
return mailetContainer.getMailetConfigs();
}
- public List getMatcherConfigs(String processorName) {
+ /**
+ * @see
org.apache.james.services.SpoolManager#getMatcherConfigs(java.lang.String)
+ */
+ public List<MatcherConfig> getMatcherConfigs(String processorName) {
MailetContainer mailetContainer =
getMailetContainerByName(processorName);
- if (mailetContainer == null) return new ArrayList();
+ if (mailetContainer == null) return new ArrayList<MatcherConfig>();
return mailetContainer.getMatcherConfigs();
}
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/LinearProcessor.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/LinearProcessor.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/LinearProcessor.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/LinearProcessor.java
Wed Oct 7 10:41:44 2009
@@ -109,8 +109,8 @@
*/
private static final String TERMINATING_MAILET_NAME =
"Terminating%Mailet%Name";
- private List mailets; // The list of mailets for this processor
- private List matchers; // The list of matchers for this processor
+ private List<Mailet> mailets; // The list of mailets for this processor
+ private List<Matcher> matchers; // The list of matchers for this processor
private volatile boolean listsClosed; // Whether the matcher/mailet lists
have been closed.
private SpoolRepository spool; // The spool on which this processor is
acting
@@ -161,10 +161,10 @@
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
- Iterator it = mailets.iterator();
+ Iterator<Mailet> it = mailets.iterator();
boolean debugEnabled = getLogger().isDebugEnabled();
while (it.hasNext()) {
- Mailet mailet = (Mailet)it.next();
+ Mailet mailet = it.next();
if (debugEnabled) {
getLogger().debug("Shutdown mailet " + mailet.getMailetInfo());
}
@@ -223,7 +223,7 @@
}
Matcher terminatingMatcher =
new GenericMatcher() {
- public Collection match(Mail mail) {
+ public Collection<MailAddress> match(Mail mail) {
return mail.getRecipients();
}
@@ -363,7 +363,7 @@
//Call the matcher and find what recipients match
- Collection recipients = null;
+ Collection<MailAddress> recipients = null;
Matcher matcher = (Matcher) matchers.get(i);
StringBuffer logMessageBuffer = null;
if (getLogger().isDebugEnabled()) {
@@ -379,7 +379,7 @@
recipients = matcher.match(mail);
if (recipients == null) {
//In case the matcher returned null, create an empty
Collection
- recipients = new ArrayList(0);
+ recipients = new ArrayList<MailAddress>(0);
} else if (recipients != mail.getRecipients()) {
//Make sure all the objects are MailAddress objects
verifyMailAddresses(recipients);
@@ -395,7 +395,7 @@
}
if (onMatchException.compareTo("nomatch") == 0) {
//In case the matcher returned null, create an empty
Collection
- recipients = new ArrayList(0);
+ recipients = new ArrayList<MailAddress>(0);
} else if (onMatchException.compareTo("matchall") == 0) {
recipients = mail.getRecipients();
// no need to verify addresses
@@ -406,11 +406,11 @@
// Split the recipients into two pools. notRecipients will
contain the
// recipients on the message that the matcher did not return.
- Collection notRecipients;
+ Collection<MailAddress> notRecipients;
if (recipients == mail.getRecipients() || recipients.size() == 0) {
- notRecipients = new ArrayList(0);
+ notRecipients = new ArrayList<MailAddress>(0);
} else {
- notRecipients = new ArrayList(mail.getRecipients());
+ notRecipients = new
ArrayList<MailAddress>(mail.getRecipients());
notRecipients.removeAll(recipients);
}
@@ -498,7 +498,7 @@
*
* @throws MessagingException when the <code>Collection</code> contains
objects that are not <code>MailAddress</code> objects
*/
- private void verifyMailAddresses(Collection col) throws MessagingException
{
+ private void verifyMailAddresses(Collection<MailAddress> col) throws
MessagingException {
try {
MailAddress addresses[] = (MailAddress[])col.toArray(new
MailAddress[0]);
@@ -555,8 +555,8 @@
* <p>Initialize the processor matcher/mailet list.</p>
*/
public void openProcessorList() {
- matchers = new ArrayList();
- mailets = new ArrayList();
+ matchers = new ArrayList<Matcher>();
+ mailets = new ArrayList<Mailet>();
}
/**
@@ -673,9 +673,12 @@
setSpool( (SpoolRepository) comp.lookup(SpoolRepository.ROLE));
}
- public List getMailetConfigs() {
- List mailetConfigs = new ArrayList();
- Iterator iterator = mailets.iterator();
+ /**
+ * @see org.apache.james.transport.MailetContainer#getMailetConfigs()
+ */
+ public List<MailetConfig> getMailetConfigs() {
+ List<MailetConfig> mailetConfigs = new ArrayList<MailetConfig>();
+ Iterator<Mailet> iterator = mailets.iterator();
while (iterator.hasNext()) {
Mailet mailet = (Mailet) iterator.next();
MailetConfig mailetConfig = mailet.getMailetConfig();
@@ -685,9 +688,12 @@
return mailetConfigs;
}
- public List getMatcherConfigs() {
- List matcherConfigs = new ArrayList();
- Iterator iterator = matchers.iterator();
+ /**
+ * @see org.apache.james.transport.MailetContainer#getMatcherConfigs()
+ */
+ public List<MatcherConfig> getMatcherConfigs() {
+ List<MatcherConfig> matcherConfigs = new ArrayList<MatcherConfig>();
+ Iterator<Matcher> iterator = matchers.iterator();
while (iterator.hasNext()) {
Matcher matcher = (Matcher) iterator.next();
MatcherConfig matcherConfig = matcher.getMatcherConfig();
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetConfigImpl.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetConfigImpl.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetConfigImpl.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetConfigImpl.java
Wed Oct 7 10:41:44 2009
@@ -93,8 +93,8 @@
*
* @return an iterator over the set of configuration parameter names.
*/
- public Iterator getInitParameterNames() {
- return new Iterator () {
+ public Iterator<String> getInitParameterNames() {
+ return new Iterator<String> () {
Configuration[] children;
int count = 0;
{
@@ -105,7 +105,7 @@
return count < children.length;
}
- public Object next() {
+ public String next() {
return children[count++].getName();
}
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetContainer.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetContainer.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetContainer.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/MailetContainer.java
Wed Oct 7 10:41:44 2009
@@ -20,6 +20,9 @@
import java.util.List;
+import org.apache.mailet.MailetConfig;
+import org.apache.mailet.MatcherConfig;
+
/**
* interface for mailet/matcher-containing processors.
@@ -44,12 +47,12 @@
* retrieve mailet configuration data for introspection
* @return List<MailetConfig>
*/
- List getMailetConfigs();
+ List<MailetConfig> getMailetConfigs();
/**
* retrieve matcher configuration data for introspection
* @return List<MatcherConfig>
*/
- List getMatcherConfigs();
+ List<MatcherConfig> getMatcherConfigs();
}
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/StateAwareProcessorList.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/StateAwareProcessorList.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/StateAwareProcessorList.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/StateAwareProcessorList.java
Wed Oct 7 10:41:44 2009
@@ -225,9 +225,9 @@
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
- Iterator it = processors.keySet().iterator();
+ Iterator<String> it = processors.keySet().iterator();
while (it.hasNext()) {
- String processorName = (String)it.next();
+ String processorName = it.next();
if (getLogger().isDebugEnabled()) {
getLogger().debug("Processor " + processorName);
}
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java
Wed Oct 7 10:41:44 2009
@@ -47,8 +47,8 @@
* @see
org.apache.mailet.base.GenericMailet#service(org.apache.mailet.Mail)
*/
public void service(Mail mail) throws MessagingException {
- Collection recipients = mail.getRecipients();
- Collection errors = new Vector();
+ Collection<MailAddress> recipients = mail.getRecipients();
+ Collection<MailAddress> errors = new Vector<MailAddress>();
MimeMessage message = mail.getMessage();
@@ -61,11 +61,11 @@
(mail.getSender() == null ? "<>" : "<"
+ mail.getSender() + ">"));
- Collection newRecipients = new LinkedList();
- for (Iterator i = recipients.iterator(); i.hasNext();) {
+ Collection<MailAddress> newRecipients = new LinkedList<MailAddress>();
+ for (Iterator<MailAddress> i = recipients.iterator(); i.hasNext();) {
MailAddress recipient = (MailAddress) i.next();
try {
- Collection usernames = processMail(mail.getSender(), recipient,
+ Collection<MailAddress> usernames =
processMail(mail.getSender(), recipient,
message);
// if the username is null or changed we remove it from the
@@ -118,11 +118,11 @@
*
* @throws MessagingException
*/
- protected Collection handleMappings(Collection mappings, MailAddress
sender, MailAddress recipient,
+ protected Collection<MailAddress> handleMappings(Collection<String>
mappings, MailAddress sender, MailAddress recipient,
MimeMessage message) throws MessagingException {
- Iterator i = mappings.iterator();
- Collection remoteRecipients = new ArrayList();
- Collection localRecipients = new ArrayList();
+ Iterator<String> i = mappings.iterator();
+ Collection<MailAddress> remoteRecipients = new
ArrayList<MailAddress>();
+ Collection<MailAddress> localRecipients = new ArrayList<MailAddress>();
while (i.hasNext()) {
String rcpt = (String) i.next();
@@ -132,7 +132,7 @@
}
MailAddress nextMap = new MailAddress(rcpt);
- if (getMailetContext().isLocalServer(nextMap.getHost())) {
+ if (getMailetContext().isLocalServer(nextMap.getDomain())) {
localRecipients.add(nextMap);
} else {
remoteRecipients.add(nextMap);
@@ -143,7 +143,7 @@
try {
getMailetContext().sendMail(sender, remoteRecipients, message);
StringBuffer logBuffer = new StringBuffer(128).append("Mail
for ").append(recipient).append(" forwarded to ");
- for (Iterator j = remoteRecipients.iterator(); j.hasNext();) {
+ for (Iterator<MailAddress> j = remoteRecipients.iterator();
j.hasNext();) {
logBuffer.append(j.next());
if (j.hasNext())
logBuffer.append(", ");
@@ -152,7 +152,7 @@
return null;
} catch (MessagingException me) {
StringBuffer logBuffer = new StringBuffer(128).append("Error
forwarding mail to ");
- for (Iterator j = remoteRecipients.iterator(); j.hasNext();) {
+ for (Iterator<MailAddress> j = remoteRecipients.iterator();
j.hasNext();) {
logBuffer.append(j.next());
if (j.hasNext())
logBuffer.append(", ");
@@ -181,6 +181,6 @@
*
* @throws MessagingException
*/
- public abstract Collection processMail(MailAddress sender, MailAddress
recipient,
+ public abstract Collection<MailAddress> processMail(MailAddress sender,
MailAddress recipient,
MimeMessage message) throws MessagingException;
}
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/ToMultiRepository.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/ToMultiRepository.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/ToMultiRepository.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/ToMultiRepository.java
Wed Oct 7 10:41:44 2009
@@ -124,8 +124,8 @@
* if an error occurs while storing the mail
*/
public void service(Mail mail) throws MessagingException {
- Collection recipients = mail.getRecipients();
- Collection errors = new Vector();
+ Collection<MailAddress> recipients = mail.getRecipients();
+ Collection<MailAddress> errors = new Vector<MailAddress>();
MimeMessage message = mail.getMessage();
@@ -151,7 +151,7 @@
}
}
- for (Iterator i = recipients.iterator(); i.hasNext();) {
+ for (Iterator<MailAddress> i = recipients.iterator(); i.hasNext();) {
MailAddress recipient = (MailAddress) i.next();
try {
if (deliveryHeader != null) {
@@ -224,7 +224,7 @@
}
username = recipient.toString();
- Collection recipients = new HashSet();
+ Collection<MailAddress> recipients = new HashSet<MailAddress>();
recipients.add(recipient);
MailImpl mail = new MailImpl(getId(), sender, recipients, message);
try {
Modified:
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/VirtualUserTable.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/VirtualUserTable.java?rev=822651&r1=822650&r2=822651&view=diff
==============================================================================
---
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/VirtualUserTable.java
(original)
+++
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/VirtualUserTable.java
Wed Oct 7 10:41:44 2009
@@ -110,9 +110,9 @@
/**
* @see
org.apache.james.transport.mailets.AbstractVirtualUserTable#processMail(org.apache.mailet.MailAddress,
org.apache.mailet.MailAddress, javax.mail.internet.MimeMessage)
*/
- public Collection processMail(MailAddress sender, MailAddress recipient,
MimeMessage message) throws MessagingException {
+ public Collection<MailAddress> processMail(MailAddress sender, MailAddress
recipient, MimeMessage message) throws MessagingException {
try {
- Collection<String> mappings = vut.getMappings(recipient.getUser(),
recipient.getHost());
+ Collection<String> mappings =
vut.getMappings(recipient.getLocalPart(), recipient.getDomain());
if (mappings != null) {
return handleMappings(mappings, sender, recipient, message);
@@ -126,7 +126,7 @@
throw new MessagingException(errorBuffer.toString());
}
- Collection rcpts = new ArrayList();
+ Collection<MailAddress> rcpts = new ArrayList<MailAddress>();
rcpts.add(recipient);
return rcpts;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]