You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by fe...@apache.org on 2011/04/04 18:36:45 UTC
svn commit: r1088681 [2/10] - in /james/server/trunk:
jpa/src/main/java/org/apache/james/domainlist/jpa/
jpa/src/main/java/org/apache/james/domainlist/jpa/model/
jpa/src/main/java/org/apache/james/user/jpa/
jpa/src/main/java/org/apache/james/user/jpa/m...
Modified: james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/jmx/LineHandlerResultJMXMonitor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/jmx/LineHandlerResultJMXMonitor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/jmx/LineHandlerResultJMXMonitor.java (original)
+++ james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/jmx/LineHandlerResultJMXMonitor.java Mon Apr 4 16:36:42 2011
@@ -19,7 +19,7 @@
package org.apache.james.lmtpserver.jmx;
-public class LineHandlerResultJMXMonitor extends org.apache.james.smtpserver.jmx.LineHandlerResultJMXMonitor{
+public class LineHandlerResultJMXMonitor extends org.apache.james.smtpserver.jmx.LineHandlerResultJMXMonitor {
@Override
protected String getDefaultJMXName() {
Modified: james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java (original)
+++ james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java Mon Apr 4 16:36:42 2011
@@ -35,27 +35,28 @@ import org.jboss.netty.channel.ChannelUp
import org.jboss.netty.channel.group.ChannelGroup;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
-public class LMTPServer extends AbstractConfigurableAsyncServer implements LMTPServerMBean{
+public class LMTPServer extends AbstractConfigurableAsyncServer implements LMTPServerMBean {
/**
- * The maximum message size allowed by this SMTP server. The default
- * value, 0, means no limit.
+ * The maximum message size allowed by this SMTP server. The default value,
+ * 0, means no limit.
*/
private long maxMessageSize = 0;
private ProtocolHandlerChain handlerChain;
private LMTPConfiguration lmtpConfig = new LMTPConfiguration();
- private String lmtpGreeting;
+ private String lmtpGreeting;
-
- @Resource(name="lmtphandlerchain")
+ @Resource(name = "lmtphandlerchain")
public void setProtocolHandlerChain(ProtocolHandlerChain handlerChain) {
this.handlerChain = handlerChain;
}
-
/*
* (non-Javadoc)
- * @see org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer#getDefaultPort()
+ *
+ * @see
+ * org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer#
+ * getDefaultPort()
*/
public int getDefaultPort() {
return 24;
@@ -63,31 +64,31 @@ public class LMTPServer extends Abstract
/*
* (non-Javadoc)
+ *
* @see org.apache.james.socket.ServerMBean#getServiceType()
*/
public String getServiceType() {
return "LMTP Service";
}
-
+
public void doConfigure(final HierarchicalConfiguration configuration) throws ConfigurationException {
if (isEnabled()) {
-
+
// get the message size limit from the conf file and multiply
// by 1024, to put it in bytes
- maxMessageSize = configuration.getLong( "maxmessagesize",maxMessageSize ) * 1024;
+ maxMessageSize = configuration.getLong("maxmessagesize", maxMessageSize) * 1024;
if (maxMessageSize > 0) {
getLogger().info("The maximum allowed message size is " + maxMessageSize + " bytes.");
} else {
getLogger().info("No maximum message size is enforced for this server.");
}
-
- // get the lmtpGreeting
- lmtpGreeting = configuration.getString("lmtpGreeting",null);
+ // get the lmtpGreeting
+ lmtpGreeting = configuration.getString("lmtpGreeting", null);
}
}
-
+
@Override
protected ChannelPipelineFactory createPipelineFactory(ChannelGroup group) {
return new LMTPChannelPipelineFactory(getTimeout(), connectionLimit, connPerIP, group);
@@ -133,7 +134,6 @@ public class LMTPServer extends Abstract
return false;
}
-
/**
* @see org.apache.james.protocols.smtp.SMTPConfiguration#getSMTPGreeting()
*/
@@ -162,7 +162,7 @@ public class LMTPServer extends Abstract
return false;
}
}
-
+
private final class LMTPChannelPipelineFactory extends AbstractSSLAwareChannelPipelineFactory {
public LMTPChannelPipelineFactory(int timeout, int maxConnections, int maxConnectsPerIp, ChannelGroup group) {
@@ -219,24 +219,29 @@ public class LMTPServer extends Abstract
/*
* (non-Javadoc)
- * @see org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer#getDefaultJMXName()
+ *
+ * @see
+ * org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer#
+ * getDefaultJMXName()
*/
protected String getDefaultJMXName() {
return "lmtpserver";
}
-
/*
* (non-Javadoc)
- * @see org.apache.james.smtpserver.netty.SMTPServerMBean#setMaximalMessageSize(long)
+ *
+ * @see
+ * org.apache.james.smtpserver.netty.SMTPServerMBean#setMaximalMessageSize
+ * (long)
*/
public void setMaximalMessageSize(long maxSize) {
maxMessageSize = maxSize;
}
-
/*
* (non-Javadoc)
+ *
* @see org.apache.james.lmtpserver.netty.LMTPServerMBean#getHeloName()
*/
public String getHeloName() {
Modified: james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java (original)
+++ james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServerMBean.java Mon Apr 4 16:36:42 2011
@@ -21,7 +21,7 @@ package org.apache.james.lmtpserver.nett
import org.apache.james.protocols.lib.jmx.ServerMBean;
import org.apache.james.protocols.smtp.SMTPServerMBean;
-public interface LMTPServerMBean extends ServerMBean, SMTPServerMBean{
+public interface LMTPServerMBean extends ServerMBean, SMTPServerMBean {
/**
* Return the maximum allowed size of the message
@@ -29,20 +29,20 @@ public interface LMTPServerMBean extends
* @return maxMessageSize
*/
long getMaximalMessageSize();
-
+
/**
- * Set the maximum allowed size of messages. Set this to 0 to accept every message
+ * Set the maximum allowed size of messages. Set this to 0 to accept every
+ * message
*
* @param maxSize
*/
void setMaximalMessageSize(long maxSize);
-
-
+
/**
* Return the hello name
*
* @return helo
*/
String getHeloName();
-
+
}
Modified: james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/OioLMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/OioLMTPServer.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/OioLMTPServer.java (original)
+++ james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/OioLMTPServer.java Mon Apr 4 16:36:42 2011
@@ -22,12 +22,10 @@ import org.jboss.netty.channel.socket.Se
import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
/**
- * LMTPServer which use old IO and not NIO. If you want to use NIO you should use {@link LMTPerver}
- *
- *
+ * LMTPServer which use old IO and not NIO. If you want to use NIO you should
+ * use {@link LMTPerver}
*/
-public class OioLMTPServer extends LMTPServer{
-
+public class OioLMTPServer extends LMTPServer {
@Override
protected ServerSocketChannelFactory createSocketChannelFactory() {
Modified: james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java (original)
+++ james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java Mon Apr 4 16:36:42 2011
@@ -18,7 +18,6 @@
****************************************************************/
package org.apache.james.adapter.mailbox;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -38,27 +37,26 @@ import org.slf4j.Logger;
/**
* JMX managmenent for Mailboxes
- *
- *
*/
public class MailboxManagerManagement extends StandardMBean implements MailboxManagerManagementMBean, LogEnabled {
private MailboxManager mailboxManager;
private Logger log;
-
- @Resource(name="mailboxmanager")
+
+ @Resource(name = "mailboxmanager")
public void setMailboxManager(MailboxManager mailboxManager) {
this.mailboxManager = mailboxManager;
}
-
+
public MailboxManagerManagement() throws NotCompliantMBeanException {
super(MailboxManagerManagementMBean.class);
}
-
-
+
/*
* (non-Javadoc)
- * @see org.apache.james.adapter.mailbox.MailboxManagerManagementMBean#deleteMailboxes(java.lang.String)
+ *
+ * @see org.apache.james.adapter.mailbox.MailboxManagerManagementMBean#
+ * deleteMailboxes(java.lang.String)
*/
public boolean deleteMailboxes(String username) {
MailboxSession session = null;
@@ -67,7 +65,7 @@ public class MailboxManagerManagement ex
mailboxManager.startProcessingRequest(session);
List<MailboxMetaData> mList = mailboxManager.search(new MailboxQuery(MailboxPath.inbox(username), "", session.getPathDelimiter()), session);
for (int i = 0; i < mList.size(); i++) {
- mailboxManager.deleteMailbox(mList.get(i).getPath(),session);
+ mailboxManager.deleteMailbox(mList.get(i).getPath(), session);
}
return true;
} catch (MailboxException e) {
@@ -87,6 +85,7 @@ public class MailboxManagerManagement ex
/*
* (non-Javadoc)
+ *
* @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
*/
public void setLog(Logger log) {
@@ -95,7 +94,10 @@ public class MailboxManagerManagement ex
/*
* (non-Javadoc)
- * @see org.apache.james.adapter.mailbox.MailboxManagerManagementMBean#listMailboxes(java.lang.String)
+ *
+ * @see
+ * org.apache.james.adapter.mailbox.MailboxManagerManagementMBean#listMailboxes
+ * (java.lang.String)
*/
public List<String> listMailboxes(String username) {
List<String> boxes = new ArrayList<String>();
Modified: james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java (original)
+++ james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java Mon Apr 4 16:36:42 2011
@@ -22,7 +22,6 @@ import java.util.List;
/**
* JMX MBean for Mailbox management
- *
*/
public interface MailboxManagerManagementMBean {
@@ -33,7 +32,7 @@ public interface MailboxManagerManagemen
* @return successful
*/
boolean deleteMailboxes(String username);
-
+
/**
* List all mailboxes for a user
*
Modified: james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java (original)
+++ james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java Mon Apr 4 16:36:42 2011
@@ -27,10 +27,8 @@ import org.apache.james.user.api.UsersRe
/**
* Utility to instance a {@link MaildirStore} object
- *
- *
*/
-public class MaildirStoreUtil{
+public class MaildirStoreUtil {
/**
* Return a {@link MaildirStore} instance
@@ -40,7 +38,7 @@ public class MaildirStoreUtil{
* @param rootURL
* @return store
* @throws FileNotFoundException
- * @throws UsersRepositoryException
+ * @throws UsersRepositoryException
*/
public static MaildirStore create(FileSystem fs, UsersRepository usersRepos, String rootURL) throws FileNotFoundException, UsersRepositoryException {
StringBuffer root = new StringBuffer();
Modified: james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java (original)
+++ james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java Mon Apr 4 16:36:42 2011
@@ -28,22 +28,25 @@ import org.apache.james.user.api.UsersRe
import org.slf4j.Logger;
/**
- * Authenticator which use an UsersRepository to check if the user and password match
- *
+ * Authenticator which use an UsersRepository to check if the user and password
+ * match
*/
-public class UserRepositoryAuthenticator implements Authenticator, LogEnabled{
+public class UserRepositoryAuthenticator implements Authenticator, LogEnabled {
private UsersRepository repos;
private Logger log;
- @Resource(name="usersrepository")
+ @Resource(name = "usersrepository")
public void setUsersRepository(UsersRepository repos) {
this.repos = repos;
}
/*
* (non-Javadoc)
- * @see org.apache.james.mailbox.store.Authenticator#isAuthentic(java.lang.String, java.lang.CharSequence)
+ *
+ * @see
+ * org.apache.james.mailbox.store.Authenticator#isAuthentic(java.lang.String
+ * , java.lang.CharSequence)
*/
public boolean isAuthentic(String userid, CharSequence passwd) {
try {
@@ -57,5 +60,5 @@ public class UserRepositoryAuthenticator
public void setLog(Logger log) {
this.log = log;
}
-
+
}
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java Mon Apr 4 16:36:42 2011
@@ -33,19 +33,19 @@ import org.apache.mailet.Mail;
import org.apache.mailet.MailetContext;
/**
- * Build up the Camel Routes by parsing the mailetcontainer.xml configuration file.
- *
- * It also offer the {@link AbstractStateCompositeProcessor} implementation which allow to inject {@link Mail} into the routes.
- *
+ * Build up the Camel Routes by parsing the mailetcontainer.xml configuration
+ * file.
*
+ * It also offer the {@link AbstractStateCompositeProcessor} implementation
+ * which allow to inject {@link Mail} into the routes.
*/
-public class CamelCompositeProcessor extends AbstractStateCompositeProcessor implements CamelContextAware{
+public class CamelCompositeProcessor extends AbstractStateCompositeProcessor implements CamelContextAware {
private CamelContext camelContext;
private MailetContext mailetContext;
private MatcherLoader matcherLoader;
private MailetLoader mailetLoader;
-
+
@Resource(name = "matcherloader")
public void setMatcherLoader(MatcherLoader matcherLoader) {
this.matcherLoader = matcherLoader;
@@ -55,13 +55,12 @@ public class CamelCompositeProcessor ext
public void setMailetLoader(MailetLoader mailetLoader) {
this.mailetLoader = mailetLoader;
}
-
- @Resource(name= "mailetcontext")
+
+ @Resource(name = "mailetcontext")
public void setMailetContext(MailetContext mailetContext) {
this.mailetContext = mailetContext;
}
-
@PostConstruct
public void init() throws Exception {
super.init();
@@ -79,11 +78,10 @@ public class CamelCompositeProcessor ext
*
* @see org.apache.camel.CamelContextAware#getCamelContext()
*/
- public CamelContext getCamelContext() {
+ public CamelContext getCamelContext() {
return camelContext;
}
-
/*
* (non-Javadoc)
*
@@ -96,9 +94,12 @@ public class CamelCompositeProcessor ext
/*
* (non-Javadoc)
- * @see org.apache.james.mailetcontainer.lib.AbstractCompositeMailProcessor#createMailProcessor(java.lang.String, org.apache.commons.configuration.HierarchicalConfiguration)
+ *
+ * @see org.apache.james.mailetcontainer.lib.AbstractCompositeMailProcessor#
+ * createMailProcessor(java.lang.String,
+ * org.apache.commons.configuration.HierarchicalConfiguration)
*/
- protected MailProcessor createMailProcessor(String name, HierarchicalConfiguration config) throws Exception{
+ protected MailProcessor createMailProcessor(String name, HierarchicalConfiguration config) throws Exception {
CamelMailetProcessor processor = new CamelMailetProcessor();
try {
processor.setLog(logger);
@@ -111,10 +112,9 @@ public class CamelCompositeProcessor ext
return processor;
} catch (Exception e) {
processor.destroy();
-
+
throw e;
}
}
-
}
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContext.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContext.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContext.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContext.java Mon Apr 4 16:36:42 2011
@@ -28,7 +28,6 @@ import org.apache.mailet.HostAddress;
public class CamelMailetContext extends JamesMailetContext {
-
/**
* Performs DNS lookups as needed to find servers which should or might
* support SMTP. Returns an Iterator over HostAddress, a specialized
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java Mon Apr 4 16:36:42 2011
@@ -41,38 +41,37 @@ import org.apache.mailet.MailetConfig;
import org.apache.mailet.Matcher;
import org.slf4j.Logger;
-
/**
- * {@link AbstractStateMailetProcessor} implementation which use Camel DSL for the {@link Matcher} / {@link Mailet} routing
- *
+ * {@link AbstractStateMailetProcessor} implementation which use Camel DSL for
+ * the {@link Matcher} / {@link Mailet} routing
*/
-public class CamelMailetProcessor extends AbstractStateMailetProcessor implements CamelContextAware{
+public class CamelMailetProcessor extends AbstractStateMailetProcessor implements CamelContextAware {
private CamelContext context;
-
private ProducerTemplate producerTemplate;
-
- private final UseLatestAggregationStrategy aggr = new UseLatestAggregationStrategy();
+ private final UseLatestAggregationStrategy aggr = new UseLatestAggregationStrategy();
-
/*
* (non-Javadoc)
- * @see org.apache.james.mailetcontainer.api.MailProcessor#service(org.apache.mailet.Mail)
+ *
+ * @see
+ * org.apache.james.mailetcontainer.api.MailProcessor#service(org.apache
+ * .mailet.Mail)
*/
public void service(Mail mail) throws MessagingException {
try {
producerTemplate.sendBody(getEndpoint(), mail);
-
- } catch (CamelExecutionException ex) {
- throw new MessagingException("Unable to process mail " + mail.getName(),ex);
- }
- }
+ } catch (CamelExecutionException ex) {
+ throw new MessagingException("Unable to process mail " + mail.getName(), ex);
+ }
+ }
/*
* (non-Javadoc)
+ *
* @see org.apache.camel.CamelContextAware#getCamelContext()
*/
public CamelContext getCamelContext() {
@@ -81,17 +80,18 @@ public class CamelMailetProcessor extend
/*
* (non-Javadoc)
- * @see org.apache.camel.CamelContextAware#setCamelContext(org.apache.camel.CamelContext)
+ *
+ * @see org.apache.camel.CamelContextAware#setCamelContext(org.apache.camel.
+ * CamelContext)
*/
public void setCamelContext(CamelContext context) {
this.context = context;
}
-
/**
- * Return the endpoint for the processorname.
+ * Return the endpoint for the processorname.
*
- * This will return a "direct" endpoint.
+ * This will return a "direct" endpoint.
*
* @param processorName
* @return endPoint
@@ -99,8 +99,7 @@ public class CamelMailetProcessor extend
protected String getEndpoint() {
return "direct:processor." + getState();
}
-
-
+
@PostConstruct
public void init() throws Exception {
producerTemplate = context.createProducerTemplate();
@@ -111,11 +110,12 @@ public class CamelMailetProcessor extend
super.init();
}
-
-
/*
* (non-Javadoc)
- * @see org.apache.james.mailetcontainer.lib.AbstractMailetContainer#setupRouting(java.util.List)
+ *
+ * @see
+ * org.apache.james.mailetcontainer.lib.AbstractMailetContainer#setupRouting
+ * (java.util.List)
*/
protected void setupRouting(List<MatcherMailetPair> pairs) throws MessagingException {
try {
@@ -125,10 +125,10 @@ public class CamelMailetProcessor extend
}
}
-
/**
- * {@link RouteBuilder} which construct the Matcher and Mailet routing use Camel DSL
- *
+ * {@link RouteBuilder} which construct the Matcher and Mailet routing use
+ * Camel DSL
+ *
*/
private final class MailetContainerRouteBuilder extends RouteBuilder {
@@ -137,74 +137,65 @@ public class CamelMailetProcessor extend
public MailetContainerRouteBuilder(List<MatcherMailetPair> pairs) {
this.pairs = pairs;
}
-
+
@Override
public void configure() throws Exception {
Processor disposeProcessor = new DisposeProcessor();
Processor removePropsProcessor = new RemovePropertiesProcessor();
Processor completeProcessor = new CompleteProcessor();
Processor stateChangedProcessor = new StateChangedProcessor();
-
+
String state = getState();
Logger logger = getLogger();
RouteDefinition processorDef = from(getEndpoint()).routeId(state).inOnly()
// store the logger in properties
- .setProperty(MatcherSplitter.LOGGER_PROPERTY, constant(getLogger()));
-
+ .setProperty(MatcherSplitter.LOGGER_PROPERTY, constant(getLogger()));
+
for (int i = 0; i < pairs.size(); i++) {
MatcherMailetPair pair = pairs.get(i);
Matcher matcher = pair.getMatcher();
Mailet mailet = pair.getMailet();
-
+
String onMatchException = null;
MailetConfig mailetConfig = mailet.getMailetConfig();
-
+
if (mailetConfig instanceof MailetConfigImpl) {
onMatchException = ((MailetConfigImpl) mailetConfig).getInitAttribute("onMatchException");
}
-
+
CamelProcessor mailetProccessor = new CamelProcessor(mailet, logger, CamelMailetProcessor.this);
// Store the matcher to use for splitter in properties
- processorDef
- .setProperty(MatcherSplitter.MATCHER_PROPERTY, constant(matcher)).setProperty(MatcherSplitter.ON_MATCH_EXCEPTION_PROPERTY, constant(onMatchException)).setProperty(MatcherSplitter.MAILETCONTAINER_PROPERTY, constant(CamelMailetProcessor.this))
-
- // do splitting of the mail based on the stored matcher
- .split().method(MatcherSplitter.class).aggregationStrategy(aggr).parallelProcessing()
-
- .choice().when(new MatcherMatch()).process(mailetProccessor).end()
-
- .choice().when(new MailStateEquals(Mail.GHOST)).process(disposeProcessor).stop().otherwise().process(removePropsProcessor).end()
+ processorDef.setProperty(MatcherSplitter.MATCHER_PROPERTY, constant(matcher)).setProperty(MatcherSplitter.ON_MATCH_EXCEPTION_PROPERTY, constant(onMatchException)).setProperty(MatcherSplitter.MAILETCONTAINER_PROPERTY, constant(CamelMailetProcessor.this))
+
+ // do splitting of the mail based on the stored matcher
+ .split().method(MatcherSplitter.class).aggregationStrategy(aggr).parallelProcessing()
+
+ .choice().when(new MatcherMatch()).process(mailetProccessor).end()
- .choice().when(new MailStateNotEquals(state)).process(stateChangedProcessor).process(completeProcessor).stop().end();
+ .choice().when(new MailStateEquals(Mail.GHOST)).process(disposeProcessor).stop().otherwise().process(removePropsProcessor).end()
+
+ .choice().when(new MailStateNotEquals(state)).process(stateChangedProcessor).process(completeProcessor).stop().end();
}
-
-
-
-
Processor terminatingMailetProcessor = new CamelProcessor(new TerminatingMailet(), getLogger(), CamelMailetProcessor.this);
-
processorDef
- // start choice
- .choice()
-
- // when the mail state did not change till yet ( the end of the route) we need to call the TerminatingMailet to
- // make sure we don't fall into a endless loop
- .when(new MailStateEquals(state)).process(terminatingMailetProcessor).stop()
-
-
- // dispose when needed
- .when(new MailStateEquals(Mail.GHOST)).process(disposeProcessor).stop()
-
- // this container is complete
- .otherwise().process(completeProcessor).stop();
-
-
- }
+ // start choice
+ .choice()
+
+ // when the mail state did not change till yet ( the end of
+ // the route) we need to call the TerminatingMailet to
+ // make sure we don't fall into a endless loop
+ .when(new MailStateEquals(state)).process(terminatingMailetProcessor).stop()
-
+ // dispose when needed
+ .when(new MailStateEquals(Mail.GHOST)).process(disposeProcessor).stop()
+
+ // this container is complete
+ .otherwise().process(completeProcessor).stop();
+
+ }
private final class RemovePropertiesProcessor implements Processor {
@@ -213,29 +204,25 @@ public class CamelMailetProcessor extend
exchange.removeProperty(MatcherSplitter.MATCHER_PROPERTY);
}
}
-
-
private final class CompleteProcessor implements Processor {
-
+
public void process(Exchange ex) throws Exception {
getLogger().debug("End of mailetprocessor for state " + getState() + " reached");
ex.setProperty(Exchange.ROUTE_STOP, true);
}
}
-
+
private final class StateChangedProcessor implements Processor {
public void process(Exchange arg0) throws Exception {
Mail mail = arg0.getIn().getBody(Mail.class);
toProcessor(mail);
-
+
}
-
- }
-
- }
+ }
+ }
}
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java Mon Apr 4 16:36:42 2011
@@ -35,14 +35,13 @@ import org.slf4j.Logger;
/**
* Mailet wrapper which execute a Mailet in a Processor
- *
*/
-public class CamelProcessor implements Processor{
+public class CamelProcessor implements Processor {
private Mailet mailet;
private Logger logger;
private CamelMailetProcessor processor;
-
+
/**
* Mailet to call on process
*
@@ -53,7 +52,7 @@ public class CamelProcessor implements P
this.logger = logger;
this.processor = processor;
}
-
+
/**
* Call the wrapped mailet for the exchange
*/
@@ -63,7 +62,7 @@ public class CamelProcessor implements P
long start = System.currentTimeMillis();
MessagingException ex = null;
try {
- mailet.service(mail);
+ mailet.service(mail);
} catch (MessagingException me) {
ex = me;
String onMailetException = null;
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/DisposeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/DisposeProcessor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/DisposeProcessor.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/DisposeProcessor.java Mon Apr 4 16:36:42 2011
@@ -26,20 +26,19 @@ import org.apache.mailet.Mail;
/**
* Processor which dispose body object if needed
- *
- *
*/
-public class DisposeProcessor implements Processor{
+public class DisposeProcessor implements Processor {
/*
* (non-Javadoc)
+ *
* @see org.apache.camel.Processor#process(org.apache.camel.Exchange)
*/
public void process(Exchange arg0) throws Exception {
Mail mail = arg0.getIn().getBody(Mail.class);
LifecycleUtil.dispose(mail.getMessage());
LifecycleUtil.dispose(mail);
-
+
// stop routing
arg0.setProperty(Exchange.ROUTE_STOP, true);
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java Mon Apr 4 16:36:42 2011
@@ -61,9 +61,7 @@ import org.slf4j.Logger;
public abstract class JamesMailetContext implements MailetContext, LogEnabled, Configurable {
- /**
- * A hash table of server attributes These are the MailetContext attributes
- */
+ /** A hash table of server attributes These are the MailetContext attributes */
private Hashtable<String, Object> attributes = new Hashtable<String, Object>();
protected DNSService dns;
@@ -76,15 +74,12 @@ public abstract class JamesMailetContext
private DomainList domains;
private MailAddress postmaster;
-
-
- @Resource(name="mailprocessor")
+ @Resource(name = "mailprocessor")
public void setMailProcessor(MailProcessor processorList) {
this.processorList = processorList;
}
-
-
+
@Resource(name = "dnsservice")
public void setDNSService(DNSService dns) {
this.dns = dns;
@@ -94,15 +89,12 @@ public abstract class JamesMailetContext
public void setUsersRepository(UsersRepository localusers) {
this.localusers = localusers;
}
-
-
- @Resource(name="domainlist")
+ @Resource(name = "domainlist")
public void setDomainList(DomainList domains) {
this.domains = domains;
}
-
-
+
/**
* @see org.apache.mailet.MailetContext#getMailServers(String)
*/
@@ -163,28 +155,34 @@ public abstract class JamesMailetContext
}
/**
+ * <p>
* This generates a response to the Return-Path address, or the address of
* the message's sender if the Return-Path is not available. Note that this
* is different than a mail-client's reply, which would use the Reply-To or
* From header.
- *
+ * </p>
+ * <p>
* Bounced messages are attached in their entirety (headers and content) and
* the resulting MIME part type is "message/rfc822".
- *
+ * </p>
+ * <p>
* The attachment to the subject of the original message (or "No Subject" if
* there is no subject in the original message)
- *
+ * </p>
+ * <p>
* There are outstanding issues with this implementation revolving around
* handling of the return-path header.
- *
+ * </p>
+ * <p>
* MIME layout of the bounce message:
- *
+ * </p>
+ * <p>
* multipart (mixed)/ contentPartRoot (body) = mpContent (alternative)/ part
* (body) = message part (body) = original
+ * </p>
*
* @see org.apache.mailet.MailetContext#bounce(Mail, String, MailAddress)
*/
-
public void bounce(Mail mail, String message, MailAddress bouncer) throws MessagingException {
if (mail.getSender() == null) {
if (log.isInfoEnabled())
@@ -248,7 +246,7 @@ public abstract class JamesMailetContext
try {
return isLocalEmail(new MailAddress(name, domains.getDefaultDomain()));
} catch (DomainListException e) {
- log("Unable to access DomainList",e);
+ log("Unable to access DomainList", e);
return false;
}
} else {
@@ -276,7 +274,7 @@ public abstract class JamesMailetContext
} catch (UsersRepositoryException e) {
log("Unable to access UsersRepository", e);
-
+
}
return false;
}
@@ -353,7 +351,9 @@ public abstract class JamesMailetContext
/*
* (non-Javadoc)
- * @see org.apache.mailet.MailetContext#log(java.lang.String, java.lang.Throwable)
+ *
+ * @see org.apache.mailet.MailetContext#log(java.lang.String,
+ * java.lang.Throwable)
*/
public void log(String arg0, Throwable arg1) {
log.info(arg0, arg1);
@@ -361,22 +361,23 @@ public abstract class JamesMailetContext
/**
* Place a mail on the spool for processing
- *
- * @param message the message to send
- *
- * @throws MessagingException if an exception is caught while placing the mail
- * on the spool
+ *
+ * @param message
+ * the message to send
+ *
+ * @throws MessagingException
+ * if an exception is caught while placing the mail on the spool
*/
public void sendMail(MimeMessage message) throws MessagingException {
- MailAddress sender = new MailAddress((InternetAddress)message.getFrom()[0]);
+ MailAddress sender = new MailAddress((InternetAddress) message.getFrom()[0]);
Collection<MailAddress> recipients = new HashSet<MailAddress>();
Address addresses[] = message.getAllRecipients();
if (addresses != null) {
for (int i = 0; i < addresses.length; i++) {
// Javamail treats the "newsgroups:" header field as a
// recipient, so we want to filter those out.
- if ( addresses[i] instanceof InternetAddress ) {
- recipients.add(new MailAddress((InternetAddress)addresses[i]));
+ if (addresses[i] instanceof InternetAddress) {
+ recipients.add(new MailAddress((InternetAddress) addresses[i]));
}
}
}
@@ -385,18 +386,21 @@ public abstract class JamesMailetContext
/*
* (non-Javadoc)
- * @see org.apache.mailet.MailetContext#sendMail(org.apache.mailet.MailAddress, java.util.Collection, javax.mail.internet.MimeMessage)
+ *
+ * @see
+ * org.apache.mailet.MailetContext#sendMail(org.apache.mailet.MailAddress,
+ * java.util.Collection, javax.mail.internet.MimeMessage)
*/
@SuppressWarnings("unchecked")
- public void sendMail(MailAddress sender, Collection recipients, MimeMessage message)
- throws MessagingException {
- sendMail(sender, recipients, message, Mail.DEFAULT);
+ public void sendMail(MailAddress sender, Collection recipients, MimeMessage message) throws MessagingException {
+ sendMail(sender, recipients, message, Mail.DEFAULT);
}
/*
* TODO: Should we use the MailProcessorList or the MailQueue here ?
*
* (non-Javadoc)
+ *
* @see org.apache.mailet.MailetContext#sendMail(org.apache.mailet.Mail)
*/
public void sendMail(Mail mail) throws MessagingException {
@@ -405,10 +409,13 @@ public abstract class JamesMailetContext
/*
* (non-Javadoc)
- * @see org.apache.mailet.MailetContext#sendMail(org.apache.mailet.MailAddress, java.util.Collection, javax.mail.internet.MimeMessage, java.lang.String)
+ *
+ * @see
+ * org.apache.mailet.MailetContext#sendMail(org.apache.mailet.MailAddress,
+ * java.util.Collection, javax.mail.internet.MimeMessage, java.lang.String)
*/
@SuppressWarnings("unchecked")
- public void sendMail(MailAddress sender, Collection recipients, MimeMessage message, String state) throws MessagingException {
+ public void sendMail(MailAddress sender, Collection recipients, MimeMessage message, String state) throws MessagingException {
MailImpl mail = new MailImpl(MailImpl.getId(), sender, recipients, message);
try {
mail.setState(state);
@@ -419,18 +426,20 @@ public abstract class JamesMailetContext
}
/**
+ * <p>
* This method has been moved to LocalDelivery (the only client of the
* method). Now we can safely remove it from the Mailet API and from this
* implementation of MailetContext.
- *
+ * </p>
+ * <p>
* The local field localDeliveryMailet will be removed when we remove the
* storeMail method.
+ * </p>
*
* @deprecated since 2.2.0 look at the LocalDelivery code to find out how to
* do the local delivery.
* @see org.apache.mailet.MailetContext#storeMail(org.apache.mailet.MailAddress,
* org.apache.mailet.MailAddress, javax.mail.internet.MimeMessage)
- *
*/
public void storeMail(MailAddress sender, MailAddress recipient, MimeMessage msg) throws MessagingException {
throw new UnsupportedOperationException("Was removed");
@@ -438,13 +447,13 @@ public abstract class JamesMailetContext
/*
* (non-Javadoc)
+ *
* @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
*/
public void setLog(Logger log) {
this.log = log;
}
-
/*
*
*/
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateEquals.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateEquals.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateEquals.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateEquals.java Mon Apr 4 16:36:42 2011
@@ -24,18 +24,18 @@ import org.apache.mailet.Mail;
/**
* Check the the Mail state is Equals to the one give on the constructor
- *
- *
*/
-public class MailStateEquals implements Predicate{
+public class MailStateEquals implements Predicate {
private String state;
+
public MailStateEquals(String state) {
this.state = state;
}
-
+
/*
* (non-Javadoc)
+ *
* @see org.apache.camel.Predicate#matches(org.apache.camel.Exchange)
*/
public boolean matches(Exchange ex) {
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateNotEquals.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateNotEquals.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateNotEquals.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailStateNotEquals.java Mon Apr 4 16:36:42 2011
@@ -24,18 +24,18 @@ import org.apache.mailet.Mail;
/**
* Check if the Mail state is NOT equal to the one given on the constructor
- *
- *
*/
-public class MailStateNotEquals implements Predicate{
+public class MailStateNotEquals implements Predicate {
private String state;
+
public MailStateNotEquals(String state) {
this.state = state;
}
-
+
/*
* (non-Javadoc)
+ *
* @see org.apache.camel.Predicate#matches(org.apache.camel.Exchange)
*/
public boolean matches(Exchange ex) {
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherMatch.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherMatch.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherMatch.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherMatch.java Mon Apr 4 16:36:42 2011
@@ -24,21 +24,21 @@ import org.apache.camel.Predicate;
import org.apache.mailet.Mail;
/**
- * Check if the previous called Matcher matched. This is done be
- * checking for the present of MatcherSplitter.MATCHER_MATCHED_ATTRIBUTE attribute in the Mail
- *
- *
+ * Check if the previous called Matcher matched. This is done be checking for
+ * the present of MatcherSplitter.MATCHER_MATCHED_ATTRIBUTE attribute in the
+ * Mail
*/
-public class MatcherMatch implements Predicate{
+public class MatcherMatch implements Predicate {
/*
* (non-Javadoc)
+ *
* @see org.apache.camel.Predicate#matches(org.apache.camel.Exchange)
*/
public boolean matches(Exchange arg0) {
- Mail m = arg0.getIn().getBody(Mail.class);
+ Mail m = arg0.getIn().getBody(Mail.class);
if (m.removeAttribute(MatcherSplitter.MATCHER_MATCHED_ATTRIBUTE) != null) {
- return true;
+ return true;
}
return false;
}
Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java Mon Apr 4 16:36:42 2011
@@ -40,50 +40,44 @@ import org.apache.mailet.Matcher;
import org.slf4j.Logger;
/**
- * A Splitter for use with Camel to split the MailMessage into many pieces if needed. This is done
- * by use a Matcher.
- *
- *
+ * A Splitter for use with Camel to split the MailMessage into many pieces if
+ * needed. This is done by use a Matcher.
*/
@InOnly
public class MatcherSplitter {
-
- /**
- * Headername which is used to indicate that the matcher matched
- */
+
+ /** Headername which is used to indicate that the matcher matched */
public final static String MATCHER_MATCHED_ATTRIBUTE = "matched";
-
- /**
- * Headername under which the matcher is stored
- */
+
+ /** Headername under which the matcher is stored */
public final static String MATCHER_PROPERTY = "matcher";
public final static String ON_MATCH_EXCEPTION_PROPERTY = "onMatchException";
-
+
public final static String LOGGER_PROPERTY = "logger";
-
- public final static String MAILETCONTAINER_PROPERTY = "container";
+ public final static String MAILETCONTAINER_PROPERTY = "container";
-
/**
- * Generate a List of MailMessage instances for the give @Body. This is done by using the given Matcher to see if we need more then one instance of the
- * MailMessage
+ * Generate a List of MailMessage instances for the give @Body. This is done
+ * by using the given Matcher to see if we need more then one instance of
+ * the MailMessage
*
- * @param matcher Matcher to use for splitting
- * @param mail Mail which is stored in the @Body of the MailMessage
+ * @param matcher
+ * Matcher to use for splitting
+ * @param mail
+ * Mail which is stored in the @Body of the MailMessage
* @return mailMessageList
* @throws MessagingException
*/
@SuppressWarnings("unchecked")
@Handler
- public List<Mail> split(@Property(MATCHER_PROPERTY) Matcher matcher, @Property(ON_MATCH_EXCEPTION_PROPERTY) String onMatchException, @Property(LOGGER_PROPERTY) Logger logger, @Property(MAILETCONTAINER_PROPERTY) CamelMailetProcessor container,
- @Body Mail mail) throws MessagingException {
+ public List<Mail> split(@Property(MATCHER_PROPERTY) Matcher matcher, @Property(ON_MATCH_EXCEPTION_PROPERTY) String onMatchException, @Property(LOGGER_PROPERTY) Logger logger, @Property(MAILETCONTAINER_PROPERTY) CamelMailetProcessor container, @Body Mail mail) throws MessagingException {
Collection<MailAddress> matchedRcpts = null;
Collection<MailAddress> origRcpts = new ArrayList<MailAddress>(mail.getRecipients());
long start = System.currentTimeMillis();
MessagingException ex = null;
-
+
try {
List<Mail> mails = new ArrayList<Mail>();
boolean fullMatch = false;
@@ -168,7 +162,7 @@ public class MatcherSplitter {
MailetProcessorListener listener = listeners.get(i);
// need to check if its null or empty!
if (matchedRcpts == null || matchedRcpts.isEmpty()) {
- listener.afterMatcher(matcher, mail.getName(), origRcpts, null, complete, ex);
+ listener.afterMatcher(matcher, mail.getName(), origRcpts, null, complete, ex);
} else {
listener.afterMatcher(matcher, mail.getName(), origRcpts, matchedRcpts, complete, ex);
}
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailProcessor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailProcessor.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailProcessor.java Mon Apr 4 16:36:42 2011
@@ -17,42 +17,45 @@
* under the License. *
****************************************************************/
-
-
package org.apache.james.mailetcontainer.api;
import org.apache.mailet.Mail;
/**
- *
- *
- * The <code>service</code> perform all needed work
- * on the Mail object. Whatever remains at the end of the service is considered
- * to need futher processing and will go to the next Mailet if there is one
- * configured or will go to the error processor if not.
- * Setting a Mail state (setState(String)) to Mail.GHOST or cleaning its recipient
- * list has the same meaning that s no more processing is needed.
+ * The <code>service</code> perform all needed work on the Mail object. Whatever
+ * remains at the end of the service is considered to need futher processing and
+ * will go to the next Mailet if there is one configured or will go to the error
+ * processor if not. Setting a Mail state (setState(String)) to Mail.GHOST or
+ * cleaning its recipient list has the same meaning that s no more processing is
+ * needed.
*/
public interface MailProcessor {
/**
- * Called by the mailet container to allow the mailet to process to
- * a message.
+ * <p>
+ * Called by the mailet container to allow the mailet to process to a
+ * message.
+ * </p>
* <p>
* This method is only called after the mailet's init() method has completed
* successfully.
+ * </p>
* <p>
- * Mailets typically run inside multithreaded mailet containers that can handle
- * multiple requests concurrently. Developers must be aware to synchronize access
- * to any shared resources such as files, network connections, as well as the
- * mailet's class and instance variables. More information on multithreaded
- * programming in Java is available in <a href="http://java.sun.com/Series/Tutorial/java/threads/multithreaded.html">the
+ * Mailets typically run inside multithreaded mailet containers that can
+ * handle multiple requests concurrently. Developers must be aware to
+ * synchronize access to any shared resources such as files, network
+ * connections, as well as the mailet's class and instance variables. More
+ * information on multithreaded programming in Java is available in <a href=
+ * "http://java.sun.com/Series/Tutorial/java/threads/multithreaded.html">the
* Java tutorial on multi-threaded programming</a>.
- *
- * @param mail - the Mail object that contains the message and routing information
- * @throws javax.mail.MessagingException - if a message or address parsing exception occurs or
- * an exception that interferes with the mailet's normal operation
+ * </p>
+ *
+ * @param mail
+ * - the Mail object that contains the message and routing
+ * information
+ * @throws javax.mail.MessagingException
+ * - if a message or address parsing exception occurs or an
+ * exception that interferes with the mailet's normal operation
*/
void service(Mail mail) throws javax.mail.MessagingException;
-
-}
+}
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MailetLoader.java Mon Apr 4 16:36:42 2011
@@ -17,8 +17,6 @@
* under the License. *
****************************************************************/
-
-
package org.apache.james.mailetcontainer.api;
import org.apache.mailet.Mailet;
@@ -27,20 +25,20 @@ import org.apache.mailet.MailetConfig;
import javax.mail.MessagingException;
/**
- * Implementations of this interface are responsible to create {@link Mailet} instances
- *
- *
+ * Implementations of this interface are responsible to create {@link Mailet}
+ * instances
*/
public interface MailetLoader {
-
+
/**
- * Get a new {@link Mailet} instance for the given {@link MailetConfig}. The returned {@link Mailet} needs to
- * be fully initialized, so the returned instance is "read-to-use"
- *
+ * Get a new {@link Mailet} instance for the given {@link MailetConfig}. The
+ * returned {@link Mailet} needs to be fully initialized, so the returned
+ * instance is "read-to-use"
+ *
* @param config
- * @throws MessagingException if an error occurs
+ * @throws MessagingException
+ * if an error occurs
*/
- Mailet getMailet(MailetConfig config)
- throws MessagingException;
+ Mailet getMailet(MailetConfig config) throws MessagingException;
}
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/MatcherLoader.java Mon Apr 4 16:36:42 2011
@@ -17,8 +17,6 @@
* under the License. *
****************************************************************/
-
-
package org.apache.james.mailetcontainer.api;
import org.apache.mailet.Matcher;
@@ -27,18 +25,19 @@ import org.apache.mailet.MatcherConfig;
import javax.mail.MessagingException;
/**
- * Implementations of this interface are responsible for loading {@link Matcher} instances
- *
- *
+ * Implementations of this interface are responsible for loading {@link Matcher}
+ * instances
*/
public interface MatcherLoader {
/**
- * Get a new {@link Matcher} for the given {@link MatcherConfig}. The returned {@link Matcher} needs to
- * be fully initialized, so the returned instance is "read-to-use"
- *
+ * Get a new {@link Matcher} for the given {@link MatcherConfig}. The
+ * returned {@link Matcher} needs to be fully initialized, so the returned
+ * instance is "read-to-use"
+ *
* @param config
- * @throws MessagingException if an error occurs
+ * @throws MessagingException
+ * if an error occurs
*/
Matcher getMatcher(MatcherConfig config) throws MessagingException;
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailProcessorManagementMBean.java Mon Apr 4 16:36:42 2011
@@ -20,52 +20,51 @@
package org.apache.james.mailetcontainer.api.jmx;
/**
- *
* MBean for Mail processing components
- *
*/
public interface MailProcessorManagementMBean {
/**
- * Return the count of handled mail
+ * Return the count of handled mail
*
* @return handledCount
*/
long getHandledMailCount();
-
+
/**
* Return the time in ms of the fastest processing
*
* @return fastest
*/
long getFastestProcessing();
-
+
/**
* Return the time in ms of the slowest processing
*
* @return slowest
*/
long getSlowestProcessing();
-
+
/**
- * Return the count of how many time the processing was done without and error
+ * Return the count of how many time the processing was done without and
+ * error
*
* @return successCount
*/
long getSuccessCount();
-
+
/**
* Return the count of how many times an error was detected while processing
*
* @return errorCount
*/
long getErrorCount();
-
+
/**
* Return the time in ms of the last processing
*
* @return last
*/
long getLastProcessing();
-
+
}
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailSpoolerMBean.java Mon Apr 4 16:36:42 2011
@@ -19,9 +19,7 @@
package org.apache.james.mailetcontainer.api.jmx;
/**
- * JMX MBean for MailSpooler
- *
- *
+ * JMX MBean for MailSpooler
*/
public interface MailSpoolerMBean {
@@ -31,12 +29,11 @@ public interface MailSpoolerMBean {
* @return threadCount
*/
int getThreadCount();
-
+
/**
*
* @return
*/
int getCurrentSpoolCount();
-
}
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MailetManagementMBean.java Mon Apr 4 16:36:42 2011
@@ -22,15 +22,15 @@ package org.apache.james.mailetcontainer
/**
* management interface for one Mailet instance
*/
-public interface MailetManagementMBean extends MailProcessorManagementMBean{
-
+public interface MailetManagementMBean extends MailProcessorManagementMBean {
+
/**
* Return the name of the mailet
*
* @return mailet
*/
String getMailetName();
-
+
/**
* Return the parameters which are configured for the mailet
*
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/api/jmx/MatcherManagementMBean.java Mon Apr 4 16:36:42 2011
@@ -22,29 +22,29 @@ package org.apache.james.mailetcontainer
/**
* management interface for one Matcher instance
*/
-public interface MatcherManagementMBean extends MailProcessorManagementMBean{
-
+public interface MatcherManagementMBean extends MailProcessorManagementMBean {
+
/**
* Return the name of the Matcher
*
* @return name
*/
String getMatcherName();
-
+
/**
* Return the matcher condition
*
* @return condition
*/
String getMatcherCondition();
-
+
/**
* Return the count of how many times the Matcher matched
*
* @return matched
*/
long getMatchedCount();
-
+
/**
* Return the count of how many times the Matcher not matches
*
Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java Mon Apr 4 16:36:42 2011
@@ -40,49 +40,47 @@ import org.apache.mailet.Mail;
import org.slf4j.Logger;
/**
- * Abstract base class for {@link CompositeProcessor} which service the {@link Mail} with a {@link CamelProcessor} instances
- *
- *
+ * Abstract base class for {@link CompositeProcessor} which service the
+ * {@link Mail} with a {@link CamelProcessor} instances
*/
-public abstract class AbstractStateCompositeProcessor implements MailProcessor, Configurable, LogEnabled{
+public abstract class AbstractStateCompositeProcessor implements MailProcessor, Configurable, LogEnabled {
private List<CompositeProcessorListener> listeners = Collections.synchronizedList(new ArrayList<CompositeProcessorListener>());
- private final Map<String,MailProcessor> processors = new HashMap<String,MailProcessor>();
+ private final Map<String, MailProcessor> processors = new HashMap<String, MailProcessor>();
protected Logger logger;
protected HierarchicalConfiguration config;
private JMXStateCompositeProcessorListener jmxListener;
private boolean enableJmx = true;
-
+
/*
* (non-Javadoc)
+ *
* @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
*/
public void setLog(Logger log) {
this.logger = log;
}
-
public void addListener(CompositeProcessorListener listener) {
listeners.add(listener);
}
-
public List<CompositeProcessorListener> getListeners() {
return listeners;
}
-
public void removeListener(CompositeProcessorListener listener) {
listeners.remove(listener);
}
-
-
/*
* (non-Javadoc)
- * @see org.apache.james.lifecycle.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+ *
+ * @see
+ * org.apache.james.lifecycle.Configurable#configure(org.apache.commons.
+ * configuration.HierarchicalConfiguration)
*/
public void configure(HierarchicalConfiguration config) throws ConfigurationException {
this.config = config;
@@ -90,32 +88,29 @@ public abstract class AbstractStateCompo
}
-
-
/**
- * Service the given {@link Mail} by hand the {@link Mail} over the {@link MailProcessor} which is responsible for the {@link Mail#getState()}
+ * Service the given {@link Mail} by hand the {@link Mail} over the
+ * {@link MailProcessor} which is responsible for the
+ * {@link Mail#getState()}
*/
public void service(Mail mail) throws MessagingException {
long start = System.currentTimeMillis();
MessagingException ex = null;
MailProcessor processor = getProcessor(mail.getState());
-
+
if (processor != null) {
logger.debug("Call MailProcessor " + mail.getState());
try {
processor.service(mail);
-
+
if (Mail.GHOST.equals(mail.getState())) {
LifecycleUtil.dispose(mail);
}
/*
- // check the mail needs further processing
- if (Mail.GHOST.equalsIgnoreCase(mail.getState()) == false) {
- service(mail);
- } else {
- LifecycleUtil.dispose(mail);
- }
-*/
+ * // check the mail needs further processing if
+ * (Mail.GHOST.equalsIgnoreCase(mail.getState()) == false) {
+ * service(mail); } else { LifecycleUtil.dispose(mail); }
+ */
} catch (MessagingException e) {
ex = e;
throw e;
@@ -123,9 +118,9 @@ public abstract class AbstractStateCompo
long end = System.currentTimeMillis() - start;
for (int i = 0; i < listeners.size(); i++) {
CompositeProcessorListener listener = listeners.get(i);
-
+
listener.afterProcessor(processor, mail.getName(), end, ex);
- }
+ }
}
} else {
throw new MessagingException("No processor found for mail " + mail.getName() + " with state " + mail.getState());
@@ -142,15 +137,13 @@ public abstract class AbstractStateCompo
return processors.get(state);
}
-
-
-
public String[] getProcessorStates() {
return processors.keySet().toArray(new String[processors.size()]);
}
/**
- * Check if all needed Processors are configured and if not throw a {@link ConfigurationException}
+ * Check if all needed Processors are configured and if not throw a
+ * {@link ConfigurationException}
*
* @throws ConfigurationException
*/
@@ -158,14 +151,14 @@ public abstract class AbstractStateCompo
boolean errorProcessorFound = false;
boolean rootProcessorFound = false;
Iterator<String> names = processors.keySet().iterator();
- while(names.hasNext()) {
+ while (names.hasNext()) {
String name = names.next();
if (name.equals(Mail.DEFAULT)) {
rootProcessorFound = true;
} else if (name.equals(Mail.ERROR)) {
errorProcessorFound = true;
}
-
+
if (errorProcessorFound && rootProcessorFound) {
return;
}
@@ -176,7 +169,7 @@ public abstract class AbstractStateCompo
throw new ConfigurationException("You need to configure a Processor with name " + Mail.DEFAULT);
}
}
-
+
@SuppressWarnings("unchecked")
@PostConstruct
public void init() throws Exception {
@@ -184,24 +177,24 @@ public abstract class AbstractStateCompo
for (int i = 0; i < processorConfs.size(); i++) {
final HierarchicalConfiguration processorConf = processorConfs.get(i);
String processorName = processorConf.getString("[@state]");
-
- // if the "child" processor has no jmx config we just use the one of the composite
+
+ // if the "child" processor has no jmx config we just use the one of
+ // the composite
if (processorConf.containsKey("[@enableJmx]") == false) {
processorConf.addProperty("[@enableJmx]", enableJmx);
}
processors.put(processorName, createMailProcessor(processorName, processorConf));
}
-
-
+
if (enableJmx) {
this.jmxListener = new JMXStateCompositeProcessorListener(this);
addListener(jmxListener);
}
-
+
// check if all needed processors are configured
checkProcessors();
}
-
+
@PreDestroy
public void dispose() {
String names[] = getProcessorStates();
@@ -212,14 +205,14 @@ public abstract class AbstractStateCompo
}
}
-
+
if (jmxListener != null) {
jmxListener.dispose();
}
}
-
+
/**
- * Create a new {@link MailProcessor}
+ * Create a new {@link MailProcessor}
*
* @param state
* @param config
@@ -227,21 +220,23 @@ public abstract class AbstractStateCompo
* @throws Exception
*/
protected abstract MailProcessor createMailProcessor(String state, HierarchicalConfiguration config) throws Exception;
-
-
+
/**
- * A Listener which will get called after {@link CompositeProcessor#service(org.apache.mailet.Mail)} was called
- *
+ * A Listener which will get called after
+ * {@link CompositeProcessor#service(org.apache.mailet.Mail)} was called
*/
public interface CompositeProcessorListener {
/**
- * Get called after the processing via a {@link MailProcessor} was complete
+ * Get called after the processing via a {@link MailProcessor} was
+ * complete
*
* @param processor
* @param mailName
- * @param processTime in ms
- * @param e or null if no exception was thrown
+ * @param processTime
+ * in ms
+ * @param e
+ * or null if no exception was thrown
*/
void afterProcessor(MailProcessor processor, String mailName, long processTime, MessagingException e);
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org