001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *    Mariana Cedica
016 */
017package org.nuxeo.ecm.platform.importer.service;
018
019import org.nuxeo.ecm.platform.importer.executor.AbstractImporterExecutor;
020import org.nuxeo.ecm.platform.importer.factories.DefaultDocumentModelFactory;
021import org.nuxeo.ecm.platform.importer.factories.ImporterDocumentModelFactory;
022import org.nuxeo.ecm.platform.importer.log.ImporterLogger;
023import org.nuxeo.ecm.platform.importer.source.SourceNode;
024
025/**
026 * Allows basic configuration of the default importer :
027 * <p>
028 * Allows configuration of the a DocumentModelFactory and the document types it creates ( if no implementation is
029 * contributed, <code>DefaultDocumentModelFactory</code> is used;
030 * <p>
031 * Also allows configuration of the SourceNode implementation; if none is provided the
032 * <code>FileSourceNode<code>> it's used by default
033 */
034public interface DefaultImporterService {
035
036    /**
037     * Imports documents using a DefaultImporterExecutor and the contributed documentModelFactory and SourceNode
038     * implementations; If no documentModelFactory implementation was contributed to the service,
039     * <code>DefaultDocumentModelFactory</code> it's used If no SourceNode implementation was contributed to the
040     * service, <code>FileSourceNode</code> it's used
041     *
042     * @param destionationPath
043     * @param sourcePath
044     * @param skipRootContainerCreation
045     * @param batchSize
046     * @param noImportingThreads
047     */
048    void importDocuments(String destionationPath, String sourcePath, boolean skipRootContainerCreation, int batchSize,
049            int noImportingThreads);
050
051    /***
052     * Imports documents using a the given executor and the contributed documentModelFactory and SourceNode
053     * implementations; If no documentModelFactory implementation was contributed to the service,
054     * <code>DefaultDocumentModelFactory</code> it's used If no SourceNode implementation was contributed to the
055     * service, <code>FileSourceNode</code> it's used
056     *
057     * @param executor
058     * @param destinationPath
059     * @param sourcePath
060     * @param skipRootContainerCreation
061     * @param batchSize
062     * @param noImportingThreads
063     * @param interactive
064     */
065    String importDocuments(AbstractImporterExecutor executor, String destinationPath, String sourcePath,
066            boolean skipRootContainerCreation, int batchSize, int noImportingThreads, boolean interactive);
067
068    /***
069     * Imports documents using a the given executor and the contributed documentModelFactory and SourceNode
070     * implementations; Allows to overwrite the leaf and folderish types used by the documentModelFactory when
071     * importing; if one of them is not specified then the contributed one is used If no documentModelFactory
072     * implementation was contributed to the service, <code>DefaultDocumentModelFactory</code> it's used If no
073     * SourceNode implementation was contributed to the service, <code>FileSourceNode</code> it's used
074     *
075     * @param executor
076     * @param destinationPath
077     * @param sourcePath
078     * @param skipRootContainerCreation
079     * @param batchSize
080     * @param noImportingThreads
081     * @param interactive
082     */
083    String importDocuments(AbstractImporterExecutor executor, String leafType, String folderishType,
084            String destinationPath, String sourcePath, boolean skipRootContainerCreation, int batchSize,
085            int noImportingThreads, boolean interactive);
086
087    void setSourceNodeClass(Class<? extends SourceNode> sourceNodeClass);
088
089    void setDocModelFactoryClass(Class<? extends ImporterDocumentModelFactory> docModelFactoryClass);
090
091    void setLeafDocType(String fileDocType);
092
093    void setFolderishDocType(String folderishDocType);
094
095    void setImporterLogger(ImporterLogger importerLogger);
096
097    /**
098     * @since 5.9.4
099     */
100    void setTransactionTimeout(int transactionTimeout);
101
102    /**
103     * @since 7.1
104     * @param repositoryName
105     */
106    void setRepository(String repositoryName);
107
108    /**
109     * Added waiting the importer refactoring. Only used by Scan Importer.
110     *
111     * @since 5.7.3
112     */
113    @Deprecated
114    Class<? extends SourceNode> getSourceNodeClass();
115
116    /**
117     * Added waiting the importer refactoring. Only used by Scan Importer.
118     *
119     * @since 5.7.3
120     */
121    @Deprecated
122    Class<? extends ImporterDocumentModelFactory> getDocModelFactoryClass();
123
124}