class LogTailDelegator extends BaseDelegator implements ILogTailDelegator {

    @Override
    public ILogTail getLogTail(final LogTailOptions opts) throws P4JavaException {
        List<Map<String, Object>> resultMaps = execMapCmdList(LOGTAIL,
                processParameters(opts, server), null);

        String logFile = null;
        long offset = -1;
        List<String> data = new ArrayList<>();
        if (nonNull(resultMaps)) {
            for (Map<String, Object> map : resultMaps) {
                if (nonNull(map)) {
                    // p4ic4idea: use IServerMessage
                    ResultMapParser.handleErrors(ResultMapParser.toServerMessage(map));
                    try {
                        if (map.containsKey(FILE)) {
                            logFile = parseString(map, FILE);
                        }

                        if (map.containsKey(DATA)) {
                            data.add(parseString(map, DATA));
                        }
                        if (map.containsKey(OFFSET)) {
                            offset = parseLong(map, OFFSET);
                        }
                    } catch (Throwable thr) {
                        Log.exception(thr);
                    }
                }
            }
        }
        if (isNotBlank(logFile) && !data.isEmpty() && offset > -1) {
            return new LogTail(logFile, offset, data);
        }
        return null;
    }

    public  LogTailDelegator(final IOptionsServer server);

}