public void record(Record record) { this.record = record; dataBaseAdapter.initialize(record, true); for (Node node : record.getConfiguration().getNodes()) { if (!node.getErrors().isEmpty()) {} RecordHandlerEventListener listener = new RecordHandlerEventListener(node); INodeConnection nodeConnection = ncp.createConnection(node); nodeConnection.getAdapter(IErrorAdapter.class).addErrorListener(this); IHandlerEventAdapter hea = nodeConnection.getAdapter(IHandlerEventAdapter.class); hea.addEventListener(Recorder.class, listener); logger.log(ILogger.DEBUG, "started recording for " + node.getINetAddress(), null); } }
public void stop() { if (record == null) { return; } for (Node node : record.getConfiguration().getNodes()) { INodeConnection nodeConnection = node.getConnection(); IHandlerEventAdapter hea = nodeConnection.getAdapter(IHandlerEventAdapter.class); RecordHandlerEventListener listener = (RecordHandlerEventListener) hea.getEventListener(Recorder.class); hea.removeEventListener(Recorder.class); listener.dispose(); dataBaseAdapter.close(); logger.log(ILogger.DEBUG, "stop recording for " + node.getINetAddress(), null); } }