Am Montag, den 21.08.2006, 16:10 +0200 schrieb Bernd Fondermann: > thanks! > > I have to admit that I don't understand what the fields > repositoryPath/repository are for.
Its the url to the db.. like : db://maildb > This is a very generic name for a variable which is _required_ to be > configured and only used in a very limited functional domain (ham/spam > admin). Currently, "repository" is never read and could be removed, as > far as I can see. its used in inizialize() and in doADDHAM and doADDSPAM > > Also, I don't like that spam administrative logic is put into the > RemoteManager which incorporates the RM to have exact knowledge how > the bayesian stuff is implemented (namely: SQL, JDBC). This is far > more insight than the RM should have und would better be found in a > separate component which hides the spam filter's implementation. Buzz > words often used in this context: high cohesion, low coupling. > > This would have the advantages that the functionality is open to other > components as well (e.g. JMX), it can be found much easier by other > developers (when put near the bayesian code) and the RemoteManager > stays more 'clean'. > > Bernd > Ok thats a good idea.. Can you do it ? You also did the other stuff for jmx bye Norman > On 8/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Author: norman > > Date: Mon Aug 21 05:39:58 2006 > > New Revision: 433238 > > > > URL: http://svn.apache.org/viewvc?rev=433238&view=rev > > Log: > > Fix junit test of RemoteManager which were broken after i commit the ADDHAM > > and ADDSPAM feature. > > The feature is now disabled if no repositoryPath is configured in the > > config.xml > > > > Modified: > > > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java > > > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java > > > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java > > > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTestConfiguration.java > > > > Modified: > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java > > URL: > > http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java?rev=433238&r1=433237&r2=433238&view=diff > > ============================================================================== > > --- > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java > > (original) > > +++ > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java > > Mon Aug 21 05:39:58 2006 > > @@ -164,10 +164,9 @@ > > else if (!prompt.equals("") && !prompt.endsWith(" ")) prompt > > += " "; > > > > Configuration reposConfiguration = > > handlerConfiguration.getChild("repositoryPath", false); > > - if (reposConfiguration == null) { > > - throw new ConfigurationException("Please configure the > > repositoryPath"); > > + if (reposConfiguration != null) { > > + repositoryPath = reposConfiguration.getValue(); > > } > > - repositoryPath = reposConfiguration.getValue(); > > } > > } > > > > > > Modified: > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java > > URL: > > http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java?rev=433238&r1=433237&r2=433238&view=diff > > ============================================================================== > > --- > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java > > (original) > > +++ > > james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java > > Mon Aug 21 05:39:58 2006 > > @@ -190,6 +190,8 @@ > > private String sqlFileUrl = "file://conf/sqlResources.xml"; > > > > DataSourceComponent datasource; > > + > > + String repository; > > > > /** > > * Set the configuration data for the handler. > > @@ -1072,7 +1074,13 @@ > > */ > > private boolean doADDHAM(String argument) { > > String exception = null; > > - > > + > > + // check if the command is disabled > > + if (repository == null) { > > + writeLoggedFlushedResponse("Command disabled. Configure a > > repositoryPath to enable it"); > > + return true; > > + } > > + > > // check if the command was called correct > > if (argument == null || argument.trim().equals("")) { > > writeLoggedFlushedResponse("Usage: ADDHAM [hamdir]"); > > @@ -1114,6 +1122,12 @@ > > private boolean doADDSPAM(String argument) { > > String exception = null; > > > > + // check if the command is disabled > > + if (repository == null) { > > + writeLoggedFlushedResponse("Command disabled. Configure a > > repositoryPath to enable it"); > > + return true; > > + } > > + > > // check if the command was called correct > > if (argument == null || argument.trim().equals("")) { > > writeLoggedFlushedResponse("Usage: ADDSPAM [spamdir]"); > > @@ -1220,9 +1234,13 @@ > > * @see org.apache.avalon.framework.activity.Initializable#initialize() > > */ > > public void initialize() throws Exception { > > - String repos = theConfigData.getRepositoryPath().substring(5); > > - datasource = (DataSourceComponent) > > theConfigData.getDataSourceSelector().select(repos); > > - File sqlFile = AvalonContextUtilities.getFile(context, sqlFileUrl); > > - analyzer.initSqlQueries(datasource.getConnection(), > > sqlFile.getAbsolutePath()); > > + repository = theConfigData.getRepositoryPath(); > > + > > + if (repository != null) { > > + String repos = repository.substring(5); > > + datasource = (DataSourceComponent) > > theConfigData.getDataSourceSelector().select(repos); > > + File sqlFile = AvalonContextUtilities.getFile(context, > > sqlFileUrl); > > + analyzer.initSqlQueries(datasource.getConnection(), > > sqlFile.getAbsolutePath()); > > + } > > } > > } > > > > Modified: > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java > > URL: > > http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java?rev=433238&r1=433237&r2=433238&view=diff > > ============================================================================== > > --- > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java > > (original) > > +++ > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java > > Mon Aug 21 05:39:58 2006 > > @@ -29,6 +29,7 @@ > > import org.apache.james.services.MailServer; > > import org.apache.james.services.UsersRepository; > > import org.apache.james.services.UsersStore; > > +import org.apache.james.test.mock.avalon.MockContext; > > import org.apache.james.test.mock.avalon.MockLogger; > > import org.apache.james.test.mock.avalon.MockServiceManager; > > import org.apache.james.test.mock.avalon.MockSocketManager; > > @@ -87,6 +88,7 @@ > > try { > > ContainerUtil.configure(m_remoteManager, testConfiguration); > > ContainerUtil.initialize(m_remoteManager); > > + ContainerUtil.contextualize(m_remoteManager, new > > MockContext()); > > } catch (Exception e) { > > throw new RuntimeException(e); > > } > > > > Modified: > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTestConfiguration.java > > URL: > > http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTestConfiguration.java?rev=433238&r1=433237&r2=433238&view=diff > > ============================================================================== > > --- > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTestConfiguration.java > > (original) > > +++ > > james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTestConfiguration.java > > Mon Aug 21 05:39:58 2006 > > @@ -67,7 +67,7 @@ > > DefaultConfiguration handlerConfig = new > > DefaultConfiguration("handler"); > > handlerConfig.addChild(Util.getValuedConfiguration("helloName", > > "myMailServer")); > > > > handlerConfig.addChild(Util.getValuedConfiguration("connectiontimeout", > > "360000")); > > - > > + > > DefaultConfiguration adminAccounts = new > > DefaultConfiguration("administrator_accounts"); > > > > DefaultConfiguration account = new DefaultConfiguration("account"); > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > !EXCUBATOR:1,44e9bedf45112087116432!
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil