Search in sources :

Example 1 with MappingException

use of teetime.stage.util.MappingException in project iobserve-analysis by research-iobserve.

the class DatFileToRecordStage method execute.

@Override
protected void execute(final File textFile) {
    final ClassNameRegistry classNameRegistry = this.classNameRegistryRepository.get(textFile.getParentFile());
    try {
        final FileInputStream inputStream = new FileInputStream(textFile);
        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 : ClassNameRegistry(kieker.analysisteetime.plugin.reader.filesystem.className.ClassNameRegistry) UnknownRecordTypeException(kieker.common.exception.UnknownRecordTypeException) MonitoringRecordException(kieker.common.exception.MonitoringRecordException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) MappingException(teetime.stage.util.MappingException)

Example 2 with MappingException

use of teetime.stage.util.MappingException in project iobserve-analysis by research-iobserve.

the class DatFileToRecordStage method createRecord.

private void createRecord(final ClassNameRegistry 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(teetime.stage.util.MappingException)

Aggregations

MappingException (teetime.stage.util.MappingException)2 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ClassNameRegistry (kieker.analysisteetime.plugin.reader.filesystem.className.ClassNameRegistry)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