use of org.opensmartgridplatform.iec60870.exceptions.Iec60870AsduHandlerNotFoundException in project open-smart-grid-platform by OSGP.
the class ClientAsduHandlerRegistry method getHandler.
public ClientAsduHandler getHandler(final ASdu asdu) throws Iec60870AsduHandlerNotFoundException {
final ASduType asduType = asdu.getTypeIdentification();
final ClientAsduHandler handler = this.handlers.get(asduType);
if (handler == null) {
LOGGER.error("Unable to process ASDU {}, no ASDU handler found for ASDU type {}", asdu, asduType);
throw new Iec60870AsduHandlerNotFoundException(asduType);
}
return handler;
}
use of org.opensmartgridplatform.iec60870.exceptions.Iec60870AsduHandlerNotFoundException in project open-smart-grid-platform by OSGP.
the class Iec60870ConnectionEventListener method newASdu.
@Override
public void newASdu(final ASdu asdu) {
try {
final ASduType asduType = asdu.getTypeIdentification();
final Iec60870AsduHandler asduHandler = this.iec60870AsduHandlerRegistry.getHandler(asduType);
asduHandler.handleAsdu(this.connection, asdu);
} catch (final Iec60870AsduHandlerNotFoundException e) {
LOGGER.error("Unknown request received, no handler available for ASDU: {}", asdu, e);
} catch (final EOFException e) {
LOGGER.error("Connection closed on connection ({}).", this.connection, e);
} catch (final Exception e) {
LOGGER.error("Exception occurred on connection ({}).", this.connection, e);
}
}
use of org.opensmartgridplatform.iec60870.exceptions.Iec60870AsduHandlerNotFoundException in project open-smart-grid-platform by OSGP.
the class ClientConnectionEventListener method newASdu.
@Override
public void newASdu(final ASdu asdu) {
LOGGER.info("Received incoming ASDU from device {}:\n{}", this.deviceIdentification, asdu);
try {
final ResponseMetadata newResponseMetadata = this.responseMetadataFactory.createWithNewCorrelationUid(this.responseMetadata);
final LogItem logItem = this.logItemFactory.create(asdu, this.deviceIdentification, newResponseMetadata.getOrganisationIdentification(), true);
this.loggingService.log(logItem);
final ClientAsduHandler asduHandler = this.asduHandlerRegistry.getHandler(asdu);
asduHandler.handleAsdu(asdu, newResponseMetadata);
} catch (final Iec60870AsduHandlerNotFoundException e) {
LOGGER.error("Unknown request received, no handler available for ASDU: {}", asdu, e);
} catch (final Exception e) {
LOGGER.error("Exception occurred while handling an incoming ASDU from device {}.", this.deviceIdentification, e);
}
}
Aggregations