4563 |
addDbInstruments(ScanMode mode, String dbDir, String fsDir, boolean background) |
addDbInstruments(ScanMode mode, String dbDir, String fsDir, boolean background) |
4564 |
throws IOException, LSException, LscpException { |
throws IOException, LSException, LscpException { |
4565 |
|
|
4566 |
|
return addDbInstruments(mode, dbDir, fsDir, background, false); |
4567 |
|
} |
4568 |
|
|
4569 |
|
/** |
4570 |
|
* Adds the instruments in the specified file system directory |
4571 |
|
* to the specified instruments database directory. |
4572 |
|
* @param mode Determines the scanning mode. If RECURSIVE is |
4573 |
|
* specified, all supported instruments in the specified file system |
4574 |
|
* direcotry will be added to the specified instruments database |
4575 |
|
* directory, including the instruments in subdirectories |
4576 |
|
* of the supplied directory. If NON_RECURSIVE is specified, |
4577 |
|
* the instruments in the subdirectories will not be processed. |
4578 |
|
* If FLAT is specified, all supported instruments in the specified |
4579 |
|
* file system direcotry will be added, including the instruments in |
4580 |
|
* subdirectories of the supplied directory, but the respective |
4581 |
|
* subdirectory structure will not be recreated in the instruments |
4582 |
|
* database and all instruments will be added directly in the |
4583 |
|
* specified database directory. |
4584 |
|
* @param dbDir The absolute path name of the database directory |
4585 |
|
* in which the supported instruments will be added. |
4586 |
|
* @param fsDir The absolute path name of the file system directory. |
4587 |
|
* @param background If <code>true</code>, the scan will be done |
4588 |
|
* in background and this method may return before the job is finished. |
4589 |
|
* @param insDir If <code>true</code> a drieectory is created for each |
4590 |
|
* instrument file. |
4591 |
|
* @return If <code>background</code> is <code>true</code>, the ID |
4592 |
|
* of the scan job. |
4593 |
|
* @throws IOException If some I/O error occurs. |
4594 |
|
* @throws LSException If the operation failed. |
4595 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4596 |
|
* @see #addInstrumentsDbListener |
4597 |
|
*/ |
4598 |
|
public synchronized int |
4599 |
|
addDbInstruments(ScanMode mode, String dbDir, String fsDir, boolean background, boolean insDir) |
4600 |
|
throws IOException, LSException, LscpException { |
4601 |
|
|
4602 |
verifyConnection(); |
verifyConnection(); |
4603 |
StringBuffer sb = new StringBuffer("ADD DB_INSTRUMENTS"); |
StringBuffer sb = new StringBuffer("ADD DB_INSTRUMENTS"); |
4604 |
if(background) sb.append(" NON_MODAL"); |
if(background) sb.append(" NON_MODAL"); |
4614 |
sb.append(" FLAT"); |
sb.append(" FLAT"); |
4615 |
break; |
break; |
4616 |
} |
} |
4617 |
|
if(insDir) |
4618 |
|
sb.append(" FILE_AS_DIR"); |
4619 |
|
|
4620 |
sb.append(" '").append(conv(dbDir)).append("' '"); |
sb.append(" '").append(conv(dbDir)).append("' '"); |
4621 |
sb.append(conv(fsDir)).append("'"); |
sb.append(conv(fsDir)).append("'"); |
4625 |
ResultSet rs = getEmptyResultSet(); |
ResultSet rs = getEmptyResultSet(); |
4626 |
return rs.getIndex(); |
return rs.getIndex(); |
4627 |
} |
} |
4628 |
|
|
4629 |
/** |
/** |
4630 |
* Removes the specified instrument from the instruments database. |
* Removes the specified instrument from the instruments database. |
4631 |
* @param instr The absolute path name of the instrument to remove. |
* @param instr The absolute path name of the instrument to remove. |