001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *    Mariana Cedica
018 */
019package org.nuxeo.ecm.platform.importer.service;
020
021import org.nuxeo.ecm.platform.importer.executor.AbstractImporterExecutor;
022import org.nuxeo.ecm.platform.importer.factories.ImporterDocumentModelFactory;
023import org.nuxeo.ecm.platform.importer.log.ImporterLogger;
024import org.nuxeo.ecm.platform.importer.source.SourceNode;
025
026/**
027 * Allows basic configuration of the default importer :
028 * <p>
029 * Allows configuration of the a DocumentModelFactory and the document types it creates ( if no implementation is
030 * contributed, <code>DefaultDocumentModelFactory</code> is used;
031 * <p>
032 * Also allows configuration of the SourceNode implementation; if none is provided the
033 * {@link org.nuxeo.ecm.platform.importer.source.FileSourceNode} it's used by default
034 */
035public interface DefaultImporterService {
036
037    /**
038     * Imports documents using a DefaultImporterExecutor and the contributed documentModelFactory and SourceNode
039     * implementations; If no documentModelFactory implementation was contributed to the service,
040     * <code>DefaultDocumentModelFactory</code> it's used If no SourceNode implementation was contributed to the
041     * service, <code>FileSourceNode</code> it's used
042     */
043    void importDocuments(String destionationPath, String sourcePath, boolean skipRootContainerCreation, int batchSize,
044            int noImportingThreads);
045
046    /***
047     * Imports documents using a the given executor and the contributed documentModelFactory and SourceNode
048     * implementations; If no documentModelFactory implementation was contributed to the service,
049     * <code>DefaultDocumentModelFactory</code> it's used If no SourceNode implementation was contributed to the
050     * service, <code>FileSourceNode</code> it's used
051     */
052    String importDocuments(AbstractImporterExecutor executor, String destinationPath, String sourcePath,
053            boolean skipRootContainerCreation, int batchSize, int noImportingThreads, boolean interactive);
054
055    /***
056     * Imports documents using a the given executor and the contributed documentModelFactory and SourceNode
057     * implementations; Allows to overwrite the leaf and folderish types used by the documentModelFactory when
058     * importing; if one of them is not specified then the contributed one is used If no documentModelFactory
059     * implementation was contributed to the service, <code>DefaultDocumentModelFactory</code> it's used If no
060     * SourceNode implementation was contributed to the service, <code>FileSourceNode</code> it's used
061     */
062    String importDocuments(AbstractImporterExecutor executor, String leafType, String folderishType,
063            String destinationPath, String sourcePath, boolean skipRootContainerCreation, int batchSize,
064            int noImportingThreads, boolean interactive);
065
066    void setSourceNodeClass(Class<? extends SourceNode> sourceNodeClass);
067
068    void setDocModelFactoryClass(Class<? extends ImporterDocumentModelFactory> docModelFactoryClass);
069
070    void setLeafDocType(String fileDocType);
071
072    void setFolderishDocType(String folderishDocType);
073
074    void setImporterLogger(ImporterLogger importerLogger);
075
076    /**
077     * @since 5.9.4
078     */
079    void setTransactionTimeout(int transactionTimeout);
080
081    /**
082     * @since 7.1
083     */
084    void setRepository(String repositoryName);
085
086    /**
087     * Added waiting the importer refactoring. Only used by Scan Importer.
088     *
089     * @since 5.7.3
090     */
091    @Deprecated
092    Class<? extends SourceNode> getSourceNodeClass();
093
094    /**
095     * Added waiting the importer refactoring. Only used by Scan Importer.
096     *
097     * @since 5.7.3
098     */
099    @Deprecated
100    Class<? extends ImporterDocumentModelFactory> getDocModelFactoryClass();
101
102    /**
103     * Sets the bulk mode for the importer.
104     *
105     * @param bulkMode {@code true} to enable bulk mode (default), or {@code false} to disable it
106     * @since 8.3
107     */
108    void setBulkMode(boolean bulkMode);
109
110    /**
111     * Sets whether or not the GenericMultiThreadedImporter should log performance metrics
112     *
113     * @since 9.3
114     */
115    void setEnablePerfLogging(boolean enablePerfLogging);
116
117    /**
118     * Gets the enablePerfLogging value used by the GenericMultiThreadImporter. Only used by Scan Importer and JAXRS
119     * Importer.
120     *
121     * @since 9.3
122     */
123    boolean getEnablePerfLogging();
124
125}