34 |
import java.util.logging.Level; |
import java.util.logging.Level; |
35 |
import java.util.logging.Logger; |
import java.util.logging.Logger; |
36 |
|
|
|
import static org.linuxsampler.lscp.Parser.*; |
|
37 |
import org.linuxsampler.lscp.event.*; |
import org.linuxsampler.lscp.event.*; |
38 |
|
|
39 |
|
import static org.linuxsampler.lscp.Parser.*; |
40 |
|
|
41 |
|
|
42 |
/** |
/** |
43 |
* This class is the abstraction representing a client endpoint for communication with LinuxSampler |
* This class is the abstraction representing a client endpoint for communication with LinuxSampler |
70 |
private String address; |
private String address; |
71 |
private int port; |
private int port; |
72 |
private Socket sock = null; |
private Socket sock = null; |
73 |
private int soTimeout = 10000; |
private int soTimeout = 20000; |
74 |
|
|
75 |
private LscpInputStream in = null; |
private LscpInputStream in = null; |
76 |
private LscpOutputStream out = null; |
private LscpOutputStream out = null; |
80 |
private boolean printOnlyMode = false; |
private boolean printOnlyMode = false; |
81 |
|
|
82 |
class EventThread extends Thread { |
class EventThread extends Thread { |
83 |
|
private Vector<String> queue = new Vector<String>(); |
84 |
private boolean terminate = false; |
private boolean terminate = false; |
85 |
|
|
86 |
EventThread() { super("LSCP-Event-Thread"); } |
EventThread() { super("LSCP-Event-Thread"); } |
88 |
public void |
public void |
89 |
run() { |
run() { |
90 |
while(!mustTerminate()) { |
while(!mustTerminate()) { |
91 |
try { processNotifications(); } |
try { |
92 |
catch(Exception x) { |
processQueue(); |
93 |
|
processNotifications(); |
94 |
|
} catch(Exception x) { |
95 |
getLogger().log(Level.FINE, x.getMessage(), x); |
getLogger().log(Level.FINE, x.getMessage(), x); |
96 |
} |
} |
97 |
try { synchronized(this) { wait(100); } } |
try { synchronized(this) { wait(100); } } |
109 |
terminate = true; |
terminate = true; |
110 |
this.notifyAll(); |
this.notifyAll(); |
111 |
} |
} |
112 |
|
|
113 |
|
public synchronized void |
114 |
|
scheduleNotification(String s) { queue.add(s); } |
115 |
|
|
116 |
|
private void |
117 |
|
processQueue() { |
118 |
|
String[] notifications = popAllNotifications(); |
119 |
|
for(String n : notifications) fireEvent(n); |
120 |
|
} |
121 |
|
|
122 |
|
private synchronized String[] |
123 |
|
popAllNotifications() { |
124 |
|
String[] notifications = queue.toArray(new String[queue.size()]); |
125 |
|
queue.removeAllElements(); |
126 |
|
return notifications; |
127 |
|
} |
128 |
} |
} |
129 |
|
|
130 |
/** |
/** |
344 |
if(!llFSI.isEmpty()) subscribe("FX_SEND_INFO"); |
if(!llFSI.isEmpty()) subscribe("FX_SEND_INFO"); |
345 |
if(!llSC.isEmpty()) subscribe("STREAM_COUNT"); |
if(!llSC.isEmpty()) subscribe("STREAM_COUNT"); |
346 |
if(!llVC.isEmpty()) subscribe("VOICE_COUNT"); |
if(!llVC.isEmpty()) subscribe("VOICE_COUNT"); |
347 |
|
if(!llTSC.isEmpty()) subscribe("TOTAL_STREAM_COUNT"); |
348 |
if(!llTVC.isEmpty()) subscribe("TOTAL_VOICE_COUNT"); |
if(!llTVC.isEmpty()) subscribe("TOTAL_VOICE_COUNT"); |
349 |
if(!llMIMC.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_COUNT"); |
if(!llMIMC.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_COUNT"); |
350 |
if(!llMIMI.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_INFO"); |
if(!llMIMI.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_INFO"); |
351 |
if(!llMIC.isEmpty()) subscribe("MIDI_INSTRUMENT_COUNT"); |
if(!llMIC.isEmpty()) subscribe("MIDI_INSTRUMENT_COUNT"); |
352 |
if(!llMII.isEmpty()) subscribe("MIDI_INSTRUMENT_INFO"); |
if(!llMII.isEmpty()) subscribe("MIDI_INSTRUMENT_INFO"); |
353 |
|
if(!llID.isEmpty()) { |
354 |
|
subscribe("DB_INSTRUMENT_DIRECTORY_COUNT"); |
355 |
|
subscribe("DB_INSTRUMENT_DIRECTORY_INFO"); |
356 |
|
subscribe("DB_INSTRUMENT_COUNT"); |
357 |
|
subscribe("DB_INSTRUMENT_INFO"); |
358 |
|
} |
359 |
if(!llGI.isEmpty()) subscribe("GLOBAL_INFO"); |
if(!llGI.isEmpty()) subscribe("GLOBAL_INFO"); |
360 |
} |
} |
361 |
|
|
403 |
String s; |
String s; |
404 |
for(;;) { |
for(;;) { |
405 |
s = in.readLine(); |
s = in.readLine(); |
406 |
if(s.startsWith("NOTIFY:")) fireEvent(s.substring("NOTIFY:".length())); |
if(s.startsWith("NOTIFY:")) { |
407 |
|
eventThread.scheduleNotification(s.substring("NOTIFY:".length())); |
408 |
|
} |
409 |
else break; |
else break; |
410 |
} |
} |
411 |
return s; |
return s; |
486 |
private final Vector<ItemInfoListener> llMIDI = new Vector<ItemInfoListener>(); |
private final Vector<ItemInfoListener> llMIDI = new Vector<ItemInfoListener>(); |
487 |
private final Vector<StreamCountListener> llSC = new Vector<StreamCountListener>(); |
private final Vector<StreamCountListener> llSC = new Vector<StreamCountListener>(); |
488 |
private final Vector<VoiceCountListener> llVC = new Vector<VoiceCountListener>(); |
private final Vector<VoiceCountListener> llVC = new Vector<VoiceCountListener>(); |
489 |
|
private final Vector<TotalStreamCountListener> llTSC = new Vector<TotalStreamCountListener>(); |
490 |
private final Vector<TotalVoiceCountListener> llTVC = new Vector<TotalVoiceCountListener>(); |
private final Vector<TotalVoiceCountListener> llTVC = new Vector<TotalVoiceCountListener>(); |
491 |
|
|
492 |
/** MIDI instrument map count listeners */ |
/** MIDI instrument map count listeners */ |
499 |
/** MIDI instrument info listeners */ |
/** MIDI instrument info listeners */ |
500 |
private final Vector<MidiInstrumentInfoListener> llMII = |
private final Vector<MidiInstrumentInfoListener> llMII = |
501 |
new Vector<MidiInstrumentInfoListener>(); |
new Vector<MidiInstrumentInfoListener>(); |
502 |
|
private final Vector<InstrumentsDbListener> llID = new Vector<InstrumentsDbListener>(); |
503 |
private final Vector<GlobalInfoListener> llGI = new Vector<GlobalInfoListener>(); |
private final Vector<GlobalInfoListener> llGI = new Vector<GlobalInfoListener>(); |
504 |
|
|
505 |
|
|
524 |
!llMIDI.isEmpty() || |
!llMIDI.isEmpty() || |
525 |
!llSC.isEmpty() || |
!llSC.isEmpty() || |
526 |
!llVC.isEmpty() || |
!llVC.isEmpty() || |
527 |
|
!llTSC.isEmpty() || |
528 |
!llTVC.isEmpty() || |
!llTVC.isEmpty() || |
529 |
!llMIMC.isEmpty() || |
!llMIMC.isEmpty() || |
530 |
!llMIMI.isEmpty() || |
!llMIMI.isEmpty() || |
531 |
!llMIC.isEmpty() || |
!llMIC.isEmpty() || |
532 |
!llMII.isEmpty() || |
!llMII.isEmpty() || |
533 |
|
!llID.isEmpty() || |
534 |
!llGI.isEmpty(); |
!llGI.isEmpty(); |
535 |
} |
} |
536 |
|
|
537 |
private void |
private synchronized void |
538 |
fireEvent(String s) { |
fireEvent(String s) { |
539 |
if(s.startsWith("CHANNEL_COUNT:")) { |
if(s.startsWith("DB_INSTRUMENT_DIRECTORY_COUNT:")) { |
540 |
|
s = s.substring("DB_INSTRUMENT_DIRECTORY_COUNT:".length()); |
541 |
|
InstrumentsDbEvent e = new InstrumentsDbEvent(this, s); |
542 |
|
for(InstrumentsDbListener l : llID) l.directoryCountChanged(e); |
543 |
|
} else if(s.startsWith("DB_INSTRUMENT_DIRECTORY_INFO:")) { |
544 |
|
InstrumentsDbEvent e; |
545 |
|
s = s.substring("DB_INSTRUMENT_DIRECTORY_INFO:".length()); |
546 |
|
if(s.startsWith("NAME ")) { |
547 |
|
String[] list; |
548 |
|
try { |
549 |
|
s = s.substring("NAME ".length()); |
550 |
|
list = parseEscapedStringList(s, ' '); |
551 |
|
if(list.length != 2) throw new LscpException(); |
552 |
|
list[1] = toNonEscapedString(list[1]); |
553 |
|
e = new InstrumentsDbEvent(this, list[0], list[1]); |
554 |
|
for(InstrumentsDbListener l : llID) { |
555 |
|
l.directoryNameChanged(e); |
556 |
|
} |
557 |
|
} catch(LscpException x) { |
558 |
|
getLogger().log ( |
559 |
|
Level.WARNING, |
560 |
|
LscpI18n.getLogMsg("CommandFailed!"), |
561 |
|
x |
562 |
|
); |
563 |
|
} |
564 |
|
} else { |
565 |
|
e = new InstrumentsDbEvent(this, s); |
566 |
|
for(InstrumentsDbListener l : llID) l.directoryInfoChanged(e); |
567 |
|
} |
568 |
|
} else if(s.startsWith("DB_INSTRUMENT_COUNT:")) { |
569 |
|
s = s.substring("DB_INSTRUMENT_COUNT:".length()); |
570 |
|
InstrumentsDbEvent e = new InstrumentsDbEvent(this, s); |
571 |
|
for(InstrumentsDbListener l : llID) l.instrumentCountChanged(e); |
572 |
|
} else if(s.startsWith("DB_INSTRUMENT_INFO:")) { |
573 |
|
InstrumentsDbEvent e; |
574 |
|
s = s.substring("DB_INSTRUMENT_INFO:".length()); |
575 |
|
if(s.startsWith("NAME ")) { |
576 |
|
String[] list; |
577 |
|
try { |
578 |
|
s = s.substring("NAME ".length()); |
579 |
|
list = parseEscapedStringList(s, ' '); |
580 |
|
if(list.length != 2) throw new LscpException(); |
581 |
|
list[1] = toNonEscapedString(list[1]); |
582 |
|
e = new InstrumentsDbEvent(this, list[0], list[1]); |
583 |
|
for(InstrumentsDbListener l : llID) { |
584 |
|
l.instrumentNameChanged(e); |
585 |
|
} |
586 |
|
} catch(LscpException x) { |
587 |
|
getLogger().log ( |
588 |
|
Level.WARNING, |
589 |
|
LscpI18n.getLogMsg("CommandFailed!"), |
590 |
|
x |
591 |
|
); |
592 |
|
} |
593 |
|
} else { |
594 |
|
e = new InstrumentsDbEvent(this, s); |
595 |
|
for(InstrumentsDbListener l : llID) l.instrumentInfoChanged(e); |
596 |
|
} |
597 |
|
} else if(s.startsWith("DB_INSTRUMENTS_JOB_INFO:")) { |
598 |
|
s = s.substring("DB_INSTRUMENTS_JOB_INFO:".length()); |
599 |
|
try { |
600 |
|
int i = Integer.parseInt(s); |
601 |
|
InstrumentsDbEvent e = new InstrumentsDbEvent(this, i); |
602 |
|
for(InstrumentsDbListener l : llID) l.jobStatusChanged(e); |
603 |
|
} catch(NumberFormatException x) { |
604 |
|
s = "Unknown DB_INSTRUMENTS_JOB_INFO format"; |
605 |
|
getLogger().log(Level.WARNING, s, x); |
606 |
|
} |
607 |
|
|
608 |
|
} else if(s.startsWith("CHANNEL_COUNT:")) { |
609 |
try { |
try { |
610 |
int i = Integer.parseInt(s.substring("CHANNEL_COUNT:".length())); |
int i = Integer.parseInt(s.substring("CHANNEL_COUNT:".length())); |
611 |
ChannelCountEvent e = new ChannelCountEvent(this, i); |
ChannelCountEvent e = new ChannelCountEvent(this, i); |
665 |
} catch(NumberFormatException x) { |
} catch(NumberFormatException x) { |
666 |
getLogger().log(Level.WARNING, "Unknown CHANNEL_INFO format", x); |
getLogger().log(Level.WARNING, "Unknown CHANNEL_INFO format", x); |
667 |
} |
} |
668 |
|
} else if(s.startsWith("TOTAL_STREAM_COUNT:")) { |
669 |
|
try { |
670 |
|
s = s.substring("TOTAL_STREAM_COUNT:".length()); |
671 |
|
int i = Integer.parseInt(s); |
672 |
|
TotalStreamCountEvent e = new TotalStreamCountEvent(this, i); |
673 |
|
for(TotalStreamCountListener l : llTSC) l.totalStreamCountChanged(e); |
674 |
|
} catch(NumberFormatException x) { |
675 |
|
getLogger().log ( |
676 |
|
Level.WARNING, "Unknown TOTAL_STREAM_COUNT format", x |
677 |
|
); |
678 |
|
} |
679 |
} else if(s.startsWith("TOTAL_VOICE_COUNT:")) { |
} else if(s.startsWith("TOTAL_VOICE_COUNT:")) { |
680 |
try { |
try { |
681 |
s = s.substring("TOTAL_VOICE_COUNT:".length()); |
s = s.substring("TOTAL_VOICE_COUNT:".length()); |
1148 |
/** |
/** |
1149 |
* Registers the specified listener for receiving event messages. |
* Registers the specified listener for receiving event messages. |
1150 |
* Listeners can be registered regardless of the connection state. |
* Listeners can be registered regardless of the connection state. |
1151 |
|
* @param l The <code>TotalStreamCountListener</code> to register. |
1152 |
|
*/ |
1153 |
|
public synchronized void |
1154 |
|
addTotalStreamCountListener(TotalStreamCountListener l) { |
1155 |
|
if(llTSC.isEmpty()) subscribe("TOTAL_STREAM_COUNT"); |
1156 |
|
llTSC.add(l); |
1157 |
|
} |
1158 |
|
|
1159 |
|
/** |
1160 |
|
* Removes the specified listener. |
1161 |
|
* Listeners can be removed regardless of the connection state. |
1162 |
|
* @param l The <code>TotalStreamCountListener</code> to remove. |
1163 |
|
*/ |
1164 |
|
public synchronized void |
1165 |
|
removeTotalStreamCountListener(TotalStreamCountListener l) { |
1166 |
|
boolean b = llTSC.remove(l); |
1167 |
|
if(b && llTSC.isEmpty()) unsubscribe("TOTAL_STREAM_COUNT"); |
1168 |
|
} |
1169 |
|
|
1170 |
|
/** |
1171 |
|
* Registers the specified listener for receiving event messages. |
1172 |
|
* Listeners can be registered regardless of the connection state. |
1173 |
* @param l The <code>TotalVoiceCountListener</code> to register. |
* @param l The <code>TotalVoiceCountListener</code> to register. |
1174 |
*/ |
*/ |
1175 |
public synchronized void |
public synchronized void |
1280 |
/** |
/** |
1281 |
* Registers the specified listener for receiving event messages. |
* Registers the specified listener for receiving event messages. |
1282 |
* Listeners can be registered regardless of the connection state. |
* Listeners can be registered regardless of the connection state. |
1283 |
|
* @param l The <code>InstrumentsDbListener</code> to register. |
1284 |
|
*/ |
1285 |
|
public synchronized void |
1286 |
|
addInstrumentsDbListener(InstrumentsDbListener l) { |
1287 |
|
if(llID.isEmpty()) { |
1288 |
|
subscribe("DB_INSTRUMENT_DIRECTORY_COUNT"); |
1289 |
|
subscribe("DB_INSTRUMENT_DIRECTORY_INFO"); |
1290 |
|
subscribe("DB_INSTRUMENT_COUNT"); |
1291 |
|
subscribe("DB_INSTRUMENT_INFO"); |
1292 |
|
subscribe("DB_INSTRUMENTS_JOB_INFO"); |
1293 |
|
} |
1294 |
|
llID.add(l); |
1295 |
|
} |
1296 |
|
|
1297 |
|
/** |
1298 |
|
* Removes the specified listener. |
1299 |
|
* Listeners can be removed regardless of the connection state. |
1300 |
|
* @param l The <code>InstrumentsDbListener</code> to remove. |
1301 |
|
*/ |
1302 |
|
public synchronized void |
1303 |
|
removeInstrumentsDbListener(InstrumentsDbListener l) { |
1304 |
|
boolean b = llID.remove(l); |
1305 |
|
if(b && llID.isEmpty()) { |
1306 |
|
unsubscribe("DB_INSTRUMENT_DIRECTORY_COUNT"); |
1307 |
|
unsubscribe("DB_INSTRUMENT_DIRECTORY_INFO"); |
1308 |
|
unsubscribe("DB_INSTRUMENT_COUNT"); |
1309 |
|
unsubscribe("DB_INSTRUMENT_INFO"); |
1310 |
|
unsubscribe("DB_INSTRUMENTS_JOB_INFO"); |
1311 |
|
} |
1312 |
|
} |
1313 |
|
|
1314 |
|
/** |
1315 |
|
* Registers the specified listener for receiving event messages. |
1316 |
|
* Listeners can be registered regardless of the connection state. |
1317 |
* @param l The <code>GlobalInfoListener</code> to register. |
* @param l The <code>GlobalInfoListener</code> to register. |
1318 |
*/ |
*/ |
1319 |
public synchronized void |
public synchronized void |
1396 |
/** |
/** |
1397 |
* Gets detailed information about a specific audio output driver. |
* Gets detailed information about a specific audio output driver. |
1398 |
* @param driverName The name of the audio output driver. |
* @param driverName The name of the audio output driver. |
1399 |
* |
* @param depList An optional list of dependences parameters. |
1400 |
* @return An <code>AudioOutputDriver</code> object containing |
* @return An <code>AudioOutputDriver</code> object containing |
1401 |
* information about the specified audio output driver. |
* information about the specified audio output driver. |
1402 |
* |
* |
1406 |
* |
* |
1407 |
* @see #getAudioOutputDriverNames |
* @see #getAudioOutputDriverNames |
1408 |
*/ |
*/ |
1409 |
private synchronized AudioOutputDriver |
public synchronized AudioOutputDriver |
1410 |
getAudioOutputDriverInfo(String driverName) throws IOException, LscpException, LSException { |
getAudioOutputDriverInfo(String driverName, Parameter... depList) |
1411 |
|
throws IOException, LscpException, LSException { |
1412 |
|
|
1413 |
verifyConnection(); |
verifyConnection(); |
1414 |
out.writeLine("GET AUDIO_OUTPUT_DRIVER INFO " + driverName); |
out.writeLine("GET AUDIO_OUTPUT_DRIVER INFO " + driverName); |
1415 |
if(getPrintOnlyMode()) return null; |
if(getPrintOnlyMode()) return null; |
1419 |
aod.setName(driverName); |
aod.setName(driverName); |
1420 |
|
|
1421 |
for(String s : aod.getParameterNames()) |
for(String s : aod.getParameterNames()) |
1422 |
aod.addParameter(getAudioOutputDriverParameterInfo(driverName, s)); |
aod.addParameter(getAudioOutputDriverParameterInfo(driverName, s, depList)); |
1423 |
|
|
1424 |
return aod; |
return aod; |
1425 |
} |
} |
1453 |
StringBuffer args = new StringBuffer(driver); |
StringBuffer args = new StringBuffer(driver); |
1454 |
args.append(' ').append(param); |
args.append(' ').append(param); |
1455 |
|
|
1456 |
for(Parameter p : deplist) |
for(Parameter p : deplist) { |
1457 |
|
if(p.getValue() == null) continue; |
1458 |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
1459 |
|
} |
1460 |
|
|
1461 |
out.writeLine("GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO " + args.toString()); |
out.writeLine("GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO " + args.toString()); |
1462 |
if(getPrintOnlyMode()) return null; |
if(getPrintOnlyMode()) return null; |
1517 |
verifyConnection(); |
verifyConnection(); |
1518 |
StringBuffer args = new StringBuffer(aoDriver); |
StringBuffer args = new StringBuffer(aoDriver); |
1519 |
|
|
1520 |
for(Parameter p : paramList) |
for(Parameter p : paramList) { |
1521 |
|
if(p.getValue() == null) continue; |
1522 |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
1523 |
|
} |
1524 |
|
|
1525 |
out.writeLine("CREATE AUDIO_OUTPUT_DEVICE " + args.toString()); |
out.writeLine("CREATE AUDIO_OUTPUT_DEVICE " + args.toString()); |
1526 |
if(getPrintOnlyMode()) return -1; |
if(getPrintOnlyMode()) return -1; |
1981 |
/** |
/** |
1982 |
* Gets detailed information about a specific MIDI input driver. |
* Gets detailed information about a specific MIDI input driver. |
1983 |
* @param driverName The name of the MIDI input driver. |
* @param driverName The name of the MIDI input driver. |
1984 |
* |
* @param depList An optional list of dependences parameters. |
1985 |
* @return A <code>MidiInputDriver</code> object containing |
* @return A <code>MidiInputDriver</code> object containing |
1986 |
* information about the specified MIDI input driver. |
* information about the specified MIDI input driver. |
1987 |
* |
* |
1991 |
* |
* |
1992 |
* @see #getMidiInputDriverNames |
* @see #getMidiInputDriverNames |
1993 |
*/ |
*/ |
1994 |
private synchronized MidiInputDriver |
public synchronized MidiInputDriver |
1995 |
getMidiInputDriverInfo(String driverName) throws IOException, LscpException, LSException { |
getMidiInputDriverInfo(String driverName, Parameter... depList) |
1996 |
|
throws IOException, LscpException, LSException { |
1997 |
|
|
1998 |
verifyConnection(); |
verifyConnection(); |
1999 |
out.writeLine("GET MIDI_INPUT_DRIVER INFO " + driverName); |
out.writeLine("GET MIDI_INPUT_DRIVER INFO " + driverName); |
2000 |
if(getPrintOnlyMode()) return null; |
if(getPrintOnlyMode()) return null; |
2005 |
mid.setName(driverName); |
mid.setName(driverName); |
2006 |
|
|
2007 |
for(String s : mid.getParameterNames()) |
for(String s : mid.getParameterNames()) |
2008 |
mid.addParameter(getMidiInputDriverParameterInfo(driverName, s)); |
mid.addParameter(getMidiInputDriverParameterInfo(driverName, s, depList)); |
2009 |
|
|
2010 |
return mid; |
return mid; |
2011 |
} |
} |
2039 |
StringBuffer args = new StringBuffer(driver); |
StringBuffer args = new StringBuffer(driver); |
2040 |
args.append(' ').append(param); |
args.append(' ').append(param); |
2041 |
|
|
2042 |
for(Parameter p : deplist) |
for(Parameter p : deplist) { |
2043 |
|
if(p.getValue() == null) continue; |
2044 |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
2045 |
|
} |
2046 |
|
|
2047 |
out.writeLine("GET MIDI_INPUT_DRIVER_PARAMETER INFO " + args.toString()); |
out.writeLine("GET MIDI_INPUT_DRIVER_PARAMETER INFO " + args.toString()); |
2048 |
if(getPrintOnlyMode()) return null; |
if(getPrintOnlyMode()) return null; |
2104 |
verifyConnection(); |
verifyConnection(); |
2105 |
StringBuffer args = new StringBuffer(miDriver); |
StringBuffer args = new StringBuffer(miDriver); |
2106 |
|
|
2107 |
for(Parameter p : paramList) |
for(Parameter p : paramList) { |
2108 |
|
if(p.getValue() == null) continue; |
2109 |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
args.append(' ').append(p.getName()).append('=').append(p.getStringValue()); |
2110 |
|
} |
2111 |
|
|
2112 |
out.writeLine("CREATE MIDI_INPUT_DEVICE " + args.toString()); |
out.writeLine("CREATE MIDI_INPUT_DEVICE " + args.toString()); |
2113 |
if(getPrintOnlyMode()) return -1; |
if(getPrintOnlyMode()) return -1; |
2252 |
mid.setActive(Boolean.parseBoolean(s)); |
mid.setActive(Boolean.parseBoolean(s)); |
2253 |
} else if(s.startsWith("PORTS: ")) { |
} else if(s.startsWith("PORTS: ")) { |
2254 |
s = s.substring("PORTS: ".length()); |
s = s.substring("PORTS: ".length()); |
2255 |
int ports = Parser.parseInt(s); |
|
2256 |
MidiPort[] midiPorts = new MidiPort[ports > 0 ? ports : 0]; |
Parameter<Integer> ports = (Parameter<Integer>) |
2257 |
|
getMidiInputDriverParameterInfo(drv, "PORTS"); |
2258 |
|
|
2259 |
|
ports.parseValue(s); |
2260 |
|
mid.setPortsParameter(ports); |
2261 |
|
|
2262 |
|
int j = ports.getValue(); |
2263 |
|
MidiPort[] midiPorts = new MidiPort[j > 0 ? j : 0]; |
2264 |
|
|
2265 |
for(int i = 0; i < midiPorts.length; i++) |
for(int i = 0; i < midiPorts.length; i++) |
2266 |
midiPorts[i] = getMidiInputPortInfo(deviceId, i); |
midiPorts[i] = getMidiInputPortInfo(deviceId, i); |
2503 |
public synchronized int |
public synchronized int |
2504 |
addMidiInstrumentMap(String name) throws IOException, LSException, LscpException { |
addMidiInstrumentMap(String name) throws IOException, LSException, LscpException { |
2505 |
verifyConnection(); |
verifyConnection(); |
2506 |
out.writeLine("ADD MIDI_INSTRUMENT_MAP '" + name + "'"); |
out.writeLine("ADD MIDI_INSTRUMENT_MAP '" + toEscapedString(name) + "'"); |
2507 |
if(getPrintOnlyMode()) return -1; |
if(getPrintOnlyMode()) return -1; |
2508 |
|
|
2509 |
ResultSet rs = getEmptyResultSet(); |
ResultSet rs = getEmptyResultSet(); |
2606 |
|
|
2607 |
for(String s : lnS) { |
for(String s : lnS) { |
2608 |
if(s.startsWith("NAME: ")) { |
if(s.startsWith("NAME: ")) { |
2609 |
name = s.substring("NAME: ".length()); |
name = toNonEscapedString(s.substring("NAME: ".length())); |
2610 |
} else if(s.startsWith("DEFAULT: ")) { |
} else if(s.startsWith("DEFAULT: ")) { |
2611 |
b = Boolean.parseBoolean(s.substring("DEFAULT: ".length())); |
b = Boolean.parseBoolean(s.substring("DEFAULT: ".length())); |
2612 |
} else { |
} else { |
2654 |
throws IOException, LscpException, LSException { |
throws IOException, LscpException, LSException { |
2655 |
|
|
2656 |
verifyConnection(); |
verifyConnection(); |
2657 |
|
name = toEscapedString(name); |
2658 |
out.writeLine("SET MIDI_INSTRUMENT_MAP NAME " + + mapId + " '" + name + "'"); |
out.writeLine("SET MIDI_INSTRUMENT_MAP NAME " + + mapId + " '" + name + "'"); |
2659 |
if(getPrintOnlyMode()) return; |
if(getPrintOnlyMode()) return; |
2660 |
|
|
2661 |
ResultSet rs = getEmptyResultSet(); |
ResultSet rs = getEmptyResultSet(); |
2662 |
} |
} |
2663 |
|
|
2664 |
|
|
2665 |
|
|
2666 |
/** |
/** |
2667 |
* Creates or replaces a MIDI instrument map entry. |
* Creates or replaces a MIDI instrument map entry. |
2668 |
* @param mapId The ID of the map, where this instrument should be mapped. |
* @param mapId The ID of the map, where this instrument should be mapped. |
2677 |
public synchronized void |
public synchronized void |
2678 |
mapMidiInstrument(int mapId, MidiInstrumentEntry entry, MidiInstrumentInfo info) |
mapMidiInstrument(int mapId, MidiInstrumentEntry entry, MidiInstrumentInfo info) |
2679 |
throws IOException, LSException, LscpException { |
throws IOException, LSException, LscpException { |
2680 |
|
mapMidiInstrument(mapId, entry, info, false); |
2681 |
|
} |
2682 |
|
|
2683 |
|
/** |
2684 |
|
* Creates or replaces a MIDI instrument map entry. |
2685 |
|
* @param mapId The ID of the map, where this instrument should be mapped. |
2686 |
|
* @param entry Specifies the position of the MIDI instrument in the MIDI instrument map. |
2687 |
|
* @param info Provides the needed information of the |
2688 |
|
* MIDI instrument, which will be mapped to the specified MIDI instrument map. |
2689 |
|
* @param nonModal If <code>true</code> the function returns immediately |
2690 |
|
* and the mapping is established in the background. |
2691 |
|
* @throws IOException If some I/O error occurs. |
2692 |
|
* @throws LSException If the mapping failed. |
2693 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
2694 |
|
* @see #unmapMidiInstrument |
2695 |
|
*/ |
2696 |
|
public synchronized void |
2697 |
|
mapMidiInstrument(int mapId, MidiInstrumentEntry entry, MidiInstrumentInfo info, boolean nonModal) |
2698 |
|
throws IOException, LSException, LscpException { |
2699 |
|
|
2700 |
verifyConnection(); |
verifyConnection(); |
2701 |
StringBuffer cmd = new StringBuffer("MAP MIDI_INSTRUMENT "); |
StringBuffer cmd = new StringBuffer("MAP MIDI_INSTRUMENT "); |
2702 |
|
if(nonModal) cmd.append("NON_MODAL "); |
2703 |
cmd.append(mapId).append(' '); |
cmd.append(mapId).append(' '); |
2704 |
cmd.append(entry.getMidiBank()).append(' '); |
cmd.append(entry.getMidiBank()).append(' '); |
2705 |
cmd.append(entry.getMidiProgram()).append(' '); |
cmd.append(entry.getMidiProgram()).append(' '); |
2706 |
cmd.append(info.getEngine()).append(" '"); |
cmd.append(info.getEngine()).append(" '"); |
2707 |
cmd.append(info.getFileName()).append("' "); |
cmd.append(info.getFilePath()).append("' "); |
2708 |
cmd.append(info.getInstrumentIndex()).append(' '); |
cmd.append(info.getInstrumentIndex()).append(' '); |
2709 |
cmd.append(info.getVolume()); |
cmd.append(info.getVolume()); |
2710 |
if(!info.getLoadMode().name().equals("DEFAULT")) { |
if(!info.getLoadMode().name().equals("DEFAULT")) { |
2711 |
cmd.append(' ').append(info.getLoadMode().name()); |
cmd.append(' ').append(info.getLoadMode().name()); |
2712 |
} |
} |
2713 |
if(info.getName() != null) cmd.append(" '").append(info.getName()).append("'"); |
|
2714 |
|
if(info.getName() != null) { |
2715 |
|
String s = toEscapedString(info.getName()); |
2716 |
|
cmd.append(" '").append(s).append("'"); |
2717 |
|
} |
2718 |
|
|
2719 |
out.writeLine(cmd.toString()); |
out.writeLine(cmd.toString()); |
2720 |
if(getPrintOnlyMode()) return; |
if(getPrintOnlyMode()) return; |
3563 |
|
|
3564 |
verifyConnection(); |
verifyConnection(); |
3565 |
String s = String.valueOf(channel) + " " + String.valueOf(midiCtrl); |
String s = String.valueOf(channel) + " " + String.valueOf(midiCtrl); |
3566 |
if(name != null) s += " '" + name + "'"; |
if(name != null) s += " '" + toEscapedString(name) + "'"; |
3567 |
out.writeLine("CREATE FX_SEND " + s); |
out.writeLine("CREATE FX_SEND " + s); |
3568 |
if(getPrintOnlyMode()) return -1; |
if(getPrintOnlyMode()) return -1; |
3569 |
|
|
3694 |
throws IOException, LscpException, LSException { |
throws IOException, LscpException, LSException { |
3695 |
|
|
3696 |
verifyConnection(); |
verifyConnection(); |
3697 |
String args = " " + channel + " " + fxSend + " '" + name + "'"; |
String args = " " + channel + " " + fxSend + " '" + toEscapedString(name) + "'"; |
3698 |
out.writeLine("SET FX_SEND NAME" + args); |
out.writeLine("SET FX_SEND NAME" + args); |
3699 |
if(getPrintOnlyMode()) return; |
if(getPrintOnlyMode()) return; |
3700 |
|
|
3783 |
} |
} |
3784 |
|
|
3785 |
/** |
/** |
3786 |
|
* Starts an instrument editor for editing the loaded instrument |
3787 |
|
* on the specified sampler channel. |
3788 |
|
* @param samplerChn The sampler channel number. |
3789 |
|
* @throws IOException If some I/O error occurs. |
3790 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3791 |
|
* @throws LSException If <code>samplerChn</code> is not a valid channel number or if |
3792 |
|
* there is no instrument loaded on the specified sampler channel. |
3793 |
|
* @see #getSamplerChannels |
3794 |
|
*/ |
3795 |
|
public synchronized void |
3796 |
|
editChannelInstrument(int samplerChn) throws IOException, LscpException, LSException { |
3797 |
|
verifyConnection(); |
3798 |
|
out.writeLine("EDIT CHANNEL INSTRUMENT " + samplerChn); |
3799 |
|
if(getPrintOnlyMode()) return; |
3800 |
|
|
3801 |
|
ResultSet rs = getEmptyResultSet(); |
3802 |
|
} |
3803 |
|
|
3804 |
|
|
3805 |
|
|
3806 |
|
/** |
3807 |
|
* Adds the specified directory to the instruments database. |
3808 |
|
* @param dir The absolute (escaped) path name of the directory to add. |
3809 |
|
* @throws IOException If some I/O error occurs. |
3810 |
|
* @throws LSException If the creation of the directory failed. |
3811 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3812 |
|
*/ |
3813 |
|
public synchronized void |
3814 |
|
addDbDirectory(String dir) throws IOException, LSException, LscpException { |
3815 |
|
verifyConnection(); |
3816 |
|
out.writeLine("ADD DB_INSTRUMENT_DIRECTORY '" + dir + "'"); |
3817 |
|
if(getPrintOnlyMode()) return; |
3818 |
|
|
3819 |
|
ResultSet rs = getEmptyResultSet(); |
3820 |
|
} |
3821 |
|
|
3822 |
|
/** |
3823 |
|
* Removes the specified directory from the instruments database. |
3824 |
|
* @param dir The absolute (escaped) path name of the directory to remove. |
3825 |
|
* @throws IOException If some I/O error occurs. |
3826 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3827 |
|
* @throws LSException If the specified directory is not |
3828 |
|
* empty or if the removal of the directory failed. |
3829 |
|
*/ |
3830 |
|
public synchronized void |
3831 |
|
removeDbDirectory(String dir) throws IOException, LscpException, LSException { |
3832 |
|
removeDbDirectory(dir, false); |
3833 |
|
} |
3834 |
|
|
3835 |
|
/** |
3836 |
|
* Removes the specified directory from the instruments database. |
3837 |
|
* @param dir The absolute path name of the directory to remove. |
3838 |
|
* @param force If <code>true</code> forces the removal of non-empty |
3839 |
|
* directory and all its content. |
3840 |
|
* @throws IOException If some I/O error occurs. |
3841 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3842 |
|
* @throws LSException If the removing of the directory failed. |
3843 |
|
*/ |
3844 |
|
public synchronized void |
3845 |
|
removeDbDirectory(String dir, boolean force) |
3846 |
|
throws IOException, LscpException, LSException { |
3847 |
|
|
3848 |
|
verifyConnection(); |
3849 |
|
String s = "REMOVE DB_INSTRUMENT_DIRECTORY "; |
3850 |
|
if(force) s += "FORCE "; |
3851 |
|
out.writeLine(s + "'" + dir + "'"); |
3852 |
|
if(getPrintOnlyMode()) return; |
3853 |
|
|
3854 |
|
ResultSet rs = getEmptyResultSet(); |
3855 |
|
} |
3856 |
|
|
3857 |
|
/** |
3858 |
|
* Removes the specified directories from the instruments database. |
3859 |
|
* @param dirs The absolute (escaped) path names of the directories to remove. |
3860 |
|
* @param force If <code>true</code> forces the removal of non-empty |
3861 |
|
* directories. |
3862 |
|
* @throws IOException If some I/O error occurs. |
3863 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3864 |
|
* @throws LSException If the removing of the directores failed. |
3865 |
|
*/ |
3866 |
|
public synchronized void |
3867 |
|
removeDbDirectories(String[] dirs, boolean force) |
3868 |
|
throws IOException, LscpException, LSException { |
3869 |
|
|
3870 |
|
verifyConnection(); |
3871 |
|
String cmd = "REMOVE DB_INSTRUMENT_DIRECTORY "; |
3872 |
|
if(force) cmd += "FORCE "; |
3873 |
|
|
3874 |
|
for(String s : dirs) out.writeLine(cmd + "'" + s + "'"); |
3875 |
|
|
3876 |
|
if(getPrintOnlyMode()) return; |
3877 |
|
|
3878 |
|
getEmptyResultSets(dirs.length, "Client.dirDeletionFailed!"); |
3879 |
|
} |
3880 |
|
|
3881 |
|
/** |
3882 |
|
* Gets the number of directories in the specified directory. |
3883 |
|
* @return The current number of directories in the specified directory. |
3884 |
|
* @param dir The absolute path name of the directory. |
3885 |
|
* @throws IOException If some I/O error occurs. |
3886 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3887 |
|
* @throws LSException If some other error occurs. |
3888 |
|
*/ |
3889 |
|
public synchronized int |
3890 |
|
getDbDirectoryCount(String dir) throws IOException, LscpException, LSException { |
3891 |
|
return getDbDirectoryCount(dir, false); |
3892 |
|
} |
3893 |
|
|
3894 |
|
/** |
3895 |
|
* Gets the number of directories in the specified directory. |
3896 |
|
* @return The current number of directories in the specified directory. |
3897 |
|
* @param dir The absolute path name of the directory. |
3898 |
|
* @param recursive If <code>true</code>, the number of all directories |
3899 |
|
* in the specified subtree will be returned. |
3900 |
|
* @throws IOException If some I/O error occurs. |
3901 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3902 |
|
* @throws LSException If some other error occurs. |
3903 |
|
*/ |
3904 |
|
public synchronized int |
3905 |
|
getDbDirectoryCount(String dir, boolean recursive) |
3906 |
|
throws IOException, LscpException, LSException { |
3907 |
|
|
3908 |
|
verifyConnection(); |
3909 |
|
String s; |
3910 |
|
if(recursive) s = "GET DB_INSTRUMENT_DIRECTORIES RECURSIVE '"; |
3911 |
|
else s = "GET DB_INSTRUMENT_DIRECTORIES '"; |
3912 |
|
out.writeLine(s + dir + "'"); |
3913 |
|
if(getPrintOnlyMode()) return -1; |
3914 |
|
|
3915 |
|
s = getSingleLineResultSet().getResult(); |
3916 |
|
return parseInt(s); |
3917 |
|
} |
3918 |
|
|
3919 |
|
/** |
3920 |
|
* Gets the list of directories in the specified directory. |
3921 |
|
* @param dir The absolute path name of the directory. |
3922 |
|
* @return A <code>String</code> array providing the names of |
3923 |
|
* all directories in the specified directory. |
3924 |
|
* @throws IOException If some I/O error occurs. |
3925 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3926 |
|
* @throws LSException If the specified path name is invalid. |
3927 |
|
*/ |
3928 |
|
public synchronized String[] |
3929 |
|
getDbDirectoryNames(String dir) throws IOException, LscpException, LSException { |
3930 |
|
verifyConnection(); |
3931 |
|
out.writeLine("LIST DB_INSTRUMENT_DIRECTORIES '" + dir + "'"); |
3932 |
|
if(getPrintOnlyMode()) return null; |
3933 |
|
|
3934 |
|
String[] names = parseEscapedStringList(getSingleLineResultSet().getResult()); |
3935 |
|
for(int i = 0; i < names.length; i++) { |
3936 |
|
names[i] = toNonEscapedString(names[i]); |
3937 |
|
} |
3938 |
|
return names; |
3939 |
|
} |
3940 |
|
|
3941 |
|
/** |
3942 |
|
* Gets information about the specified directory. |
3943 |
|
* @param dir The absolute path name of the directory. |
3944 |
|
* @return A <code>DbDirectoryInfo</code> instance providing information |
3945 |
|
* about the specified directory. |
3946 |
|
* @throws IOException If some I/O error occurs. |
3947 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3948 |
|
* @throws LSException If the specified directory is not found. |
3949 |
|
*/ |
3950 |
|
public synchronized DbDirectoryInfo |
3951 |
|
getDbDirectoryInfo(String dir) throws IOException, LscpException, LSException { |
3952 |
|
verifyConnection(); |
3953 |
|
out.writeLine("GET DB_INSTRUMENT_DIRECTORY INFO '" + dir + "'"); |
3954 |
|
if(getPrintOnlyMode()) return null; |
3955 |
|
|
3956 |
|
ResultSet rs = getMultiLineResultSet(); |
3957 |
|
DbDirectoryInfo info = new DbDirectoryInfo(rs.getMultiLineResult()); |
3958 |
|
if(dir.equals("/")) { |
3959 |
|
info.setName("/"); |
3960 |
|
} else { |
3961 |
|
dir = removeEndingFileSeparator(dir); |
3962 |
|
} |
3963 |
|
String s = getFileName(dir); |
3964 |
|
if(s != null) info.setName(toNonEscapedFileName(s)); |
3965 |
|
s = getParentDirectory(dir); |
3966 |
|
if(s != null) info.setParentDirectoryPath(s); |
3967 |
|
|
3968 |
|
return info; |
3969 |
|
} |
3970 |
|
|
3971 |
|
/** |
3972 |
|
* Gets the list of directories in the specified directory. |
3973 |
|
* @param dir The absolute path name of the directory. |
3974 |
|
* @return A <code>DbDirectoryInfo</code> array providing |
3975 |
|
* information about all directories in the specified directory. |
3976 |
|
* @throws IOException If some I/O error occurs. |
3977 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3978 |
|
* @throws LSException If the specified path name is invalid. |
3979 |
|
*/ |
3980 |
|
public synchronized DbDirectoryInfo[] |
3981 |
|
getDbDirectories(String dir) throws IOException, LscpException, LSException { |
3982 |
|
String[] dirS = getDbDirectoryNames(dir); |
3983 |
|
if(!hasEndingFileSeparator(dir)) dir += "/"; |
3984 |
|
DbDirectoryInfo[] infoS = new DbDirectoryInfo[dirS.length]; |
3985 |
|
for(int i = 0; i < dirS.length; i++) { |
3986 |
|
infoS[i] = getDbDirectoryInfo(dir + toEscapedFileName(dirS[i])); |
3987 |
|
} |
3988 |
|
return infoS; |
3989 |
|
} |
3990 |
|
|
3991 |
|
/** |
3992 |
|
* Gets the list of directories in the specified directory. |
3993 |
|
* @param dir The absolute path name of the directory. |
3994 |
|
* @return A <code>DbDirectoryInfo</code> array providing |
3995 |
|
* information about all directories in the specified directory. |
3996 |
|
* @throws IOException If some I/O error occurs. |
3997 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
3998 |
|
* @throws LSException If the specified path name is invalid. |
3999 |
|
* |
4000 |
|
public synchronized DbDirectoryInfo[] |
4001 |
|
getDbDirectories(String dir) throws IOException, LscpException, LSException { |
4002 |
|
String[] dirS = getDbDirectoryNames(dir); |
4003 |
|
if(dirS.length == 0) return new DbDirectoryInfo[0]; |
4004 |
|
|
4005 |
|
if(dir.charAt(dir.length() - 1) != '/') dir += "/"; |
4006 |
|
|
4007 |
|
for(int i = 0; i < dirS.length; i++) { |
4008 |
|
out.writeLine("GET DB_INSTRUMENT_DIRECTORY INFO '" + dir + dirS[i] + "'"); |
4009 |
|
} |
4010 |
|
|
4011 |
|
if(getPrintOnlyMode()) return null; |
4012 |
|
|
4013 |
|
if(dir.length() > 1) dir = dir.substring(0, dir.length() - 1); |
4014 |
|
StringBuffer sb = new StringBuffer(); |
4015 |
|
DbDirectoryInfo[] infoS = new DbDirectoryInfo[dirS.length]; |
4016 |
|
for(int i = 0; i < dirS.length; i++) { |
4017 |
|
try { |
4018 |
|
ResultSet rs = getMultiLineResultSet(); |
4019 |
|
infoS[i] = new DbDirectoryInfo(rs.getMultiLineResult()); |
4020 |
|
infoS[i].setName(dirS[i]); |
4021 |
|
infoS[i].setParentDirectoryPath(dir); |
4022 |
|
} catch (SocketTimeoutException e) { |
4023 |
|
getLogger().log(Level.FINE, e.getMessage(), e); |
4024 |
|
sb.append(e.getMessage()).append("\n"); |
4025 |
|
break; |
4026 |
|
} catch (Exception e) { |
4027 |
|
getLogger().log(Level.FINE, e.getMessage(), e); |
4028 |
|
sb.append(e.getMessage()).append("\n"); |
4029 |
|
} |
4030 |
|
} |
4031 |
|
|
4032 |
|
String details = sb.toString(); |
4033 |
|
if(details.length() > 0) { |
4034 |
|
String err = LscpI18n.getLogMsg("Client.getInstrsInfoFailed!"); |
4035 |
|
throw new LSException(0, err, details); |
4036 |
|
} |
4037 |
|
|
4038 |
|
return infoS; |
4039 |
|
}*/ |
4040 |
|
|
4041 |
|
/** |
4042 |
|
* Renames the specified directory. |
4043 |
|
* @param dir The absolute path name of the directory to rename. |
4044 |
|
* @param name The new name for the directory. |
4045 |
|
* @throws IOException If some I/O error occurs. |
4046 |
|
* @throws LSException If the renaming of the directory failed. |
4047 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4048 |
|
*/ |
4049 |
|
public synchronized void |
4050 |
|
renameDbDirectory(String dir, String name) throws IOException, LSException, LscpException { |
4051 |
|
verifyConnection(); |
4052 |
|
name = toEscapedString(name); |
4053 |
|
out.writeLine("SET DB_INSTRUMENT_DIRECTORY NAME '" + dir + "' '" + name + "'"); |
4054 |
|
if(getPrintOnlyMode()) return; |
4055 |
|
|
4056 |
|
ResultSet rs = getEmptyResultSet(); |
4057 |
|
} |
4058 |
|
|
4059 |
|
/** |
4060 |
|
* Moves the specified directory into the specified location. |
4061 |
|
* @param dir The absolute path name of the directory to move. |
4062 |
|
* @param dst The location where the directory will be moved to. |
4063 |
|
* @throws IOException If some I/O error occurs. |
4064 |
|
* @throws LSException If the operation failed. |
4065 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4066 |
|
*/ |
4067 |
|
public synchronized void |
4068 |
|
moveDbDirectory(String dir, String dst) throws IOException, LSException, LscpException { |
4069 |
|
verifyConnection(); |
4070 |
|
out.writeLine("MOVE DB_INSTRUMENT_DIRECTORY '" + dir + "' '" + dst + "'"); |
4071 |
|
if(getPrintOnlyMode()) return; |
4072 |
|
|
4073 |
|
ResultSet rs = getEmptyResultSet(); |
4074 |
|
} |
4075 |
|
|
4076 |
|
/** |
4077 |
|
* Moves the specified directories into the specified location. |
4078 |
|
* @param dirs The absolute path names of the directories to move. |
4079 |
|
* @param dst The location where the directories will be moved to. |
4080 |
|
* @throws IOException If some I/O error occurs. |
4081 |
|
* @throws LSException If the operation failed. |
4082 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4083 |
|
*/ |
4084 |
|
public synchronized void |
4085 |
|
moveDbDirectories(String dirs[], String dst) throws IOException, LSException, LscpException { |
4086 |
|
verifyConnection(); |
4087 |
|
for(String s : dirs) { |
4088 |
|
out.writeLine("MOVE DB_INSTRUMENT_DIRECTORY '" + s + "' '" + dst + "'"); |
4089 |
|
} |
4090 |
|
if(getPrintOnlyMode()) return; |
4091 |
|
|
4092 |
|
getEmptyResultSets(dirs.length, "Client.dirMovingFailed!"); |
4093 |
|
} |
4094 |
|
|
4095 |
|
/** |
4096 |
|
* Copies the specified directory into the specified location. |
4097 |
|
* @param dir The absolute path name of the directory to copy. |
4098 |
|
* @param dst The location where the directory will be copied to. |
4099 |
|
* @throws IOException If some I/O error occurs. |
4100 |
|
* @throws LSException If the operation failed. |
4101 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4102 |
|
*/ |
4103 |
|
public synchronized void |
4104 |
|
copyDbDirectory(String dir, String dst) throws IOException, LSException, LscpException { |
4105 |
|
verifyConnection(); |
4106 |
|
out.writeLine("COPY DB_INSTRUMENT_DIRECTORY '" + dir + "' '" + dst + "'"); |
4107 |
|
if(getPrintOnlyMode()) return; |
4108 |
|
|
4109 |
|
ResultSet rs = getEmptyResultSet(); |
4110 |
|
} |
4111 |
|
|
4112 |
|
/** |
4113 |
|
* Copies the specified directories into the specified location. |
4114 |
|
* @param dirs The absolute path names of the directories to copy. |
4115 |
|
* @param dst The location where the directories will be copied to. |
4116 |
|
* @throws IOException If some I/O error occurs. |
4117 |
|
* @throws LSException If the operation failed. |
4118 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4119 |
|
*/ |
4120 |
|
public synchronized void |
4121 |
|
copyDbDirectories(String[] dirs, String dst) throws IOException, LSException, LscpException { |
4122 |
|
verifyConnection(); |
4123 |
|
for(String s : dirs) { |
4124 |
|
out.writeLine("COPY DB_INSTRUMENT_DIRECTORY '" + s + "' '" + dst + "'"); |
4125 |
|
} |
4126 |
|
if(getPrintOnlyMode()) return; |
4127 |
|
|
4128 |
|
getEmptyResultSets(dirs.length, "Client.dirCopyingFailed!"); |
4129 |
|
} |
4130 |
|
|
4131 |
|
/** |
4132 |
|
* Changes the description of the specified directory. |
4133 |
|
* @param dir The absolute path name of the directory. |
4134 |
|
* @param desc The new description for the directory. |
4135 |
|
* @throws IOException If some I/O error occurs. |
4136 |
|
* @throws LSException If failed to change the description. |
4137 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4138 |
|
*/ |
4139 |
|
public synchronized void |
4140 |
|
setDbDirectoryDescription(String dir, String desc) |
4141 |
|
throws IOException, LSException, LscpException { |
4142 |
|
|
4143 |
|
verifyConnection(); |
4144 |
|
String s = "SET DB_INSTRUMENT_DIRECTORY DESCRIPTION '"; |
4145 |
|
out.writeLine(s + dir + "' '" + toEscapedString(desc) + "'"); |
4146 |
|
if(getPrintOnlyMode()) return; |
4147 |
|
|
4148 |
|
ResultSet rs = getEmptyResultSet(); |
4149 |
|
} |
4150 |
|
|
4151 |
|
public static enum ScanMode { |
4152 |
|
RECURSIVE, NON_RECURSIVE, FLAT |
4153 |
|
} |
4154 |
|
|
4155 |
|
/** |
4156 |
|
* Adds the specified instrument to the specified instruments database directory. |
4157 |
|
* @param dbDir The absolute path name of the database directory in which the |
4158 |
|
* specified instrument will be added. |
4159 |
|
* @param filePath The absolute path name of the instrument file. |
4160 |
|
* @param instrIndex The index of the instrument (in the given instrument file) to add. |
4161 |
|
* @throws IOException If some I/O error occurs. |
4162 |
|
* @throws LSException If the operation failed. |
4163 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4164 |
|
*/ |
4165 |
|
public synchronized void |
4166 |
|
addDbInstrument(String dbDir, String filePath, int instrIndex) |
4167 |
|
throws IOException, LSException, LscpException { |
4168 |
|
|
4169 |
|
addDbInstrument(dbDir, filePath, instrIndex, false); |
4170 |
|
} |
4171 |
|
|
4172 |
|
/** |
4173 |
|
* Adds the specified instrument to the specified instruments database directory. |
4174 |
|
* @param dbDir The absolute path name of the database directory in which the |
4175 |
|
* specified instrument will be added. |
4176 |
|
* @param filePath The absolute path name of the instrument file. |
4177 |
|
* @param instrIndex The index of the instrument (in the given instrument file) to add. |
4178 |
|
* @param background If <code>true</code>, the scan will be done |
4179 |
|
* in background and this method may return before the job is finished. |
4180 |
|
* @return If <code>background</code> is <code>true</code>, the ID |
4181 |
|
* of the scan job. |
4182 |
|
* @throws IOException If some I/O error occurs. |
4183 |
|
* @throws LSException If the operation failed. |
4184 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4185 |
|
* @see #addInstrumentsDbListener |
4186 |
|
*/ |
4187 |
|
public synchronized int |
4188 |
|
addDbInstrument(String dbDir, String filePath, int instrIndex, boolean background) |
4189 |
|
throws IOException, LSException, LscpException { |
4190 |
|
|
4191 |
|
verifyConnection(); |
4192 |
|
String s = "ADD DB_INSTRUMENTS"; |
4193 |
|
if(background) s += " NON_MODAL"; |
4194 |
|
s += " '" + dbDir + "' '" + filePath + "' "; |
4195 |
|
out.writeLine(s + String.valueOf(instrIndex)); |
4196 |
|
if(getPrintOnlyMode()) return -1; |
4197 |
|
|
4198 |
|
ResultSet rs = getEmptyResultSet(); |
4199 |
|
return rs.getIndex(); |
4200 |
|
} |
4201 |
|
|
4202 |
|
/** |
4203 |
|
* Adds the instruments in the specified file to the specified |
4204 |
|
* instruments database directory. |
4205 |
|
* @param dbDir The absolute path name of the database directory |
4206 |
|
* in which the the supported instruments will be added. |
4207 |
|
* @param filePath The absolute path name of the file to scan for instruments. |
4208 |
|
* @throws IOException If some I/O error occurs. |
4209 |
|
* @throws LSException If the operation failed. |
4210 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4211 |
|
*/ |
4212 |
|
public synchronized void |
4213 |
|
addDbInstruments(String dbDir, String filePath) |
4214 |
|
throws IOException, LSException, LscpException { |
4215 |
|
|
4216 |
|
addDbInstruments(dbDir, filePath, false); |
4217 |
|
} |
4218 |
|
|
4219 |
|
/** |
4220 |
|
* Adds the instruments in the specified file to the specified |
4221 |
|
* instruments database directory. |
4222 |
|
* @param dbDir The absolute path name of the database directory |
4223 |
|
* in which the the supported instruments will be added. |
4224 |
|
* @param filePath The absolute path name of the file to scan for instruments. |
4225 |
|
* @param background If <code>true</code>, the scan will be done |
4226 |
|
* in background and this method may return before the job is finished. |
4227 |
|
* @return If <code>background</code> is <code>true</code>, the ID |
4228 |
|
* of the scan job. |
4229 |
|
* @throws IOException If some I/O error occurs. |
4230 |
|
* @throws LSException If the operation failed. |
4231 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4232 |
|
* @see #addInstrumentsDbListener |
4233 |
|
*/ |
4234 |
|
public synchronized int |
4235 |
|
addDbInstruments(String dbDir, String filePath, boolean background) |
4236 |
|
throws IOException, LSException, LscpException { |
4237 |
|
|
4238 |
|
verifyConnection(); |
4239 |
|
String s = "ADD DB_INSTRUMENTS"; |
4240 |
|
if(background) s += " NON_MODAL"; |
4241 |
|
out.writeLine(s + " '" + dbDir + "' '" + filePath + "'"); |
4242 |
|
if(getPrintOnlyMode()) return -1; |
4243 |
|
|
4244 |
|
ResultSet rs = getEmptyResultSet(); |
4245 |
|
return rs.getIndex(); |
4246 |
|
} |
4247 |
|
|
4248 |
|
/** |
4249 |
|
* Adds the instruments in the specified file system directory |
4250 |
|
* to the specified instruments database directory. |
4251 |
|
* @param mode Determines the scanning mode. If RECURSIVE is |
4252 |
|
* specified, all supported instruments in the specified file system |
4253 |
|
* direcotry will be added to the specified instruments database |
4254 |
|
* directory, including the instruments in subdirectories |
4255 |
|
* of the supplied directory. If NON_RECURSIVE is specified, |
4256 |
|
* the instruments in the subdirectories will not be processed. |
4257 |
|
* If FLAT is specified, all supported instruments in the specified |
4258 |
|
* file system direcotry will be added, including the instruments in |
4259 |
|
* subdirectories of the supplied directory, but the respective |
4260 |
|
* subdirectory structure will not be recreated in the instruments |
4261 |
|
* database and all instruments will be added directly in the |
4262 |
|
* specified database directory. |
4263 |
|
* @param dbDir The absolute path name of the database directory |
4264 |
|
* in which the supported instruments will be added. |
4265 |
|
* @param fsDir The absolute path name of the file system directory. |
4266 |
|
* @throws IOException If some I/O error occurs. |
4267 |
|
* @throws LSException If the operation failed. |
4268 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4269 |
|
*/ |
4270 |
|
public synchronized void |
4271 |
|
addDbInstruments(ScanMode mode, String dbDir, String fsDir) |
4272 |
|
throws IOException, LSException, LscpException { |
4273 |
|
|
4274 |
|
addDbInstruments(mode, dbDir, fsDir, false); |
4275 |
|
} |
4276 |
|
|
4277 |
|
/** |
4278 |
|
* Adds the instruments in the specified file system directory |
4279 |
|
* to the specified instruments database directory. |
4280 |
|
* @param mode Determines the scanning mode. If RECURSIVE is |
4281 |
|
* specified, all supported instruments in the specified file system |
4282 |
|
* direcotry will be added to the specified instruments database |
4283 |
|
* directory, including the instruments in subdirectories |
4284 |
|
* of the supplied directory. If NON_RECURSIVE is specified, |
4285 |
|
* the instruments in the subdirectories will not be processed. |
4286 |
|
* If FLAT is specified, all supported instruments in the specified |
4287 |
|
* file system direcotry will be added, including the instruments in |
4288 |
|
* subdirectories of the supplied directory, but the respective |
4289 |
|
* subdirectory structure will not be recreated in the instruments |
4290 |
|
* database and all instruments will be added directly in the |
4291 |
|
* specified database directory. |
4292 |
|
* @param dbDir The absolute path name of the database directory |
4293 |
|
* in which the supported instruments will be added. |
4294 |
|
* @param fsDir The absolute path name of the file system directory. |
4295 |
|
* @param background If <code>true</code>, the scan will be done |
4296 |
|
* in background and this method may return before the job is finished. |
4297 |
|
* @return If <code>background</code> is <code>true</code>, the ID |
4298 |
|
* of the scan job. |
4299 |
|
* @throws IOException If some I/O error occurs. |
4300 |
|
* @throws LSException If the operation failed. |
4301 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4302 |
|
* @see #addInstrumentsDbListener |
4303 |
|
*/ |
4304 |
|
public synchronized int |
4305 |
|
addDbInstruments(ScanMode mode, String dbDir, String fsDir, boolean background) |
4306 |
|
throws IOException, LSException, LscpException { |
4307 |
|
|
4308 |
|
verifyConnection(); |
4309 |
|
StringBuffer sb = new StringBuffer("ADD DB_INSTRUMENTS"); |
4310 |
|
if(background) sb.append(" NON_MODAL"); |
4311 |
|
|
4312 |
|
switch(mode) { |
4313 |
|
case RECURSIVE: |
4314 |
|
sb.append(" RECURSIVE"); |
4315 |
|
break; |
4316 |
|
case NON_RECURSIVE: |
4317 |
|
sb.append(" NON_RECURSIVE"); |
4318 |
|
break; |
4319 |
|
case FLAT: |
4320 |
|
sb.append(" FLAT"); |
4321 |
|
break; |
4322 |
|
} |
4323 |
|
|
4324 |
|
sb.append(" '").append(dbDir).append("' '"); |
4325 |
|
sb.append(fsDir).append("'"); |
4326 |
|
out.writeLine(sb.toString()); |
4327 |
|
if(getPrintOnlyMode()) return -1; |
4328 |
|
|
4329 |
|
ResultSet rs = getEmptyResultSet(); |
4330 |
|
return rs.getIndex(); |
4331 |
|
} |
4332 |
|
|
4333 |
|
/** |
4334 |
|
* Removes the specified instrument from the instruments database. |
4335 |
|
* @param instr The absolute path name of the instrument to remove. |
4336 |
|
* @throws IOException If some I/O error occurs. |
4337 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4338 |
|
* @throws LSException If the removing of the instrument failed. |
4339 |
|
*/ |
4340 |
|
public synchronized void |
4341 |
|
removeDbInstrument(String instr) throws IOException, LscpException, LSException { |
4342 |
|
|
4343 |
|
verifyConnection(); |
4344 |
|
out.writeLine("REMOVE DB_INSTRUMENT '" + instr + "'"); |
4345 |
|
if(getPrintOnlyMode()) return; |
4346 |
|
|
4347 |
|
ResultSet rs = getEmptyResultSet(); |
4348 |
|
} |
4349 |
|
|
4350 |
|
/** |
4351 |
|
* Removes the specified instruments from the instruments database. |
4352 |
|
* @param instrs The absolute path names of the instruments to remove. |
4353 |
|
* @throws IOException If some I/O error occurs. |
4354 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4355 |
|
* @throws LSException If the removing of the instruments failed. |
4356 |
|
*/ |
4357 |
|
public synchronized void |
4358 |
|
removeDbInstruments(String[] instrs) throws IOException, LscpException, LSException { |
4359 |
|
verifyConnection(); |
4360 |
|
for(String s : instrs) { |
4361 |
|
out.writeLine("REMOVE DB_INSTRUMENT '" + s + "'"); |
4362 |
|
} |
4363 |
|
if(getPrintOnlyMode()) return; |
4364 |
|
|
4365 |
|
getEmptyResultSets(instrs.length, "Client.instrDeletionFailed!"); |
4366 |
|
} |
4367 |
|
|
4368 |
|
/** |
4369 |
|
* Gets the number of instruments in the specified directory. |
4370 |
|
* @return The current number of instruments in the specified directory. |
4371 |
|
* @param dir The absolute path name of the directory. |
4372 |
|
* @throws IOException If some I/O error occurs. |
4373 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4374 |
|
* @throws LSException If some other error occurs. |
4375 |
|
*/ |
4376 |
|
public synchronized int |
4377 |
|
getDbInstrumentCount(String dir) throws IOException, LscpException, LSException { |
4378 |
|
return getDbInstrumentCount(dir, false); |
4379 |
|
} |
4380 |
|
|
4381 |
|
/** |
4382 |
|
* Gets the number of instruments in the specified directory. |
4383 |
|
* @return The current number of instruments in the specified directory. |
4384 |
|
* @param dir The absolute path name of the directory. |
4385 |
|
* @param recursive If <code>true</code>, the number of all instruments |
4386 |
|
* in the specified subtree will be returned. |
4387 |
|
* @throws IOException If some I/O error occurs. |
4388 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4389 |
|
* @throws LSException If some other error occurs. |
4390 |
|
*/ |
4391 |
|
public synchronized int |
4392 |
|
getDbInstrumentCount(String dir, boolean recursive) |
4393 |
|
throws IOException, LscpException, LSException { |
4394 |
|
|
4395 |
|
verifyConnection(); |
4396 |
|
String s; |
4397 |
|
if(recursive) s = "GET DB_INSTRUMENTS RECURSIVE '"; |
4398 |
|
else s = "GET DB_INSTRUMENTS '"; |
4399 |
|
out.writeLine(s + dir + "'"); |
4400 |
|
if(getPrintOnlyMode()) return -1; |
4401 |
|
|
4402 |
|
s = getSingleLineResultSet().getResult(); |
4403 |
|
return parseInt(s); |
4404 |
|
} |
4405 |
|
|
4406 |
|
/** |
4407 |
|
* Gets the list of instruments in the specified directory. |
4408 |
|
* @param dir The absolute path name of the directory. |
4409 |
|
* @return A <code>String</code> array providing the names of |
4410 |
|
* all instruments in the specified directory. |
4411 |
|
* @throws IOException If some I/O error occurs. |
4412 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4413 |
|
* @throws LSException If the specified path name is invalid. |
4414 |
|
*/ |
4415 |
|
public synchronized String[] |
4416 |
|
getDbInstrumentNames(String dir) throws IOException, LscpException, LSException { |
4417 |
|
verifyConnection(); |
4418 |
|
out.writeLine("LIST DB_INSTRUMENTS '" + dir + "'"); |
4419 |
|
if(getPrintOnlyMode()) return null; |
4420 |
|
|
4421 |
|
String[] names = parseEscapedStringList(getSingleLineResultSet().getResult()); |
4422 |
|
for(int i = 0; i < names.length; i++) { |
4423 |
|
names[i] = toNonEscapedString(names[i]); |
4424 |
|
} |
4425 |
|
return names; |
4426 |
|
} |
4427 |
|
|
4428 |
|
/** |
4429 |
|
* Gets information about the specified instrument. |
4430 |
|
* @param instr The absolute path name of the instrument. |
4431 |
|
* @return A <code>DbInstrumentInfo</code> instance providing information |
4432 |
|
* about the specified instrument. |
4433 |
|
* @throws IOException If some I/O error occurs. |
4434 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4435 |
|
* @throws LSException If the specified instrument is not found. |
4436 |
|
*/ |
4437 |
|
public synchronized DbInstrumentInfo |
4438 |
|
getDbInstrumentInfo(String instr) throws IOException, LscpException, LSException { |
4439 |
|
verifyConnection(); |
4440 |
|
out.writeLine("GET DB_INSTRUMENT INFO '" + instr + "'"); |
4441 |
|
if(getPrintOnlyMode()) return null; |
4442 |
|
|
4443 |
|
ResultSet rs = getMultiLineResultSet(); |
4444 |
|
DbInstrumentInfo info = new DbInstrumentInfo(rs.getMultiLineResult()); |
4445 |
|
String s = getParentDirectory(instr); |
4446 |
|
if(s != null) info.setDirectoryPath(s); |
4447 |
|
s = getFileName(instr); |
4448 |
|
if(s != null) info.setName(toNonEscapedFileName(s)); |
4449 |
|
|
4450 |
|
return info; |
4451 |
|
} |
4452 |
|
|
4453 |
|
/** |
4454 |
|
* Gets the list of instruments in the specified directory. |
4455 |
|
* @param dir The absolute path name of the directory. |
4456 |
|
* @return A <code>DbInstrumentInfo</code> array providing |
4457 |
|
* information about all instruments in the specified directory. |
4458 |
|
* @throws IOException If some I/O error occurs. |
4459 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4460 |
|
* @throws LSException If the specified path name is invalid. |
4461 |
|
*/ |
4462 |
|
public synchronized DbInstrumentInfo[] |
4463 |
|
getDbInstruments(String dir) throws IOException, LscpException, LSException { |
4464 |
|
String[] instrS = getDbInstrumentNames(dir); |
4465 |
|
if(!hasEndingFileSeparator(dir)) dir += "/"; |
4466 |
|
|
4467 |
|
DbInstrumentInfo[] infoS = new DbInstrumentInfo[instrS.length]; |
4468 |
|
for(int i = 0; i < instrS.length; i++) { |
4469 |
|
infoS[i] = getDbInstrumentInfo(dir + toEscapedFileName(instrS[i])); |
4470 |
|
} |
4471 |
|
return infoS; |
4472 |
|
} |
4473 |
|
|
4474 |
|
/** |
4475 |
|
* Gets the list of instruments in the specified directory. |
4476 |
|
* @param dir The absolute path name of the directory. |
4477 |
|
* @return A <code>DbInstrumentInfo</code> array providing |
4478 |
|
* information about all instruments in the specified directory. |
4479 |
|
* @throws IOException If some I/O error occurs. |
4480 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4481 |
|
* @throws LSException If the specified path name is invalid. |
4482 |
|
* |
4483 |
|
public synchronized DbInstrumentInfo[] |
4484 |
|
getDbInstruments(String dir) throws IOException, LscpException, LSException { |
4485 |
|
String[] instrS = getDbInstrumentNames(dir); |
4486 |
|
if(instrS.length == 0) return new DbInstrumentInfo[0]; |
4487 |
|
|
4488 |
|
if(dir.charAt(dir.length() - 1) != '/') dir += "/"; |
4489 |
|
|
4490 |
|
for(int i = 0; i < instrS.length; i++) { |
4491 |
|
out.writeLine("GET DB_INSTRUMENT INFO '" + dir + instrS[i] + "'"); |
4492 |
|
} |
4493 |
|
|
4494 |
|
if(getPrintOnlyMode()) return null; |
4495 |
|
|
4496 |
|
if(dir.length() > 1) dir = dir.substring(0, dir.length() - 1); |
4497 |
|
StringBuffer sb = new StringBuffer(); |
4498 |
|
DbInstrumentInfo[] infoS = new DbInstrumentInfo[instrS.length]; |
4499 |
|
for(int i = 0; i < instrS.length; i++) { |
4500 |
|
try { |
4501 |
|
ResultSet rs = getMultiLineResultSet(); |
4502 |
|
infoS[i] = new DbInstrumentInfo(rs.getMultiLineResult()); |
4503 |
|
infoS[i].setName(instrS[i]); |
4504 |
|
infoS[i].setDirectoryPath(dir); |
4505 |
|
} catch (SocketTimeoutException e) { |
4506 |
|
getLogger().log(Level.FINE, e.getMessage(), e); |
4507 |
|
sb.append(e.getMessage()).append("\n"); |
4508 |
|
break; |
4509 |
|
} catch (Exception e) { |
4510 |
|
getLogger().log(Level.FINE, e.getMessage(), e); |
4511 |
|
sb.append(e.getMessage()).append("\n"); |
4512 |
|
} |
4513 |
|
} |
4514 |
|
|
4515 |
|
String details = sb.toString(); |
4516 |
|
if(details.length() > 0) { |
4517 |
|
String err = LscpI18n.getLogMsg("Client.getInstrsInfoFailed!"); |
4518 |
|
throw new LSException(0, err, details); |
4519 |
|
} |
4520 |
|
|
4521 |
|
return infoS; |
4522 |
|
}*/ |
4523 |
|
|
4524 |
|
/** |
4525 |
|
* Renames the specified instrument. |
4526 |
|
* @param instr The absolute path name of the instrument to rename. |
4527 |
|
* @param name The new name for the instrument. |
4528 |
|
* @throws IOException If some I/O error occurs. |
4529 |
|
* @throws LSException If the renaming of the instrument failed. |
4530 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4531 |
|
*/ |
4532 |
|
public synchronized void |
4533 |
|
renameDbInstrument(String instr, String name) |
4534 |
|
throws IOException, LSException, LscpException { |
4535 |
|
|
4536 |
|
verifyConnection(); |
4537 |
|
name = toEscapedString(name); |
4538 |
|
out.writeLine("SET DB_INSTRUMENT NAME '" + instr + "' '" + name + "'"); |
4539 |
|
if(getPrintOnlyMode()) return; |
4540 |
|
|
4541 |
|
ResultSet rs = getEmptyResultSet(); |
4542 |
|
} |
4543 |
|
|
4544 |
|
/** |
4545 |
|
* Moves the specified instrument into the specified location. |
4546 |
|
* @param instr The absolute path name of the instrument to move. |
4547 |
|
* @param dst The directory where the specified instrument will be moved to. |
4548 |
|
* @throws IOException If some I/O error occurs. |
4549 |
|
* @throws LSException If the operation failed. |
4550 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4551 |
|
*/ |
4552 |
|
public synchronized void |
4553 |
|
moveDbInstrument(String instr, String dst) throws IOException, LSException, LscpException { |
4554 |
|
verifyConnection(); |
4555 |
|
out.writeLine("MOVE DB_INSTRUMENT '" + instr + "' '" + dst + "'"); |
4556 |
|
if(getPrintOnlyMode()) return; |
4557 |
|
|
4558 |
|
ResultSet rs = getEmptyResultSet(); |
4559 |
|
} |
4560 |
|
|
4561 |
|
/** |
4562 |
|
* Moves the specified instruments into the specified location. |
4563 |
|
* @param instrs The absolute path names of the instruments to move. |
4564 |
|
* @param dst The directory where the specified instruments will be moved to. |
4565 |
|
* @throws IOException If some I/O error occurs. |
4566 |
|
* @throws LSException If the operation failed. |
4567 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4568 |
|
*/ |
4569 |
|
public synchronized void |
4570 |
|
moveDbInstruments(String[] instrs, String dst) throws IOException, LSException, LscpException { |
4571 |
|
verifyConnection(); |
4572 |
|
for(String s : instrs) { |
4573 |
|
out.writeLine("MOVE DB_INSTRUMENT '" + s + "' '" + dst + "'"); |
4574 |
|
} |
4575 |
|
if(getPrintOnlyMode()) return; |
4576 |
|
|
4577 |
|
getEmptyResultSets(instrs.length, "Client.instrMovingFailed!"); |
4578 |
|
} |
4579 |
|
|
4580 |
|
/** |
4581 |
|
* Copies the specified instrument into the specified location. |
4582 |
|
* @param instr The absolute path name of the instrument to copy. |
4583 |
|
* @param dst The directory where the specified instrument will be copied to. |
4584 |
|
* @throws IOException If some I/O error occurs. |
4585 |
|
* @throws LSException If the operation failed. |
4586 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4587 |
|
*/ |
4588 |
|
public synchronized void |
4589 |
|
copyDbInstrument(String instr, String dst) throws IOException, LSException, LscpException { |
4590 |
|
verifyConnection(); |
4591 |
|
out.writeLine("COPY DB_INSTRUMENT '" + instr + "' '" + dst + "'"); |
4592 |
|
if(getPrintOnlyMode()) return; |
4593 |
|
|
4594 |
|
ResultSet rs = getEmptyResultSet(); |
4595 |
|
} |
4596 |
|
|
4597 |
|
/** |
4598 |
|
* Copies the specified instruments into the specified location. |
4599 |
|
* @param instrs The absolute path name of the instruments to copy. |
4600 |
|
* @param dst The directory where the specified instruments will be copied to. |
4601 |
|
* @throws IOException If some I/O error occurs. |
4602 |
|
* @throws LSException If the operation failed. |
4603 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4604 |
|
*/ |
4605 |
|
public synchronized void |
4606 |
|
copyDbInstruments(String[] instrs, String dst) throws IOException, LSException, LscpException { |
4607 |
|
verifyConnection(); |
4608 |
|
for(String s : instrs) { |
4609 |
|
out.writeLine("COPY DB_INSTRUMENT '" + s + "' '" + dst + "'"); |
4610 |
|
} |
4611 |
|
if(getPrintOnlyMode()) return; |
4612 |
|
|
4613 |
|
getEmptyResultSets(instrs.length, "Client.instrCopyingFailed!"); |
4614 |
|
} |
4615 |
|
|
4616 |
|
/** |
4617 |
|
* Changes the description of the specified instrument. |
4618 |
|
* @param instr The absolute path name of the instrument. |
4619 |
|
* @param desc The new description for the instrument. |
4620 |
|
* @throws IOException If some I/O error occurs. |
4621 |
|
* @throws LSException If failed to change the description. |
4622 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4623 |
|
*/ |
4624 |
|
public synchronized void |
4625 |
|
setDbInstrumentDescription(String instr, String desc) |
4626 |
|
throws IOException, LSException, LscpException { |
4627 |
|
|
4628 |
|
verifyConnection(); |
4629 |
|
desc = toEscapedString(desc); |
4630 |
|
out.writeLine("SET DB_INSTRUMENT DESCRIPTION '" + instr + "' '" + desc + "'"); |
4631 |
|
if(getPrintOnlyMode()) return; |
4632 |
|
|
4633 |
|
ResultSet rs = getEmptyResultSet(); |
4634 |
|
} |
4635 |
|
|
4636 |
|
/** |
4637 |
|
* Finds all directories in the specified directory |
4638 |
|
* that corresponds to the specified search criterias. |
4639 |
|
* @param dir The absolute path name of the directory to search. |
4640 |
|
* @param query Provides the search criterias. |
4641 |
|
* @return A <code>DbDirectoryInfo</code> array providing |
4642 |
|
* information about all directories that are found in the specified directory. |
4643 |
|
* @throws IOException If some I/O error occurs. |
4644 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4645 |
|
* @throws LSException If the specified path name is invalid. |
4646 |
|
*/ |
4647 |
|
public synchronized DbDirectoryInfo[] |
4648 |
|
findDbDirectories(String dir, DbSearchQuery query) |
4649 |
|
throws IOException, LscpException, LSException { |
4650 |
|
|
4651 |
|
return findDbDirectories(dir, query, false); |
4652 |
|
} |
4653 |
|
|
4654 |
|
/** |
4655 |
|
* Finds all directories in the specified directory |
4656 |
|
* that corresponds to the specified search criterias. |
4657 |
|
* @param dir The absolute path name of the directory to search. |
4658 |
|
* @param query Provides the search criterias. |
4659 |
|
* @param nonRecursive If <code>true</code>, the search will be non-recursive. |
4660 |
|
* @return A <code>DbDirectoryInfo</code> array providing |
4661 |
|
* information about all directories that are found in the specified directory. |
4662 |
|
* @throws IOException If some I/O error occurs. |
4663 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4664 |
|
* @throws LSException If the specified path name is invalid. |
4665 |
|
*/ |
4666 |
|
public synchronized DbDirectoryInfo[] |
4667 |
|
findDbDirectories(String dir, DbSearchQuery query, boolean nonRecursive) |
4668 |
|
throws IOException, LscpException, LSException { |
4669 |
|
|
4670 |
|
verifyConnection(); |
4671 |
|
StringBuffer sb = new StringBuffer(); |
4672 |
|
sb.append("FIND DB_INSTRUMENT_DIRECTORIES"); |
4673 |
|
if(nonRecursive) sb.append(" NON_RECURSIVE"); |
4674 |
|
sb.append(" '").append(dir).append("'"); |
4675 |
|
|
4676 |
|
if(query.name != null && query.name.length() > 0) { |
4677 |
|
sb.append(" NAME='").append(toEscapedString(query.name)).append("'"); |
4678 |
|
} |
4679 |
|
|
4680 |
|
String s = query.getCreatedAfter(); |
4681 |
|
String s2 = query.getCreatedBefore(); |
4682 |
|
if(s != null || s2 != null) { |
4683 |
|
sb.append(" CREATED='"); |
4684 |
|
if(s != null) sb.append(s); |
4685 |
|
sb.append(".."); |
4686 |
|
if(s2 != null) sb.append(s2); |
4687 |
|
sb.append("'"); |
4688 |
|
} |
4689 |
|
|
4690 |
|
s = query.getModifiedAfter(); |
4691 |
|
s2 = query.getModifiedBefore(); |
4692 |
|
if(s != null || s2 != null) { |
4693 |
|
sb.append(" MODIFIED='"); |
4694 |
|
if(s != null) sb.append(s); |
4695 |
|
sb.append(".."); |
4696 |
|
if(s2 != null) sb.append(s2); |
4697 |
|
sb.append("'"); |
4698 |
|
} |
4699 |
|
|
4700 |
|
if(query.description != null && query.description.length() > 0) { |
4701 |
|
sb.append(" DESCRIPTION='"); |
4702 |
|
sb.append(toEscapedString(query.description)).append("'"); |
4703 |
|
} |
4704 |
|
|
4705 |
|
out.writeLine(sb.toString()); |
4706 |
|
if(getPrintOnlyMode()) return null; |
4707 |
|
|
4708 |
|
String[] dirS = parseEscapedStringList(getSingleLineResultSet().getResult()); |
4709 |
|
|
4710 |
|
DbDirectoryInfo[] infoS = new DbDirectoryInfo[dirS.length]; |
4711 |
|
for(int i = 0; i < dirS.length; i++) { |
4712 |
|
infoS[i] = getDbDirectoryInfo(dirS[i]); |
4713 |
|
} |
4714 |
|
return infoS; |
4715 |
|
} |
4716 |
|
|
4717 |
|
/** |
4718 |
|
* Finds all instruments in the specified directory |
4719 |
|
* that corresponds to the specified search criterias. |
4720 |
|
* @param dir The absolute path name of the directory to search. |
4721 |
|
* @param query Provides the search criterias. |
4722 |
|
* @return A <code>DbInstrumentInfo</code> array providing |
4723 |
|
* information about all instruments that are found in the specified directory. |
4724 |
|
* @throws IOException If some I/O error occurs. |
4725 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4726 |
|
* @throws LSException If the specified path name is invalid. |
4727 |
|
*/ |
4728 |
|
public synchronized DbInstrumentInfo[] |
4729 |
|
findDbInstruments(String dir, DbSearchQuery query) |
4730 |
|
throws IOException, LscpException, LSException { |
4731 |
|
|
4732 |
|
return findDbInstruments(dir, query, false); |
4733 |
|
} |
4734 |
|
|
4735 |
|
/** |
4736 |
|
* Finds all instruments in the specified directory |
4737 |
|
* that corresponds to the specified search criterias. |
4738 |
|
* @param dir The absolute path name of the directory to search. |
4739 |
|
* @param query Provides the search criterias. |
4740 |
|
* @param nonRecursive If <code>true</code>, the search will be non-recursive. |
4741 |
|
* @return A <code>DbInstrumentInfo</code> array providing |
4742 |
|
* information about all instruments that are found in the specified directory. |
4743 |
|
* @throws IOException If some I/O error occurs. |
4744 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4745 |
|
* @throws LSException If the specified path name is invalid. |
4746 |
|
*/ |
4747 |
|
public synchronized DbInstrumentInfo[] |
4748 |
|
findDbInstruments(String dir, DbSearchQuery query, boolean nonRecursive) |
4749 |
|
throws IOException, LscpException, LSException { |
4750 |
|
|
4751 |
|
verifyConnection(); |
4752 |
|
StringBuffer sb = new StringBuffer(); |
4753 |
|
sb.append("FIND DB_INSTRUMENTS"); |
4754 |
|
if(nonRecursive) sb.append(" NON_RECURSIVE"); |
4755 |
|
sb.append(" '").append(dir).append("'"); |
4756 |
|
|
4757 |
|
if(query.name != null && query.name.length() > 0) { |
4758 |
|
sb.append(" NAME='").append(toEscapedString(query.name)).append("'"); |
4759 |
|
} |
4760 |
|
|
4761 |
|
if(query.formatFamilies.size() > 0) { |
4762 |
|
sb.append(" FORMAT_FAMILIES='").append(query.formatFamilies.get(0)); |
4763 |
|
for(int i = 1; i < query.formatFamilies.size(); i++) { |
4764 |
|
sb.append(',').append(query.formatFamilies.get(i)); |
4765 |
|
} |
4766 |
|
sb.append("'"); |
4767 |
|
} |
4768 |
|
|
4769 |
|
if(query.minSize != -1 || query.maxSize != -1) { |
4770 |
|
sb.append(" SIZE='"); |
4771 |
|
if(query.minSize != -1) sb.append(query.minSize); |
4772 |
|
sb.append(".."); |
4773 |
|
if(query.maxSize != -1) sb.append(query.maxSize); |
4774 |
|
sb.append("'"); |
4775 |
|
} |
4776 |
|
|
4777 |
|
String s = query.getCreatedAfter(); |
4778 |
|
String s2 = query.getCreatedBefore(); |
4779 |
|
if(s != null || s2 != null) { |
4780 |
|
sb.append(" CREATED='"); |
4781 |
|
if(s != null) sb.append(s); |
4782 |
|
sb.append(".."); |
4783 |
|
if(s2 != null) sb.append(s2); |
4784 |
|
sb.append("'"); |
4785 |
|
} |
4786 |
|
|
4787 |
|
s = query.getModifiedAfter(); |
4788 |
|
s2 = query.getModifiedBefore(); |
4789 |
|
if(s != null || s2 != null) { |
4790 |
|
sb.append(" MODIFIED='"); |
4791 |
|
if(s != null) sb.append(s); |
4792 |
|
sb.append(".."); |
4793 |
|
if(s2 != null) sb.append(s2); |
4794 |
|
sb.append("'"); |
4795 |
|
} |
4796 |
|
|
4797 |
|
if(query.description != null && query.description.length() > 0) { |
4798 |
|
sb.append(" DESCRIPTION='"); |
4799 |
|
sb.append(toEscapedString(query.description)).append("'"); |
4800 |
|
} |
4801 |
|
|
4802 |
|
if(query.instrumentType != DbSearchQuery.InstrumentType.BOTH) { |
4803 |
|
sb.append(" IS_DRUM="); |
4804 |
|
if(query.instrumentType == DbSearchQuery.InstrumentType.DRUM) { |
4805 |
|
sb.append("'true'"); |
4806 |
|
} else { |
4807 |
|
sb.append("'false'"); |
4808 |
|
} |
4809 |
|
} |
4810 |
|
|
4811 |
|
if(query.product != null && query.product.length() > 0) { |
4812 |
|
sb.append(" PRODUCT='").append(toEscapedString(query.product)).append("'"); |
4813 |
|
} |
4814 |
|
|
4815 |
|
if(query.artists != null && query.artists.length() > 0) { |
4816 |
|
sb.append(" ARTISTS='").append(toEscapedString(query.artists)).append("'"); |
4817 |
|
} |
4818 |
|
|
4819 |
|
if(query.keywords != null && query.keywords.length() > 0) { |
4820 |
|
sb.append(" KEYWORDS='"); |
4821 |
|
sb.append(toEscapedString(query.keywords)).append("'"); |
4822 |
|
} |
4823 |
|
|
4824 |
|
out.writeLine(sb.toString()); |
4825 |
|
if(getPrintOnlyMode()) return null; |
4826 |
|
|
4827 |
|
String[] instrS = parseEscapedStringList(getSingleLineResultSet().getResult()); |
4828 |
|
|
4829 |
|
DbInstrumentInfo[] infoS = new DbInstrumentInfo[instrS.length]; |
4830 |
|
for(int i = 0; i < instrS.length; i++) { |
4831 |
|
infoS[i] = getDbInstrumentInfo(instrS[i]); |
4832 |
|
} |
4833 |
|
return infoS; |
4834 |
|
} |
4835 |
|
|
4836 |
|
/** |
4837 |
|
* Gets status information about the specified job. |
4838 |
|
* @param jobId The ID of the job. |
4839 |
|
* @return A <code>ScanJobInfo</code> instance providing information |
4840 |
|
* about the specified job. |
4841 |
|
* @throws IOException If some I/O error occurs. |
4842 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4843 |
|
* @throws LSException If the specified job is not found. |
4844 |
|
*/ |
4845 |
|
public synchronized ScanJobInfo |
4846 |
|
getDbInstrumentsJobInfo(int jobId) throws IOException, LscpException, LSException { |
4847 |
|
verifyConnection(); |
4848 |
|
out.writeLine("GET DB_INSTRUMENTS_JOB INFO " + String.valueOf(jobId)); |
4849 |
|
if(getPrintOnlyMode()) return null; |
4850 |
|
|
4851 |
|
ResultSet rs = getMultiLineResultSet(); |
4852 |
|
ScanJobInfo info = new ScanJobInfo(rs.getMultiLineResult()); |
4853 |
|
|
4854 |
|
return info; |
4855 |
|
} |
4856 |
|
|
4857 |
|
/** |
4858 |
|
* Removes all instruments and directories and re-creates |
4859 |
|
* the instruments database structure. |
4860 |
|
* @throws IOException If some I/O error occurs. |
4861 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4862 |
|
* @throws LSException If the formatting of the instruments database failed. |
4863 |
|
*/ |
4864 |
|
public synchronized void |
4865 |
|
formatInstrumentsDb() throws IOException, LscpException, LSException { |
4866 |
|
verifyConnection(); |
4867 |
|
out.writeLine("FORMAT INSTRUMENTS_DB"); |
4868 |
|
if(getPrintOnlyMode()) return; |
4869 |
|
|
4870 |
|
ResultSet rs = getEmptyResultSet(); |
4871 |
|
} |
4872 |
|
|
4873 |
|
/** |
4874 |
* Resets the specified sampler channel. |
* Resets the specified sampler channel. |
4875 |
* |
* |
4876 |
* @param samplerChn The sampler channel number. |
* @param samplerChn The sampler channel number. |
4907 |
} |
} |
4908 |
|
|
4909 |
/** |
/** |
4910 |
|
* Gets the current number of all active streams. |
4911 |
|
* @return The current number of all active streams. |
4912 |
|
* @throws IOException If some I/O error occurs. |
4913 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
4914 |
|
* @throws LSException If some other error occurs. |
4915 |
|
*/ |
4916 |
|
public synchronized int |
4917 |
|
getTotalStreamCount() throws IOException, LscpException, LSException { |
4918 |
|
verifyConnection(); |
4919 |
|
out.writeLine("GET TOTAL_STREAM_COUNT"); |
4920 |
|
if(getPrintOnlyMode()) return -1; |
4921 |
|
|
4922 |
|
String s = getSingleLineResultSet().getResult(); |
4923 |
|
return parseInt(s); |
4924 |
|
} |
4925 |
|
|
4926 |
|
/** |
4927 |
* Gets the current number of all active voices. |
* Gets the current number of all active voices. |
4928 |
* @return The current number of all active voices. |
* @return The current number of all active voices. |
4929 |
* @throws IOException If some I/O error occurs. |
* @throws IOException If some I/O error occurs. |
5013 |
} |
} |
5014 |
|
|
5015 |
/** |
/** |
5016 |
|
* Gets the number of instruments in the specified instrument file. |
5017 |
|
* @param filename The absolute path name of the instrument file. |
5018 |
|
* @return The number of instruments in the specified instrument file. |
5019 |
|
* @throws IOException If some I/O error occurs. |
5020 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
5021 |
|
* @throws LSException If the file is not found, or other error occur. |
5022 |
|
*/ |
5023 |
|
public synchronized int |
5024 |
|
getFileInstrumentCount(String filename) throws IOException, LscpException, LSException { |
5025 |
|
verifyConnection(); |
5026 |
|
out.writeLine("GET FILE INSTRUMENTS '" + filename +"'"); |
5027 |
|
if(getPrintOnlyMode()) return -1; |
5028 |
|
|
5029 |
|
String s = getSingleLineResultSet().getResult(); |
5030 |
|
return parseInt(s); |
5031 |
|
} |
5032 |
|
|
5033 |
|
/** |
5034 |
|
* Gets information about the instrument with index |
5035 |
|
* <code>instrIdx</code> in the specified instrument file. |
5036 |
|
* @param filename The absolute path name of the instrument file. |
5037 |
|
* @param instrIdx The index of the instrument in the specified instrument file. |
5038 |
|
* @throws IOException If some I/O error occurs. |
5039 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
5040 |
|
* @throws LSException If failed to retrieve information. |
5041 |
|
*/ |
5042 |
|
public synchronized Instrument |
5043 |
|
getFileInstrumentInfo(String filename, int instrIdx) |
5044 |
|
throws IOException, LscpException, LSException { |
5045 |
|
|
5046 |
|
verifyConnection(); |
5047 |
|
out.writeLine("GET FILE INSTRUMENT INFO '" + filename + "' " + String.valueOf(instrIdx)); |
5048 |
|
if(getPrintOnlyMode()) return null; |
5049 |
|
|
5050 |
|
ResultSet rs = getMultiLineResultSet(); |
5051 |
|
Instrument instr = new FileInstrument(rs.getMultiLineResult()) { }; |
5052 |
|
|
5053 |
|
return instr; |
5054 |
|
} |
5055 |
|
|
5056 |
|
/** |
5057 |
|
* Gets the list of instruments in the specified instrument file. |
5058 |
|
* @param filename The absolute path name of the instrument file. |
5059 |
|
* @return An <code>Instrument</code> array providing |
5060 |
|
* information about all instruments in the specified instrument file. |
5061 |
|
* @throws IOException If some I/O error occurs. |
5062 |
|
* @throws LscpException If LSCP protocol corruption occurs. |
5063 |
|
* @throws LSException If the specified file name is invalid. |
5064 |
|
*/ |
5065 |
|
public synchronized Instrument[] |
5066 |
|
getFileInstruments(String filename) throws IOException, LscpException, LSException { |
5067 |
|
int l = getFileInstrumentCount(filename); |
5068 |
|
if(l < 0) return null; |
5069 |
|
Instrument[] instrS = new FileInstrument[l]; |
5070 |
|
|
5071 |
|
for(int i = 0; i < instrS.length; i++) { |
5072 |
|
instrS[i] = getFileInstrumentInfo(filename, i); |
5073 |
|
} |
5074 |
|
return instrS; |
5075 |
|
} |
5076 |
|
|
5077 |
|
private static class FileInstrument extends AbstractInstrument { |
5078 |
|
FileInstrument(String[] resultSet) throws LscpException { |
5079 |
|
super(resultSet); |
5080 |
|
} |
5081 |
|
|
5082 |
|
public String |
5083 |
|
getEngine() { |
5084 |
|
// TODO: engine lookup? |
5085 |
|
return getFormatFamily(); |
5086 |
|
} |
5087 |
|
|
5088 |
|
public boolean |
5089 |
|
parse(String s) throws LscpException { |
5090 |
|
if(s.startsWith("PRODUCT: ") || s.startsWith("ARTISTS: ")) return true; |
5091 |
|
return super.parse(s); |
5092 |
|
} |
5093 |
|
} |
5094 |
|
|
5095 |
|
private void |
5096 |
|
getEmptyResultSets(int count, String err) throws LSException { |
5097 |
|
StringBuffer sb = new StringBuffer(); |
5098 |
|
for(int i = 0; i < count; i++) { |
5099 |
|
try { getEmptyResultSet(); } |
5100 |
|
catch (SocketTimeoutException e) { |
5101 |
|
getLogger().log(Level.FINE, e.getMessage(), e); |
5102 |
|
sb.append(e.getMessage()).append("\n"); |
5103 |
|
break; |
5104 |
|
} catch (Exception e) { |
5105 |
|
getLogger().log(Level.FINE, e.getMessage(), e); |
5106 |
|
sb.append(e.getMessage()).append("\n"); |
5107 |
|
} |
5108 |
|
} |
5109 |
|
|
5110 |
|
String details = sb.toString(); |
5111 |
|
if(details.length() > 0) { |
5112 |
|
String s = LscpI18n.getLogMsg(err); |
5113 |
|
throw new LSException(0, s, details); |
5114 |
|
} |
5115 |
|
} |
5116 |
|
|
5117 |
|
/** |
5118 |
* Returns the logger for this library. |
* Returns the logger for this library. |
5119 |
* @return The logger for this library. |
* @return The logger for this library. |
5120 |
*/ |
*/ |