james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1052049 - in /james/server/trunk: container-spring/src/main/config/james/ container-spring/src/main/config/james/context/ mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/ mailetcontainer-camel/src/main/java/org/a...
Date Wed, 22 Dec 2010 19:48:10 GMT
Author: norman
Date: Wed Dec 22 19:48:09 2010
New Revision: 1052049

URL: http://svn.apache.org/viewvc?rev=1052049&view=rev
Log:
Some more renaming to make sure the class names explain what they do. Also alter the mailetcontainer.xml
to be easier to understand. I think I'm done now with mailercontainer stuff

Added:
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
      - copied, changed from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
      - copied, changed from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java
      - copied, changed from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java
      - copied, changed from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java
Removed:
    james/server/trunk/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/jmx/ProcessorManagementMBean.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java
Modified:
    james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
    james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java

Modified: james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml?rev=1052049&r1=1052048&r2=1052049&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
(original)
+++ james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
Wed Dec 22 19:48:09 2010
@@ -101,7 +101,7 @@
     <bean id="configurationProvider" class="org.apache.james.container.spring.provider.configuration.ConfigurationProviderImpl">
         <property name="configurationMappings">
             <map>
-                <entry key="mailprocessor" value="mailetcontainer.states"/>
+                <entry key="mailprocessor" value="mailetcontainer.processors"/>
                 <entry key="mailspooler" value="mailetcontainer.spooler"/>
                 <entry key="mailetcontext" value="mailetcontainer.context"/>
              </map>

Modified: james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml?rev=1052049&r1=1052048&r2=1052049&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml (original)
+++ james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml Wed Dec
22 19:48:09 2010
@@ -30,8 +30,8 @@
     <threads> 20 </threads>
   </spooler>
     
-  <states>
-    <state name="root" enableJmx="true">
+  <processors>
+    <processor state="root" enableJmx="true">
       <mailet match="All" class="PostmasterAlias"/>
       <mailet match="RelayLimit=30" class="Null"/>
       <mailet match="SMTPAuthSuccessful" class="ToProcessor">
@@ -44,9 +44,9 @@
        <mailet match="All" class="ToProcessor">
         <processor>transport</processor>
        </mailet>
-     </state>
+     </processor>
 
-    <state name="transport" enableJmx="true">
+    <processor state="transport" enableJmx="true">
       <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
         <name>X-UserIsAuth</name>
         <value>true</value>
@@ -73,36 +73,36 @@
         <sendpartial>true</sendpartial>
         <bounceProcessor>bounces</bounceProcessor>
       </mailet>
-    </state>
+    </processor>
 
-    <state name="error" enableJmx="true">
+    <processor state="error" enableJmx="true">
       <mailet match="All" class="ToRepository">
         <repositoryPath>file://var/mail/error/</repositoryPath>
       </mailet>
-    </state>
+    </processor>
 
-    <state name="spam" enableJmx="true">
+    <processor state="spam" enableJmx="true">
       <mailet match="All" class="ToRepository">
         <repositoryPath>file://var/mail/spam/</repositoryPath>
       </mailet>
-    </state>
+    </processor>
 
-    <state name="local-address-error" enableJmx="true">
+    <processor state="local-address-error" enableJmx="true">
       <mailet match="All" class="ToRepository">
         <repositoryPath>file://var/mail/address-error/</repositoryPath>
       </mailet>
-    </state>
+    </processor>
 
-    <state name="relay-denied" enableJmx="true">
+    <processor state="relay-denied" enableJmx="true">
       <mailet match="All" class="ToRepository">
         <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
       </mailet>
-    </state>
+    </processor>
 
-    <state name="bounces" enableJmx="true">
+    <processor state="bounces" enableJmx="true">
       <mailet match="All" class="DSNBounce">
         <passThrough>false</passThrough>
       </mailet>
-    </state>
-  </states>
+    </processor>
+  </processors>
 </mailetcontainer>

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=1052049&r1=1052048&r2=1052049&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
Wed Dec 22 19:48:09 2010
@@ -28,7 +28,7 @@ import org.apache.commons.configuration.
 import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.james.mailetcontainer.api.MailetLoader;
 import org.apache.james.mailetcontainer.api.MatcherLoader;
-import org.apache.james.mailetcontainer.lib.AbstractCompositeProcessor;
+import org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor;
 import org.apache.james.mailetcontainer.lib.matchers.CompositeMatcher;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
@@ -44,7 +44,7 @@ import org.apache.mailet.Matcher;
  * See JAMES-948 
  * 
  */
-public class CamelCompositeProcessor extends AbstractCompositeProcessor implements CamelContextAware{
+public class CamelCompositeProcessor extends AbstractStateCompositeProcessor implements CamelContextAware{
 
     private CamelContext camelContext;
     private MailetContext mailetContext;
@@ -114,19 +114,6 @@ public class CamelCompositeProcessor ext
         container.init();
         return container;
     }
-
-    @Override
-    public void dispose() {
-        String names[] = getProcessorNames();
-        for (int i = 0; i < names.length; i++) {
-            MailProcessor processor = getProcessor(names[i]);
-            if (processor instanceof CamelMailetProcessor) {
-                ((CamelMailetProcessor) processor).destroy();
-            }
-
-        }
-        super.dispose();
-    }
  
 
 }

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=1052049&r1=1052048&r2=1052049&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
Wed Dec 22 19:48:09 2010
@@ -33,7 +33,7 @@ import org.apache.camel.builder.RouteBui
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
 import org.apache.commons.logging.Log;
-import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor;
+import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor;
 import org.apache.james.mailetcontainer.lib.MailetConfigImpl;
 import org.apache.james.mailetcontainer.lib.MatcherMailetPair;
 import org.apache.mailet.Mail;
@@ -43,10 +43,10 @@ import org.apache.mailet.Matcher;
 
 
 /**
- * {@link AbstractMailetProcessor} 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 AbstractMailetProcessor implements CamelContextAware{
+public class CamelMailetProcessor extends AbstractStateMailetProcessor implements CamelContextAware{
 
     private CamelContext context;
 
@@ -97,7 +97,7 @@ public class CamelMailetProcessor extend
      * @return endPoint
      */
     protected String getEndpoint() {
-        return "direct:processor." + getName();
+        return "direct:processor." + getState();
     }
     
     
@@ -140,10 +140,10 @@ public class CamelMailetProcessor extend
             Processor disposeProcessor = new DisposeProcessor();
             Processor removePropsProcessor = new RemovePropertiesProcessor();
             Processor completeProcessor = new CompleteProcessor();
-            String name = getName();
+            String state = getState();
             Log logger = getLogger();
 
-            RouteDefinition processorDef = from(getEndpoint()).routeId(name).inOnly()
+            RouteDefinition processorDef = from(getEndpoint()).routeId(state).inOnly()
             // store the logger in properties
             .setProperty(MatcherSplitter.LOGGER_PROPERTY, constant(getLogger()));
             
@@ -171,7 +171,7 @@ public class CamelMailetProcessor extend
                     
                     .choice().when(new MailStateEquals(Mail.GHOST)).process(disposeProcessor).stop().otherwise().process(removePropsProcessor).end()
 
-                    .choice().when(new MailStateNotEquals(name)).process(completeProcessor).stop().end();
+                    .choice().when(new MailStateNotEquals(state)).process(completeProcessor).stop().end();
             }
                 
           
@@ -187,7 +187,7 @@ public class CamelMailetProcessor extend
              
                 // 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(name)).process(terminatingMailetProcessor).stop()
+                .when(new MailStateEquals(state)).process(terminatingMailetProcessor).stop()
                 
                    
                 // dispose when needed
@@ -214,7 +214,7 @@ public class CamelMailetProcessor extend
         private final class CompleteProcessor implements Processor {
             
             public void process(Exchange ex) throws Exception {
-                getLogger().debug("End of mailetcontainer" + getName() + " reached");
+                getLogger().debug("End of mailetcontainer" + getState() + " reached");
                 ex.setProperty(Exchange.ROUTE_STOP, true);
             }
         }

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=1052049&r1=1052048&r2=1052049&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
Wed Dec 22 19:48:09 2010
@@ -26,7 +26,7 @@ import javax.mail.MessagingException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.commons.logging.Log;
-import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor.MailetProcessorListener;
+import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.MailetConfigImpl;
 import org.apache.james.mailetcontainer.lib.ProcessorUtil;
 import org.apache.mailet.Mail;
@@ -48,7 +48,7 @@ public class CamelProcessor implements P
      * 
      * @param mailet
      */
-    public CamelProcessor(Mailet mailet, Log logger, CamelMailetProcessor container) {
+    public CamelProcessor(Mailet mailet, Log logger, CamelMailetProcessor processor) {
         this.mailet = mailet;
         this.logger = logger;
         this.processor = processor;

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=1052049&r1=1052048&r2=1052049&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
Wed Dec 22 19:48:09 2010
@@ -33,7 +33,7 @@ import org.apache.camel.InOnly;
 import org.apache.camel.Property;
 import org.apache.commons.logging.Log;
 import org.apache.james.core.MailImpl;
-import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor.MailetProcessorListener;
+import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.ProcessorUtil;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;

Copied: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
(from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java?p2=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java&p1=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java&r1=1052035&r2=1052049&rev=1052049&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
Wed Dec 22 19:48:09 2010
@@ -36,8 +36,7 @@ import org.apache.james.lifecycle.api.Co
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.mailetcontainer.api.MailProcessor;
-import org.apache.james.mailetcontainer.api.jmx.ProcessorManagementMBean;
-import org.apache.james.mailetcontainer.lib.jmx.JMXCompositeMailProcessorListener;
+import org.apache.james.mailetcontainer.lib.jmx.JMXStateCompositeProcessorListener;
 import org.apache.mailet.Mail;
 
 /**
@@ -45,14 +44,14 @@ import org.apache.mailet.Mail;
  * 
  *
  */
-public abstract class AbstractCompositeProcessor implements MailProcessor, Configurable,
LogEnabled, ProcessorManagementMBean{
+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>();
     protected Log logger;
     protected HierarchicalConfiguration config;
 
-    private JMXCompositeMailProcessorListener jmxListener;
+    private JMXStateCompositeProcessorListener jmxListener;
     private boolean enableJmx = true;
     
     /*
@@ -130,22 +129,19 @@ public abstract class AbstractCompositeP
     }
 
     /**
-     * Return a {@link MailProcessor} for a given name
+     * Return a {@link MailProcessor} for a given state
      * 
      * @param name
      * @return processor
      */
-    public MailProcessor getProcessor(String name) {
-        return processors.get(name);
+    public MailProcessor getProcessor(String state) {
+        return processors.get(state);
     }
 
 
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MailProcessorList#getProcessorNames()
-     */
-    public String[] getProcessorNames() {
+
+    public String[] getProcessorStates() {
         return processors.keySet().toArray(new String[processors.size()]);
     }
 
@@ -180,10 +176,10 @@ public abstract class AbstractCompositeP
     @SuppressWarnings("unchecked")
     @PostConstruct
     public void init() throws Exception {
-        List<HierarchicalConfiguration> processorConfs = config.configurationsAt("state");
+        List<HierarchicalConfiguration> processorConfs = config.configurationsAt("processor");
         for (int i = 0; i < processorConfs.size(); i++) {
             final HierarchicalConfiguration processorConf = processorConfs.get(i);
-            String processorName = processorConf.getString("[@name]");
+            String processorName = processorConf.getString("[@state]");
             
             // if the "child" processor has no jmx config we just use the one of the composite
             if (processorConf.containsKey("[@enableJmx]") == false) {
@@ -194,7 +190,7 @@ public abstract class AbstractCompositeP
         
         
         if (enableJmx) {
-            this.jmxListener = new JMXCompositeMailProcessorListener(this);
+            this.jmxListener = new JMXStateCompositeProcessorListener(this);
             addListener(jmxListener);
         }
         
@@ -204,7 +200,15 @@ public abstract class AbstractCompositeP
     
     @PreDestroy
     public void dispose() {
+        String names[] = getProcessorStates();
+        for (int i = 0; i < names.length; i++) {
+            MailProcessor processor = getProcessor(names[i]);
+            if (processor instanceof AbstractStateMailetProcessor) {
+                ((AbstractStateMailetProcessor) processor).destroy();
+            }
 
+        }
+        
         if (jmxListener != null) {
             jmxListener.dispose();
         }
@@ -213,12 +217,12 @@ public abstract class AbstractCompositeP
     /**
      * Create a new {@link MailProcessor} 
      * 
-     * @param name
+     * @param state
      * @param config
      * @return container
      * @throws Exception
      */
-    protected abstract MailProcessor createMailProcessor(String name, HierarchicalConfiguration
config) throws Exception;
+    protected abstract MailProcessor createMailProcessor(String state, HierarchicalConfiguration
config) throws Exception;
     
     
     /**

Copied: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
(from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java?p2=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java&p1=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java&r1=1052035&r2=1052049&rev=1052049&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
Wed Dec 22 19:48:09 2010
@@ -39,7 +39,7 @@ import org.apache.james.lifecycle.api.Lo
 import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.james.mailetcontainer.api.MailetLoader;
 import org.apache.james.mailetcontainer.api.MatcherLoader;
-import org.apache.james.mailetcontainer.lib.jmx.JMXMailetContainerListener;
+import org.apache.james.mailetcontainer.lib.jmx.JMXStateMailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.matchers.CompositeMatcher;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
@@ -55,18 +55,18 @@ import org.apache.mailet.base.MatcherInv
  * Abstract base class for {@link MailProcessor} implementations which want to process {@link
Mail} via {@link Matcher} and {@link Mailet}
  *
  */
-public abstract class AbstractMailetProcessor implements MailProcessor, Configurable, LogEnabled{
+public abstract class AbstractStateMailetProcessor implements MailProcessor, Configurable,
LogEnabled{
 
     private MailetContext mailetContext;
     private MatcherLoader matcherLoader;
     private List<MailetProcessorListener> listeners = Collections.synchronizedList(new
ArrayList<MailetProcessorListener>());
-    private String processorName;
-    private JMXMailetContainerListener jmxListener;
+    private JMXStateMailetProcessorListener jmxListener;
     private boolean enableJmx = true;
     private Log logger;
     private HierarchicalConfiguration config;
     private MailetLoader mailetLoader;
     private List<MatcherMailetPair> pairs = new ArrayList<MatcherMailetPair>();
+    private String state;
 
     
     @Resource(name = "matcherloader")
@@ -99,9 +99,9 @@ public abstract class AbstractMailetProc
      * @see org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
      */
     public void configure(HierarchicalConfiguration config) throws ConfigurationException
{
-        this.processorName = config.getString("[@name]", null);
-        if (processorName == null) throw new ConfigurationException("Processor name must
be configured");
-        if (processorName.equals(Mail.GHOST)) throw new ConfigurationException("ProcessorName
of " + Mail.GHOST + " is reserved for internal use, choose a different name");
+        this.state = config.getString("[@state]", null);
+        if (state == null) throw new ConfigurationException("Processor state attribute must
be configured");
+        if (state.equals(Mail.GHOST)) throw new ConfigurationException("Processor state of
" + Mail.GHOST + " is reserved for internal use, choose a different one");
 
         this.enableJmx = config.getBoolean("[@enableJmx]", true);
         this.config = config;
@@ -120,7 +120,7 @@ public abstract class AbstractMailetProc
         setupRouting(pairs);
         
         if (enableJmx) {
-            this.jmxListener = new JMXMailetContainerListener(processorName, this);
+            this.jmxListener = new JMXStateMailetProcessorListener(state, this);
             addListener(jmxListener);
         }
     }
@@ -158,8 +158,8 @@ public abstract class AbstractMailetProc
         return logger;
     }
     
-    protected String getName() {
-        return processorName;
+    protected String getState() {
+        return state;
     }
 
     /**
@@ -257,7 +257,7 @@ public abstract class AbstractMailetProc
      * @throws NotCompliantMBeanException
      */
     @SuppressWarnings("unchecked")
-    private List<Matcher> loadCompositeMatchers(String processorName, Map<String,Matcher>
compMap, List<HierarchicalConfiguration> compMatcherConfs) throws ConfigurationException,
MessagingException {
+    private List<Matcher> loadCompositeMatchers(String state, Map<String,Matcher>
compMap, List<HierarchicalConfiguration> compMatcherConfs) throws ConfigurationException,
MessagingException {
         List<Matcher> matchers = new ArrayList<Matcher>();
 
         for (int j= 0 ; j < compMatcherConfs.size(); j++) {
@@ -275,7 +275,7 @@ public abstract class AbstractMailetProc
                 if (matcher instanceof CompositeMatcher) {
                     CompositeMatcher compMatcher = (CompositeMatcher) matcher;
                     
-                    List<Matcher> childMatcher = loadCompositeMatchers(processorName,
compMap,c.configurationsAt("matcher"));
+                    List<Matcher> childMatcher = loadCompositeMatchers(state, compMap,c.configurationsAt("matcher"));
                     for (int i = 0 ; i < childMatcher.size(); i++) {
                         compMatcher.add(childMatcher.get(i));
                     }
@@ -285,7 +285,7 @@ public abstract class AbstractMailetProc
                 if (m instanceof CompositeMatcher) {
                     CompositeMatcher compMatcher = (CompositeMatcher) m;
                     
-                    List<Matcher> childMatcher = loadCompositeMatchers(processorName,
compMap,c.configurationsAt("matcher"));
+                    List<Matcher> childMatcher = loadCompositeMatchers(state, compMap,c.configurationsAt("matcher"));
                     for (int i = 0 ; i < childMatcher.size(); i++) {
                         compMatcher.add(childMatcher.get(i));
                     }
@@ -296,7 +296,7 @@ public abstract class AbstractMailetProc
             matchers.add(matcher);
             if (compName != null) {
                 // check if there is already a composite Matcher with the name registered
in the processor
-                if (compMap.containsKey(compName)) throw new ConfigurationException("CompositeMatcher
with name " + compName + " is already defined in processor " + processorName);
+                if (compMap.containsKey(compName)) throw new ConfigurationException("CompositeMatcher
with name " + compName + " is already defined in processor " + state);
                 compMap.put(compName, matcher);
             }
         }
@@ -308,7 +308,7 @@ public abstract class AbstractMailetProc
         
         // load composite matchers if there are any
         Map<String,Matcher> compositeMatchers = new HashMap<String, Matcher>();
-        loadCompositeMatchers(getName(), compositeMatchers, config.configurationsAt("matcher"));
+        loadCompositeMatchers(getState(), compositeMatchers, config.configurationsAt("matcher"));
         
         
         final List<HierarchicalConfiguration> mailetConfs = config.configurationsAt("mailet");

Copied: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java
(from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java?p2=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java&p1=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java&r1=1052035&r2=1052049&rev=1052049&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java
Wed Dec 22 19:48:09 2010
@@ -32,21 +32,21 @@ import javax.management.ObjectName;
 
 import org.apache.james.lifecycle.api.Disposable;
 import org.apache.james.mailetcontainer.api.MailProcessor;
-import org.apache.james.mailetcontainer.lib.AbstractCompositeProcessor;
-import org.apache.james.mailetcontainer.lib.AbstractCompositeProcessor.CompositeProcessorListener;
+import org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor;
+import org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.CompositeProcessorListener;
 
 /**
  * {@link CompositeProcessorListener} implementation which register MBeans for its child
{@link MailProcessor} 
  * and keep track of the stats
  *
  */
-public class JMXCompositeMailProcessorListener implements CompositeProcessorListener, Disposable{
+public class JMXStateCompositeProcessorListener implements CompositeProcessorListener, Disposable{
 
-    private AbstractCompositeProcessor mList;
+    private AbstractStateCompositeProcessor mList;
     private MBeanServer mbeanserver;
     private List<ObjectName> mbeans = new ArrayList<ObjectName>();
     private Map<MailProcessor, MailProcessorManagement> mMap = new HashMap<MailProcessor,
MailProcessorManagement>();
-    public JMXCompositeMailProcessorListener(AbstractCompositeProcessor mList) throws MalformedObjectNameException,
JMException {
+    public JMXStateCompositeProcessorListener(AbstractStateCompositeProcessor mList) throws
MalformedObjectNameException, JMException {
         this.mList = mList;
         
         mbeanserver = ManagementFactory.getPlatformMBeanServer();
@@ -82,7 +82,7 @@ public class JMXCompositeMailProcessorLi
        
         String baseObjectName = "org.apache.james:type=component,name=processor,";
 
-        String[] processorNames = mList.getProcessorNames();
+        String[] processorNames = mList.getProcessorStates();
         for (int i = 0; i < processorNames.length; i++) {
             String processorName = processorNames[i];
             registerProcessorMBean(baseObjectName, processorName);

Copied: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java
(from r1052035, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java?p2=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java&p1=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java&r1=1052035&r2=1052049&rev=1052049&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java
Wed Dec 22 19:48:09 2010
@@ -33,8 +33,8 @@ import javax.management.MalformedObjectN
 import javax.management.ObjectName;
 
 import org.apache.james.lifecycle.api.Disposable;
-import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor;
-import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor.MailetProcessorListener;
+import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor;
+import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.matchers.CompositeMatcher;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.Mailet;
@@ -46,9 +46,9 @@ import org.apache.mailet.Matcher;
  * 
  *
  */
-public class JMXMailetContainerListener implements MailetProcessorListener, Disposable{
+public class JMXStateMailetProcessorListener implements MailetProcessorListener, Disposable{
 
-    private AbstractMailetProcessor processor;
+    private AbstractStateMailetProcessor processor;
     private MBeanServer mbeanserver;
     private List<ObjectName> mbeans = new ArrayList<ObjectName>();
     private Map<Mailet, MailetManagement> mailetMap = new HashMap<Mailet, MailetManagement>();
@@ -56,7 +56,7 @@ public class JMXMailetContainerListener 
 
     private String name;
 
-    public JMXMailetContainerListener(String name, AbstractMailetProcessor processor) throws
MalformedObjectNameException, JMException {
+    public JMXStateMailetProcessorListener(String name, AbstractStateMailetProcessor processor)
throws MalformedObjectNameException, JMException {
         this.processor = processor;
         this.name = name;
         



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message