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 be...@apache.org on 2006/10/29 14:43:45 UTC

svn commit: r468903 - in /james/server/trunk: ./ lib/ src/conf/ src/java/org/apache/james/management/ src/java/org/apache/james/management/mbean/ src/java/org/apache/james/services/ src/java/org/apache/james/transport/

Author: berndf
Date: Sun Oct 29 05:43:44 2006
New Revision: 468903

URL: http://svn.apache.org/viewvc?view=rev&rev=468903
Log:
add processor, mailet and matcher management (JAMES-635)

Added:
    james/server/trunk/lib/mx4j-jmx.jar
      - copied unchanged from r468881, james/server/trunk/phoenix-bin/lib/mx4j-jmx.jar
    james/server/trunk/lib/mx4j.LICENSE
      - copied unchanged from r468881, james/server/trunk/phoenix-bin/lib/mx4j.LICENSE
    james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.java
    james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.xinfo
    james/server/trunk/src/java/org/apache/james/management/ProcessorManagementMBean.java
    james/server/trunk/src/java/org/apache/james/management/mbean/
    james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagement.java
    james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagementMBean.java
    james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagement.java
    james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagementMBean.java
    james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetail.java
    james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetailMBean.java
    james/server/trunk/src/java/org/apache/james/services/ProcessorManagementService.java
Modified:
    james/server/trunk/build.xml
    james/server/trunk/include.properties
    james/server/trunk/src/conf/james-assembly.xml
    james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.xinfo

Modified: james/server/trunk/build.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/build.xml?view=diff&rev=468903&r1=468902&r2=468903
==============================================================================
--- james/server/trunk/build.xml (original)
+++ james/server/trunk/build.xml Sun Oct 29 05:43:44 2006
@@ -84,6 +84,7 @@
             <include name="${javax-activation.jar}"/>
             <include name="${bcmail.jar}"/>
             <include name="${bcmail-workaround.jar}"/>
+            <include name="${javax.management}"/>
             <include name="${jspf.jar}"/>
             <include name="${mstor.jar}"/>
             <include name="${commons-logging.jar}"/>

Modified: james/server/trunk/include.properties
URL: http://svn.apache.org/viewvc/james/server/trunk/include.properties?view=diff&rev=468903&r1=468902&r2=468903
==============================================================================
--- james/server/trunk/include.properties (original)
+++ james/server/trunk/include.properties Sun Oct 29 05:43:44 2006
@@ -104,4 +104,7 @@
 commons-configuration.jar=commons-configuration-1.1.jar
 commons-beanutils.jar=commons-beanutils-1.7.0.jar
 
+# ----- javax.management -----
+
+javax.management=mx4j-jmx.jar
 

Modified: james/server/trunk/src/conf/james-assembly.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/src/conf/james-assembly.xml?view=diff&rev=468903&r1=468902&r2=468903
==============================================================================
--- james/server/trunk/src/conf/james-assembly.xml (original)
+++ james/server/trunk/src/conf/james-assembly.xml Sun Oct 29 05:43:44 2006
@@ -67,6 +67,10 @@
       <provide name="mailstore" role="org.apache.avalon.cornerstone.services.store.Store"/>
   </block>
   
+  <block name="processormanagement" class="org.apache.james.management.ProcessorManagement" >
+      <provide name="spoolmanager" role="org.apache.james.services.SpoolManager"/>
+  </block>
+
   <block name="bayesiananalyzermanagement" class="org.apache.james.management.BayesianAnalyzerManagement" >
       <provide name="database-connections"
              role="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" />

Added: james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,135 @@
+    /****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.management;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.ProcessorManagementService;
+import org.apache.james.services.SpoolManager;
+import org.apache.james.management.mbean.MatcherManagement;
+import org.apache.james.management.mbean.ProcessorDetail;
+import org.apache.james.management.mbean.MailetManagement;
+import org.apache.mailet.MailetConfig;
+import org.apache.mailet.MatcherConfig;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * manage processors, mailets and matchers
+ */
+public class ProcessorManagement implements Serviceable, ProcessorManagementService, ProcessorManagementMBean {
+
+    private SpoolManager processorManager;
+
+    public void service(ServiceManager serviceManager) throws ServiceException {
+        SpoolManager processorManager = (SpoolManager)serviceManager.lookup(SpoolManager.ROLE);
+        setProcessorManager(processorManager);
+        registerMBeans(); // move to appropriate place! to initialize()?
+    }
+
+    private void registerMBeans() {
+        ArrayList mBeanServers = MBeanServerFactory.findMBeanServer(null);
+        if (mBeanServers == null || mBeanServers.size() == 0) return; // no server to publish MBeans
+
+        // take the first one
+        MBeanServer mBeanServer = (MBeanServer) mBeanServers.get(0);
+
+        String baseObjectName = "Phoenix:application=james,topic=ProcessorAdministration,block=ProcessorManagement,";
+
+        String[] processorNames = getProcessorNames();
+        for (int i = 0; i < processorNames.length; i++) {
+            String processorName = processorNames[i];
+            createProcessorMBean(baseObjectName, processorName, mBeanServer);
+            continue;
+        }
+    }
+
+    private void createProcessorMBean(String baseObjectName, String processorName, MBeanServer mBeanServer) {
+        String processorMBeanName = baseObjectName + "processor=" + processorName;
+        ProcessorDetail processorMBean = new ProcessorDetail(processorManager, processorName);
+        registerMBean(mBeanServer, processorMBeanName, processorMBean);
+
+        // add all mailets but the last, because that is a terminator (see LinearProcessor.closeProcessorLists())
+        List mailetConfigs = processorManager.getMailetConfigs(processorName);
+        for (int i = 0; i < mailetConfigs.size()-1; i++) {
+            MailetConfig mailetConfig = (MailetConfig) mailetConfigs.get(i);
+
+            String mailetMBeanName = processorMBeanName + ",subtype=mailet,index=" + (i+1) + ",mailetname=" + mailetConfig.getMailetName();
+            MailetManagement mailetMBean = new MailetManagement(mailetConfig);
+            registerMBean(mBeanServer, mailetMBeanName, mailetMBean);
+        }
+
+        // add all matchers but the last, because that is a terminator (see LinearProcessor.closeProcessorLists())
+        List matcherConfigs = processorManager.getMatcherConfigs(processorName);
+        for (int i = 0; i < matcherConfigs.size()-1; i++) {
+            MatcherConfig matcherConfig = (MatcherConfig) matcherConfigs.get(i);
+
+            String matcherMBeanName = processorMBeanName + ",subtype=matcher,index=" + (i+1) + ",matchername=" + matcherConfig.getMatcherName();
+            MatcherManagement matcherMBean = new MatcherManagement(matcherConfig);
+            registerMBean(mBeanServer, matcherMBeanName, matcherMBean);
+        }
+
+    }
+
+    private void registerMBean(MBeanServer mBeanServer, String mBeanName, Object object) {
+        ObjectName objectName = null;
+        try {
+            objectName = new ObjectName(mBeanName);
+        } catch (MalformedObjectNameException e) {
+            return; // TODO handle error, log something
+        }
+        try {
+            mBeanServer.registerMBean(object, objectName);
+        } catch (javax.management.JMException e) {
+            e.printStackTrace(); // TODO change to logger
+        }
+    }
+
+    public void setProcessorManager(SpoolManager processorManager) {
+        this.processorManager = processorManager;
+    }
+
+    public String[] getProcessorNames() {
+        return processorManager.getProcessorNames();
+    }
+
+    public String[] getMailetNames(String processorName) {
+        List mailetConfigs = processorManager.getMailetConfigs(processorName);
+        // always ommit the terminating mailet
+        String[] mailetNames = new String[mailetConfigs.size()-1];
+        int i = 0;
+        Iterator iterator = mailetConfigs.iterator();
+        while (iterator.hasNext()) {
+            MailetConfig mailetConfig = (MailetConfig) iterator.next();
+            if (!iterator.hasNext()) continue; // ommit the terminating mailet
+            String mailetName = mailetConfig.getMailetName();
+            mailetNames[i] = mailetName;
+            i++;
+        }
+        return mailetNames;
+    }
+
+}

Added: james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.xinfo?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.xinfo (added)
+++ james/server/trunk/src/java/org/apache/james/management/ProcessorManagement.xinfo Sun Oct 29 05:43:44 2006
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<blockinfo>
+
+  <!-- section to describe block -->
+  <block>
+    <version>1.0</version>
+  </block>
+
+  <services>
+    <service name="org.apache.james.services.ProcessorManagementService" version="1.0" />
+  </services>
+    
+  <!-- interfaces that may be exported to manange this block -->
+  <management-access-points>
+    <service name="org.apache.james.management.ProcessorManagementMBean"/>
+  </management-access-points>
+
+  <dependencies>
+    <dependency>
+      <service name="org.apache.james.services.SpoolManager" version="1.0"/>
+    </dependency>
+  </dependencies>
+</blockinfo>

Added: james/server/trunk/src/java/org/apache/james/management/ProcessorManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/ProcessorManagementMBean.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/ProcessorManagementMBean.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/ProcessorManagementMBean.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,20 @@
+package org.apache.james.management;
+
+/**
+ * Expose processor management functionality through JMX.
+ *
+ * @phoenix:mx-topic name="ProcessorAdministration"
+ */
+public interface ProcessorManagementMBean {
+
+    /**
+     * Retrieves all existing processors
+     *
+     * @phoenix:mx-operation
+     * @phoenix:mx-description Retrieves all existing processors
+     *
+     * @return names of all configured processors
+     */
+    String[] getProcessorNames();
+
+}

Added: james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagement.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagement.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagement.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.management.mbean;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.mailet.MailetConfig;
+
+public class MailetManagement implements MailetManagementMBean {
+    private MailetConfig mailetConfig;
+
+    public MailetManagement(MailetConfig mailetConfig) {
+        this.mailetConfig = mailetConfig;
+    }
+
+    public String getMailetName() {
+        return mailetConfig.getMailetName();
+    }
+    
+    public String[] getMailetParameters() {
+        List parameterList = new ArrayList();
+        Iterator iterator = mailetConfig.getInitParameterNames();
+        while (iterator.hasNext()) {
+            String name = (String) iterator.next();
+            String value = mailetConfig.getInitParameter(name);
+            parameterList.add(name + "=" + value);
+        }
+        String[] result = (String[]) parameterList.toArray(new String[] {});
+        return result;
+    }
+}

Added: james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagementMBean.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagementMBean.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/mbean/MailetManagementMBean.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,28 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.management.mbean;
+
+/**
+ * management interface for one Mailet instance
+ */
+public interface MailetManagementMBean {
+    String getMailetName();
+    String[] getMailetParameters();
+}

Added: james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagement.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagement.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagement.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,37 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.management.mbean;
+
+import org.apache.mailet.MatcherConfig;
+
+public class MatcherManagement implements MatcherManagementMBean {
+    private MatcherConfig matcherConfig;
+
+    public MatcherManagement(MatcherConfig matcherConfig) {
+        this.matcherConfig = matcherConfig;
+    }
+
+    public String getMatcherName() {
+        return matcherConfig.getMatcherName();
+    }
+    
+    public String getMatcherCondition() {
+        return matcherConfig.getCondition();
+    }
+}

Added: james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagementMBean.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagementMBean.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/mbean/MatcherManagementMBean.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,28 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.management.mbean;
+
+/**
+ * management interface for one Matcher instance
+ */
+public interface MatcherManagementMBean {
+    String getMatcherName();
+    String getMatcherCondition();
+}

Added: james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetail.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetail.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetail.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetail.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.management.mbean;
+
+import org.apache.james.services.SpoolManager;
+
+public class ProcessorDetail implements ProcessorDetailMBean {
+
+    private SpoolManager processorManager;
+    private String processorName;
+
+    public ProcessorDetail(SpoolManager processorManager, String processorName) {
+        this.processorManager = processorManager;
+        this.processorName = processorName;
+    }
+
+    public String getName() {
+        return processorName;
+    }
+}

Added: james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetailMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetailMBean.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetailMBean.java (added)
+++ james/server/trunk/src/java/org/apache/james/management/mbean/ProcessorDetailMBean.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,28 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.management.mbean;
+
+
+/**
+ * MBean for one processor instance
+ */
+public interface ProcessorDetailMBean {
+
+    public String getName();
+}

Added: james/server/trunk/src/java/org/apache/james/services/ProcessorManagementService.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/services/ProcessorManagementService.java?view=auto&rev=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/services/ProcessorManagementService.java (added)
+++ james/server/trunk/src/java/org/apache/james/services/ProcessorManagementService.java Sun Oct 29 05:43:44 2006
@@ -0,0 +1,37 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.services;
+
+import org.apache.james.management.ProcessorManagementMBean;
+
+public interface ProcessorManagementService extends ProcessorManagementMBean {
+
+    /**
+     * retrieves the list of all processors
+     * @return array of names
+     */
+    String[] getProcessorNames();
+
+    /**
+     * retrieves the list of all mailets for one processor
+     * @param processorName
+     * @return array of names
+     */
+    String[] getMailetNames(String processorName);
+}

Modified: james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.xinfo?view=diff&rev=468903&r1=468902&r2=468903
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.xinfo Sun Oct 29 05:43:44 2006
@@ -7,6 +7,10 @@
     <version>1.0</version>
   </block>
 
+  <services>
+    <service name="org.apache.james.services.SpoolManager" version="1.0" />
+  </services>
+    
   <dependencies>
     <dependency>
       <service name="org.apache.james.services.SpoolRepository" version="1.0"/>



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


Re: ProcessorManagement and management interface (Was: svn commit: r468903)

Posted by Stefano Bagnara <ap...@bago.org>.
Bernd Fondermann wrote:
> On 11/15/06, Stefano Bagnara <ap...@bago.org> wrote:
>> I agree: I have to update pom.xml to be aware of this dependency, then!
> 
> Ow, Sorry, I did not think of this...
> 
>  Bernd

Don't worry, I like to keep it updated because I use it to run 
tests/coverage and other tools, but it is not our official build tool so 
there is no problem if you simply ignore it.

We'll have anyway to update it when we want to publish the website (but 
we don't publish trunk/next-major website yet).

Stefano

PS: I added mx4j-jmx 1.1.1 as the dependency and not the newer 2.1.1 or 
the 3.0.1 because I saw that the jar we include is the 1.1.1.


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


Re: ProcessorManagement and management interface (Was: svn commit: r468903)

Posted by Bernd Fondermann <be...@googlemail.com>.
On 11/15/06, Stefano Bagnara <ap...@bago.org> wrote:
> Bernd Fondermann wrote:
> > I pinged the dev-list about that.
>
> Ops, now I remember, maybe I told you to proceed, too ;-)

Possibly ;-)

>
> > Some more words are obviously needed. :-)
> > [removed detailed explanation...]
> > For me this is no big deal
>
> I agree: I have to update pom.xml to be aware of this dependency, then!

Ow, Sorry, I did not think of this...

  Bernd

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


Re: ProcessorManagement and management interface (Was: svn commit: r468903)

Posted by Stefano Bagnara <ap...@bago.org>.
Bernd Fondermann wrote:
> On 11/15/06, Stefano Bagnara <ap...@bago.org> wrote:
>> Bernd, or anyone else with an answer for this,
>>
>> I see that the ProcessorManagement have direct dependencies on
>> javax.management classes: I'm not against this, but why we need this
>> dependency here and not for the other management tools?
> 
> In 
> http://mail-archives.apache.org/mod_mbox/james-server-dev/200610.mbox/%3c88f6e29a0610260428u3bb2a2alc0a92e3a83e247d1@mail.gmail.com%3e 
> 
> I pinged the dev-list about that.

Ops, now I remember, maybe I told you to proceed, too ;-)

> Some more words are obviously needed. :-)
> [removed detailed explanation...]
> For me this is no big deal

I agree: I have to update pom.xml to be aware of this dependency, then!

Thank you,
Stefano


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


Re: ProcessorManagement and management interface (Was: svn commit: r468903)

Posted by Bernd Fondermann <be...@googlemail.com>.
On 11/15/06, Stefano Bagnara <ap...@bago.org> wrote:
> Bernd, or anyone else with an answer for this,
>
> I see that the ProcessorManagement have direct dependencies on
> javax.management classes: I'm not against this, but why we need this
> dependency here and not for the other management tools?

In http://mail-archives.apache.org/mod_mbox/james-server-dev/200610.mbox/%3c88f6e29a0610260428u3bb2a2alc0a92e3a83e247d1@mail.gmail.com%3e
I pinged the dev-list about that.

Some more words are obviously needed. :-)

Before JAMES-635, our Management MBeans were declared at build time
and Avalon took the tasks of registering them with the MBeansServer.
According to the JMX spec, for this to work, only java classes named
"*MBean" are needed, no dependencies on any of the JMX interfaces are
needed in our code.
This is all still in place and unchanged.

Now, when we want to have one Mailet MBean per Mailet instance, we
have to register them ourselves at run-time (cause the exact number
and structure is not known at build-time). This requires generating
ObjectNames and accessing the MBeanServer in ProcessorManagement. This
creates a dependency on javax.managment.

For me this is no big deal, because it is becoming a standard API
anyway and makes it possible to use more features from the JMX tool
case.
Outlook:

The next step is to add statistics. A simple getter
   int getProcessedMailsPerSecond()
externalized as a JMX method is allowing for JConsole to draw nice
graphs with no further coding.

The next next step is to add notifications. You could hook up to a
processor analysing the mail processing process /live/. (No need to
restart in debug mode, possibility to filter only events you need to
have.)

  Bernd


>
> Stefano
>
> berndf@apache.org wrote:
> > Author: berndf
> > Date: Sun Oct 29 05:43:44 2006
> > New Revision: 468903
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=468903
> > Log:
> > add processor, mailet and matcher management (JAMES-635)
> > [...]
> > +import javax.management.MBeanServer;
> > +import javax.management.MBeanServerFactory;
> > +import javax.management.MalformedObjectNameException;
> > +import javax.management.ObjectName;
> > +import java.util.ArrayList;
> > +import java.util.Iterator;
> > +import java.util.List;
> > +
> > +/**
> > + * manage processors, mailets and matchers
> > + */
> > +public class ProcessorManagement implements Serviceable, ProcessorManagementService, ProcessorManagementMBean {
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>

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


Re: ProcessorManagement and management interface (Was: svn commit: r468903)

Posted by Norman Maurer <nm...@byteaction.de>.
Im really looking forward for the statistics .. Such a feature whould be
something i really was waiting for :-)

bye
Norman

Bernd Fondermann schrieb:
> On 11/15/06, Stefano Bagnara <ap...@bago.org> wrote:
>> Bernd, or anyone else with an answer for this,
>>
>> I see that the ProcessorManagement have direct dependencies on
>> javax.management classes: I'm not against this, but why we need this
>> dependency here and not for the other management tools?
>
> In
> http://mail-archives.apache.org/mod_mbox/james-server-dev/200610.mbox/%3c88f6e29a0610260428u3bb2a2alc0a92e3a83e247d1@mail.gmail.com%3e
>
> I pinged the dev-list about that.
>
> Some more words are obviously needed. :-)
>
> Before JAMES-635, our Management MBeans were declared at build time
> and Avalon took the tasks of registering them with the MBeansServer.
> According to the JMX spec, for this to work, only java classes named
> "*MBean" are needed, no dependencies on any of the JMX interfaces are
> needed in our code.
> This is all still in place and unchanged.
>
> Now, when we want to have one Mailet MBean per Mailet instance, we
> have to register them ourselves at run-time (cause the exact number
> and structure is not known at build-time). This requires generating
> ObjectNames and accessing the MBeanServer in ProcessorManagement. This
> creates a dependency on javax.managment.
>
> For me this is no big deal, because it is becoming a standard API
> anyway and makes it possible to use more features from the JMX tool
> case.
> Outlook:
>
> The next step is to add statistics. A simple getter
>   int getProcessedMailsPerSecond()
> externalized as a JMX method is allowing for JConsole to draw nice
> graphs with no further coding.
>
> The next next step is to add notifications. You could hook up to a
> processor analysing the mail processing process /live/. (No need to
> restart in debug mode, possibility to filter only events you need to
> have.)
>
>  Bernd
>
>
>>
>> Stefano
>>
>> berndf@apache.org wrote:
>> > Author: berndf
>> > Date: Sun Oct 29 05:43:44 2006
>> > New Revision: 468903
>> >
>> > URL: http://svn.apache.org/viewvc?view=rev&rev=468903
>> > Log:
>> > add processor, mailet and matcher management (JAMES-635)
>> > [...]
>> > +import javax.management.MBeanServer;
>> > +import javax.management.MBeanServerFactory;
>> > +import javax.management.MalformedObjectNameException;
>> > +import javax.management.ObjectName;
>> > +import java.util.ArrayList;
>> > +import java.util.Iterator;
>> > +import java.util.List;
>> > +
>> > +/**
>> > + * manage processors, mailets and matchers
>> > + */
>> > +public class ProcessorManagement implements Serviceable,
>> ProcessorManagementService, ProcessorManagementMBean {
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-dev-help@james.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
> !EXCUBATOR:1,455b2f1453071344813439!



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


ProcessorManagement and management interface (Was: svn commit: r468903)

Posted by Stefano Bagnara <ap...@bago.org>.
Bernd, or anyone else with an answer for this,

I see that the ProcessorManagement have direct dependencies on 
javax.management classes: I'm not against this, but why we need this 
dependency here and not for the other management tools?

Stefano

berndf@apache.org wrote:
> Author: berndf
> Date: Sun Oct 29 05:43:44 2006
> New Revision: 468903
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=468903
> Log:
> add processor, mailet and matcher management (JAMES-635)
> [...]
> +import javax.management.MBeanServer;
> +import javax.management.MBeanServerFactory;
> +import javax.management.MalformedObjectNameException;
> +import javax.management.ObjectName;
> +import java.util.ArrayList;
> +import java.util.Iterator;
> +import java.util.List;
> +
> +/**
> + * manage processors, mailets and matchers
> + */
> +public class ProcessorManagement implements Serviceable, ProcessorManagementService, ProcessorManagementMBean {



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