/** * @since 1.10 */ public TextLine2RecordFilter(final ClassNameRegistryRepository classNameRegistryRepository) { this.recordFromTextLineCreator = new RecordFromTextLineCreator(classNameRegistryRepository); }
public OutputPort<IMonitoringRecord> getOutputPort() { return this.textLine2RecordFilter.getOutputPort(); }
public DatFile2RecordFilter(final ClassNameRegistryRepository classNameRegistryRepository) { this.file2TextLinesFilter = new File2TextLinesFilter(); this.textLine2RecordFilter = new TextLine2RecordFilter(classNameRegistryRepository); this.connectPorts(this.file2TextLinesFilter.getOutputPort(), this.textLine2RecordFilter.getInputPort()); }
public Dir2RecordsFilter(final ClassNameRegistryRepository classNameRegistryRepository) { this.classNameRegistryRepository = classNameRegistryRepository; // does not yet work with more than one thread due to classNameRegistryRepository: classNameRegistryRepository is set after the ctor // create stages final ClassNameRegistryCreationFilter tempClassNameRegistryCreationFilter = new ClassNameRegistryCreationFilter(this.classNameRegistryRepository); final Directory2FilesFilter directory2FilesFilter = new Directory2FilesFilter(); final FileExtensionSwitch fileExtensionSwitch = new FileExtensionSwitch(); final DatFile2RecordFilter datFile2RecordFilter = new DatFile2RecordFilter(this.classNameRegistryRepository); final BinaryFile2RecordFilter binaryFile2RecordFilter = new BinaryFile2RecordFilter(this.classNameRegistryRepository); this.recordMerger = new Merger<>(); // store ports due to readability reasons final OutputPort<File> datFileOutputPort = fileExtensionSwitch.addFileExtension(FSUtil.DAT_FILE_EXTENSION); final OutputPort<File> binFileOutputPort = fileExtensionSwitch.addFileExtension(BinaryCompressionMethod.NONE.getFileExtension()); // connect ports by pipes this.connectPorts(tempClassNameRegistryCreationFilter.getOutputPort(), directory2FilesFilter.getInputPort()); this.connectPorts(directory2FilesFilter.getOutputPort(), fileExtensionSwitch.getInputPort()); this.connectPorts(datFileOutputPort, datFile2RecordFilter.getInputPort()); this.connectPorts(binFileOutputPort, binaryFile2RecordFilter.getInputPort()); this.connectPorts(datFile2RecordFilter.getOutputPort(), this.recordMerger.getNewInputPort()); this.connectPorts(binaryFile2RecordFilter.getOutputPort(), this.recordMerger.getNewInputPort()); // prepare pipeline this.classNameRegistryCreationFilter = tempClassNameRegistryCreationFilter; }
public IMonitoringRecord createRecordFromLine(final File textFile, final String line) throws MonitoringRecordException, IllegalRecordFormatException, MappingException, UnknownRecordTypeException { this.charBuffer.put(line); return this.createRecord(this.classNameRegistryRepository.get(textFile.getParentFile())); }
@Override protected void execute(final TextLineContainer textLine) { try { final IMonitoringRecord record = this.recordFromTextLineCreator.createRecordFromLine(textLine.getTextFile(), textLine.getTextLine()); this.outputPort.send(record); } catch (final MonitoringRecordException e) { this.logger.error("Could not create record from text line: '" + textLine + "'", e); } catch (final IllegalRecordFormatException e) { this.logger.error("Illegal record format: " + textLine, e); } catch (final MappingException e) { this.logger.error("", e); } catch (final UnknownRecordTypeException e) { final String classname = e.getClassName(); if (!this.ignoreUnknownRecordTypes) { // this.abortDueToUnknownRecordType = true; // currently not used this.logger.error("Failed to load record type " + classname, e); } else if (!this.unknownTypesObserved.contains(classname)) { this.unknownTypesObserved.add(classname); this.logger.error("Failed to load record type " + classname, e); // log once for this type } } }