Changeset 29979

Show
Ignore:
Timestamp:
02/07/08 17:00:26 (10 months ago)
Author:
dmihalache
Message:

PLE-1: Do an XML/File importer for incoming mail
additional import functions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.core/branches/1.4/nuxeo-core-io/src/main/java/org/nuxeo/ecm/core/io/IODocumentManager.java

    r29029 r29979  
    3232 
    3333/** 
    34  * 
    35  * @author dm 
     34 * Defines functional interface that deals directly with documents import using 
     35 * provided DocumentReader or InputStream as a source and DocumentWriter that 
     36 * knows how the documents will be saved into the repository. 
     37 *  
     38 * @author <a href="mailto:dm@nuxeo.com">Dragos Mihalache</a> 
    3639 */ 
    3740public interface IODocumentManager extends Serializable { 
     
    4245 
    4346    DocumentTranslationMap importDocuments(InputStream in, 
     47            DocumentWriter customDocWriter) throws ImportDocumentException, 
     48            ClientException, IOException; 
     49 
     50    /** 
     51     *  
     52     * @param customDocReader reader from the input stream 
     53     * @param customDocWriter 
     54     * @return 
     55     * @throws ImportDocumentException 
     56     * @throws ClientException 
     57     * @throws IOException 
     58     */ 
     59    DocumentTranslationMap importDocuments(DocumentReader customDocReader, 
    4460            DocumentWriter customDocWriter) throws ImportDocumentException, 
    4561            ClientException, IOException; 
  • org.nuxeo.ecm.core/branches/1.4/nuxeo-core-io/src/main/java/org/nuxeo/ecm/core/io/impl/IODocumentManagerImpl.java

    r29029 r29979  
    221221    } 
    222222 
     223    public DocumentTranslationMap importDocuments( 
     224            DocumentReader customDocReader, DocumentWriter customDocWriter) 
     225            throws ImportDocumentException, ClientException, IOException { 
     226 
     227        try { 
     228            DocumentPipe pipe = new DocumentPipeImpl(10); 
     229            pipe.setReader(customDocReader); 
     230            pipe.setWriter(customDocWriter); 
     231            DocumentTranslationMap map = pipe.run(); 
     232 
     233            // will need to save session before notifying events, otherwise docs 
     234            // won't be found 
     235            // writer.close(); 
     236 
     237            return map; 
     238        } catch (Exception e) { 
     239            throw new ImportDocumentException(e); 
     240        } 
     241    } 
     242 
    223243}