Index: C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/mailrepository/filepair/File_Persistent_Stream_Repository.java =================================================================== --- C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/mailrepository/filepair/File_Persistent_Stream_Repository.java (revision 410395) +++ C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/mailrepository/filepair/File_Persistent_Stream_Repository.java (working copy) @@ -17,16 +17,13 @@ package org.apache.james.mailrepository.filepair; +import org.apache.avalon.cornerstone.services.store.StreamRepository; + import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import org.apache.avalon.cornerstone.services.store.StreamRepository; -import org.apache.james.util.io.IOUtil; - /** * Implementation of a StreamRepository to a File. * TODO: -retieve(String key) should return a FilterInputStream to allow @@ -37,9 +34,6 @@ extends AbstractFileRepository implements StreamRepository { - protected final HashMap m_inputs = new HashMap(); - protected final HashMap m_outputs = new HashMap(); - protected String getExtensionDecorator() { return ".FileStreamStore"; @@ -52,26 +46,7 @@ { try { - InputStream stream = getInputStream( key ); - - final Object o = m_inputs.get( key ); - if( null == o ) - { - m_inputs.put( key, stream ); - } - else if( o instanceof ArrayList ) - { - ( (ArrayList)o ).add( stream ); - } - else - { - final ArrayList list = new ArrayList(); - list.add( o ); - list.add( stream ); - m_inputs.put( key, list ); - } - - return stream; + return getInputStream( key ); } catch( final IOException ioe ) { @@ -89,26 +64,7 @@ try { final OutputStream outputStream = getOutputStream( key ); - final BufferedOutputStream stream = new BufferedOutputStream( outputStream ); - - final Object o = m_outputs.get( key ); - if( null == o ) - { - m_outputs.put( key, stream ); - } - else if( o instanceof ArrayList ) - { - ( (ArrayList)o ).add( stream ); - } - else - { - final ArrayList list = new ArrayList(); - list.add( o ); - list.add( stream ); - m_outputs.put( key, list ); - } - - return stream; + return new BufferedOutputStream( outputStream ); } catch( final IOException ioe ) { @@ -118,49 +74,6 @@ } } - public synchronized void remove( final String key ) - { - Object o = m_inputs.remove( key ); - if( null != o ) - { - if( o instanceof InputStream ) - { - IOUtil.shutdownStream( (InputStream)o ); - } - else - { - final ArrayList list = (ArrayList)o; - final int size = list.size(); - - for( int i = 0; i < size; i++ ) - { - IOUtil.shutdownStream( (InputStream)list.get( i ) ); - } - } - } - - o = m_outputs.remove( key ); - if( null != o ) - { - if( o instanceof OutputStream ) - { - IOUtil.shutdownStream( (OutputStream)o ); - } - else - { - final ArrayList list = (ArrayList)o; - final int size = list.size(); - - for( int i = 0; i < size; i++ ) - { - IOUtil.shutdownStream( (OutputStream)list.get( i ) ); - } - } - } - - super.remove( key ); - } - public long getSize(final String key) { try { return getFile(key).length(); Index: C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/core/AvalonMailStore.java =================================================================== --- C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/core/AvalonMailStore.java (revision 410395) +++ C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/core/AvalonMailStore.java (working copy) @@ -20,6 +20,7 @@ import org.apache.avalon.cornerstone.services.store.Store; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.component.Composable; +import org.apache.avalon.framework.service.DefaultServiceManager; import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.Serviceable; @@ -33,7 +34,6 @@ import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.commons.collections.ReferenceMap; -import org.apache.james.services.MailRepository; import java.util.HashMap; import java.util.Map; @@ -92,7 +92,9 @@ public void service( final ServiceManager manager ) throws ServiceException { - this.m_manager = manager; + DefaultServiceManager def_manager = new DefaultServiceManager(manager); + def_manager.put(Store.ROLE, this); + m_manager = def_manager; } @@ -223,7 +225,7 @@ { String type = repConf.getAttribute("type"); String repID = destination + type; - MailRepository reply = (MailRepository) repositories.get(repID); + Object reply = repositories.get(repID); StringBuffer logBuffer = null; if (reply != null) { if (getLogger().isDebugEnabled()) { @@ -269,7 +271,7 @@ } try { - reply = (MailRepository) this.getClass().getClassLoader().loadClass(repClass).newInstance(); + reply = this.getClass().getClassLoader().loadClass(repClass).newInstance(); ContainerUtil.enableLogging(reply,getLogger()); ContainerUtil.contextualize(reply,context); ContainerUtil.service(reply,m_manager); Index: C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo =================================================================== --- C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo (revision 410395) +++ C:/Lab/VOID/projects/james-trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo (working copy) @@ -14,9 +14,6 @@ - - - Index: C:/Lab/VOID/projects/james-trunk/src/conf/james-config.xml =================================================================== --- C:/Lab/VOID/projects/james-trunk/src/conf/james-config.xml (revision 410395) +++ C:/Lab/VOID/projects/james-trunk/src/conf/james-config.xml (working copy) @@ -995,6 +995,34 @@ MAIL + + + + file + + + OBJECT + + + SYNCHRONOUS + ASYNCHRONOUS + CACHE + + + + + + file + + + STREAM + + + SYNCHRONOUS + ASYNCHRONOUS + CACHE + + @@ -1145,41 +1173,6 @@ - - - - - - - - file - - - OBJECT - - - SYNCHRONOUS - ASYNCHRONOUS - CACHE - - - - - - file - - - STREAM - - - SYNCHRONOUS - ASYNCHRONOUS - CACHE - - - - - Index: C:/Lab/VOID/projects/james-trunk/src/conf/james-assembly.xml =================================================================== --- C:/Lab/VOID/projects/james-trunk/src/conf/james-assembly.xml (revision 410395) +++ C:/Lab/VOID/projects/james-trunk/src/conf/james-assembly.xml (working copy) @@ -120,8 +120,6 @@ - @@ -135,7 +133,7 @@ - @@ -151,10 +149,6 @@ NOTHING BELOW THIS SHOULD NEED CHANGING, (unless you want secure sockets (TLS)) --> - - -