use of org.cojen.tupl.ext.Crypto in project Tupl by cojen.
the class RedoEventPrinter method main.
/**
* @param args [0]: base file, [1]: first log number to read from, [2]: optional crypto
* class; remaining args are passed to its constructor as separate parameters
*/
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
var baseFile = new java.io.File(args[0]);
long logId = Long.parseLong(args[1]);
Crypto crypto = null;
if (args.length > 2) {
Class clazz = Class.forName(args[2]);
var types = new Class[args.length - 3];
var params = new String[types.length];
for (int i = 0; i < types.length; i++) {
types[i] = String.class;
params[i] = args[i + 3];
}
crypto = (Crypto) clazz.getConstructor(types).newInstance((Object[]) params);
}
EventListener listener = (type, message, messageArgs) -> {
System.out.println(String.format(message, messageArgs));
};
new RedoLog(crypto, baseFile, logId, 0, null).replay(new RedoEventPrinter(listener, EventType.DEBUG), null, null, null);
}
Aggregations