public Node retrieve(String host, String port) { INodeConnectionProvider ncp = injector.getInstance(INodeConnectionProvider.class); INodeConnection connection = ncp.createConnection(host, port); INodeAdapter nodeAdapter = connection.getAdapter(INodeAdapter.class); Node result = nodeAdapter.pullNode(); connection.close(); return EcoreUtil.copy(result); }
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); } }