Search in sources :

Example 1 with MappingException

use of kieker.analysisteetime.plugin.reader.filesystem.util.MappingException in project iobserve-analysis by research-iobserve.

the class DatFileToRecordStage method execute.

@Override
protected void execute(final File textFile) {
    final ReaderRegistry<String> classNameRegistry = this.classNameRegistryRepository.get(textFile.getParentFile());
    try {
        final InputStream inputStream = Files.newInputStream(textFile.toPath(), StandardOpenOption.READ);
        if (inputStream != null) {
            this.processInputChannel(classNameRegistry, inputStream);
            inputStream.close();
        }
    } catch (final FileNotFoundException e) {
        this.logger.error("", e);
    } catch (final IOException e) {
        this.logger.error("", e);
    } catch (final MappingException e) {
        this.logger.error("", e);
    } catch (final MonitoringRecordException e) {
        this.logger.error("", e);
    } catch (final UnknownRecordTypeException e) {
        this.logger.error("", e);
    }
}
Also used : UnknownRecordTypeException(kieker.common.exception.UnknownRecordTypeException) InputStream(java.io.InputStream) MonitoringRecordException(kieker.common.exception.MonitoringRecordException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) MappingException(kieker.analysisteetime.plugin.reader.filesystem.util.MappingException)

Example 2 with MappingException

use of kieker.analysisteetime.plugin.reader.filesystem.util.MappingException in project iobserve-analysis by research-iobserve.

the class DatFileToRecordStage method createRecord.

private void createRecord(final ReaderRegistry<String> classNameRegistry) throws MappingException, MonitoringRecordException, UnknownRecordTypeException {
    this.charBuffer.flip();
    final char lead = this.charBuffer.get();
    if (lead == '$') {
        final TextValueDeserializer deserializer = TextValueDeserializer.create(this.charBuffer);
        final int id = deserializer.getInt();
        final String classname = classNameRegistry.get(id);
        if (classname == null) {
            throw new MappingException("Missing classname mapping for record type id " + "'" + id + "'");
        }
        final long loggingTimestamp = deserializer.getLong();
        final IRecordFactory<? extends IMonitoringRecord> recordFactory = this.recordFactories.get(classname);
        final IMonitoringRecord event = recordFactory.create(deserializer);
        event.setLoggingTimestamp(loggingTimestamp);
        this.outputPort.send(event);
        this.charBuffer.clear();
    }
}
Also used : IMonitoringRecord(kieker.common.record.IMonitoringRecord) TextValueDeserializer(kieker.common.record.io.TextValueDeserializer) MappingException(kieker.analysisteetime.plugin.reader.filesystem.util.MappingException)

Aggregations

MappingException (kieker.analysisteetime.plugin.reader.filesystem.util.MappingException)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 MonitoringRecordException (kieker.common.exception.MonitoringRecordException)1 UnknownRecordTypeException (kieker.common.exception.UnknownRecordTypeException)1 IMonitoringRecord (kieker.common.record.IMonitoringRecord)1 TextValueDeserializer (kieker.common.record.io.TextValueDeserializer)1