/[svn]/jsampler/trunk/src/org/jsampler/task/InstrumentsDb.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/task/InstrumentsDb.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1205 by iliev, Thu May 24 21:55:41 2007 UTC revision 1781 by iliev, Mon Sep 29 18:21:21 2008 UTC
# Line 140  public class InstrumentsDb { Line 140  public class InstrumentsDb {
140                                    
141                  /**                  /**
142                   * Used to decrease the traffic. All task in the queue                   * Used to decrease the traffic. All task in the queue
143                   * equal to this are removed.                   * equal to this are removed if added using {@link org.jsampler.CC#scheduleTask}.
144                     * @see org.jsampler.CC#addTask
145                   */                   */
146                  public boolean                  public boolean
147                  equals(Object obj) {                  equals(Object obj) {
# Line 387  public class InstrumentsDb { Line 388  public class InstrumentsDb {
388                                    
389                  /**                  /**
390                   * Used to decrease the traffic. All task in the queue                   * Used to decrease the traffic. All task in the queue
391                   * equal to this are removed.                   * equal to this are removed if added using {@link org.jsampler.CC#scheduleTask}.
392                     * @see org.jsampler.CC#addTask
393                   */                   */
394                  public boolean                  public boolean
395                  equals(Object obj) {                  equals(Object obj) {
# Line 637  public class InstrumentsDb { Line 639  public class InstrumentsDb {
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>.
# Line 659  public class InstrumentsDb { Line 662  public class InstrumentsDb {
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                          }                          }
# Line 698  public class InstrumentsDb { Line 711  public class InstrumentsDb {
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>.
# Line 708  public class InstrumentsDb { Line 722  public class InstrumentsDb {
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. */
# Line 720  public class InstrumentsDb { Line 749  public class InstrumentsDb {
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) {
# Line 875  public class InstrumentsDb { Line 903  public class InstrumentsDb {
903          }          }
904                    
905          /**          /**
906             * This task gets a list of all instrument files in the database
907             * that that doesn't exist in the filesystem.
908             */
909            public static class FindLostInstrumentFiles extends EnhancedTask<String[]> {
910                    
911                    /**
912                     * Creates a new instance of <code>FindLostInstrumentFiles</code>.
913                     */
914                    public
915                    FindLostInstrumentFiles() {
916                            setTitle("InstrumentsDb.FindLostInstrumentFiles_task");
917                            setDescription(i18n.getMessage("InstrumentsDb.FindLostInstrumentFiles.desc"));
918                    }
919            
920                    /** The entry point of the task. */
921                    public void
922                    run() {
923                            try { setResult(CC.getClient().findLostDbInstrumentFiles()); }
924                            catch(Exception x) {
925                                    setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));
926                                    CC.getLogger().log(Level.FINE, getErrorMessage(), x);
927                            }
928                    }
929            }
930            
931            /**
932             * This task substitutes all occurrences of the specified instrument file
933             * in the database, with the specified new path.
934             */
935            public static class SetInstrumentFilePath extends EnhancedTask {
936                    private String oldPath;
937                    private String newPath;
938                    
939                    /**
940                     * Creates a new instance of <code>SetInstrumentFilePath</code>.
941                     * @param oldPath The absolute path name of the instrument file to substitute.
942                     * @param newPath The new absolute path name.
943                     */
944                    public
945                    SetInstrumentFilePath(String oldPath, String newPath) {
946                            setTitle("InstrumentsDb.SetInstrumentFilePath_task");
947                            setDescription(i18n.getMessage("InstrumentsDb.SetInstrumentFilePath.desc"));
948                            this.oldPath = oldPath;
949                            this.newPath = newPath;
950                    }
951            
952                    /** The entry point of the task. */
953                    public void
954                    run() {
955                            try { CC.getClient().setDbInstrumentFilePath(oldPath, newPath); }
956                            catch(Exception x) {
957                                    setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));
958                                    CC.getLogger().log(Level.FINE, getErrorMessage(), x);
959                            }
960                    }
961            }
962            
963            /**
964           * This task retrieves information about a scan job.           * This task retrieves information about a scan job.
965           */           */
966          public static class GetScanJobInfo extends EnhancedTask<ScanJobInfo> {          public static class GetScanJobInfo extends EnhancedTask<ScanJobInfo> {
# Line 906  public class InstrumentsDb { Line 992  public class InstrumentsDb {
992                                    
993                  /**                  /**
994                   * Used to decrease the traffic. All task in the queue                   * Used to decrease the traffic. All task in the queue
995                   * equal to this are removed.                   * equal to this are removed if added using {@link org.jsampler.CC#scheduleTask}.
996                     * @see org.jsampler.CC#addTask
997                   */                   */
998                  public boolean                  public boolean
999                  equals(Object obj) {                  equals(Object obj) {
# Line 917  public class InstrumentsDb { Line 1004  public class InstrumentsDb {
1004                          return true;                          return true;
1005                  }                  }
1006          }          }
1007            
1008            /**
1009             * This task formats the instruments database.
1010             */
1011            public static class Format extends EnhancedTask {
1012                    /**
1013                     * Formats the instruments database..
1014                     */
1015                    public
1016                    Format() {
1017                            setTitle("InstrumentsDb.Format_task");
1018                            String s = i18n.getMessage("InstrumentsDb.Format.desc");
1019                            setDescription(s);
1020                    }
1021            
1022                    /** The entry point of the task. */
1023                    public void
1024                    run() {
1025                            try { CC.getClient().formatInstrumentsDb(); }
1026                            catch(Exception x) {
1027                                    setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));
1028                                    CC.getLogger().log(Level.FINE, getErrorMessage(), x);
1029                            }
1030                    }
1031            }
1032  }  }

Legend:
Removed from v.1205  
changed lines
  Added in v.1781

  ViewVC Help
Powered by ViewVC