use of de.mossgrabers.controller.osc.exception.MissingCommandException in project DrivenByMoss by git-moss.
the class OSCParser method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final IOpenSoundControlMessage message) {
this.logMessage(message);
final LinkedList<String> oscParts = parseAddress(message);
if (oscParts.isEmpty())
return;
final String command = oscParts.removeFirst();
if ("refresh".equals(command)) {
this.writer.flush(true);
return;
}
final Object[] values = message.getValues();
try {
final IModule module = this.modules.get(command);
if (module == null)
throw new UnknownCommandException(command);
if (values != null && values.length > 1)
module.execute(command, oscParts, values);
else
module.execute(command, oscParts, values == null || values.length == 0 ? null : values[0]);
} catch (final IllegalParameterException ex) {
this.host.println("Illegal parameter: " + message.getAddress() + " " + ex.getMessage());
} catch (final UnknownCommandException ex) {
this.host.println("Unknown OSC command: " + message.getAddress() + " " + ex.getMessage());
} catch (final MissingCommandException ex) {
this.host.println("Missing command: " + message.getAddress());
}
}
Aggregations