System.setProperty("java.security.auth.login.config", loginConf);
StandaloneContainer.addConfigurationURL(containerConf);
container = StandaloneContainer.getInstance();
RepositoryService repService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
cservice = (CommandService)container.getComponentInstanceOfType(CommandService.class);
// we need to login (see BasicAppContext, 38) and set current item before ctx using
if (ctx == null)
{
// login via Authenticator
Authenticator authr = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
String validUser =
authr.validateUser(new Credential[]{new UsernameCredential("root"), new PasswordCredential("exo")});
Identity id = authr.createIdentity(validUser);
ConversationState s = new ConversationState(id);
ConversationState.setCurrent(s);
ctx = new CliAppContext(repService.getDefaultRepository(), PARAMETERS_KEY);
Node root = ctx.getSession().getRootNode();
ctx.setCurrentItem(root);
if (root.hasNode("testJCRClientCommands") == false)
{
Node node = root.addNode("testJCRClientCommands").addNode("childOftestJCRClientCommands");