List of usage examples for org.apache.commons.chain Context get
V get(Object key);
From source file:org.apache.jackrabbit.standalone.cli.info.LsNodes.java
/** * {@inheritDoc}/* w w w. ja v a 2s . c o m*/ */ protected Iterator getNodes(Context ctx) throws CommandException, RepositoryException { String pattern = (String) ctx.get(this.patternKey); Node n = CommandHelper.getCurrentNode(ctx); return CommandHelper.getNodes(ctx, n, pattern); }
From source file:org.apache.jackrabbit.standalone.cli.info.LsProperties.java
/** * {@inheritDoc}// w w w . j a v a2 s .co m */ protected Iterator getProperties(Context ctx) throws CommandException, RepositoryException { String pattern = (String) ctx.get(this.patternKey); Node n = CommandHelper.getCurrentNode(ctx); return CommandHelper.getProperties(ctx, n, pattern); }
From source file:org.apache.jackrabbit.standalone.cli.info.LsReferences.java
/** * {@inheritDoc}/*from w w w . jav a 2 s . c o m*/ */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); Node n = CommandHelper.getNode(ctx, path); // header int[] width = new int[] { 60 }; String[] header = new String[] { bundle.getString("word.path") }; // print header PrintHelper.printRow(ctx, width, header); // print separator PrintHelper.printSeparatorRow(ctx, width, '-'); PropertyIterator iter = n.getReferences(); while (iter.hasNext()) { Property p = iter.nextProperty(); // print header PrintHelper.printRow(ctx, width, new String[] { p.getPath() }); } CommandHelper.getOutput(ctx).println(); CommandHelper.getOutput(ctx).println(iter.getSize() + " " + bundle.getString("word.references")); return false; }
From source file:org.apache.jackrabbit.standalone.cli.info.LsVersions.java
/** * {@inheritDoc}//from w w w . jav a 2s.c o m */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); Node n = CommandHelper.getNode(ctx, path); // header int[] width = new int[] { 20, 50 }; String[] header = new String[] { bundle.getString("word.version"), bundle.getString("word.labels") }; // print header PrintHelper.printRow(ctx, width, header); // print separator PrintHelper.printSeparatorRow(ctx, width, '-'); VersionIterator iter = n.getVersionHistory().getAllVersions(); while (iter.hasNext()) { Version v = iter.nextVersion(); Collection row = new ArrayList(); row.add(v.getName()); row.add(Arrays.asList(n.getVersionHistory().getVersionLabels(v))); PrintHelper.printRow(ctx, width, row); } return false; }
From source file:org.apache.jackrabbit.standalone.cli.lock.AddLockToken.java
/** * {@inheritDoc}/*from www. j a v a2 s .co m*/ */ public boolean execute(Context ctx) throws Exception { String token = (String) ctx.get(this.tokenKey); if (log.isDebugEnabled()) { log.debug("Adding lock token " + token + " to the current session."); } Session s = CommandHelper.getSession(ctx); s.addLockToken(token); return false; }
From source file:org.apache.jackrabbit.standalone.cli.lock.Lock.java
/** * {@inheritDoc}/*from w w w . jav a2s . co m*/ */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); boolean deep = Boolean.valueOf((String) ctx.get(this.deepKey)).booleanValue(); boolean sessionScoped = Boolean.valueOf((String) ctx.get(this.sessionScopedKey)).booleanValue(); if (log.isDebugEnabled()) { log.debug("locking node at " + path + " deep=" + deep + " sessionScoped=" + sessionScoped); } CommandHelper.getNode(ctx, path).lock(deep, sessionScoped); return false; }
From source file:org.apache.jackrabbit.standalone.cli.lock.RefreshLock.java
/** * {@inheritDoc}//from ww w. j a va 2 s. co m */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); if (log.isDebugEnabled()) { log.debug("refreshing lock at " + path); } Node n = CommandHelper.getNode(ctx, path); n.getLock().refresh(); return false; }
From source file:org.apache.jackrabbit.standalone.cli.lock.RemoveLockToken.java
/** * {@inheritDoc}//w w w .j ava 2s . com */ public boolean execute(Context ctx) throws Exception { String token = (String) ctx.get(this.tokenKey); if (log.isDebugEnabled()) { log.debug("Removing lock token " + token + " from the current session."); } Session s = CommandHelper.getSession(ctx); s.removeLockToken(token); return false; }
From source file:org.apache.jackrabbit.standalone.cli.lock.Unlock.java
/** * {@inheritDoc}//from w w w . j ava2 s . c o m */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); if (log.isDebugEnabled()) { log.debug("Unlocking node at " + path); } CommandHelper.getNode(ctx, path).unlock(); return false; }
From source file:org.apache.jackrabbit.standalone.cli.mixin.AddMixin.java
/** * {@inheritDoc}// www . ja va2 s .c o m */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); String mixin = (String) ctx.get(this.mixinKey); if (log.isDebugEnabled()) { log.debug("adding mixin " + mixin + " to node " + path); } CommandHelper.getNode(ctx, path).addMixin(mixin); return false; }