@@ -76,6 +76,8 @@ public class ConfigParser {
7676 private static final String FILE_LIST_PATH = "fileListPath" ;
7777 private static final String CHECK_LOCAL_RECORD = "checkLocalRecord" ;
7878
79+ private static final String LOCAL_TO_COSN_FS_SECTION_NAME = "migrateLocalToCosnFs" ;
80+
7981 private static final String ALI_SECTION_NAME = "migrateAli" ;
8082 private static final String AWS_SECTION_NAME = "migrateAws" ;
8183 private static final String QINIU_SECTION_NAME = "migrateQiniu" ;
@@ -303,6 +305,14 @@ public boolean parse() {
303305 if (!initCopyFromUpyunConfig (prefs , (CopyFromUpyunConfig ) config )) {
304306 return false ;
305307 }
308+ } else if (migrateType .equals (MigrateType .MIGRATE_FROM_LOCAL_TO_COSN_FS )){
309+ if (!checkMigrateLocalToCosnFsConfig (prefs )) {
310+ return false ;
311+ }
312+ config = new CopyFromLocalToCosnConfig ();
313+ if (!initCopyFromLocalToCosnConfig (prefs , (CopyFromLocalToCosnConfig ) config )) {
314+ return false ;
315+ }
306316 }
307317
308318
@@ -402,6 +412,13 @@ private boolean checkMigrateLocalConfig(Preferences prefs) {
402412 return true ;
403413 }
404414
415+ private boolean checkMigrateLocalToCosnFsConfig (Preferences prefs ) {
416+ if (!isKeyExist (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , LOCAL_LOCALPATH )) {
417+ return false ;
418+ }
419+ return true ;
420+ }
421+
405422 private boolean checkMigrateCopyBucketConfig (Preferences prefs ) {
406423 if (!isKeyExist (prefs , COPY_BUCKET_SECTION_NAME , COPY_SRC_REGION )) {
407424 return false ;
@@ -715,6 +732,69 @@ private boolean initCopyFromLocalConfig(Preferences prefs,
715732 return true ;
716733 }
717734
735+ private boolean initCopyFromLocalToCosnConfig (Preferences prefs ,
736+ CopyFromLocalToCosnConfig copyLocalConfig ) {
737+ if (!initCommonConfig (prefs , copyLocalConfig )) {
738+ return false ;
739+ }
740+ try {
741+
742+ String localPathConfig = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , LOCAL_LOCALPATH );
743+ assert (localPathConfig != null );
744+ copyLocalConfig .setLocalPath (localPathConfig );
745+
746+ String excludes = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , LOCAL_EXECLUDE );
747+ if (excludes != null && !excludes .trim ().isEmpty ()) {
748+ copyLocalConfig .setExcludes (excludes );
749+ } else {
750+ excludes = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , "excludes" );
751+ if (excludes != null && !excludes .trim ().isEmpty ()) {
752+ copyLocalConfig .setExcludes (excludes );
753+ }
754+ }
755+
756+ String ignoreModifiedTimeLessThanStr =
757+ getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , IGNORE_MODIFIED_TIME_LESS_THAN );
758+ if (ignoreModifiedTimeLessThanStr != null
759+ && !ignoreModifiedTimeLessThanStr .trim ().isEmpty ()) {
760+ copyLocalConfig .setIgnoreModifiedTimeLessThan (ignoreModifiedTimeLessThanStr );
761+ }
762+
763+ String ignoreSuffix = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , IGNORE_SUFFIX );
764+ if (ignoreSuffix != null && !ignoreSuffix .trim ().isEmpty ()) {
765+ copyLocalConfig .setIgnoreSuffix (ignoreSuffix );
766+ }
767+
768+ String includeSuffix = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , INCLUDE_SUFFIX );
769+ if (includeSuffix != null && !includeSuffix .trim ().isEmpty ()) {
770+ copyLocalConfig .setIncludeSuffix (includeSuffix );
771+ }
772+
773+ String ignoreEmptyFile = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , IGNORE_EMPTY_FILE );
774+ if (ignoreEmptyFile != null && (ignoreEmptyFile .compareToIgnoreCase ("on" ) == 0 )) {
775+ copyLocalConfig .setIgnoreEmptyFile (true );
776+ }
777+ String fileListMode = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , FILE_LIST_MODE );
778+ if (fileListMode != null && (fileListMode .compareToIgnoreCase ("on" ) == 0 )) {
779+ copyLocalConfig .setFileListMode (true );
780+ }
781+ String fileListPath = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , FILE_LIST_PATH );
782+ if (fileListPath != null ) {
783+ copyLocalConfig .setFileListPath (fileListPath );
784+ }
785+
786+ String strCheckLocal = getConfigValue (prefs , LOCAL_TO_COSN_FS_SECTION_NAME , CHECK_LOCAL_RECORD );
787+ if (strCheckLocal != null ) {
788+ copyLocalConfig .setCheckLocalRecord (strCheckLocal );
789+ }
790+ } catch (Exception e ) {
791+ System .err .println (e .getMessage ());
792+ log .error (e .getMessage ());
793+ return false ;
794+ }
795+ return true ;
796+ }
797+
718798 private boolean initCopyFromUrllistConfig (Preferences prefs ,
719799 CopyFromUrllistConfig copyUrllistConfig ) {
720800 if (!initCommonConfig (prefs , copyUrllistConfig )) {
0 commit comments