Logger logger = Logger.getRootLogger();
logger.addAppender(new ConsoleAppender(new PatternLayout("%p %m%n")));
logger.setLevel(Level.WARN);
String uri = command.getOptionValue("cli");
Repository repository = JcrUtils.getRepository(uri);
Context context = new ContextBase();
CommandHelper.setRepository(context, repository, uri);
try {
Session session = repository.login();
CommandHelper.setSession(context, session);
CommandHelper.setCurrentNode(context, session.getRootNode());
} catch (RepositoryException ignore) {
// anonymous login not possible
}
new JcrClient(context).runInteractive();
try {
CommandHelper.getSession(context).logout();
} catch (CommandException ignore) {
// already logged out
}
} else {
message("Welcome to Apache Jackrabbit!");
message("-------------------------------");
File repository =
new File(command.getOptionValue("repo", "jackrabbit"));
message("Using repository directory " + repository);
repository.mkdirs();
File tmp = new File(repository, "tmp");
tmp.mkdir();
File log = new File(repository, "log");
log.mkdir();