001/* 002 * (C) Copyright 2006-2007 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 * Nuxeo - initial API and implementation 018 * 019 * $Id$ 020 */ 021package org.nuxeo.ecm.platform.scanimporter.service; 022 023import org.nuxeo.common.utils.Path; 024import org.nuxeo.common.xmap.annotation.XNode; 025import org.nuxeo.common.xmap.annotation.XObject; 026 027/** 028 * XMap Descriptor for importer config 029 * 030 * @author Thierry Delprat 031 */ 032@XObject("importerConfig") 033public class ImporterConfig { 034 035 @XNode("sourcePath") 036 protected String sourcePath; 037 038 @XNode("processedPath") 039 protected String processedPath; 040 041 @XNode("nbThreads") 042 protected Integer nbThreads = 1; 043 044 @XNode("batchSize") 045 protected Integer batchSize = 10; 046 047 @XNode("transactionTimeout") 048 protected Integer transactionTimeout = 0; 049 050 @XNode("targetPath") 051 protected String targetPath = "/"; 052 053 @XNode("useXMLMapping") 054 protected boolean useXMLMapping = true; 055 056 @XNode("createInitialFolder") 057 protected boolean createInitialFolder = true; 058 059 @XNode("mergeInitialFolder") 060 protected boolean mergeInitialFolder = false; 061 062 @XNode("update") 063 protected boolean update = true; 064 065 public String getSourcePath() { 066 if (sourcePath == null) { 067 return null; 068 } 069 return new Path(sourcePath).removeTrailingSeparator().toString(); 070 } 071 072 public String getProcessedPath() { 073 return processedPath; 074 } 075 076 public Integer getNbThreads() { 077 return nbThreads; 078 } 079 080 public Integer getBatchSize() { 081 return batchSize; 082 } 083 084 /** 085 * @since 5.9.4 086 */ 087 public Integer getTransactionTimeout() { 088 return transactionTimeout; 089 } 090 091 public String getTargetPath() { 092 if (targetPath == null) { 093 return null; 094 } 095 return new Path(targetPath).removeTrailingSeparator().toString(); 096 } 097 098 public boolean useXMLMapping() { 099 return useXMLMapping; 100 } 101 102 public boolean isCreateInitialFolder() { 103 return createInitialFolder; 104 } 105 106 public boolean isUpdate() { 107 return update; 108 } 109 110 public void setCreateInitialFolder(boolean createInitialFolder) { 111 this.createInitialFolder = createInitialFolder; 112 } 113 114 public boolean isMergeInitialFolder() { 115 return mergeInitialFolder; 116 } 117 118 public void setMergeInitialFolder(boolean mergeInitialFolder) { 119 this.mergeInitialFolder = mergeInitialFolder; 120 } 121 122 public void setSourcePath(String sourcePath) { 123 this.sourcePath = sourcePath; 124 } 125 126 public void setProcessedPath(String processedPath) { 127 this.processedPath = processedPath; 128 } 129 130 public void setNbThreads(Integer nbThreads) { 131 this.nbThreads = nbThreads; 132 } 133 134 public void setBatchSize(Integer batchSize) { 135 this.batchSize = batchSize; 136 } 137 138 /** 139 * @since 5.9.4 140 */ 141 public void setTransactionTimeout(Integer transactionTimeout) { 142 this.transactionTimeout = transactionTimeout; 143 } 144 145 public void setTargetPath(String tagetPath) { 146 this.targetPath = tagetPath; 147 } 148 149 public void setUseXMLMapping(boolean useXMLMapping) { 150 this.useXMLMapping = useXMLMapping; 151 } 152 153 public void setUpdate(boolean update) { 154 this.update = update; 155 } 156 157}