jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edgarp...@apache.org
Subject svn commit: r312896 [2/6] - in /incubator/jackrabbit/trunk/contrib/jcr-commands: ./ src/java/org/apache/jackrabbit/command/ src/java/org/apache/jackrabbit/command/cli/ src/java/org/apache/jackrabbit/command/collect/ src/java/org/apache/jackrabbit/comma...
Date Tue, 11 Oct 2005 14:41:03 GMT
Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParser.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParser.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParser.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParser.java Tue Oct 11 07:38:54 2005
@@ -33,19 +33,15 @@
 /**
  * Input Parser
  */
-public class JcrParser
-{
+public class JcrParser {
     /** parser */
     private static Log log = LogFactory.getLog(JcrParser.class);
 
-    static
-    {
-        try
-        {
+    static {
+        try {
             ConfigParser parser = new ConfigParser();
             parser.parse(JcrParser.class.getResource("command.xml"));
-        } catch (Exception e)
-        {
+        } catch (Exception e) {
             e.printStackTrace();
             log.error(e);
         }
@@ -63,31 +59,26 @@
     /**
      * Constructor
      */
-    public JcrParser()
-    {
+    public JcrParser() {
         super();
     }
 
     /**
      * Parse the user's input.
-     * 
      * @param input
-     * @return a Command
+     *        user's input
      * @throws JcrParserException
-     *             if the input is illegal
+     *         if the input is illegal
      * @throws ConfigurationException
-     *             if the mapped command can't be mapped to a Commons Chain
-     *             Command
+     *         if the mapped command can't be mapped to a Commons Chain Command
      */
     public void parse(String input) throws JcrParserException,
-            ConfigurationException
-    {
+            ConfigurationException {
         this.cl = null;
         this.cmd = null;
 
         // Validate input
-        if (input == null || input.length() == 0)
-        {
+        if (input == null || input.length() == 0) {
             throw new JcrParserException("exception.parse.input.empty");
         }
 
@@ -109,14 +100,12 @@
 
         // Create Chain Command
         String impl = cl.getImpl();
-        if (impl == null)
-        {
+        if (impl == null) {
             impl = cl.getName();
         }
         cmd = catalog.getCommand(impl);
 
-        if (cmd == null)
-        {
+        if (cmd == null) {
             throw new JcrParserException("no chain command for name " + impl);
         }
 
@@ -124,12 +113,11 @@
 
     /**
      * Tokenize user's input
-     * 
      * @param input
-     * @return
+     *        the user's input
+     * @return a <code>List</code> containing the arguments
      */
-    private LinkedList getArguments(String input)
-    {
+    private LinkedList getArguments(String input) {
         LinkedList args = new LinkedList();
         int length = input.length();
 
@@ -139,29 +127,23 @@
 
         StringBuffer arg = new StringBuffer();
 
-        for (int i = 0; i < length; ++i)
-        {
+        for (int i = 0; i < length; ++i) {
             char c = input.charAt(i);
 
             // end of argument?
             if ((!insideSingleQuote & !insideDoubleQuote & Character
-                .isWhitespace(c)))
-            {
-                if (arg.toString().trim().length() > 0)
-                {
+                .isWhitespace(c))) {
+                if (arg.toString().trim().length() > 0) {
                     args.add(arg.toString().trim());
                     arg = new StringBuffer();
                 }
                 continue;
             }
 
-            if (i == escape)
-            { // escaped char
+            if (i == escape) { // escaped char
                 arg.append(c);
-            } else
-            { // unescaped char
-                switch (c)
-                {
+            } else { // unescaped char
+                switch (c) {
                 case '\\':
                     escape = i + 1;
                     break;
@@ -178,8 +160,7 @@
             }
         }
 
-        if (arg.toString().trim().length() > 0)
-        {
+        if (arg.toString().trim().length() > 0) {
             args.add(arg.toString());
         }
 
@@ -187,52 +168,55 @@
     }
 
     /**
-     * Populate the context with the attributes needed by the Command
+     * Populate the <code>Context</code> with the attributes needed by the
+     * <code>Command</code>
+     * @param ctx
+     *        the <code>Context</code>
      */
-    public void populateContext(Context ctx)
-    {
+    public void populateContext(Context ctx) {
         Iterator iter = cl.getAllParameters();
-        while (iter.hasNext())
-        {
+        while (iter.hasNext()) {
             AbstractParameter param = (AbstractParameter) iter.next();
-            log.debug("add ctx attr: " + param.getContextKey() + "=" + param.getValue());
+            log.debug("add ctx attr: " + param.getContextKey() + "="
+                    + param.getValue());
             ctx.put(param.getContextKey(), param.getValue());
         }
     }
 
     /**
-     * Remove context attribute specific to the parsed command
+     * Remove <code>Context</code> attribute specific to the parsed
+     * <code>Command</code>
+     * @param ctx
+     *        the <code>Context</code>
      */
-    public void depopulateContext(Context ctx)
-    {
+    public void depopulateContext(Context ctx) {
         Iterator iter = cl.getAllParameters();
-        while (iter.hasNext())
-        {
+        while (iter.hasNext()) {
             AbstractParameter param = (AbstractParameter) iter.next();
-            String ctxKey = param.getContextKey() ;
+            String ctxKey = param.getContextKey();
             log.debug("remove ctx attr: " + ctxKey + "=" + param.getValue());
             ctx.remove(ctxKey);
         }
     }
 
     /**
-     * @return the Command
+     * @return the <code>Command</code>
      */
-    public Command getCommand()
-    {
+    public Command getCommand() {
         return cmd;
     }
 
     /**
-     * Populate the CommandLine with the given parameters
-     * 
+     * Populate the <code>CommandLine</code> with the given parameters
      * @param cl
-     * @param values
+     *        the <code>CommandLine</code>
+     * @param valList
+     *        the arguments
      * @throws JcrParserException
+     *         if the user's input is illegal
      */
     private void populate(CommandLine cl, List valList)
-            throws JcrParserException
-    {
+            throws JcrParserException {
         String[] values = (String[]) valList
             .toArray(new String[valList.size()]);
 
@@ -244,42 +228,33 @@
         // Input arguments
         List args = new ArrayList();
 
-        for (int i = 0; i < values.length; i++)
-        {
+        for (int i = 0; i < values.length; i++) {
             String value = values[i];
 
-            if (value.startsWith("-"))
-            {
+            if (value.startsWith("-")) {
                 // option
-                if (i + 1 < values.length && !values[i + 1].startsWith("-"))
-                {
+                if (i + 1 < values.length && !values[i + 1].startsWith("-")) {
                     Option opt = (Option) options.get(value.substring(1));
-                    if (opt == null)
-                    {
-                        throw new JcrParserException("no.opt.for.name",
-                            new String[]
-                            {
+                    if (opt == null) {
+                        throw new JcrParserException("exception.no.opt.for.name",
+                            new String[] {
                                 value.substring(1)
                             });
                     }
                     opt.setValue(values[i + 1]);
                     i++;
-                } else
-                {
+                } else {
                     // flag
                     Flag flag = (Flag) flags.get(value.substring(1));
-                    if (flag == null)
-                    {
-                        throw new JcrParserException("no.flag.for.name",
-                            new String[]
-                            {
+                    if (flag == null) {
+                        throw new JcrParserException("exception.no.flag.for.name",
+                            new String[] {
                                 value
                             });
                     }
                     flag.setPresent(true);
                 }
-            } else
-            {
+            } else {
                 // collect arguments
                 args.add(value);
             }
@@ -287,12 +262,10 @@
 
         // set arguments
         String[] argValues = (String[]) args.toArray(new String[args.size()]);
-        for (int j = 0; j < argValues.length; j++)
-        {
+        for (int j = 0; j < argValues.length; j++) {
             Argument arg = (Argument) clArgs.get(new Integer(j));
-            if (arg == null)
-            {
-                throw new JcrParserException("more.arguments.than.expected");
+            if (arg == null) {
+                throw new JcrParserException("exception.more.arguments.than.expected");
             }
             arg.setValue(argValues[j]);
         }
@@ -300,21 +273,18 @@
     }
 
     /**
-     * Validate the CommandLine.
-     * 
+     * Validate the <code>CommandLine</code>
      * @param cl
+     *        the <code>CommandLine</code>
      * @throws JcrParserException
+     *         if a required parameter is not present in the user's input
      */
-    private void validate(CommandLine cl) throws JcrParserException
-    {
+    private void validate(CommandLine cl) throws JcrParserException {
         Iterator iter = cl.getRequiredParameters();
-        while (iter.hasNext())
-        {
+        while (iter.hasNext()) {
             AbstractParameter param = (AbstractParameter) iter.next();
-            if (param.getValue() == null)
-            {
-                throw new JcrParserException("missing.paramater", new String[]
-                {
+            if (param.getValue() == null) {
+                throw new JcrParserException("exception.missing.paramater", new String[] {
                     param.getName()
                 });
             }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParserException.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParserException.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParserException.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/JcrParserException.java Tue Oct 11 07:38:54 2005
@@ -21,8 +21,7 @@
 /**
  * Exception thrown if any error occurs while parsing the user's input.
  */
-public class JcrParserException extends CommandException
-{
+public class JcrParserException extends CommandException {
 
     /**
      * <code>serialVersionUID</code>
@@ -30,39 +29,35 @@
     private static final long serialVersionUID = 3761694498056713525L;
 
     /**
-     * @param message
-     * @param arguments
+     * @param message the message
+     * @param arguments the arguments
      */
-    public JcrParserException(String message, Object[] arguments)
-    {
+    public JcrParserException(String message, Object[] arguments) {
         super(message, arguments);
     }
 
     /**
-     * @param message
-     * @param cause
-     * @param arguments
+     * @param message the message
+     * @param cause the cause
+     * @param arguments the arguments
      */
     public JcrParserException(String message, Throwable cause,
-        Object[] arguments)
-    {
+        Object[] arguments) {
         super(message, cause, arguments);
     }
 
     /**
-     * @param message
+     * @param message the message
      */
-    public JcrParserException(String message)
-    {
+    public JcrParserException(String message) {
         super(message);
     }
 
     /**
-     * @param message
-     * @param cause
+     * @param message the message
+     * @param cause the cause
      */
-    public JcrParserException(String message, Throwable cause)
-    {
+    public JcrParserException(String message, Throwable cause) {
         super(message, cause);
     }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/Option.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/Option.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/Option.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/Option.java Tue Oct 11 07:38:54 2005
@@ -17,11 +17,10 @@
 package org.apache.jackrabbit.command.cli;
 
 /**
- * Command Line option. An option is a pair of parameters with the following
- * pattern -[option name] [option value]
+ * Command Line option. <br>
+ * An option is a pair with the following pattern -[option name] [option value]
  */
-public class Option extends AbstractParameter
-{
+public class Option extends AbstractParameter {
 
     /** argument name */
     private String argName;
@@ -30,59 +29,55 @@
     private boolean required = false;
 
     /**
-     * @return Returns the required.
+     * @return true if this <code>Option</code> is required
      */
-    public boolean isRequired()
-    {
+    public boolean isRequired() {
         return required;
     }
 
     /**
      * @param required
-     *            The required to set.
+     *        set required
      */
-    public void setRequired(boolean required)
-    {
+    public void setRequired(boolean required) {
         this.required = required;
     }
 
     /**
-     * @return Returns the argName.
+     * @return the argument name
      */
-    public String getArgName()
-    {
+    public String getArgName() {
         return argName;
     }
 
     /**
-     * @return localized argument name
+     * @return the localized argument name
      */
-    public String getLocalizedArgName()
-    {
+    public String getLocalizedArgName() {
         return bundle.getString(this.getArgName());
     }
 
     /**
      * @param argName
-     *            The argName to set.
+     *        the argument name to set
      */
-    public void setArgName(String argName)
-    {
+    public void setArgName(String argName) {
         this.argName = argName;
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    public Object clone()
-    {
+    public Object clone() {
         Option o = new Option();
         this.clone(o);
         return o;
     }
 
-    protected void clone(Option opt)
-    {
+    /**
+     * {@inheritDoc}
+     */
+    protected void clone(Option opt) {
         super.clone(opt);
         opt.argName = this.argName;
         opt.required = this.required;
@@ -90,10 +85,9 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    public String getLocalizedDescription()
-    {
+    public String getLocalizedDescription() {
         return bundle.getString(this.getDescription());
     }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/SourceCommand.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/SourceCommand.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/SourceCommand.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/SourceCommand.java Tue Oct 11 07:38:54 2005
@@ -28,57 +28,48 @@
 import org.apache.jackrabbit.command.CommandException;
 
 /**
- * Executes a CLI script from the given file.
+ * Executes a script from the given file
  */
-public class SourceCommand implements Command
-{
+public class SourceCommand implements Command {
     /** Resource bundle */
-    private ResourceBundle bundle = CommandHelper.getBundle() ;
+    private ResourceBundle bundle = CommandHelper.getBundle();
 
     /** file */
     private String fileKey = "file";
 
-    /** cli parser */
-    JcrParser parser = new JcrParser();
-
     /**
      * @return Returns the file.
      */
-    public String getFileKey()
-    {
+    public String getFileKey() {
         return fileKey;
     }
 
     /**
      * @param file
-     *            The file to set.
+     *        The file to set.
      */
-    public void setFileKey(String file)
-    {
+    public void setFileKey(String file) {
         this.fileKey = file;
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    public boolean execute(Context ctx) throws Exception
-    {
+    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()
-            });
+        if (!f.exists()) {
+            throw new CommandException("exception.file.not.found",
+                new String[] {
+                    f.getAbsolutePath()
+                });
         }
         // client
-        JcrClient client = new JcrClient(ctx) ;
-        
+        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)
-        {
+        while ((line = in.readLine()) != null) {
             out.println(bundle.getString("word.running") + ": " + line);
             client.runCommand(line);
         }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/command-line.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/command-line.xml?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/command-line.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/cli/command-line.xml Tue Oct 11 07:38:54 2005
@@ -1,900 +1,901 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!DOCTYPE commands [
-	<!ELEMENT commands (command+)>
+  <!ELEMENT commands (command+)>
 
-	<!ELEMENT command (alias*, argument*, option*, flag*)>
-	<!ATTLIST command 
-	name NMTOKEN #REQUIRED 
-	description CDATA #IMPLIED
-	impl NMTOKEN #IMPLIED >
-
-	<!ELEMENT alias EMPTY>
-	<!ATTLIST alias
-		name NMTOKEN #REQUIRED>
-
-	<!ELEMENT option EMPTY>
-	<!ATTLIST option 
-		name NMTOKEN #REQUIRED 
-		context-key NMTOKEN #IMPLIED 
-		arg-name CDATA #IMPLIED
-		required NMTOKEN #IMPLIED 
-		default CDATA #IMPLIED 
-		description CDATA #IMPLIED>
-
-	<!ELEMENT argument EMPTY>
-	<!ATTLIST argument  
-		name NMTOKEN #REQUIRED 
-		context-key NMTOKEN #IMPLIED 
-		position NMTOKEN #REQUIRED 
-		arg-name CDATA #IMPLIED
-		required NMTOKEN #IMPLIED 
-		default CDATA #IMPLIED 
-		description CDATA #IMPLIED>
-
-	<!ELEMENT flag EMPTY>
-	<!ATTLIST flag
-		name NMTOKEN #REQUIRED 
-		context-key NMTOKEN #IMPLIED 
-		description CDATA #IMPLIED>
-		
-	]>
+  <!ELEMENT command (alias*, argument*, option*, flag*)>
+  <!ATTLIST command
+  name NMTOKEN #REQUIRED
+  description CDATA #IMPLIED
+  impl NMTOKEN #IMPLIED >
+
+  <!ELEMENT alias EMPTY>
+  <!ATTLIST alias
+    name NMTOKEN #REQUIRED>
+
+  <!ELEMENT option EMPTY>
+  <!ATTLIST option
+    name NMTOKEN #REQUIRED
+    context-key NMTOKEN #IMPLIED
+    arg-name CDATA #IMPLIED
+    required NMTOKEN #IMPLIED
+    default CDATA #IMPLIED
+    description CDATA #IMPLIED>
+
+  <!ELEMENT argument EMPTY>
+  <!ATTLIST argument
+    name NMTOKEN #REQUIRED
+    context-key NMTOKEN #IMPLIED
+    position NMTOKEN #REQUIRED
+    arg-name CDATA #IMPLIED
+    required NMTOKEN #IMPLIED
+    default CDATA #IMPLIED
+    description CDATA #IMPLIED>
+
+  <!ELEMENT flag EMPTY>
+  <!ATTLIST flag
+    name NMTOKEN #REQUIRED
+    context-key NMTOKEN #IMPLIED
+    description CDATA #IMPLIED>
+
+  ]>
 <commands>
 
-	<command name="addlocktoken" impl="addLockToken">
-		<alias name="addtoken"/>
-		<argument 
-			name="token"
-			position="0"
-			required="true"/>
-	</command>
-		
-	<command name="addmixin" impl="addMixin">
-		<alias name="addmix"/>
-		<argument 
-			name="mixin"
-			position="0"
-			required="true"/>
-		<argument 
-			name="path"
-			position="1"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="addnode" impl="addNode">
-		<alias name="add"/>
-		<argument 
-			name="name" 
-			position="0"
-			context-key="relPath"
-			arg-name="common.jcrname" 
-			description="common.jcrname.desc" 
-			required="true"/>
-		<argument 
-			name="type"
-			position="1" 
-			arg-name="common.nodetype" 
-			description="common.nodetype.desc" />
-	</command>	
-	
-	<command name="addversionlabel" impl="addVersionLabel">
-		<alias name="addvlabel"/>
-		<argument name="version"
-			position="0" />
-		<argument name="label"
-			position="1" />
-		<option name="path" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-		<flag name="moveLabel"/>
-	</command>
-
-	<command name="cat">
-		<argument 
-			name="path" 
-			position="0" 
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"
-			required="true"/>
-		<argument 
-			name="idx" 
-			position="1" 
-			arg-name="common.index" 
-			description="common.index.desc"
-			context-key="index"/>
-	</command>	
-	
-	<command name="checkin">
-		<argument 
-			name="path"
-			position="0"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-	
-	<command name="checkout">
-		<argument 
-			name="path"
-			position="0"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="clearworkspace" impl="clearWorkspace">
-		<alias name="clear"/>
-	</command>
-
-	<command name="createworkspace" impl="createWorkspace">
-		<alias name="createw"/>
-		<argument 
-			name="name"
-			position="0"
-			required="true"/>
-	</command>
-		
-	<command name="clone">
-		<argument 
-			name="scrWorkspace"
-			position="0"
-			required="true"
-			arg-name="word.name"
-			description="common.source"/>
-		<argument 
-			name="srcAbsPath"
-			position="1"
-			required="true"/>
-		<argument 
-			name="destAbsPath"
-			position="2"
-			required="true"/>
-		<flag name="removeExisting"/>
-	</command>
-	
-	<command name="copy">
-		<argument 
-			name="srcAbsPath" 
-			position="0" 
-			arg-name="common.jcrabspath" 
-			required="true"/>
-		<argument 
-			name="destAbsPath" 
-			position="1" 
-			arg-name="common.jcrabspath" 
-			required="true"/>
-		<option 
-			name="fromWorkspace" 
-			context-key="srcWorkspace"/>
-	</command>	
-	
-	<command name="connect" impl="connectToRmiServer">
-		<argument 
-			name="url" 
-			position="0"
-			required="true"/>
-	</command>
-
-	<command name="currentnode" impl="currentNode">
-		<alias name="cd"/>
-		<alias name="cn"/>
-		<argument 
-			name="path" 
-			position="0"
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"/>
-	</command>	
-
-	<command name="dump">	
-		<argument 
-			name="path" 
-			position="0" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-	
-	<command name="exportdocview" impl="exportDocViewToFile">
-		<alias name="exportdoc"/>
-		<argument 
-			name="srcAbsPath" 
-			position="0"
-			arg-name="common.jcrabspath" 
-			description="common.exportview.from"
-			required="true"/>
-		<argument 
-			name="desFsPath" 
-			position="1"
-			arg-name="common.fspath" 
-			description="common.exportview.to"
-			required="true"/>
-		<flag 
-			name="overwrite" 
-			description="word.overwrite"/>
-		<flag
-			name="skipBinary" 
-			description="common.exportview.skipBinary" />
-		<flag 
-			name="noRecurse" 
-			description="common.exportview.noRecurse"/>
-	</command>	
-	
-	<command name="exportfilesystem" impl="exportFileSystem">
-		<alias name="exportfs"/>
-		<argument
-			name="srcJcrPath"
-			position="0"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"
-			required="true"/>
-		<argument
-			name="destFsPath" 
-			position="1"
-			arg-name="common.fspath" 
-			description="word.destination"
-			required="true"/>
-		<flag name="overwrite"
-			description="word.overwrite"/>
-	</command>
-
-	<command name="exportproperty" impl="exportPropertyToFile">
-		<alias name="exportprop"/>
-		<alias name="exportp"/>
-		<argument 
-			name="name"
-			position="0" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"
-			required="true"/>
-		<argument 
-			name="destFsPath" 
-			position="1"
-			arg-name="common.fspath" 
-			description="common.fspath.desc"
-			required="true"/>
-		<option 
-			name="idx" 
-			arg-name="common.index" 
-			description="common.index.desc"
-			context-key="index"/>
-		<flag 
-			name="overwrite" 
-			description="word.overwrite"/>
-	</command>	
-			
-	<command name="exportsysview" impl="exportSysViewToFile">
-		<alias name="exportsys"/>
-		<argument 
-			name="srcAbsPath" 
-			position="0"
-			arg-name="common.jcrabspath" 
-			description="common.exportview.from"
-			required="true"/>
-		<argument 
-			name="desFsPath" 
-			position="1"
-			arg-name="common.fspath" 
-			description="common.exportview.to"
-			required="true"/>
-		<flag 
-			name="overwrite" 
-			description="word.overwrite"/>
-		<flag
-			name="skipBinary" 
-			description="common.exportview.skipBinary"/>
-		<flag 
-			name="noRecurse" 
-			description="common.exportview.noRecurse"/>
-	</command>	
-	
-	<command name="help">
-		<argument 
-			name="command" 
-			position="0"
-			required="false" />
-	</command>
-
-	<command name="importfilesystem" impl="importFileSystem">
-		<alias name="importfs"/>
-		<argument 
-			name="srcFsPath"
-			position="0" 
-			arg-name="common.fspath" 
-			description="common.fspath.desc" 
-			required="true"/>
-	</command>	
-
-	<command name="importxml" impl="importXmlFromFile">
-		<alias name="import"/>
-		<argument 
-			name="srcFsPath" 
-			position="0"
-			arg-name="common.fspath" 
-			description="common.fspath.desc" 
-			required="true"/>
-		<argument 
-			name="destJcrPath" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"
-			position="1"/>
-		<option 
-			name="uuidBehaviour" 
-			arg-name="common.uuidBehaviour"
-			description="common.uuidBehaviour.desc"
-			default="0"/>
-	</command>		
-
-	<command name="lock">
-		<argument 
-			name="path" 
-			position="0" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-		<flag name="deep"/>
-		<flag name="session" context-key="sessionScoped"/>
-	</command>	
-			
-	<command name="login">
-		<argument 
-			name="user"
-			position="0"
-			arg-name="word.user"
-			default="anonymous"/>
-		<argument 
-			name="password"
-			position="1"
-			arg-name="word.password"
-			default="anonymous"/>
-		<option 
-			name="workspace" 
-			arg-name="word.name"/>
-	</command>
-	
-	<command name="logout"/>		
-
-	<command name="lscollect" impl="lsCollect">
-		<alias name="collect"/>
-		<argument 
-			name="pattern" 
-			position="0" 
-			arg-name="common.namepattern" 
-			description="common.namepattern.desc" 
-			required="true"/>
-		<option 
-			name="path" 
-			context-key="srcPath"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-		<option 
-			name="depth" 
-			arg-name="word.int" 
-			description="word.int"
-			default="1"/>
-		<option 
-			name="maxItems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-	</command>	
-
-	<command name="lscollectnodes" impl="lsCollectNodes">
-		<alias name="lscollectn"/>
-		<alias name="collectn"/>
-		<argument 
-			name="pattern" 
-			position="0" 
-			arg-name="common.namepattern"
-			description="common.namepattern.desc" 
-			required="true"/>
-		<option 
-			name="depth" 
-			arg-name="word.int" 
-			description="word.int"
-			default="1"/>
-		<option 
-			name="maxItems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-		<flag name="uuid" description="cmd.lsnodes.uuid"/>
-		<flag name="nsize" description="cmd.lsnodes.nsize"/>
-		<flag name="psize" description="cmd.lsnodes.psize"/>
-		<flag name="rsize" description="cmd.lsnodes.rsize"/>
-		<flag name="m" description="cmd.lsnodes.m"/>
-		<flag name="v" description="cmd.lsnodes.v"/>
-		<flag name="l" description="cmd.lsnodes.l"/>
-		<flag name="r" description="cmd.lsnodes.r"/>
-		<flag name="locked" description="cmd.lsnodes.locked"/>
-		<flag name="hasLock" description="cmd.lsnodes.hasLock"/>
-		<flag name="locktoken" 
-			context-key="lockToken" 
-			description="cmd.lsnodes.locktoken"/>
-		<flag name="new" description="cmd.lsnodes.new"/>
-		<flag name="mod" description="cmd.lsnodes.mod"/>
-		<flag name="path" description="cmd.lsnodes.path"/>
-	</command>	
-	
-	<command name="lscollectproperties" impl="lsCollectProperties">
-		<alias name="collectp"/>
-		<alias name="collectprop"/>
-		<argument 
-			name="pattern" 
-			position="0" 
-			arg-name="common.namepattern" 
-			description="common.namepattern.desc"
-			required="true"/>
-		<option 
-			name="depth" 
-			arg-name="word.depth" 
-			description="word.depth"
-			default="1"/>
-		<option 
-			name="maxitems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-	</command>	
-	
-	<command name="lsitems" impl="lsItems">
-		<alias name="ls"/>
-		<argument 
-			name="pattern" 
-			position="0"
-			arg-name="common.namepattern" 
-			description="common.namepattern.desc"/>
-		<option
-			name="maxItems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-	</command>
-	
-	<command name="lsproperties" impl="lsProperties">
-		<alias name="lsp"/>
-		<alias name="lsprop"/>
-		<argument 
-			name="pattern" 
-			position="0"
-			arg-name="common.namepattern" 
-			description="common.namepattern.desc"/>
-		<option 
-			name="maxItems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-	</command>		
-	
-	<command name="lsnodes" impl="lsNodes">
-		<alias name="lsn"/>
-		<argument 
-			name="pattern" 
-			position="0"
-			arg-name="common.namepattern" 
-			description="common.namepattern.desc"/>
-		<option 
-			name="maxItems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-		<flag name="path" description="cmd.lsnodes.path"/>
-		<flag name="uuid" description="cmd.lsnodes.uuid"/>
-		<flag name="m" context-key="mixin" description="cmd.lsnodes.m"/>
-		<flag name="nsize" context-key="nodeSize" description="cmd.lsnodes.nsize"/>
-		<flag name="psize" context-key="propertiesSize" description="cmd.lsnodes.psize"/>
-		<flag name="rsize" context-key="referencesSize" description="cmd.lsnodes.rsize"/>
-		<flag name="v" context-key="versionable" description="cmd.lsnodes.v"/>
-		<flag name="l" context-key="lockable" description="cmd.lsnodes.l"/>
-		<flag name="r" context-key="referenceable" description="cmd.lsnodes.r"/>
-		<flag name="locked" description="cmd.lsnodes.locked"/>
-		<flag name="haslock" context-key="hasLock" description="cmd.lsnodes.hasLock"/>
-		<flag name="locktoken" context-key="lockToken"/>
-		<flag name="new" description="cmd.lsnodes.new"/>
-		<flag name="mod" context-key="modified" description="cmd.lsnodes.mod"/>
-	</command>	
-
-	<command name="lsreferences" impl="lsReferences">
-		<alias name="lsr"/>
-		<alias name="lsref"/>
-		<argument 
-			name="path" 
-			position="0"
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="lsversions" impl="lsVersions">
-		<alias name="lsv"/>
-		<alias name="lsver"/>
-		<argument 
-			name="path" 
-			position="0"
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="merge">
-		<argument 
-			name="srcWorkspace"
-			arg-name="word.source"
-			description="word.source"
-			position="0" />
-		<argument name="path"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"
-			position="1" />
-		<flag name="bestEffort"/>
-	</command>
-	
-	<command name="move">
-		<argument 
-			name="srcAbsPath" 
-			position="0" 
-			arg-name="common.jcrabspath" 
-			description="common.jcrabspath.desc"
-			required="true"/>
-		<argument 
-			name="destAbsPath" 
-			position="1" 
-			arg-name="common.jcrabspath" 
-			description="common.jcrabspath.desc"
-			required="true"/>
-	</command>	
-
-	<command name="orderbefore" impl="orderBefore">
-		<alias name="order"/>
-		<argument 
-			name="srcChild" 
-			position="0" 
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"
-			required="true"/>
-		<argument 
-			name="destChild" 
-			position="1" 
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"
-			required="true"/>
-		<option
-			name="parent" 
-			context-key="parentPath"
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"/>			
-	</command>		
-	
-	<command name="refresh">
-		<argument 
-			name="path" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"
-			position="0"/>
-		<flag name="keepChanges" description="phrase.keepchanges"/>
-	</command>
-
-	<command name="refreshlock" impl="refreshLock">
-		<alias name="refreshl"/>
-		<argument 
-			name="path" 
-			position="0" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>	
-
-	<command name="registernamespace" impl="registerNamespace">
-		<argument 
-			name="prefix" 
-			position="0" 
-			arg-name="word.prefix"
-			description="word.prefix"/>
-		<argument 
-			name="uri" 
-			position="1" 
-			arg-name="word.uri"
-			description="word.uri"/>
-	</command>	
-		
-	<command name="removeitem" impl="removeItem">
-		<alias name="remove"/>
-		<alias name="delete"/>
-		<alias name="rm"/>
-		<alias name="del"/>
-		<argument 
-			name="path"
-			position="0" 
-			arg-name="common.jcrpath" 
-			description="common.jcrpath"/>
-	</command>	
-
-	<command name="removeitems" impl="removeItems">
-		<alias name="rmitems"/>
-		<alias name="delitems"/>
-		<alias name="deleteitems"/>
-		<argument 
-			name="pattern" 
-			position="0"
-			arg-name="common.namepattern" 
-			description="common.namepattern.desc" 
-			required="true"/>
-		<option 
-			name="root"
-			context-key="path"
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"/>
-	</command>		
-
-	<command name="removelocktoken" impl="removeLockToken">
-		<alias name="removetoken"/>
-		<argument 
-			name="token"
-			position="0"
-			arg-name="phrase.locktoken" 
-			description="phrase.locktoken"
-			required="true"/>
-	</command>
-
-	<command name="removemixin" impl="removeMixin">
-		<alias name="removemix"/>
-		<alias name="deletemix"/>
-		<alias name="delmix"/>
-		<argument 
-			name="mixin"
-			position="0"
-			arg-name="word.mixin" 
-			description="word.mixin"
-			required="true"/>
-		<argument 
-			name="path"
-			position="1"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-	
-	<command name="removeversion" impl="removeVersion">
-		<alias name="removev"/>
-		<argument name="name"
-			position="0" 
-			arg-name="word.name"
-			description="word.name"/>
-		<option name="path"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="removeversionlabel" impl="removeVersionLabel">
-		<alias name="removevlabel"/>
-		<alias name="delvlabel"/>
-		<argument name="label"
-			arg-name="word.label"
-			description="word.label"
-			position="0" />
-		<option name="path"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-								
-	<command name="removeversionbylabel" impl="removeVersionByLabel">
-		<alias name="removevbylabel"/>
-		<alias name="delvbylabel"/>
-		<alias name="removevbyl"/>
-		<alias name="delvbyl"/>
-		<argument name="label"
-			arg-name="word.label"
-			description="word.label"
-			position="0" />
-		<option name="path"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="rename">
-		<argument 
-			name="srcPath" 
-			position="0" 
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"
-			required="true"/>
-		<argument 
-			name="destPath" 
-			position="1" 
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"
-			required="true"/>
-	</command>	
-
-	<command name="restore">
-		<argument name="version"
-			position="0" 
-			arg-name="word.version"
-			description="word.version"/>
-		<option name="path"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-		<flag name="removeexisting" 
-			context-key="removeExisting"
-			description="phrase.removeExisting"/>
-	</command>
-
-	<command name="restorebylabel" impl="restoreByLabel">
-		<alias name="restorebyl"/>
-		<argument name="label"
-			arg-name="word.label"
-			description="word.label"
-			position="0" />
-		<option name="path"
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-		<flag name="removeexisting" 
-			context-key="removeExisting"
-			description="phrase.removeExisting"/>
-	</command>
-
-	<command name="save">	
-		<argument 
-			name="path" 
-			position="0"
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="setmultivalueproperty" impl="setMultiValueProperty">
-		<alias name="setmultiprop"/>
-		<argument 
-			name="name" 
-			position="0"
-			arg-name="word.name" 
-			description="word.name" 
-			required="true"/>
-		<argument 
-			name="value" 
-			position="1"
-			arg-name="word.value" 
-			description="word.value" 
-			required="true"/>
-		<option 
-			name="type" 
-			arg-name="common.nodetype" 
-			description="common.nodetype.desc" />
-		<option 
-			name="regexp" 
-			context-key="regExp"
-			arg-name="phrase.regexp"
-			description="phrase.regexp"
-			default=","/>
-	</command>		
-		
-	<command name="setproperty" impl="setProperty">
-		<alias name="setprop"/>
-		<alias name="setp"/>
-		<argument 
-			name="name" 
-			position="0"
-			arg-name="word.name" 
-			description="word.name" 
-			required="true"/>
-		<argument 
-			name="value" 
-			position="1"
-			arg-name="word.value" 
-			description="word.value" 
-			required="true"/>
-		<option 
-			name="type" 
-			arg-name="common.nodetype" 
-			description="common.nodetype.desc" />
-		<option 
-			name="parent" 
-			context-key="parentPath"
-			arg-name="common.jcrpath" 
-			description="common.jcrpath.desc" />			
-	</command>		
-
-	<command name="setpropertyfromfile" impl="setPropertyFromFile">
-		<alias name="setpropfromfile"/>
-		<alias name="setfsprop"/>
-		<argument 
-			name="name" 
-			position="0"
-			arg-name="word.name" 
-			description="word.name" 
-			required="true"/>
-		<argument 
-			name="fsPath" 
-			position="1"
-			arg-name="common.fspath" 
-			description="common.fspath.desc"
-			context-key="value"
-			required="true"/>
-		<option 
-			name="type" 
-			arg-name="common.nodetype" 
-			description="common.nodetype"/>
-		<option 
-			name="parentPath" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-			
-	<command name="source">
-		<argument 
-			name="file" 
-			position="0" 
-			arg-name="common.fspath" 
-			description="common.fspath.desc"
-			required="true"/>
-	</command>
-
-	<command name="sqlquery" impl="sqlQuery">
-		<alias name="sql"/>
-		<argument 
-			name="statement" 
-			position="0"
-			arg-name="word.stmt" 
-			description="word.stmt"
-			required="true"/>
-		<option 
-			name="maxitems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-		<flag name="uuid" description="cmd.lsnodes.uuid"/>
-		<flag name="nsize" description="cmd.lsnodes.nsize"/>
-		<flag name="psize" description="cmd.lsnodes.psize"/>
-		<flag name="rsize" description="cmd.lsnodes.rsize"/>
-		<flag name="m" description="cmd.lsnodes.m"/>
-		<flag name="v" description="cmd.lsnodes.v"/>
-		<flag name="l" description="cmd.lsnodes.l"/>
-		<flag name="r" description="cmd.lsnodes.r"/>
-		<flag name="locked" description="cmd.lsnodes.locked"/>
-		<flag name="hasLock" description="cmd.lsnodes.hasLock"/>
-		<flag name="new" description="cmd.lsnodes.new"/>
-		<flag name="mod" description="cmd.lsnodes.mod"/>
-		<flag name="path" description="cmd.lsnodes.path"/>		
-		<flag name="locktocken" description="cmd.lsnodes.locktoken"/>
-	</command>
-	
-	<command name="startjackrabbit" impl="startJackrabbit">
-		<alias name="start"/>
-		<argument
-			name="config" 
-			position="0"
-			arg-name="common.fspath" 
-			description="common.fspath.desc"
-			required="true"/>
-		<argument
-			name="home" 
-			position="1"
-			arg-name="common.fspath" 
-			description="common.fspath.desc"
-			required="true"/>
-	</command>
-	
-	<command name="stopjackrabbit" impl="stopJackrabbit">	
-		<alias name="stop"/>
-	</command>
-	
-	<command name="unlock">
-		<argument 
-			name="path" 
-			position="0" 
-			arg-name="common.jcrpath"
-			description="common.jcrpath.desc"/>
-	</command>
-
-	<command name="xpathquery" impl="xpathQuery">
-		<alias name="xpath"/>
-		<argument 
-			name="statement" 
-			position="0"
-			arg-name="word.stmt" 
-			description="word.stmt"
-			required="true"/>
-		<option 
-			name="maxitems" 
-			arg-name="word.int" 
-			description="phrase.maxitems"/>
-		<flag name="uuid" description="cmd.lsnodes.uuid"/>
-		<flag name="nsize" description="cmd.lsnodes.nsize"/>
-		<flag name="psize" description="cmd.lsnodes.psize"/>
-		<flag name="rsize" description="cmd.lsnodes.rsize"/>
-		<flag name="m" description="cmd.lsnodes.m"/>
-		<flag name="v" description="cmd.lsnodes.v"/>
-		<flag name="l" description="cmd.lsnodes.l"/>
-		<flag name="r" description="cmd.lsnodes.r"/>
-		<flag name="locked" description="cmd.lsnodes.locked"/>
-		<flag name="hasLock" description="cmd.lsnodes.hasLock"/>
-		<flag name="new" description="cmd.lsnodes.new"/>
-		<flag name="mod" description="cmd.lsnodes.mod"/>
-		<flag name="path" description="cmd.lsnodes.path"/>		
-		<flag name="locktoken" description="cmd.lsnodes.locktoken"/>
-	</command>
-			
+  <command name="addlocktoken" impl="addLockToken">
+    <alias name="addtoken"/>
+    <argument
+      name="token"
+      position="0"
+      required="true"/>
+  </command>
+
+  <command name="addmixin" impl="addMixin">
+    <alias name="addmix"/>
+    <argument
+      name="mixin"
+      position="0"
+      required="true"/>
+    <argument
+      name="path"
+      position="1"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="addnode" impl="addNode">
+    <alias name="add"/>
+    <argument
+      name="name"
+      position="0"
+      context-key="relPath"
+      arg-name="common.jcrname"
+      description="common.jcrname.desc"
+      required="true"/>
+    <argument
+      name="type"
+      position="1"
+      arg-name="common.nodetype"
+      description="common.nodetype.desc" />
+  </command>
+
+  <command name="addversionlabel" impl="addVersionLabel">
+    <alias name="addvlabel"/>
+    <argument name="version"
+      position="0" />
+    <argument name="label"
+      position="1" />
+    <option name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+    <flag name="moveLabel"/>
+  </command>
+
+  <command name="cat">
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      required="true"/>
+    <argument
+      name="idx"
+      position="1"
+      arg-name="common.index"
+      description="common.index.desc"
+      context-key="index"/>
+  </command>
+
+  <command name="checkin">
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="checkout">
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="clearworkspace" impl="clearWorkspace">
+    <alias name="clear"/>
+  </command>
+
+  <command name="createworkspace" impl="createWorkspace">
+    <alias name="createw"/>
+    <argument
+      name="name"
+      position="0"
+      required="true"/>
+  </command>
+
+  <command name="clone">
+    <argument
+      name="scrWorkspace"
+      position="0"
+      required="true"
+      arg-name="word.name"
+      description="common.source"/>
+    <argument
+      name="srcAbsPath"
+      position="1"
+      required="true"/>
+    <argument
+      name="destAbsPath"
+      position="2"
+      required="true"/>
+    <flag name="removeExisting"/>
+  </command>
+
+  <command name="copy">
+    <argument
+      name="srcAbsPath"
+      position="0"
+      arg-name="common.jcrabspath"
+      required="true"/>
+    <argument
+      name="destAbsPath"
+      position="1"
+      arg-name="common.jcrabspath"
+      required="true"/>
+    <option
+      name="fromWorkspace"
+      context-key="srcWorkspace"/>
+  </command>
+
+  <command name="connect" impl="connectToRmiServer">
+    <argument
+      name="url"
+      position="0"
+      required="true"/>
+  </command>
+
+  <command name="currentnode" impl="currentNode">
+    <alias name="cd"/>
+    <alias name="cn"/>
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="dump">
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="exportdocview" impl="exportDocViewToFile">
+    <alias name="exportdoc"/>
+    <argument
+      name="srcAbsPath"
+      position="0"
+      arg-name="common.jcrabspath"
+      description="common.exportview.from"
+      required="true"/>
+    <argument
+      name="desFsPath"
+      position="1"
+      arg-name="common.fspath"
+      description="common.exportview.to"
+      required="true"/>
+    <flag
+      name="overwrite"
+      description="word.overwrite"/>
+    <flag
+      name="skipBinary"
+      description="common.exportview.skipBinary" />
+    <flag
+      name="noRecurse"
+      description="common.exportview.noRecurse"/>
+  </command>
+
+  <command name="exportfilesystem" impl="exportFileSystem">
+    <alias name="exportfs"/>
+    <argument
+      name="srcJcrPath"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      required="true"/>
+    <argument
+      name="destFsPath"
+      position="1"
+      arg-name="common.fspath"
+      description="word.destination"
+      required="true"/>
+    <flag name="overwrite"
+      description="word.overwrite"/>
+  </command>
+
+  <command name="exportproperty" impl="exportPropertyToFile">
+    <alias name="exportprop"/>
+    <alias name="exportp"/>
+    <argument
+      name="name"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      required="true"/>
+    <argument
+      name="destFsPath"
+      position="1"
+      arg-name="common.fspath"
+      description="common.fspath.desc"
+      required="true"/>
+    <option
+      name="idx"
+      arg-name="common.index"
+      description="common.index.desc"
+      context-key="index"/>
+    <flag
+      name="overwrite"
+      description="word.overwrite"/>
+  </command>
+
+  <command name="exportsysview" impl="exportSysViewToFile">
+    <alias name="exportsys"/>
+    <argument
+      name="srcAbsPath"
+      position="0"
+      arg-name="common.jcrabspath"
+      description="common.exportview.from"
+      required="true"/>
+    <argument
+      name="desFsPath"
+      position="1"
+      arg-name="common.fspath"
+      description="common.exportview.to"
+      required="true"/>
+    <flag
+      name="overwrite"
+      description="word.overwrite"/>
+    <flag
+      name="skipBinary"
+      description="common.exportview.skipBinary"/>
+    <flag
+      name="noRecurse"
+      description="common.exportview.noRecurse"/>
+  </command>
+
+  <command name="help">
+    <argument
+      name="command"
+      position="0"
+      required="false" />
+  </command>
+
+  <command name="importfilesystem" impl="importFileSystem">
+    <alias name="importfs"/>
+    <argument
+      name="srcFsPath"
+      position="0"
+      arg-name="common.fspath"
+      description="common.fspath.desc"
+      required="true"/>
+  </command>
+
+  <command name="importxml" impl="importXmlFromFile">
+    <alias name="import"/>
+    <argument
+      name="srcFsPath"
+      position="0"
+      arg-name="common.fspath"
+      description="common.fspath.desc"
+      required="true"/>
+    <argument
+      name="destJcrPath"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      position="1"/>
+    <option
+      name="uuidBehaviour"
+      arg-name="common.uuidBehaviour"
+      description="common.uuidBehaviour.desc"
+      default="0"/>
+  </command>
+
+  <command name="lock">
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+    <flag name="deep"/>
+    <flag name="session" context-key="sessionScoped"/>
+  </command>
+
+  <command name="login">
+    <argument
+      name="user"
+      position="0"
+      arg-name="word.user"
+      default="anonymous"/>
+    <argument
+      name="password"
+      position="1"
+      arg-name="word.password"
+      default="anonymous"/>
+    <option
+      name="workspace"
+      arg-name="word.name"/>
+  </command>
+
+  <command name="logout"/>
+
+  <command name="lscollect" impl="lsCollect">
+    <alias name="collect"/>
+    <argument
+      name="pattern"
+      position="0"
+      arg-name="common.namepattern"
+      description="common.namepattern.desc"
+      required="true"/>
+    <option
+      name="path"
+      context-key="srcPath"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+    <option
+      name="depth"
+      arg-name="word.int"
+      description="word.int"
+      default="1"/>
+    <option
+      name="maxItems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+  </command>
+
+  <command name="lscollectnodes" impl="lsCollectNodes">
+    <alias name="lscollectn"/>
+    <alias name="collectn"/>
+    <argument
+      name="pattern"
+      position="0"
+      arg-name="common.namepattern"
+      description="common.namepattern.desc"
+      required="true"/>
+    <option
+      name="depth"
+      arg-name="word.int"
+      description="word.int"
+      default="1"/>
+    <option
+      name="maxItems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+    <flag name="uuid" description="cmd.lsnodes.uuid"/>
+    <flag name="nsize" description="cmd.lsnodes.nsize"/>
+    <flag name="psize" description="cmd.lsnodes.psize"/>
+    <flag name="rsize" description="cmd.lsnodes.rsize"/>
+    <flag name="m" description="cmd.lsnodes.m"/>
+    <flag name="v" description="cmd.lsnodes.v"/>
+    <flag name="l" description="cmd.lsnodes.l"/>
+    <flag name="r" description="cmd.lsnodes.r"/>
+    <flag name="locked" description="cmd.lsnodes.locked"/>
+    <flag name="hasLock" description="cmd.lsnodes.hasLock"/>
+    <flag name="locktoken"
+      context-key="lockToken"
+      description="cmd.lsnodes.locktoken"/>
+    <flag name="new" description="cmd.lsnodes.new"/>
+    <flag name="mod" description="cmd.lsnodes.mod"/>
+    <flag name="path" description="cmd.lsnodes.path"/>
+  </command>
+
+  <command name="lscollectproperties" impl="lsCollectProperties">
+    <alias name="collectp"/>
+    <alias name="collectprop"/>
+    <argument
+      name="pattern"
+      position="0"
+      arg-name="common.namepattern"
+      description="common.namepattern.desc"
+      required="true"/>
+    <option
+      name="depth"
+      arg-name="word.depth"
+      description="word.depth"
+      default="1"/>
+    <option
+      name="maxitems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+  </command>
+
+  <command name="lsitems" impl="lsItems">
+    <alias name="ls"/>
+    <alias name="dir"/>
+    <argument
+      name="pattern"
+      position="0"
+      arg-name="common.namepattern"
+      description="common.namepattern.desc"/>
+    <option
+      name="maxItems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+  </command>
+
+  <command name="lsproperties" impl="lsProperties">
+    <alias name="lsp"/>
+    <alias name="lsprop"/>
+    <argument
+      name="pattern"
+      position="0"
+      arg-name="common.namepattern"
+      description="common.namepattern.desc"/>
+    <option
+      name="maxItems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+  </command>
+
+  <command name="lsnodes" impl="lsNodes">
+    <alias name="lsn"/>
+    <argument
+      name="pattern"
+      position="0"
+      arg-name="common.namepattern"
+      description="common.namepattern.desc"/>
+    <option
+      name="maxItems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+    <flag name="path" description="cmd.lsnodes.path"/>
+    <flag name="uuid" description="cmd.lsnodes.uuid"/>
+    <flag name="m" context-key="mixin" description="cmd.lsnodes.m"/>
+    <flag name="nsize" context-key="nodeSize" description="cmd.lsnodes.nsize"/>
+    <flag name="psize" context-key="propertiesSize" description="cmd.lsnodes.psize"/>
+    <flag name="rsize" context-key="referencesSize" description="cmd.lsnodes.rsize"/>
+    <flag name="v" context-key="versionable" description="cmd.lsnodes.v"/>
+    <flag name="l" context-key="lockable" description="cmd.lsnodes.l"/>
+    <flag name="r" context-key="referenceable" description="cmd.lsnodes.r"/>
+    <flag name="locked" description="cmd.lsnodes.locked"/>
+    <flag name="haslock" context-key="hasLock" description="cmd.lsnodes.hasLock"/>
+    <flag name="locktoken" context-key="lockToken"/>
+    <flag name="new" description="cmd.lsnodes.new"/>
+    <flag name="mod" context-key="modified" description="cmd.lsnodes.mod"/>
+  </command>
+
+  <command name="lsreferences" impl="lsReferences">
+    <alias name="lsr"/>
+    <alias name="lsref"/>
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="lsversions" impl="lsVersions">
+    <alias name="lsv"/>
+    <alias name="lsver"/>
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="merge">
+    <argument
+      name="srcWorkspace"
+      arg-name="word.source"
+      description="word.source"
+      position="0" />
+    <argument name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      position="1" />
+    <flag name="bestEffort"/>
+  </command>
+
+  <command name="move">
+    <argument
+      name="srcAbsPath"
+      position="0"
+      arg-name="common.jcrabspath"
+      description="common.jcrabspath.desc"
+      required="true"/>
+    <argument
+      name="destAbsPath"
+      position="1"
+      arg-name="common.jcrabspath"
+      description="common.jcrabspath.desc"
+      required="true"/>
+  </command>
+
+  <command name="orderbefore" impl="orderBefore">
+    <alias name="order"/>
+    <argument
+      name="srcChild"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      required="true"/>
+    <argument
+      name="destChild"
+      position="1"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      required="true"/>
+    <option
+      name="parent"
+      context-key="parentPath"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="refresh">
+    <argument
+      name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      position="0"/>
+    <flag name="keepChanges" description="phrase.keepchanges"/>
+  </command>
+
+  <command name="refreshlock" impl="refreshLock">
+    <alias name="refreshl"/>
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="registernamespace" impl="registerNamespace">
+    <argument
+      name="prefix"
+      position="0"
+      arg-name="word.prefix"
+      description="word.prefix"/>
+    <argument
+      name="uri"
+      position="1"
+      arg-name="word.uri"
+      description="word.uri"/>
+  </command>
+
+  <command name="removeitem" impl="removeItem">
+    <alias name="remove"/>
+    <alias name="delete"/>
+    <alias name="rm"/>
+    <alias name="del"/>
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath"/>
+  </command>
+
+  <command name="removeitems" impl="removeItems">
+    <alias name="rmitems"/>
+    <alias name="delitems"/>
+    <alias name="deleteitems"/>
+    <argument
+      name="pattern"
+      position="0"
+      arg-name="common.namepattern"
+      description="common.namepattern.desc"
+      required="true"/>
+    <option
+      name="root"
+      context-key="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="removelocktoken" impl="removeLockToken">
+    <alias name="removetoken"/>
+    <argument
+      name="token"
+      position="0"
+      arg-name="phrase.locktoken"
+      description="phrase.locktoken"
+      required="true"/>
+  </command>
+
+  <command name="removemixin" impl="removeMixin">
+    <alias name="removemix"/>
+    <alias name="deletemix"/>
+    <alias name="delmix"/>
+    <argument
+      name="mixin"
+      position="0"
+      arg-name="word.mixin"
+      description="word.mixin"
+      required="true"/>
+    <argument
+      name="path"
+      position="1"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="removeversion" impl="removeVersion">
+    <alias name="removev"/>
+    <argument name="name"
+      position="0"
+      arg-name="word.name"
+      description="word.name"/>
+    <option name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="removeversionlabel" impl="removeVersionLabel">
+    <alias name="removevlabel"/>
+    <alias name="delvlabel"/>
+    <argument name="label"
+      arg-name="word.label"
+      description="word.label"
+      position="0" />
+    <option name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="removeversionbylabel" impl="removeVersionByLabel">
+    <alias name="removevbylabel"/>
+    <alias name="delvbylabel"/>
+    <alias name="removevbyl"/>
+    <alias name="delvbyl"/>
+    <argument name="label"
+      arg-name="word.label"
+      description="word.label"
+      position="0" />
+    <option name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="rename">
+    <argument
+      name="srcPath"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      required="true"/>
+    <argument
+      name="destPath"
+      position="1"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"
+      required="true"/>
+  </command>
+
+  <command name="restore">
+    <argument name="version"
+      position="0"
+      arg-name="word.version"
+      description="word.version"/>
+    <option name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+    <flag name="removeexisting"
+      context-key="removeExisting"
+      description="phrase.removeExisting"/>
+  </command>
+
+  <command name="restorebylabel" impl="restoreByLabel">
+    <alias name="restorebyl"/>
+    <argument name="label"
+      arg-name="word.label"
+      description="word.label"
+      position="0" />
+    <option name="path"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+    <flag name="removeexisting"
+      context-key="removeExisting"
+      description="phrase.removeExisting"/>
+  </command>
+
+  <command name="save">
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="setmultivalueproperty" impl="setMultiValueProperty">
+    <alias name="setmultiprop"/>
+    <argument
+      name="name"
+      position="0"
+      arg-name="word.name"
+      description="word.name"
+      required="true"/>
+    <argument
+      name="value"
+      position="1"
+      arg-name="word.value"
+      description="word.value"
+      required="true"/>
+    <option
+      name="type"
+      arg-name="common.nodetype"
+      description="common.nodetype.desc" />
+    <option
+      name="regexp"
+      context-key="regExp"
+      arg-name="phrase.regexp"
+      description="phrase.regexp"
+      default=","/>
+  </command>
+
+  <command name="setproperty" impl="setProperty">
+    <alias name="setprop"/>
+    <alias name="setp"/>
+    <argument
+      name="name"
+      position="0"
+      arg-name="word.name"
+      description="word.name"
+      required="true"/>
+    <argument
+      name="value"
+      position="1"
+      arg-name="word.value"
+      description="word.value"
+      required="true"/>
+    <option
+      name="type"
+      arg-name="common.nodetype"
+      description="common.nodetype.desc" />
+    <option
+      name="parent"
+      context-key="parentPath"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc" />
+  </command>
+
+  <command name="setpropertyfromfile" impl="setPropertyFromFile">
+    <alias name="setpropfromfile"/>
+    <alias name="setfsprop"/>
+    <argument
+      name="name"
+      position="0"
+      arg-name="word.name"
+      description="word.name"
+      required="true"/>
+    <argument
+      name="fsPath"
+      position="1"
+      arg-name="common.fspath"
+      description="common.fspath.desc"
+      context-key="value"
+      required="true"/>
+    <option
+      name="type"
+      arg-name="common.nodetype"
+      description="common.nodetype"/>
+    <option
+      name="parentPath"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="source">
+    <argument
+      name="file"
+      position="0"
+      arg-name="common.fspath"
+      description="common.fspath.desc"
+      required="true"/>
+  </command>
+
+  <command name="sqlquery" impl="sqlQuery">
+    <alias name="sql"/>
+    <argument
+      name="statement"
+      position="0"
+      arg-name="word.stmt"
+      description="word.stmt"
+      required="true"/>
+    <option
+      name="maxitems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+    <flag name="uuid" description="cmd.lsnodes.uuid"/>
+    <flag name="nsize" description="cmd.lsnodes.nsize"/>
+    <flag name="psize" description="cmd.lsnodes.psize"/>
+    <flag name="rsize" description="cmd.lsnodes.rsize"/>
+    <flag name="m" description="cmd.lsnodes.m"/>
+    <flag name="v" description="cmd.lsnodes.v"/>
+    <flag name="l" description="cmd.lsnodes.l"/>
+    <flag name="r" description="cmd.lsnodes.r"/>
+    <flag name="locked" description="cmd.lsnodes.locked"/>
+    <flag name="hasLock" description="cmd.lsnodes.hasLock"/>
+    <flag name="new" description="cmd.lsnodes.new"/>
+    <flag name="mod" description="cmd.lsnodes.mod"/>
+    <flag name="path" description="cmd.lsnodes.path"/>
+    <flag name="locktocken" description="cmd.lsnodes.locktoken"/>
+  </command>
+
+  <command name="startjackrabbit" impl="startJackrabbit">
+    <alias name="start"/>
+    <argument
+      name="config"
+      position="0"
+      arg-name="common.fspath"
+      description="common.fspath.desc"
+      required="true"/>
+    <argument
+      name="home"
+      position="1"
+      arg-name="common.fspath"
+      description="common.fspath.desc"
+      required="true"/>
+  </command>
+
+  <command name="stopjackrabbit" impl="stopJackrabbit">
+    <alias name="stop"/>
+  </command>
+
+  <command name="unlock">
+    <argument
+      name="path"
+      position="0"
+      arg-name="common.jcrpath"
+      description="common.jcrpath.desc"/>
+  </command>
+
+  <command name="xpathquery" impl="xpathQuery">
+    <alias name="xpath"/>
+    <argument
+      name="statement"
+      position="0"
+      arg-name="word.stmt"
+      description="word.stmt"
+      required="true"/>
+    <option
+      name="maxitems"
+      arg-name="word.int"
+      description="phrase.maxitems"/>
+    <flag name="uuid" description="cmd.lsnodes.uuid"/>
+    <flag name="nsize" description="cmd.lsnodes.nsize"/>
+    <flag name="psize" description="cmd.lsnodes.psize"/>
+    <flag name="rsize" description="cmd.lsnodes.rsize"/>
+    <flag name="m" description="cmd.lsnodes.m"/>
+    <flag name="v" description="cmd.lsnodes.v"/>
+    <flag name="l" description="cmd.lsnodes.l"/>
+    <flag name="r" description="cmd.lsnodes.r"/>
+    <flag name="locked" description="cmd.lsnodes.locked"/>
+    <flag name="hasLock" description="cmd.lsnodes.hasLock"/>
+    <flag name="new" description="cmd.lsnodes.new"/>
+    <flag name="mod" description="cmd.lsnodes.mod"/>
+    <flag name="path" description="cmd.lsnodes.path"/>
+    <flag name="locktoken" description="cmd.lsnodes.locktoken"/>
+  </command>
+
 </commands>

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/AbstractCollect.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/AbstractCollect.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/AbstractCollect.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/AbstractCollect.java Tue Oct 11 07:38:54 2005
@@ -1,18 +1,18 @@
 /*
- * Copyright 2002-2004 The Apache Software Foundation.
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
  */
 package org.apache.jackrabbit.command.collect;
 
@@ -32,122 +32,132 @@
  * Collect the children items from the given node and store them under the given
  * key.
  */
-public abstract class AbstractCollect implements Command
-{
-	/** logger */
-	private static Log log = LogFactory.getLog(AbstractCollect.class);
-
-	// ---------------------------- < keys >
-
-	/** path key. Default value is "." */
-	private String srcPathKey = "srcPath";
-
-	/** context attribute key for the depth attribute. */
-	private String depthKey = "depth";
-
-	/** context attribute key for the name pattern attribute. Default value is "*" */
-	private String namePatternKey = "namePattern";
-
-	/** context attribute key for the destination attribute */
-	private String destKey = "collected";
-
-	/**
-	 * @inheritDoc
-	 */
-	public final boolean execute(Context ctx) throws Exception
-	{
-		if (this.destKey == null || this.destKey.length() == 0)
-		{
-			throw new IllegalStateException("target variable is not set");
-		}
-		String relPath = (String) ctx.get(this.srcPathKey);
-		if (relPath == null)
-		{
-			relPath = ".";
-		}
-		String namePattern = (String) ctx.get(this.namePatternKey);
-		if (namePattern == null || namePattern.length() == 0)
-		{
-			namePattern = "*";
-		}
-
-		int depth = Integer.parseInt((String) ctx.get(this.depthKey));
-
-		Node node = CommandHelper.getNode(ctx, relPath);
-		if (log.isDebugEnabled())
-		{
-			log.debug("collecting nodes from " + node.getPath() + " depth="
-					+ depth + " pattern=" + namePattern
-					+ " into target variable " + this.destKey);
-		}
-
-		Collection items = new ArrayList();
-		ChildrenCollectorFilter collector = new ChildrenCollectorFilter(
-				namePattern, items, isCollectNodes(), isCollectProperties(),
-				depth);
-		collector.visit(node);
-		ctx.put(this.destKey, items.iterator());
-
-		return false;
-	}
-
-	/**
-	 * @return Returns the depthKey.
-	 */
-	public String getDepthKey()
-	{
-		return depthKey;
-	}
-
-	/**
-	 * @param depthKey
-	 *            Set the context attribute key for the depth attribute
-	 */
-	public void setDepthKey(String depthKey)
-	{
-		this.depthKey = depthKey;
-	}
-
-	/**
-	 * @return Returns the namePatternKey.
-	 */
-	public String getNamePatternKey()
-	{
-		return namePatternKey;
-	}
-
-	/**
-	 * @param namePatternKey
-	 *            context attribute key for the name pattern attribute
-	 */
-	public void setNamePatternKey(String namePatternKey)
-	{
-		this.namePatternKey = namePatternKey;
-	}
-
-	/** Collect nodes flag */
-	protected abstract boolean isCollectNodes();
-
-	/** Collect properties flag */
-	protected abstract boolean isCollectProperties();
-
-	public String getDestKey()
-	{
-		return destKey;
-	}
-
-	public void setDestKey(String destKey)
-	{
-		this.destKey = destKey;
-	}
-
-	public String getSrcPathKey()
-	{
-		return srcPathKey;
-	}
-
-	public void setSrcPathKey(String srcPathKey)
-	{
-		this.srcPathKey = srcPathKey;
-	}
+public abstract class AbstractCollect implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(AbstractCollect.class);
+
+    // ---------------------------- < keys >
+
+    /** path key. Default value is "." */
+    private String srcPathKey = "srcPath";
+
+    /** context attribute key for the depth attribute. */
+    private String depthKey = "depth";
+
+    /**
+     * context attribute key for the name pattern attribute. Default value is
+     * "*"
+     */
+    private String namePatternKey = "namePattern";
+
+    /** context attribute key for the destination attribute */
+    private String destKey = "collected";
+
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean execute(Context ctx) throws Exception {
+        if (this.destKey == null || this.destKey.length() == 0) {
+            throw new IllegalStateException("target variable is not set");
+        }
+        String relPath = (String) ctx.get(this.srcPathKey);
+        if (relPath == null) {
+            relPath = ".";
+        }
+        String namePattern = (String) ctx.get(this.namePatternKey);
+        if (namePattern == null || namePattern.length() == 0) {
+            namePattern = "*";
+        }
+
+        int depth = Integer.parseInt((String) ctx.get(this.depthKey));
+
+        Node node = CommandHelper.getNode(ctx, relPath);
+        if (log.isDebugEnabled()) {
+            log.debug("collecting nodes from " + node.getPath() + " depth="
+                    + depth + " pattern=" + namePattern
+                    + " into target variable " + this.destKey);
+        }
+
+        Collection items = new ArrayList();
+        ChildrenCollectorFilter collector = new ChildrenCollectorFilter(
+            namePattern, items, isCollectNodes(), isCollectProperties(), depth);
+        collector.visit(node);
+        ctx.put(this.destKey, items.iterator());
+
+        return false;
+    }
+
+    /**
+     * @return Returns the depthKey.
+     */
+    public String getDepthKey() {
+        return depthKey;
+    }
+
+    /**
+     * @param depthKey
+     *        Set the context attribute key for the depth attribute
+     */
+    public void setDepthKey(String depthKey) {
+        this.depthKey = depthKey;
+    }
+
+    /**
+     * @return Returns the namePatternKey.
+     */
+    public String getNamePatternKey() {
+        return namePatternKey;
+    }
+
+    /**
+     * @param namePatternKey
+     *        context attribute key for the name pattern attribute
+     */
+    public void setNamePatternKey(String namePatternKey) {
+        this.namePatternKey = namePatternKey;
+    }
+
+    /**
+     * Collect nodes flag
+     * @return true if <code>Node</code> s must be collected
+     */
+    protected abstract boolean isCollectNodes();
+
+    /**
+     * Collect properties flag
+     * @return true if <code>Property</code> s must be collected
+     */
+    protected abstract boolean isCollectProperties();
+
+    /**
+     * @return the destination key
+     */
+    public String getDestKey() {
+        return destKey;
+    }
+
+    /**
+     * Sets the destination key
+     * @param destKey
+     *        the detination key
+     */
+    public void setDestKey(String destKey) {
+        this.destKey = destKey;
+    }
+
+    /**
+     * @return the source path key
+     */
+    public String getSrcPathKey() {
+        return srcPathKey;
+    }
+
+    /**
+     * Sets the source path key
+     * @param srcPathKey
+     *        the source path key
+     */
+    public void setSrcPathKey(String srcPathKey) {
+        this.srcPathKey = srcPathKey;
+    }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectItems.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectItems.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectItems.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectItems.java Tue Oct 11 07:38:54 2005
@@ -19,22 +19,19 @@
 /**
  * Collect children, either nodes or properties
  */
-public class CollectItems extends AbstractCollect
-{
+public class CollectItems extends AbstractCollect {
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    protected boolean isCollectNodes()
-    {
+    protected boolean isCollectNodes() {
         return true;
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    protected boolean isCollectProperties()
-    {
+    protected boolean isCollectProperties() {
         return true;
     }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectNodes.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectNodes.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectNodes.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectNodes.java Tue Oct 11 07:38:54 2005
@@ -19,23 +19,20 @@
 /**
  * Collect nodes only
  */
-public class CollectNodes extends AbstractCollect
-{
+public class CollectNodes extends AbstractCollect {
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    protected boolean isCollectNodes()
-    {
+    protected boolean isCollectNodes() {
         return true;
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    protected boolean isCollectProperties()
-    {
+    protected boolean isCollectProperties() {
         return false;
     }
-    
+
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectProperties.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectProperties.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectProperties.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/collect/CollectProperties.java Tue Oct 11 07:38:54 2005
@@ -19,23 +19,20 @@
 /**
  * Collect properties only
  */
-public class CollectProperties extends AbstractCollect
-{
+public class CollectProperties extends AbstractCollect {
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    protected boolean isCollectNodes()
-    {
+    protected boolean isCollectNodes() {
         return false;
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
-    protected boolean isCollectProperties()
-    {
+    protected boolean isCollectProperties() {
         return true;
     }
-    
+
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AbstractSetProperty.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AbstractSetProperty.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AbstractSetProperty.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AbstractSetProperty.java Tue Oct 11 07:38:54 2005
@@ -21,66 +21,81 @@
 /**
  * SetProperty superclass.
  */
-public abstract class AbstractSetProperty implements Command
-{
-	// ---------------------------- < keys >
-
-	/** destination node path key */
-	protected String parentPathKey = "parentPath";
-
-	/** Property name key */
-	protected String nameKey = "name";
-
-	/** Propety type key */
-	protected String typeKey = "type";
-
-	/** Property value key */
-	protected String valueKey = "value";
-
-	/**
-	 * @return Returns the valueKey.
-	 */
-	public String getValueKey()
-	{
-		return valueKey;
-	}
-
-	/**
-	 * @param valueKey
-	 *            Set the context attribute key for the value attribute.
-	 */
-	public void setValueKey(String valueKey)
-	{
-		this.valueKey = valueKey;
-	}
-
-	public String getParentPathKey()
-	{
-		return parentPathKey;
-	}
-
-	public void setParentPathKey(String parentPathKey)
-	{
-		this.parentPathKey = parentPathKey;
-	}
-
-	public String getNameKey()
-	{
-		return nameKey;
-	}
-
-	public void setNameKey(String nameKey)
-	{
-		this.nameKey = nameKey;
-	}
-
-	public String getTypeKey()
-	{
-		return typeKey;
-	}
-
-	public void setTypeKey(String typeKey)
-	{
-		this.typeKey = typeKey;
-	}
+public abstract class AbstractSetProperty implements Command {
+    // ---------------------------- < keys >
+
+    /** destination node path key */
+    protected String parentPathKey = "parentPath";
+
+    /** Property name key */
+    protected String nameKey = "name";
+
+    /** Propety type key */
+    protected String typeKey = "type";
+
+    /** Property value key */
+    protected String valueKey = "value";
+
+    /**
+     * @return Returns the valueKey.
+     */
+    public String getValueKey() {
+        return valueKey;
+    }
+
+    /**
+     * @param valueKey
+     *        Set the context attribute key for the value attribute.
+     */
+    public void setValueKey(String valueKey) {
+        this.valueKey = valueKey;
+    }
+
+    /**
+     * @return the parent path key
+     */
+    public String getParentPathKey() {
+        return parentPathKey;
+    }
+
+    /**
+     * Sets the parent path key
+     * @param parentPathKey
+     *        the parent path key
+     */
+    public void setParentPathKey(String parentPathKey) {
+        this.parentPathKey = parentPathKey;
+    }
+
+    /**
+     * @return the name key
+     */
+    public String getNameKey() {
+        return nameKey;
+    }
+
+    /**
+     * Sets the name key
+     * @param nameKey
+     *        the name key
+     */
+    public void setNameKey(String nameKey) {
+        this.nameKey = nameKey;
+    }
+
+    /**
+     * @return the type key
+     */
+    public String getTypeKey() {
+        return typeKey;
+    }
+
+    /**
+     * Sets the type key
+     * @param typeKey
+     *        the type key
+     */
+    public void setTypeKey(String typeKey) {
+        this.typeKey = typeKey;
+    }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AddNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AddNode.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AddNode.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/AddNode.java Tue Oct 11 07:38:54 2005
@@ -25,76 +25,67 @@
 import org.apache.jackrabbit.command.CommandHelper;
 
 /**
- * Add a node to the current working node.
+ * Add a node to the current working <code>Node</code>
  */
-public class AddNode implements Command
-{
-	/** logger */
-	private static Log log = LogFactory.getLog(AddNode.class);
-
-	// ---------------------------- < keys >
-
-	/** Node type key */
-	private String typeKey = "type";
-
-	/** Node name key */
-	private String relPathKey = "relPath";
-
-	/**
-	 * @inheritDoc
-	 */
-	public boolean execute(Context ctx) throws Exception
-	{
-		Node node = CommandHelper.getCurrentNode(ctx);
-		String nodeType = (String) ctx.get(this.typeKey);
-		String name = (String) ctx.get(this.relPathKey);
-
-		if (log.isDebugEnabled())
-		{
-			log.debug("adding node at " + node.getPath() + "/" + name);
-		}
-
-		if (nodeType == null)
-		{
-			node.addNode(name);
-		} else
-		{
-			node.addNode(name, nodeType);
-		}
-		return false;
-	}
-
-	/**
-	 * @return Returns the nodeTypeKey.
-	 */
-	public String getTypeKey()
-	{
-		return typeKey;
-	}
-
-	/**
-	 * @param nodeTypeKey
-	 *            Set the context attribute key for the node type attribute.
-	 */
-	public void setTypeKey(String nodeTypeKey)
-	{
-		this.typeKey = nodeTypeKey;
-	}
-
-	/**
-	 * @return Returns the relative path.
-	 */
-	public String getRelPathKey()
-	{
-		return relPathKey;
-	}
-
-	/**
-	 * @param relPathKey
-	 *            The relative path key to set.
-	 */
-	public void setRelPathKey(String relPathKey)
-	{
-		this.relPathKey = relPathKey;
-	}
+public class AddNode implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(AddNode.class);
+
+    // ---------------------------- < keys >
+
+    /** Node type key */
+    private String typeKey = "type";
+
+    /** Node name key */
+    private String relPathKey = "relPath";
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean execute(Context ctx) throws Exception {
+        Node node = CommandHelper.getCurrentNode(ctx);
+        String nodeType = (String) ctx.get(this.typeKey);
+        String name = (String) ctx.get(this.relPathKey);
+
+        if (log.isDebugEnabled()) {
+            log.debug("adding node at " + node.getPath() + "/" + name);
+        }
+
+        if (nodeType == null) {
+            node.addNode(name);
+        } else {
+            node.addNode(name, nodeType);
+        }
+        return false;
+    }
+
+    /**
+     * @return the nodeTypeKey.
+     */
+    public String getTypeKey() {
+        return typeKey;
+    }
+
+    /**
+     * @param nodeTypeKey
+     *        Set the context attribute key for the node type attribute.
+     */
+    public void setTypeKey(String nodeTypeKey) {
+        this.typeKey = nodeTypeKey;
+    }
+
+    /**
+     * @return the relative path.
+     */
+    public String getRelPathKey() {
+        return relPathKey;
+    }
+
+    /**
+     * @param relPathKey
+     *        the relative path key to set
+     */
+    public void setRelPathKey(String relPathKey) {
+        this.relPathKey = relPathKey;
+    }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/ClearWorkspace.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/ClearWorkspace.java?rev=312896&r1=312895&r2=312896&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/ClearWorkspace.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/core/ClearWorkspace.java Tue Oct 11 07:38:54 2005
@@ -30,46 +30,39 @@
 import org.apache.jackrabbit.command.CommandHelper;
 
 /**
- * Remove all the content from the current working Workspace
+ * Remove all the content from the current working <code>Workspace</code>
  */
-public class ClearWorkspace implements Command
-{
-	/** logger */
-	private static Log log = LogFactory.getLog(ClearWorkspace.class);
+public class ClearWorkspace implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(ClearWorkspace.class);
 
-	/**
-	 * @inheritDoc
-	 */
-	public boolean execute(Context ctx) throws Exception
-	{
-		Session s = CommandHelper.getSession(ctx);
+    /**
+     * {@inheritDoc}
+     */
+    public boolean execute(Context ctx) throws Exception {
+        Session s = CommandHelper.getSession(ctx);
 
-		if (log.isDebugEnabled())
-		{
-			log.debug("removing all content from workspace "
-					+ s.getWorkspace().getName());
-		}
+        if (log.isDebugEnabled()) {
+            log.debug("removing all content from workspace "
+                    + s.getWorkspace().getName());
+        }
 
-		// Set current node to root
-		CommandHelper.setCurrentNode(ctx, s.getRootNode());
-		NodeIterator iter = s.getRootNode().getNodes();
-		while (iter.hasNext())
-		{
-			Node n = (Node) iter.next();
-			if (!n.getName().equals(JcrConstants.JCR_SYSTEM))
-			{
-				n.remove();
-			}
-		}
-		PropertyIterator pIter = s.getRootNode().getProperties();
-		while (pIter.hasNext())
-		{
-			Property p = pIter.nextProperty();
-			if (!p.getName().equals(JcrConstants.JCR_PRIMARYTYPE))
-			{
-				p.remove();
-			}
-		}
-		return false;
-	}
+        // Set current node to root
+        CommandHelper.setCurrentNode(ctx, s.getRootNode());
+        NodeIterator iter = s.getRootNode().getNodes();
+        while (iter.hasNext()) {
+            Node n = (Node) iter.next();
+            if (!n.getName().equals(JcrConstants.JCR_SYSTEM)) {
+                n.remove();
+            }
+        }
+        PropertyIterator pIter = s.getRootNode().getProperties();
+        while (pIter.hasNext()) {
+            Property p = pIter.nextProperty();
+            if (!p.getName().equals(JcrConstants.JCR_PRIMARYTYPE)) {
+                p.remove();
+            }
+        }
+        return false;
+    }
 }



Mime
View raw message