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