Author: bago
Date: Sun Jun 29 10:08:44 2008
New Revision: 672642

URL: http://svn.apache.org/viewvc?rev=672642&view=rev
Log:
Moved hardcoded urls to configurations (JAMES-841).
Thanks to David Jencks for submitting the patch. Added "fallback" to previous 
url when the configuration is not in place (for backward compatibility with 
older configuration files).

Modified:
    
james/server/trunk/core-library/src/main/java/org/apache/james/management/BayesianAnalyzerManagement.java
    james/server/trunk/phoenix-deployment/src/conf/james-config.xml
    
james/server/trunk/phoenix-deployment/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerFactory.java
    
james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/testdata/VirtualRepositoryMix.xml
    
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/James.java
    james/server/trunk/spring-deployment/src/main/config/james/james-config.xml

Modified: 
james/server/trunk/core-library/src/main/java/org/apache/james/management/BayesianAnalyzerManagement.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/management/BayesianAnalyzerManagement.java?rev=672642&r1=672641&r2=672642&view=diff
==============================================================================
--- 
james/server/trunk/core-library/src/main/java/org/apache/james/management/BayesianAnalyzerManagement.java
 (original)
+++ 
james/server/trunk/core-library/src/main/java/org/apache/james/management/BayesianAnalyzerManagement.java
 Sun Jun 29 10:08:44 2008
@@ -1,450 +1,452 @@
-/****************************************************************
- * 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 java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.InputStream;
-import java.sql.SQLException;
-import java.sql.Connection;
-import java.util.Map;
-
-import net.fortuna.mstor.data.MboxFile;
-
-import org.apache.avalon.cornerstone.services.datasources.DataSourceSelector;
-import org.apache.avalon.excalibur.datasource.DataSourceComponent;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-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.BayesianAnalyzerManagementService;
-import org.apache.james.services.FileSystem;
-import org.apache.james.util.JDBCBayesianAnalyzer;
-
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
-/**
- * Management for BayesianAnalyzer
- */
-public class BayesianAnalyzerManagement implements 
BayesianAnalyzerManagementService, Serviceable, Initializable, Configurable, 
BayesianAnalyzerManagementMBean {
-
-    private final static String HAM = "HAM";
-    private final static String SPAM = "SPAM";
-    private DataSourceSelector selector;
-    private DataSourceComponent component;
-    private String repos;
-    private String sqlFileUrl = "file://conf/sqlResources.xml";
-    private FileSystem fileSystem;
-    
-    /**
-     * @see 
org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
-     */
-    public void service(ServiceManager arg0) throws ServiceException {
-        DataSourceSelector selector = (DataSourceSelector) 
arg0.lookup(DataSourceSelector.ROLE);
-        setDataSourceSelector(selector);
-        setFileSystem((FileSystem) arg0.lookup(FileSystem.ROLE));
-    }
-
-    /**
-     * Sets the file system service
-     * 
-     * @param system new service
-     */
-    private void setFileSystem(FileSystem system) {
-        this.fileSystem = system;
-    }
-
-    /**
-     * @see org.apache.avalon.framework.activity.Initializable#initialize()
-     */
-    public void initialize() throws Exception {
-        if (repos != null) {
-            setDataSourceComponent((DataSourceComponent) 
selector.select(repos));
-            File sqlFile = fileSystem.getFile(sqlFileUrl);
-            analyzer.initSqlQueries(component.getConnection(), 
sqlFile.getAbsolutePath());
-        }
-    }
-
-    /**
-     * @see 
org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration arg0) throws ConfigurationException {
-        Configuration reposPath = arg0.getChild("repositoryPath",false);
-        if (reposPath != null) {
-            setRepositoryPath(reposPath.getValue());
-        }
-    }
-    
-    /**
-     * Set the repository path 
-     * 
-     * @param repositoryPath Thre repositoryPath
-     */
-    public void setRepositoryPath(String repositoryPath) {
-        repos = repositoryPath.substring(5);
-    }
-    
-    /**
-     * Set the DatasourceSekector
-     * 
-     * @param selector The DataSourceSelector
-     */
-    public void setDataSourceSelector (DataSourceSelector selector) {
-        this.selector = selector;
-    }
-    
-    /**
-     * Set the DataSourceComponent
-     * 
-     * @param component The DataSourceComponent
-     */
-    public void setDataSourceComponent(DataSourceComponent component) {
-        this.component = component;
-    }
-    
-    /**
-     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addHamFromDir(String)
-     */
-    public int addHamFromDir(String dir) throws 
BayesianAnalyzerManagementException {
-        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
-        
-        return feedBayesianAnalyzerFromDir(dir,HAM);
-    }
-
-    /**
-     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addSpamFromDir(String)
-     */
-    public int addSpamFromDir(String dir) throws 
BayesianAnalyzerManagementException {
-        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
-        
-        return feedBayesianAnalyzerFromDir(dir,SPAM);
-    }
-    
-    /**
-     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addHamFromMbox(String)
-     */
-    public int addHamFromMbox(String file) throws 
BayesianAnalyzerManagementException {
-        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
-        return feedBayesianAnalyzerFromMbox(file,HAM);
-    }
-
-    /**
-     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addSpamFromMbox(String)
-     */
-    public int addSpamFromMbox(String file) throws 
BayesianAnalyzerManagementException {
-        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
-        return feedBayesianAnalyzerFromMbox(file,SPAM);
-    }
-
-    /**
-     * Helper method to train the BayesianAnalysis from directory which 
contain mails
-     *
-     * @param dir The directory which contains the emails which should be used 
to feed the BayesianAnalysis
-     * @param type The type to train. HAM or SPAM
-     * @return count The count of trained messages
-     * @throws BayesianAnalyzerManagementException
-     * @throws IllegalArgumentException Get thrown if the directory is not 
valid
-     */
-    private int feedBayesianAnalyzerFromDir(String dir, String type) throws 
BayesianAnalyzerManagementException {
-
-        //Clear out any existing word/counts etc..
-        analyzer.clear();
-
-        File tmpFile = new File(dir);
-        int count = 0;
-
-        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
-
-            // check if the provided dir is really a directory
-            if (tmpFile.isDirectory()) {
-                File[] files = tmpFile.listFiles();
-
-                for (int i = 0; i < files.length; i++) {
-                    BufferedReader stream = null;
-                    try {
-                        stream = new BufferedReader(new FileReader(files[i]));
-                    } catch (FileNotFoundException e) {
-                        throw new 
BayesianAnalyzerManagementException("acessing mail file failed.", e);
-                    }
-                    addMailToCorpus(type, stream);
-                    count++;
-                }
-
-                updateTokens(type);
-
-            } else {
-               throw new IllegalArgumentException("Please provide an valid 
directory");
-            }
-        }
-
-        return count;
-    }
-
-    /**
-     * Update the tokens 
-     * 
-     * @param type The type whichs tokens should be updated. Valid types are 
HAM or SPAM
-     * @throws BayesianAnalyzerManagementException
-     */
-    private void updateTokens(String type) throws 
BayesianAnalyzerManagementException {
-        //Update storage statistics.
-        try {
-            Connection connection = component.getConnection();
-            if (type.equalsIgnoreCase(HAM)) {
-                analyzer.updateHamTokens(connection);
-            } else if (type.equalsIgnoreCase(SPAM)) {
-                analyzer.updateSpamTokens(connection);
-            }
-        } catch (SQLException e) {
-            throw new BayesianAnalyzerManagementException("updating tokens 
failed.", e);
-        }
-    }
-
-    /**
-     * Add mail to corpus 
-     * 
-     * @param type The type to add to corpus. Valid types are HAM or SPAM
-     * @param stream The stream which is used to transfer the data
-     * @throws BayesianAnalyzerManagementException
-     */
-    private void addMailToCorpus(String type, BufferedReader stream) throws 
BayesianAnalyzerManagementException {
-        try {
-            if (type.equalsIgnoreCase(HAM)) {
-                analyzer.addHam(stream);
-            } else if (type.equalsIgnoreCase(SPAM)) {
-                analyzer.addSpam(stream);
-            }
-        } catch (IOException e) {
-            throw new BayesianAnalyzerManagementException("adding to corpus 
failed.", e);
-        }
-    }
-
-
-    /**
-     * Helper method to train the BayesianAnalysis from mbox file
-     *
-     * @param mboxFile The mbox file
-     * @param type The type to train. HAM or SPAM
-     * @return count The count of trained messages
-     * @throws BayesianAnalyzerManagementException
-     */
-    private int feedBayesianAnalyzerFromMbox(String mboxFile, String type) 
throws BayesianAnalyzerManagementException {
-        int count = 0;
-
-        //Clear out any existing word/counts etc..
-        analyzer.clear();
-
-        File tmpFile = new File(mboxFile);
-
-        if (MboxFile.isValid(tmpFile)) {
-            MboxFile mbox = new MboxFile(tmpFile,MboxFile.READ_ONLY);
-
-            synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
-                int messageCount = 0;
-                try {
-                    messageCount = mbox.getMessageCount();
-                } catch (IOException e) {
-                    throw new BayesianAnalyzerManagementException(e);
-                }
-                for (int i = 0; i < messageCount; i++) {
-                    InputStream message = null;
-                    try {
-                        message = mbox.getMessageAsStream(i);
-                    } catch (IOException e) {
-                        throw new BayesianAnalyzerManagementException("could 
not access mail from mbox streanm", e);
-                    }
-                    BufferedReader stream = new BufferedReader(new 
InputStreamReader(message));
-                    addMailToCorpus(type, stream);
-                    count++;
-                }
-
-                //Update storage statistics.
-                updateTokens(type);
-            }
-        } else {
-            throw new IllegalArgumentException("Please provide an valid mbox 
file");
-        }
-
-        return count;
-    }
-    
-    /**
-     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#exportData(String)
-     */
-    public void exportData(String file) throws 
BayesianAnalyzerManagementException {
-        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
-
-        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
-            try {
-                analyzer.loadHamNSpam(component.getConnection());
-            } catch (SQLException e) {
-                throw new BayesianAnalyzerManagementException("loading ham and 
spam failed.", e);
-            }
-
-            int hamMessageCount = analyzer.getHamMessageCount();
-            int spamMessageCount = analyzer.getSpamMessageCount();
-            Map hamTokenCounts = analyzer.getHamTokenCounts();
-            Map spamTokenCounts = analyzer.getSpamTokenCounts();
-
-            XStream xstream = new XStream(new DomDriver());
-            xstream.alias("bayesianAnalyzer", BayesianAnalyzerXml.class);
-            FileOutputStream fileOutputStream = null;
-            try {
-                fileOutputStream = new FileOutputStream(file);
-            } catch (FileNotFoundException e) {
-                throw new BayesianAnalyzerManagementException("opening export 
file failed", e);
-            }
-            PrintWriter printwriter = new PrintWriter(fileOutputStream);
-            printwriter.println(xstream.toXML(new 
BayesianAnalyzerXml(hamMessageCount,spamMessageCount,hamTokenCounts,spamTokenCounts)));
-            printwriter.close();
-        }
-    }
-    
-    /**
-     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#importData(String)
-     */
-    public void importData(String file) throws 
BayesianAnalyzerManagementException {
-        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
-
-        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK){
-            XStream xstream = new XStream(new DomDriver());
-
-            FileReader fileReader = null;
-            try {
-                fileReader = new FileReader(file);
-            } catch (FileNotFoundException e) {
-                throw new BayesianAnalyzerManagementException("opening input 
file failed", e);
-            }
-            BayesianAnalyzerXml bAnalyzerXml = (BayesianAnalyzerXml) 
xstream.fromXML(fileReader);
-
-            // clear old data
-            analyzer.clear();
-            analyzer.tokenCountsClear();
-
-            //TODO: Drop old corpus in database;
-
-            // add the new data
-            analyzer.setHamMessageCount(bAnalyzerXml.getHamMessageCount());
-            analyzer.setSpamMessageCount(bAnalyzerXml.getSpamMessageCount());
-            analyzer.setHamTokenCounts(bAnalyzerXml.getHamTokenCounts());
-            analyzer.setSpamTokenCounts(bAnalyzerXml.getSpamTokenCounts());
-            updateTokens(HAM);
-            updateTokens(SPAM);
-        }
-
-    }
-    
-    private JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer() {
-        protected void delegatedLog(String logString) {
-            // no logging
-        }
-    };
-    
-
-    /**
-     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#resetData()
-     */
-    public void resetData() throws BayesianAnalyzerManagementException {
-        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
-            try {
-                analyzer.resetData(component.getConnection());
-            } catch (SQLException e) {
-                throw new BayesianAnalyzerManagementException(e.getMessage());
-            }
-        }
-    
-    }
-    
-    /**
-     * Inner class to represent the data in an xml file
-     */
-    private static class BayesianAnalyzerXml {
-        private int hamMessageCount = 0;
-        private int spamMessageCount = 0;
-        private Map hamTokenCounts;
-        private Map spamTokenCounts;
-    
-        /**
-         * Default Constructer
-         * 
-         * @param hamMessageCount the count of trained ham messages
-         * @param spamMessageCount the count of trained spam messages
-         * @param hamTokenCounts the count and tokens of trained ham  
-         * @param spamTokenCounts the count and tokens of trained spam
-         */
-        public BayesianAnalyzerXml(int hamMessageCount, int spamMessageCount, 
Map hamTokenCounts, Map spamTokenCounts) {
-            this.hamMessageCount = hamMessageCount;
-            this.spamMessageCount = spamMessageCount;
-            this.hamTokenCounts = hamTokenCounts;
-            this.spamTokenCounts = spamTokenCounts;
-        }
-    
-        /**
-         * Return the count of trained ham messages
-         * 
-         * @return hamMessageCount the count of trained ham messages 
-         */
-        public int getHamMessageCount() {
-            return hamMessageCount;
-        }
-    
-        /**
-         * Return the count of trained spam messages
-         * 
-         * @return spamMessageCount the count of trained spam messages
-         */
-        public int getSpamMessageCount() {
-            return spamMessageCount;
-        }
-    
-        /**
-         * Return a Map which contains the token as key and the count as value 
of trained ham messages
-         * 
-         * @return hamTokenCounts a Map which contains the tokens and counts
-         */
-        public Map getHamTokenCounts() {
-            return hamTokenCounts;
-        }
-    
-        /**
-         * Return a Map which contains the token as key and the count as value 
of trained spam messages
-         * 
-         * @return spamTokenCounts a Map which countains the tokens and counts
-         */
-        public Map getSpamTokenCounts() {
-            return spamTokenCounts;
-        }
-    
-    }
-
-}
+/****************************************************************
+ * 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 java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.InputStream;
+import java.sql.SQLException;
+import java.sql.Connection;
+import java.util.Map;
+
+import net.fortuna.mstor.data.MboxFile;
+
+import org.apache.avalon.cornerstone.services.datasources.DataSourceSelector;
+import org.apache.avalon.excalibur.datasource.DataSourceComponent;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+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.BayesianAnalyzerManagementService;
+import org.apache.james.services.FileSystem;
+import org.apache.james.util.JDBCBayesianAnalyzer;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+/**
+ * Management for BayesianAnalyzer
+ */
+public class BayesianAnalyzerManagement implements 
BayesianAnalyzerManagementService, Serviceable, Initializable, Configurable, 
BayesianAnalyzerManagementMBean {
+
+    private final static String HAM = "HAM";
+    private final static String SPAM = "SPAM";
+    private DataSourceSelector selector;
+    private DataSourceComponent component;
+    private String repos;
+    private String sqlFileUrl;
+    private FileSystem fileSystem;
+    
+    /**
+     * @see 
org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
+     */
+    public void service(ServiceManager arg0) throws ServiceException {
+        DataSourceSelector selector = (DataSourceSelector) 
arg0.lookup(DataSourceSelector.ROLE);
+        setDataSourceSelector(selector);
+        setFileSystem((FileSystem) arg0.lookup(FileSystem.ROLE));
+    }
+
+    /**
+     * Sets the file system service
+     * 
+     * @param system new service
+     */
+    private void setFileSystem(FileSystem system) {
+        this.fileSystem = system;
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     */
+    public void initialize() throws Exception {
+        if (repos != null) {
+            setDataSourceComponent((DataSourceComponent) 
selector.select(repos));
+            File sqlFile = fileSystem.getFile(sqlFileUrl);
+            analyzer.initSqlQueries(component.getConnection(), 
sqlFile.getAbsolutePath());
+        }
+    }
+
+    /**
+     * @see 
org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
+     */
+    public void configure(Configuration arg0) throws ConfigurationException {
+        Configuration reposPath = arg0.getChild("repositoryPath",false);
+        if (reposPath != null) {
+            setRepositoryPath(reposPath.getValue());
+        }
+        sqlFileUrl = arg0.getChild("sqlFile").getValue();
+        if (sqlFileUrl == null) sqlFileUrl = "file://conf/sqlResources.xml";
+    }
+    
+    /**
+     * Set the repository path 
+     * 
+     * @param repositoryPath Thre repositoryPath
+     */
+    public void setRepositoryPath(String repositoryPath) {
+        repos = repositoryPath.substring(5);
+    }
+    
+    /**
+     * Set the DatasourceSekector
+     * 
+     * @param selector The DataSourceSelector
+     */
+    public void setDataSourceSelector (DataSourceSelector selector) {
+        this.selector = selector;
+    }
+    
+    /**
+     * Set the DataSourceComponent
+     * 
+     * @param component The DataSourceComponent
+     */
+    public void setDataSourceComponent(DataSourceComponent component) {
+        this.component = component;
+    }
+    
+    /**
+     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addHamFromDir(String)
+     */
+    public int addHamFromDir(String dir) throws 
BayesianAnalyzerManagementException {
+        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
+        
+        return feedBayesianAnalyzerFromDir(dir,HAM);
+    }
+
+    /**
+     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addSpamFromDir(String)
+     */
+    public int addSpamFromDir(String dir) throws 
BayesianAnalyzerManagementException {
+        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
+        
+        return feedBayesianAnalyzerFromDir(dir,SPAM);
+    }
+    
+    /**
+     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addHamFromMbox(String)
+     */
+    public int addHamFromMbox(String file) throws 
BayesianAnalyzerManagementException {
+        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
+        return feedBayesianAnalyzerFromMbox(file,HAM);
+    }
+
+    /**
+     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#addSpamFromMbox(String)
+     */
+    public int addSpamFromMbox(String file) throws 
BayesianAnalyzerManagementException {
+        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
+        return feedBayesianAnalyzerFromMbox(file,SPAM);
+    }
+
+    /**
+     * Helper method to train the BayesianAnalysis from directory which 
contain mails
+     *
+     * @param dir The directory which contains the emails which should be used 
to feed the BayesianAnalysis
+     * @param type The type to train. HAM or SPAM
+     * @return count The count of trained messages
+     * @throws BayesianAnalyzerManagementException
+     * @throws IllegalArgumentException Get thrown if the directory is not 
valid
+     */
+    private int feedBayesianAnalyzerFromDir(String dir, String type) throws 
BayesianAnalyzerManagementException {
+
+        //Clear out any existing word/counts etc..
+        analyzer.clear();
+
+        File tmpFile = new File(dir);
+        int count = 0;
+
+        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
+
+            // check if the provided dir is really a directory
+            if (tmpFile.isDirectory()) {
+                File[] files = tmpFile.listFiles();
+
+                for (int i = 0; i < files.length; i++) {
+                    BufferedReader stream = null;
+                    try {
+                        stream = new BufferedReader(new FileReader(files[i]));
+                    } catch (FileNotFoundException e) {
+                        throw new 
BayesianAnalyzerManagementException("acessing mail file failed.", e);
+                    }
+                    addMailToCorpus(type, stream);
+                    count++;
+                }
+
+                updateTokens(type);
+
+            } else {
+               throw new IllegalArgumentException("Please provide an valid 
directory");
+            }
+        }
+
+        return count;
+    }
+
+    /**
+     * Update the tokens 
+     * 
+     * @param type The type whichs tokens should be updated. Valid types are 
HAM or SPAM
+     * @throws BayesianAnalyzerManagementException
+     */
+    private void updateTokens(String type) throws 
BayesianAnalyzerManagementException {
+        //Update storage statistics.
+        try {
+            Connection connection = component.getConnection();
+            if (type.equalsIgnoreCase(HAM)) {
+                analyzer.updateHamTokens(connection);
+            } else if (type.equalsIgnoreCase(SPAM)) {
+                analyzer.updateSpamTokens(connection);
+            }
+        } catch (SQLException e) {
+            throw new BayesianAnalyzerManagementException("updating tokens 
failed.", e);
+        }
+    }
+
+    /**
+     * Add mail to corpus 
+     * 
+     * @param type The type to add to corpus. Valid types are HAM or SPAM
+     * @param stream The stream which is used to transfer the data
+     * @throws BayesianAnalyzerManagementException
+     */
+    private void addMailToCorpus(String type, BufferedReader stream) throws 
BayesianAnalyzerManagementException {
+        try {
+            if (type.equalsIgnoreCase(HAM)) {
+                analyzer.addHam(stream);
+            } else if (type.equalsIgnoreCase(SPAM)) {
+                analyzer.addSpam(stream);
+            }
+        } catch (IOException e) {
+            throw new BayesianAnalyzerManagementException("adding to corpus 
failed.", e);
+        }
+    }
+
+
+    /**
+     * Helper method to train the BayesianAnalysis from mbox file
+     *
+     * @param mboxFile The mbox file
+     * @param type The type to train. HAM or SPAM
+     * @return count The count of trained messages
+     * @throws BayesianAnalyzerManagementException
+     */
+    private int feedBayesianAnalyzerFromMbox(String mboxFile, String type) 
throws BayesianAnalyzerManagementException {
+        int count = 0;
+
+        //Clear out any existing word/counts etc..
+        analyzer.clear();
+
+        File tmpFile = new File(mboxFile);
+
+        if (MboxFile.isValid(tmpFile)) {
+            MboxFile mbox = new MboxFile(tmpFile,MboxFile.READ_ONLY);
+
+            synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
+                int messageCount = 0;
+                try {
+                    messageCount = mbox.getMessageCount();
+                } catch (IOException e) {
+                    throw new BayesianAnalyzerManagementException(e);
+                }
+                for (int i = 0; i < messageCount; i++) {
+                    InputStream message = null;
+                    try {
+                        message = mbox.getMessageAsStream(i);
+                    } catch (IOException e) {
+                        throw new BayesianAnalyzerManagementException("could 
not access mail from mbox streanm", e);
+                    }
+                    BufferedReader stream = new BufferedReader(new 
InputStreamReader(message));
+                    addMailToCorpus(type, stream);
+                    count++;
+                }
+
+                //Update storage statistics.
+                updateTokens(type);
+            }
+        } else {
+            throw new IllegalArgumentException("Please provide an valid mbox 
file");
+        }
+
+        return count;
+    }
+    
+    /**
+     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#exportData(String)
+     */
+    public void exportData(String file) throws 
BayesianAnalyzerManagementException {
+        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
+
+        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
+            try {
+                analyzer.loadHamNSpam(component.getConnection());
+            } catch (SQLException e) {
+                throw new BayesianAnalyzerManagementException("loading ham and 
spam failed.", e);
+            }
+
+            int hamMessageCount = analyzer.getHamMessageCount();
+            int spamMessageCount = analyzer.getSpamMessageCount();
+            Map hamTokenCounts = analyzer.getHamTokenCounts();
+            Map spamTokenCounts = analyzer.getSpamTokenCounts();
+
+            XStream xstream = new XStream(new DomDriver());
+            xstream.alias("bayesianAnalyzer", BayesianAnalyzerXml.class);
+            FileOutputStream fileOutputStream = null;
+            try {
+                fileOutputStream = new FileOutputStream(file);
+            } catch (FileNotFoundException e) {
+                throw new BayesianAnalyzerManagementException("opening export 
file failed", e);
+            }
+            PrintWriter printwriter = new PrintWriter(fileOutputStream);
+            printwriter.println(xstream.toXML(new 
BayesianAnalyzerXml(hamMessageCount,spamMessageCount,hamTokenCounts,spamTokenCounts)));
+            printwriter.close();
+        }
+    }
+    
+    /**
+     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#importData(String)
+     */
+    public void importData(String file) throws 
BayesianAnalyzerManagementException {
+        if (repos == null) throw new 
BayesianAnalyzerManagementException("RepositoryPath not configured");
+
+        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK){
+            XStream xstream = new XStream(new DomDriver());
+
+            FileReader fileReader = null;
+            try {
+                fileReader = new FileReader(file);
+            } catch (FileNotFoundException e) {
+                throw new BayesianAnalyzerManagementException("opening input 
file failed", e);
+            }
+            BayesianAnalyzerXml bAnalyzerXml = (BayesianAnalyzerXml) 
xstream.fromXML(fileReader);
+
+            // clear old data
+            analyzer.clear();
+            analyzer.tokenCountsClear();
+
+            //TODO: Drop old corpus in database;
+
+            // add the new data
+            analyzer.setHamMessageCount(bAnalyzerXml.getHamMessageCount());
+            analyzer.setSpamMessageCount(bAnalyzerXml.getSpamMessageCount());
+            analyzer.setHamTokenCounts(bAnalyzerXml.getHamTokenCounts());
+            analyzer.setSpamTokenCounts(bAnalyzerXml.getSpamTokenCounts());
+            updateTokens(HAM);
+            updateTokens(SPAM);
+        }
+
+    }
+    
+    private JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer() {
+        protected void delegatedLog(String logString) {
+            // no logging
+        }
+    };
+    
+
+    /**
+     * @see 
org.apache.james.services.BayesianAnalyzerManagementService#resetData()
+     */
+    public void resetData() throws BayesianAnalyzerManagementException {
+        synchronized(JDBCBayesianAnalyzer.DATABASE_LOCK) {
+            try {
+                analyzer.resetData(component.getConnection());
+            } catch (SQLException e) {
+                throw new BayesianAnalyzerManagementException(e.getMessage());
+            }
+        }
+    
+    }
+    
+    /**
+     * Inner class to represent the data in an xml file
+     */
+    private static class BayesianAnalyzerXml {
+        private int hamMessageCount = 0;
+        private int spamMessageCount = 0;
+        private Map hamTokenCounts;
+        private Map spamTokenCounts;
+    
+        /**
+         * Default Constructer
+         * 
+         * @param hamMessageCount the count of trained ham messages
+         * @param spamMessageCount the count of trained spam messages
+         * @param hamTokenCounts the count and tokens of trained ham  
+         * @param spamTokenCounts the count and tokens of trained spam
+         */
+        public BayesianAnalyzerXml(int hamMessageCount, int spamMessageCount, 
Map hamTokenCounts, Map spamTokenCounts) {
+            this.hamMessageCount = hamMessageCount;
+            this.spamMessageCount = spamMessageCount;
+            this.hamTokenCounts = hamTokenCounts;
+            this.spamTokenCounts = spamTokenCounts;
+        }
+    
+        /**
+         * Return the count of trained ham messages
+         * 
+         * @return hamMessageCount the count of trained ham messages 
+         */
+        public int getHamMessageCount() {
+            return hamMessageCount;
+        }
+    
+        /**
+         * Return the count of trained spam messages
+         * 
+         * @return spamMessageCount the count of trained spam messages
+         */
+        public int getSpamMessageCount() {
+            return spamMessageCount;
+        }
+    
+        /**
+         * Return a Map which contains the token as key and the count as value 
of trained ham messages
+         * 
+         * @return hamTokenCounts a Map which contains the tokens and counts
+         */
+        public Map getHamTokenCounts() {
+            return hamTokenCounts;
+        }
+    
+        /**
+         * Return a Map which contains the token as key and the count as value 
of trained spam messages
+         * 
+         * @return spamTokenCounts a Map which countains the tokens and counts
+         */
+        public Map getSpamTokenCounts() {
+            return spamTokenCounts;
+        }
+    
+    }
+
+}

Modified: james/server/trunk/phoenix-deployment/src/conf/james-config.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/conf/james-config.xml?rev=672642&r1=672641&r2=672642&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/conf/james-config.xml (original)
+++ james/server/trunk/phoenix-deployment/src/conf/james-config.xml Sun Jun 29 
10:08:44 2008
@@ -133,6 +133,8 @@
       <!-- will use the specified value. -->
       <!-- Set the default helloName which is used in all services if not 
overridden in the specific service-->
       <helloName autodetect="true">myMailServer</helloName>
+      <!-- according to the James code the need for this might be a temporary 
hack -->
+      <configuration-directory>file://conf</configuration-directory>
    </James>
 
     <!--
@@ -145,6 +147,7 @@
         </namespaces>
         <factory
             
class="org.apache.james.mailboxmanager.torque.TorqueMailboxManagerFactory">
+                   
<configFile>file://conf/mailboxManagerSqlResources.xml</configFile>
                    <torque-properties>
                        <property name="torque.database.default"
                            value="mailboxmanager"/>
@@ -944,7 +947,8 @@
    <!-- This is needed by the RemoteManager to enable the 
BayesianAnaylyzerManagement commands --> 
    <bayesiananalyzermanagement> 
       <repositoryPath> db://maildb </repositoryPath>
-   </bayesiananalyzermanagement>  
+      <sqlFile>file://conf/sqlResources.xml</sqlFile>
+   </bayesiananalyzermanagement>
     
 
    <!-- The RemoteManager server is enabled by default -->

Modified: 
james/server/trunk/phoenix-deployment/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerFactory.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerFactory.java?rev=672642&r1=672641&r2=672642&view=diff
==============================================================================
--- 
james/server/trunk/phoenix-deployment/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerFactory.java
 (original)
+++ 
james/server/trunk/phoenix-deployment/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerFactory.java
 Sun Jun 29 10:08:44 2008
@@ -60,6 +60,7 @@
     private boolean initialized;
 
     private FileSystem fileSystem;
+    private String configFile;
 
     private static final String[] tableNames = new String[] {
             MailboxRowPeer.TABLE_NAME, MessageRowPeer.TABLE_NAME,
@@ -80,7 +81,7 @@
                 conn = Transaction.begin(MailboxRowPeer.DATABASE_NAME);
                 SqlResources sqlResources = new SqlResources();
                 sqlResources.init(fileSystem
-                        
.getResource("file://conf/mailboxManagerSqlResources.xml"),
+                        .getResource(configFile),
                         TorqueMailboxManagerFactory.class.getName(), conn,
                         new HashMap());
 
@@ -119,10 +120,10 @@
 
     public void configureDefaults()
             throws org.apache.commons.configuration.ConfigurationException {
-        File configFile = new File("torque.properties");
-        if (configFile.canRead()) {
+        File torqueConfigFile = new File("torque.properties");
+        if (torqueConfigFile.canRead()) {
             getLog().info("reading torque.properties...");
-            torqueConf = new PropertiesConfiguration(configFile);
+            torqueConf = new PropertiesConfiguration(torqueConfigFile);
         } else {
             torqueConf = new BaseConfiguration();
             torqueConf.addProperty("torque.database.default", 
"mailboxmanager");
@@ -144,6 +145,7 @@
             torqueConf.addProperty(
                     "torque.dsfactory.mailboxmanager.pool.maxActive", "100");
         }
+        configFile = "file://conf/mailboxManagerSqlResources.xml";
     }
 
     public void configure(
@@ -156,6 +158,8 @@
             torqueConf.addProperty(tps[i].getAttribute("name"), tps[i]
                     .getAttribute("value"));
         }
+        configFile = conf.getChild("configFile").getValue();
+        if (configFile == null) configFile = 
"file://conf/mailboxManagerSqlResources.xml";
     }
 
     private boolean tableExists(DatabaseMetaData dbMetaData, String tableName)

Modified: 
james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/testdata/VirtualRepositoryMix.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/testdata/VirtualRepositoryMix.xml?rev=672642&r1=672641&r2=672642&view=diff
==============================================================================
--- 
james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/testdata/VirtualRepositoryMix.xml
 (original)
+++ 
james/server/trunk/phoenix-deployment/src/test/org/apache/james/mailboxmanager/testdata/VirtualRepositoryMix.xml
 Sun Jun 29 10:08:44 2008
@@ -1,128 +1,129 @@
-<config>
-<!--
-  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.    
--->
-       <mailboxmanager>
-               <namespaces>
-                       <usernamespace name="#mail" delimiter="."/>
-               </namespaces>
-               <factory
-                       
class="org.apache.james.mailboxmanager.impl.VirtualMailboxManagerFactory">
-                       <mounts>
-                               <mount>
-                                       <point point="#user"/>
-                                       <point point="#user1"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
-                                               <myconf attr="test"/>
-                                       </target>
-                               </mount>
-
-                               <mount>
-                                       <point point="#user2"/>
-                                       <point point="#user3"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
-                                               <myconf attr="test2"/>
-                                       </target>
-                               </mount>
-                               <mount>
-                                       <point point="#system"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.mailstore.MailStoreMailboxManagerFactory">
-                                               <repository 
destinationURL="file://var/mail/"
-                                                       type="MAIL"/>
-                                       </target>
-                               </mount>
-                               <mount>
-                                       <point point="#mail"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.torque.TorqueMailboxManagerFactory">
-                                               <torque-properties>
-                                                       <property 
name="torque.database.default"
-                                                               
value="mailboxmanager"/>
-                                                       <property
-                                                               
name="torque.database.mailboxmanager.adapter"
-                                                               value="derby"/>
-                                                       <property
-                                                               
name="torque.dsfactory.mailboxmanager.factory"
-                                                               
value="org.apache.torque.dsfactory.SharedPoolDataSourceFactory"/>
-                                                       <property
-                                                               
name="torque.dsfactory.mailboxmanager.connection.driver"
-                                                               
value="org.apache.derby.jdbc.EmbeddedDriver"/>
-                                                       <property
-                                                               
name="torque.dsfactory.mailboxmanager.connection.url"
-                                                               
value="jdbc:derby:tmp/mailboxmanager-derbydb;create=true"/>
-                                                       <property
-                                                               
name="torque.dsfactory.mailboxmanager.connection.user"
-                                                               value="app"/>
-                                                       <property
-                                                               
name="torque.dsfactory.mailboxmanager.connection.password"
-                                                               value="app"/>
-                                                       <property
-                                                               
name="torque.dsfactory.mailboxmanager.pool.maxActive"
-                                                               value="100"/>
-                                               </torque-properties>
-                                       </target>
-                               </mount>
-                       </mounts>
-               </factory>
-       </mailboxmanager>
-       <mailboxmanager-without-torque>
-               <namespaces>
-                       <usernamespace name="#mail" delimiter="."/>
-               </namespaces>
-               <factory
-                       
class="org.apache.james.mailboxmanager.impl.VirtualMailboxManagerFactory">
-                       <mounts>
-                               <mount>
-                                       <point point="#user"/>
-                                       <point point="#user1"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
-                                               <myconf attr="test"/>
-                                       </target>
-                               </mount>
-
-                               <mount>
-                                       <point point="#user2"/>
-                                       <point point="#user3"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
-                                               <myconf attr="test2"/>
-                                       </target>
-                               </mount>
-                               <mount>
-                                       <point point="#system"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.mailstore.MailStoreMailboxManagerFactory">
-                                               <repository 
destinationURL="file://var/mail/"
-                                                       type="MAIL"/>
-                                       </target>
-                               </mount>
-                               <mount>
-                                       <point point="#mail"/>
-                                       <target
-                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
-                                               <myconf attr="test3"/>
-                                       </target>
-                               </mount>
-                       </mounts>
-               </factory>
-       </mailboxmanager-without-torque>
-</config>
+<config>
+<!--
+  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.    
+-->
+       <mailboxmanager>
+               <namespaces>
+                       <usernamespace name="#mail" delimiter="."/>
+               </namespaces>
+               <factory
+                       
class="org.apache.james.mailboxmanager.impl.VirtualMailboxManagerFactory">
+                       <mounts>
+                               <mount>
+                                       <point point="#user"/>
+                                       <point point="#user1"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
+                                               <myconf attr="test"/>
+                                       </target>
+                               </mount>
+
+                               <mount>
+                                       <point point="#user2"/>
+                                       <point point="#user3"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
+                                               <myconf attr="test2"/>
+                                       </target>
+                               </mount>
+                               <mount>
+                                       <point point="#system"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.mailstore.MailStoreMailboxManagerFactory">
+                                               <repository 
destinationURL="file://var/mail/"
+                                                       type="MAIL"/>
+                                       </target>
+                               </mount>
+                               <mount>
+                                       <point point="#mail"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.torque.TorqueMailboxManagerFactory">
+                                               <configFile 
name="file://conf/mailboxManagerSqlResources.xml"/>
+                                               <torque-properties>
+                                                       <property 
name="torque.database.default"
+                                                               
value="mailboxmanager"/>
+                                                       <property
+                                                               
name="torque.database.mailboxmanager.adapter"
+                                                               value="derby"/>
+                                                       <property
+                                                               
name="torque.dsfactory.mailboxmanager.factory"
+                                                               
value="org.apache.torque.dsfactory.SharedPoolDataSourceFactory"/>
+                                                       <property
+                                                               
name="torque.dsfactory.mailboxmanager.connection.driver"
+                                                               
value="org.apache.derby.jdbc.EmbeddedDriver"/>
+                                                       <property
+                                                               
name="torque.dsfactory.mailboxmanager.connection.url"
+                                                               
value="jdbc:derby:tmp/mailboxmanager-derbydb;create=true"/>
+                                                       <property
+                                                               
name="torque.dsfactory.mailboxmanager.connection.user"
+                                                               value="app"/>
+                                                       <property
+                                                               
name="torque.dsfactory.mailboxmanager.connection.password"
+                                                               value="app"/>
+                                                       <property
+                                                               
name="torque.dsfactory.mailboxmanager.pool.maxActive"
+                                                               value="100"/>
+                                               </torque-properties>
+                                       </target>
+                               </mount>
+                       </mounts>
+               </factory>
+       </mailboxmanager>
+       <mailboxmanager-without-torque>
+               <namespaces>
+                       <usernamespace name="#mail" delimiter="."/>
+               </namespaces>
+               <factory
+                       
class="org.apache.james.mailboxmanager.impl.VirtualMailboxManagerFactory">
+                       <mounts>
+                               <mount>
+                                       <point point="#user"/>
+                                       <point point="#user1"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
+                                               <myconf attr="test"/>
+                                       </target>
+                               </mount>
+
+                               <mount>
+                                       <point point="#user2"/>
+                                       <point point="#user3"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
+                                               <myconf attr="test2"/>
+                                       </target>
+                               </mount>
+                               <mount>
+                                       <point point="#system"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.mailstore.MailStoreMailboxManagerFactory">
+                                               <repository 
destinationURL="file://var/mail/"
+                                                       type="MAIL"/>
+                                       </target>
+                               </mount>
+                               <mount>
+                                       <point point="#mail"/>
+                                       <target
+                                               
class="org.apache.james.mailboxmanager.mock.MockMailboxManagerFactory">
+                                               <myconf attr="test3"/>
+                                       </target>
+                               </mount>
+                       </mounts>
+               </factory>
+       </mailboxmanager-without-torque>
+</config>

Modified: 
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/James.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/James.java?rev=672642&r1=672641&r2=672642&view=diff
==============================================================================
--- 
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/James.java
 (original)
+++ 
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/James.java
 Sun Jun 29 10:08:44 2008
@@ -301,7 +301,10 @@
         attributes.put(Constants.AVALON_COMPONENT_MANAGER, compMgr);
 
         //Temporary get out to allow complex mailet config files to stop 
blocking sergei sozonoff's work on bouce processing
-        java.io.File configDir = fileSystem.getFile("file://conf/");
+        String confDir = conf.getChild("configuration-directory").getValue();
+        // defaults to the old behaviour
+        if (confDir == null) confDir = "file://conf/";
+        java.io.File configDir = fileSystem.getFile(confDir);
         attributes.put("confDir", configDir.getCanonicalPath());
 
         try {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to