639 |
private String dbDir; |
private String dbDir; |
640 |
private String fsDir; |
private String fsDir; |
641 |
private boolean flat; |
private boolean flat; |
642 |
|
private boolean insDir; |
643 |
|
|
644 |
/** |
/** |
645 |
* Creates a new instance of <code>AddInstruments</code>. |
* Creates a new instance of <code>AddInstruments</code>. |
662 |
*/ |
*/ |
663 |
public |
public |
664 |
AddInstruments(String dbDir, String fsDir, boolean flat) { |
AddInstruments(String dbDir, String fsDir, boolean flat) { |
665 |
|
this(dbDir, fsDir, flat, false); |
666 |
|
} |
667 |
|
|
668 |
|
/** |
669 |
|
* Creates a new instance of <code>AddInstruments</code>. |
670 |
|
* @param dbDir The absolute path name of the database directory |
671 |
|
* in which all instruments from the specified directory will be added. |
672 |
|
* @param fsDir The absolute path name of the file system directory. |
673 |
|
* @param flat If <code>true</code>, the respective subdirectory structure |
674 |
|
* will not be re-created in the supplied database directory. |
675 |
|
* @param insDir If <code>true</code>, a directory will be created for each |
676 |
|
* instrument file |
677 |
|
*/ |
678 |
|
public |
679 |
|
AddInstruments(String dbDir, String fsDir, boolean flat, boolean insDir) { |
680 |
setTitle("InstrumentsDb.AddInstruments_task"); |
setTitle("InstrumentsDb.AddInstruments_task"); |
681 |
String s = i18n.getMessage("InstrumentsDb.AddInstruments.desc"); |
String s = i18n.getMessage("InstrumentsDb.AddInstruments.desc"); |
682 |
setDescription(s); |
setDescription(s); |
683 |
this.dbDir = dbDir; |
this.dbDir = dbDir; |
684 |
this.fsDir = fsDir; |
this.fsDir = fsDir; |
685 |
this.flat = flat; |
this.flat = flat; |
686 |
|
this.insDir = insDir; |
687 |
} |
} |
688 |
|
|
689 |
/** The entry point of the task. */ |
/** The entry point of the task. */ |
690 |
public void |
public void |
691 |
run() { |
run() { |
692 |
try { |
try { |
693 |
int i; |
ScanMode scanMode = flat ? ScanMode.FLAT : ScanMode.RECURSIVE; |
694 |
if(flat) { |
int i = CC.getClient().addDbInstruments ( |
695 |
i = CC.getClient().addDbInstruments ( |
scanMode, dbDir, fsDir, true, insDir |
696 |
ScanMode.FLAT, dbDir, fsDir, true |
); |
|
); |
|
|
} else { |
|
|
i = CC.getClient().addDbInstruments ( |
|
|
ScanMode.RECURSIVE, dbDir, fsDir, true |
|
|
); |
|
|
} |
|
697 |
|
|
698 |
setResult(i); |
setResult(i); |
699 |
} |
} |
711 |
public static class AddInstrumentsNonrecursive extends EnhancedTask<Integer> { |
public static class AddInstrumentsNonrecursive extends EnhancedTask<Integer> { |
712 |
private String dbDir; |
private String dbDir; |
713 |
private String fsDir; |
private String fsDir; |
714 |
|
private boolean insDir; |
715 |
|
|
716 |
/** |
/** |
717 |
* Creates a new instance of <code>AddInstrumentsNonrecursive</code>. |
* Creates a new instance of <code>AddInstrumentsNonrecursive</code>. |
722 |
*/ |
*/ |
723 |
public |
public |
724 |
AddInstrumentsNonrecursive(String dbDir, String fsDir) { |
AddInstrumentsNonrecursive(String dbDir, String fsDir) { |
725 |
|
this(dbDir, fsDir, false); |
726 |
|
} |
727 |
|
|
728 |
|
/** |
729 |
|
* Creates a new instance of <code>AddInstrumentsNonrecursive</code>. |
730 |
|
* @param dbDir The absolute path name of the database directory |
731 |
|
* in which the instruments from the specified directory (excluding |
732 |
|
* the instruments in the subdirectories) will be added. |
733 |
|
* @param fsDir The absolute path name of the file system directory. |
734 |
|
* @param insDir If <code>true</code> a directory is add for each |
735 |
|
* instrument file. |
736 |
|
*/ |
737 |
|
public |
738 |
|
AddInstrumentsNonrecursive(String dbDir, String fsDir, boolean insDir) { |
739 |
setTitle("InstrumentsDb.AddInstrumentsNonrecursive_task"); |
setTitle("InstrumentsDb.AddInstrumentsNonrecursive_task"); |
740 |
String s = i18n.getMessage("InstrumentsDb.AddInstrumentsNonrecursive.desc"); |
String s = i18n.getMessage("InstrumentsDb.AddInstrumentsNonrecursive.desc"); |
741 |
setDescription(s); |
setDescription(s); |
742 |
this.dbDir = dbDir; |
this.dbDir = dbDir; |
743 |
this.fsDir = fsDir; |
this.fsDir = fsDir; |
744 |
|
this.insDir = insDir; |
745 |
} |
} |
746 |
|
|
747 |
/** The entry point of the task. */ |
/** The entry point of the task. */ |
749 |
run() { |
run() { |
750 |
try { |
try { |
751 |
int i = CC.getClient().addDbInstruments ( |
int i = CC.getClient().addDbInstruments ( |
752 |
ScanMode.NON_RECURSIVE, dbDir, fsDir, true |
ScanMode.NON_RECURSIVE, dbDir, fsDir, true, insDir |
753 |
); |
); |
|
|
|
754 |
setResult(i); |
setResult(i); |
755 |
} |
} |
756 |
catch(Exception x) { |
catch(Exception x) { |