List of usage examples for org.apache.commons.chain Context get
V get(Object key);
From source file:org.apache.jackrabbit.standalone.cli.mixin.RemoveMixin.java
/** * {@inheritDoc}/*from w w w . ja v a 2 s . c om*/ */ 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("removing mixin " + mixin + " from node " + path); } CommandHelper.getNode(ctx, path).removeMixin(mixin); return false; }
From source file:org.apache.jackrabbit.standalone.cli.namespace.RegisterNamespace.java
/** * {@inheritDoc}// w ww . j a va2s . c o m */ public boolean execute(Context ctx) throws Exception { String prefix = (String) ctx.get(this.prefixKey); String uri = (String) ctx.get(this.uriKey); if (log.isDebugEnabled()) { log.debug("registering namespace uri=" + uri + " prefix=" + prefix); } CommandHelper.getSession(ctx).getWorkspace().getNamespaceRegistry().registerNamespace(prefix, uri); return false; }
From source file:org.apache.jackrabbit.standalone.cli.namespace.SetNamespacePrefix.java
/** * {@inheritDoc}/*from www. j av a 2 s. com*/ */ public boolean execute(Context ctx) throws Exception { String prefix = (String) ctx.get(this.prefixKey); String uri = (String) ctx.get(this.uriKey); if (log.isDebugEnabled()) { log.debug("setting namespace prefix uri=" + uri + " new prefix=" + prefix); } CommandHelper.getSession(ctx).setNamespacePrefix(prefix, uri); return false; }
From source file:org.apache.jackrabbit.standalone.cli.namespace.UnregisterNamespace.java
/** * {@inheritDoc}//from w w w. j a va 2s .c o m */ public boolean execute(Context ctx) throws Exception { String prefix = (String) ctx.get(this.prefixKey); if (log.isDebugEnabled()) { log.debug("unregistering namespace with prefix=" + prefix); } CommandHelper.getSession(ctx).getWorkspace().getNamespaceRegistry().unregisterNamespace(prefix); return false; }
From source file:org.apache.jackrabbit.standalone.cli.nodetype.RegisterNodeType.java
public boolean execute(Context context) throws Exception { String path = (String) context.get(srcFsPathKey); // Register the custom node types defined in the CND file InputStream is = new FileInputStream(path); if (log.isDebugEnabled()) { log.debug("Import CND from path " + path); }//from w w w . ja va2s . co m CndImporter.registerNodeTypes(new InputStreamReader(is), CommandHelper.getSession(context)); return false; }
From source file:org.apache.jackrabbit.standalone.cli.query.AbstractQuery.java
/** * {@inheritDoc}//from w w w. j av a 2s .c o m */ public final boolean execute(Context ctx) throws Exception { String statement = (String) ctx.get(this.statementKey); Session session = CommandHelper.getSession(ctx); Query query = session.getWorkspace().getQueryManager().createQuery(statement, this.getLanguage()); QueryResult result = query.execute(); ctx.put(destKey, result.getNodes()); return false; }
From source file:org.apache.jackrabbit.standalone.cli.SourceCommand.java
/** * {@inheritDoc}/*from w ww.j a v a2s . co m*/ */ public boolean execute(Context ctx) throws Exception { File f = new File((String) ctx.get(this.fileKey)); if (!f.exists()) { throw new CommandException("exception.file.not.found", new String[] { f.getAbsolutePath() }); } // client JcrClient client = new JcrClient(ctx); BufferedReader in = new BufferedReader(new FileReader(f)); PrintWriter out = CommandHelper.getOutput(ctx); String line = null; while ((line = in.readLine()) != null) { out.println(bundle.getString("word.running") + ": " + line); client.runCommand(line); } in.close(); return false; }
From source file:org.apache.jackrabbit.standalone.cli.version.AddVersionLabel.java
/** * {@inheritDoc}// w w w . j a v a 2s .c o m */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); String versionName = (String) ctx.get(this.versionKey); boolean moveLabel = Boolean.valueOf((String) ctx.get(this.moveLabelKey)).booleanValue(); String versionLabel = (String) ctx.get(this.labelKey); if (log.isDebugEnabled()) { log.debug("Add label " + versionLabel + " to version " + versionName + " of node at " + path); } CommandHelper.getNode(ctx, path).getVersionHistory().addVersionLabel(versionName, versionLabel, moveLabel); return false; }
From source file:org.apache.jackrabbit.standalone.cli.version.Checkin.java
/** * {@inheritDoc}/*from ww w. j a v a 2 s . com*/ */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); if (log.isDebugEnabled()) { log.debug("cheking in node at " + path); } Version v = CommandHelper.getNode(ctx, path).checkin(); ctx.put(this.targetVersion, v.getName()); return false; }
From source file:org.apache.jackrabbit.standalone.cli.version.Checkout.java
/** * {@inheritDoc}//ww w.j ava2 s.com */ public boolean execute(Context ctx) throws Exception { String path = (String) ctx.get(this.pathKey); if (log.isDebugEnabled()) { log.debug("cheking out node at " + path); } CommandHelper.getNode(ctx, path).checkout(); return false; }