jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edgarp...@apache.org
Subject svn commit: r231495 [4/7] - in /incubator/jackrabbit/trunk/contrib/jcr-commands: ./ applications/test/ applications/test/fs/ applications/test/fs/dummy folder/ benchmarking/ src/java/ src/java/org/apache/jackrabbit/chain/ src/java/org/apache/jackrabbit...
Date Thu, 11 Aug 2005 18:06:07 GMT
Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/command-line.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/command-line.xml?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/command-line.xml (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/command-line.xml Thu Aug 11 11:04:29 2005
@@ -0,0 +1,602 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+	Command descriptor document
+-->
+<!DOCTYPE commands [
+	<!ELEMENT commands (command+)>
+	<!-- Command descriptor -->
+	<!ELEMENT command (alias*, argument*, option*, flag*)>
+	<!-- 
+		name: command name
+		impl: implementor class name
+		description: ResourceBundle key
+	-->
+	<!ATTLIST command 
+	name NMTOKEN #REQUIRED 
+	impl NMTOKEN #IMPLIED 
+	description CDATA #IMPLIED >
+
+	<!--
+		name: alias name
+	-->
+	<!ELEMENT alias EMPTY>
+	<!ATTLIST alias
+		name NMTOKEN #REQUIRED>
+
+	<!--
+		name: option name
+		command-attribute: Command property
+		position: argument name
+		arg-name: argument name
+		required: required flag
+		value: option default value (used for non required arguments)
+		description: argument description [optional] if not specified [command name].[option name] is assumed
+	-->
+	<!ELEMENT option EMPTY>
+	<!ATTLIST option 
+		name NMTOKEN #REQUIRED 
+		command-attribute NMTOKEN #IMPLIED 
+		arg-name CDATA #IMPLIED
+		required NMTOKEN #IMPLIED 
+		value CDATA #IMPLIED 
+		description CDATA #IMPLIED>
+
+	<!ELEMENT argument EMPTY>
+	<!ATTLIST argument  
+		name NMTOKEN #REQUIRED 
+		position NMTOKEN #REQUIRED 
+		arg-name CDATA #IMPLIED
+		command-attribute NMTOKEN #IMPLIED 
+		required NMTOKEN #IMPLIED 
+		value CDATA #IMPLIED 
+		description CDATA #IMPLIED>
+
+	<!ELEMENT flag EMPTY>
+	<!ATTLIST flag
+		name NMTOKEN #REQUIRED 
+		command-attribute NMTOKEN #IMPLIED 
+		description CDATA #IMPLIED>
+		
+	]>
+	
+<commands>
+	
+	<command name="addmixin" impl="org.apache.jackrabbit.chain.command.AddMixin">
+		<alias name="addmix"/>
+		<argument 
+			name="path" 
+			position="0"
+			arg-name="jcr.path" 
+			description="jcr.path"
+			required="true"/>
+		<argument 
+			name="mixin"
+			position="1" 
+			arg-name="mixin.name" 
+			command-attribute="mixinName"
+			required="true"/>
+	</command>	
+	
+	<command name="addnode" impl="org.apache.jackrabbit.chain.command.AddNode">
+		<alias name="add"/>
+		<argument 
+			name="name" 
+			position="0"
+			arg-name="node name" 
+			command-attribute="nodeName" 
+			description="node.name" 
+			required="true"/>
+		<argument 
+			name="type"
+			position="1" 
+			arg-name="node type" 
+			command-attribute="nodeType" 
+			description="node.type" />
+	</command>	
+		
+	<command name="clearworkspace" impl="org.apache.jackrabbit.chain.command.ClearWorkspace"/>
+	
+	<command name="copy" impl="org.apache.jackrabbit.chain.command.Copy">
+		<argument 
+			name="from" 
+			position="0" 
+			arg-name="jcr.path" 
+			description="copy.from"
+			required="true"/>
+		<argument 
+			name="to" 
+			position="1" 
+			arg-name="jcr.path" 
+			description="copy.to"
+			required="true"/>
+	</command>
+		
+	<command name="currentnode" impl="org.apache.jackrabbit.chain.command.CurrentNode">
+		<alias name="cd"/>
+		<alias name="cn"/>
+		<argument 
+			name="path" 
+			position="0"
+			arg-name="path" 
+			description="node.path"/>
+	</command>	
+
+	<command name="exportdocview" impl="org.apache.jackrabbit.chain.command.xml.ExportDocViewToFile">
+		<alias name="exportdoc"/>
+		<argument 
+			name="from" 
+			position="0"
+			arg-name="jcr.path" 
+			description="exportview.from"
+			required="true"/>
+		<argument 
+			name="to" 
+			position="1"
+			arg-name="fs.path" 
+			description="exportview.to"
+			required="true"/>
+		<flag 
+			name="overwrite" 
+			description="overwrite"/>
+		<flag
+			name="skipBinary" 
+			description="exportview.skipBinary" />
+		<flag 
+			name="noRecurse" 
+			description="exportview.noRecurse"/>
+	</command>	
+
+	<command name="exportfilesystem" impl="org.apache.jackrabbit.chain.command.fs.ExportFileSystem">
+		<alias name="exportfs"/>
+		<argument 
+			name="from"
+			position="0" 
+			arg-name="jcr.path" 
+			description="source"
+			required="true"/>
+		<argument 
+			name="to" 
+			position="1"
+			arg-name="fs.path" 
+			description="destination"
+			required="true"/>
+		<flag name="overwrite"/>
+	</command>	
+	
+	<command name="exportproperty" impl="org.apache.jackrabbit.chain.command.fs.ExportPropertyToFile">
+		<alias name="exportprop"/>
+		<alias name="exportp"/>
+		<argument 
+			name="name"
+			position="0" 
+			arg-name="name" 
+			description="name" 
+			required="true"/>
+		<argument 
+			name="to" 
+			position="1"
+			arg-name="fs.path" 
+			required="true"/>
+		<option 
+			name="idx" 
+			arg-name="index" 
+			command-attribute="index"/>
+		<flag 
+			name="overwrite" 
+			description="overwrite"/>
+	</command>				
+	
+	<command name="exportsysview" impl="org.apache.jackrabbit.chain.command.xml.ExportSysViewToFile">
+		<alias name="exportsys"/>
+		<argument 
+			name="from" 
+			position="0"
+			arg-name="jcr.path" 
+			description="exportview.from"
+			required="true"/>
+		<argument 
+			name="to" 
+			position="1"
+			arg-name="fs.path" 
+			description="exportview.to"
+			required="true"/>
+		<flag 
+			name="overwrite" 
+			description="overwrite"/>
+		<flag 
+			name="skipBinary" 
+			description="exportview.skipBinary" />
+		<flag 
+			name="noRecurse" 
+			description="exportview.noRecurse"/>
+	</command>	
+	
+	<command name="importfilesystem" impl="org.apache.jackrabbit.chain.command.fs.ImportFileSystem">
+		<alias name="importfs"/>
+		<argument 
+			name="from"
+			position="0" 
+			arg-name="file" 
+			description="file" 
+			required="true"/>
+	</command>		
+
+	<command name="importxml" impl="org.apache.jackrabbit.chain.command.xml.ImportXmlFromFile">
+		<argument 
+			name="from" 
+			position="0"
+			arg-name="file" 
+			description="file" 
+			required="true"/>
+		<argument 
+			name="uuidBehaviour" 
+			position="1"
+			arg-name="int"/>
+	</command>			
+		
+	<command name="login" impl="org.apache.jackrabbit.chain.command.Login">
+		<option 
+			name="u" 
+			command-attribute="user"
+			arg-name="user name"/>
+		<option 
+			name="p"
+			command-attribute="password" 
+			arg-name="password"/>
+		<option 
+			name="w" 
+			command-attribute="workspace" 			
+			arg-name="workspace" />
+	</command>
+	
+	<command name="logout" impl="org.apache.jackrabbit.chain.command.Logout"/>
+	
+	<command name="lsitems">
+		<alias name="ls"/>
+		<argument 
+			name="pattern" 
+			command-attribute="patternKey"
+			position="0"
+			arg-name="name pattern" />
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+	</command>
+	
+	<command name="lscollect">
+		<alias name="collect"/>
+		<argument name="pattern" position="0" arg-name="name.pattern" required="true"/>
+		<option name="depth" arg-name="var.name" value="1"/>
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+	</command>	
+	
+	<command name="lsproperties" >
+		<alias name="lsp"/>
+		<alias name="lsprop"/>
+		<argument 
+			name="pattern" 
+			position="0"
+			arg-name="name.pattern" 
+			description="ls.pattern"/>
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+	</command>		
+
+	<command name="lscollectproperties">
+		<alias name="collectp"/>
+		<alias name="collectprop"/>
+		<argument name="pattern" position="0" arg-name="name.pattern" required="true"/>
+		<option name="depth" arg-name="var.name" value="1"/>
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+	</command>	
+		
+	<command name="lsnodes" >
+		<alias name="lsn"/>
+		<argument 
+			name="pattern" 
+			position="0"
+			arg-name="name.namepattern" 
+			description="lsitems.pattern"/>
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+		<flag name="path"/>
+		<flag name="uuid" />
+		<flag name="m"/>
+		<flag name="nsize"/>
+		<flag name="psize"/>
+		<flag name="rsize"/>
+		<flag name="v"/>
+		<flag name="l"/>
+		<flag name="r"/>
+		<flag name="locked"/>
+		<flag name="hasLock"/>
+		<flag name="new"/>
+		<flag name="mod"/>
+	</command>	
+
+	<command name="lscollectnodes">
+		<alias name="lscollectn"/>
+		<alias name="collectn"/>
+		<argument name="pattern" position="0" arg-name="name.pattern" required="true"/>
+		<option name="depth" arg-name="var.name" value="1"/>
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+		<flag name="uuid" description="lsnodes.uuid"/>
+		<flag name="nsize" description="lsnodes.nsize"/>
+		<flag name="psize" description="lsnodes.psize"/>
+		<flag name="rsize" description="lsnodes.rsize"/>
+		<flag name="m" description="lsnodes.m"/>
+		<flag name="v" description="lsnodes.v"/>
+		<flag name="l" description="lsnodes.l"/>
+		<flag name="r" description="lsnodes.r"/>
+		<flag name="locked" description="lsnodes.locked"/>
+		<flag name="hasLock" description="lsnodes.hasLock"/>
+		<flag name="new" description="lsnodes.new"/>
+		<flag name="mod" description="lsnodes.mod"/>
+		<flag name="path" description="lsnodes.path"/>
+	</command>	
+
+	<command name="lsreferences" impl="org.apache.jackrabbit.chain.command.info.LsReferences">
+		<alias name="lsr"/>
+		<alias name="lsref"/>
+		<argument 
+			name="path" 
+			position="0"
+			arg-name="jcr.path" 
+			description="jcr.path"
+			required="true"/>
+	</command>
+	
+	<command name="move" impl="org.apache.jackrabbit.chain.command.Move">
+		<argument 
+			name="from" 
+			arg-name="jcr.path" 
+			position="0" 
+			description="move.from"
+			required="true"/>
+		<argument 
+			name="to" 
+			arg-name="jcr.path" 
+			position="1" 
+			description="move.to"
+			required="true"/>
+	</command>
+	
+	<command name="refresh" impl="org.apache.jackrabbit.chain.command.Refresh">
+		<argument 
+			name="path" 
+			arg-name="jcr.path"
+			position="0"/>
+		<flag name="keepChanges"/>
+	</command>
+	
+	<command name="removeitem" impl="org.apache.jackrabbit.chain.command.RemoveItem">
+		<alias name="remove"/>
+		<alias name="delete"/>
+		<alias name="rm"/>
+		<alias name="del"/>
+		<argument 
+			name="path"
+			position="0" 
+			arg-name="path" 
+			description="path"/>
+	</command>		
+
+	<command name="removeitems" impl="org.apache.jackrabbit.chain.command.RemoveItems">
+		<alias name="rmitems"/>
+		<alias name="delitems"/>
+		<argument 
+			name="pattern" 
+			position="0"
+			arg-name="pattern" 
+			description="pattern" 
+			required="true"/>
+	</command>		
+
+	<command name="removemixin" impl="org.apache.jackrabbit.chain.command.RemoveMixin">
+		<alias name="removemix"/>
+		<alias name="rmmix"/>
+		<alias name="delmix"/>
+		<argument 
+			name="path" 
+			position="0"
+			arg-name="jcr.path" 
+			description="jcr.path" 
+			required="true"/>
+		<argument 
+			name="mixin"
+			position="1" 
+			arg-name="mixin.name" 
+			command-attribute="mixinName"
+			description="mixin.name"
+			required="true"/>
+	</command>	
+
+	<command name="rename" impl="org.apache.jackrabbit.chain.command.Rename">
+		<argument 
+			name="from" 
+			position="0" 
+			arg-name="name" 
+			description="rename.from"
+			required="true"/>
+		<argument 
+			name="to" 
+			position="1" 
+			arg-name="name" 
+			description="rename.to"
+			required="true"/>
+	</command>
+	
+	<command name="save" impl="org.apache.jackrabbit.chain.command.SaveSession"/>		
+
+	<command name="savenode" impl="org.apache.jackrabbit.chain.command.SaveNode"/>		
+	
+	<command name="setmultivalueproperty" impl="org.apache.jackrabbit.chain.command.SetMultivalueProperty">
+		<alias name="setmultiprop"/>
+		<argument 
+			name="name" 
+			position="0"
+			arg-name="name" 
+			command-attribute="propertyName"
+			description="setProp.name" 
+			required="true"/>
+		<argument 
+			name="value" 
+			position="1"
+			arg-name="value" 
+			description="setProp.value" 
+			required="true"/>
+		<option 
+			name="type" 
+			arg-name="type" 
+			description="setProp.type" 
+			command-attribute="propertyType" />
+		<option 
+			name="regexp" 
+			command-attribute="regExp"
+			arg-name="regular expression"/>
+	</command>		
+		
+	<command name="setproperty" impl="org.apache.jackrabbit.chain.command.SetProperty">
+		<alias name="setprop"/>
+		<argument 
+			name="name" 
+			position="0"
+			arg-name="name" 
+			command-attribute="propertyName"
+			required="true"/>
+		<argument 
+			name="value" 
+			position="1"
+			arg-name="value" 
+			required="true"/>
+		<option 
+			name="type" 
+			arg-name="type" 
+			command-attribute="propertyType" />
+	</command>	
+
+	<command name="setpropertyfromfile" impl="org.apache.jackrabbit.chain.command.fs.SetPropertyFromFile">
+		<alias name="setpropfromfile"/>
+		<argument 
+			name="name" 
+			position="0"
+			arg-name="name" 
+			command-attribute="propertyName"
+			description="setProp.name" 
+			required="true"/>
+		<argument 
+			name="path" 
+			position="1"
+			arg-name="path" 
+			command-attribute="value" 
+			required="true"/>
+		<option 
+			name="type" 
+			arg-name="type" 
+			description="setProp.type" 
+			command-attribute="propertyType" />
+	</command>		
+
+	<command name="sqlquery">
+		<alias name="sql"/>
+		<argument 
+			name="statement" 
+			position="0"
+			arg-name="stmt" 
+			required="true"/>
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+		<flag name="uuid" description="lsnodes.uuid"/>
+		<flag name="nsize" description="lsnodes.nsize"/>
+		<flag name="psize" description="lsnodes.psize"/>
+		<flag name="rsize" description="lsnodes.rsize"/>
+		<flag name="m" description="lsnodes.m"/>
+		<flag name="v" description="lsnodes.v"/>
+		<flag name="l" description="lsnodes.l"/>
+		<flag name="r" description="lsnodes.r"/>
+		<flag name="locked" description="lsnodes.locked"/>
+		<flag name="hasLock" description="lsnodes.hasLock"/>
+		<flag name="new" description="lsnodes.new"/>
+		<flag name="mod" description="lsnodes.mod"/>
+		<flag name="path" description="lsnodes.path"/>		
+	</command>
+	
+	<command name="startjackrabbit" 
+		impl="org.apache.jackrabbit.chain.command.StartJackrabbit">
+		<option 
+			name="config" 
+			arg-name="file" 
+			required="true"/>
+		<option 
+			name="home" 
+			arg-name="folder" 
+			required="true"/>
+	</command>
+	
+	<command name="stopjackrabbit" 
+		impl="org.apache.jackrabbit.chain.command.StopJackrabbit" />
+
+	<!-- info commands -->
+	<command name="help" impl="org.apache.jackrabbit.chain.command.info.Help">
+		<argument 
+			name="command" 
+			position="0"
+			arg-name="command name" 
+			required="false" />
+	</command>
+	
+	<command name="cat" impl="org.apache.jackrabbit.chain.command.info.Cat">
+		<argument name="path" position="0" arg-name="path" required="true"/>
+		<argument name="idx" position="1" arg-name="index" command-attribute="index"/>
+	</command>	
+	
+	<command name="dump" impl="org.apache.jackrabbit.chain.command.info.Dump"/>	
+	
+	<!-- script -->
+	<command name="source" impl="org.apache.jackrabbit.chain.cli.SourceCommand">
+		<argument name="file" position="0" arg-name="fs.path" required="true"/>
+	</command>
+
+	<command name="xpathquery">
+		<alias name="xpath"/>
+		<argument 
+			name="statement" 
+			position="0"
+			arg-name="stmt" 
+			required="true"/>
+		<option 
+			name="maxitems" 
+			arg-name="int" 
+			description="show.max.items"/>
+		<flag name="uuid" description="lsnodes.uuid"/>
+		<flag name="nsize" description="lsnodes.nsize"/>
+		<flag name="psize" description="lsnodes.psize"/>
+		<flag name="rsize" description="lsnodes.rsize"/>
+		<flag name="m" description="lsnodes.m"/>
+		<flag name="v" description="lsnodes.v"/>
+		<flag name="l" description="lsnodes.l"/>
+		<flag name="r" description="lsnodes.r"/>
+		<flag name="locked" description="lsnodes.locked"/>
+		<flag name="hasLock" description="lsnodes.hasLock"/>
+		<flag name="new" description="lsnodes.new"/>
+		<flag name="mod" description="lsnodes.mod"/>
+		<flag name="path" description="lsnodes.path"/>		
+	</command>
+
+</commands>
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/command-line.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/digester-rules.dtd
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/digester-rules.dtd?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/digester-rules.dtd (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/digester-rules.dtd Thu Aug 11 11:04:29 2005
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!-- $Id: digester-rules.dtd 155412 2005-02-26 12:58:36Z dirkv $
+  
+ Copyright 2001-2005 The Apache Software Foundation.
+ 
+ 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
+  
+ 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.
+--> 
+
+<!--
+        "Digester" component of the Jakarta Commons Subproject
+        DTD for the definition of Digester rules in XML.
+        $Id: digester-rules.dtd 155412 2005-02-26 12:58:36Z dirkv $
+
+        Applications wishing to reference this DTD in their own documents
+        should use the following DOCTYPE declaration:
+
+        <!DOCTYPE digester-rules PUBLIC
+         "-//Jakarta Apache //DTD digester-rules XML V1.0//EN"
+         "digester-rules.dtd">
+
+-->
+
+<!-- This document type defines an XML format for defining Digester rules.
+     Digester is a framework for pattern-matching-based parsing of XML into
+     Java objects. See http://jakarta.apache.org/commons/digester.html.  -->
+
+<!ENTITY % rule-elements "bean-property-setter-rule | call-method-rule |
+                   call-param-rule | object-param-rule |
+                   factory-create-rule | object-create-rule |
+                   set-properties-rule | set-nested-properties-rule |
+                   set-property-rule | set-top-rule |
+                   set-next-rule | set-root-rule" >
+
+<!-- digester-rules is the root element. -->
+<!ELEMENT digester-rules (pattern | include | %rule-elements; )*>
+
+
+<!-- <pattern> defines a matching pattern, or part of a matching pattern. Any
+     rule nested in a pattern element prepends its parent's to its pattern.
+     Patterns may be recursively nested.
+     Example:
+       <pattern value="foo">
+          <pattern value="bar">
+            <object-create-rule pattern="baz" classname="Fubar" />
+          </pattern>
+       </pattern>
+
+     The above sample fragment defines an ObjectCreateRule associated
+     with the pattern "foo/bar/baz".
+
+  Note that the use of pattern elements is optional; an alternative is for
+  each rule element to contain a 'pattern' attribute.   -->
+<!ELEMENT pattern (pattern | include | %rule-elements; )*>
+<!ATTLIST pattern
+    value CDATA #REQUIRED>
+
+
+<!--
+  <include> allows one set of digester rules to be included inside
+  another. The 'path' attribute contains the URI of the document to
+  include. Inclusion behaves as if the included rules document is
+  'macro-expanded' within the outer document.
+  Programmatically initialized rules can be included as well, via the
+  'class' attribute. The 'class' attribute should contain the name
+  of a class that implements
+  org.apache.commons.digester.xmlrules.DigesterRulesSource.
+-->
+<!ELEMENT include EMPTY>
+<!ATTLIST include
+    path  CDATA #IMPLIED
+    class CDATA #IMPLIED>
+
+
+<!-- Each 'rule' element below corresponds to a concrete subclass
+     of org.apache.framework.digester.Rule.
+     Each 'rule' element has an optional 'pattern' attribute, which
+     defines the pattern for that rule instance. If the rule element
+     is nested inside one or more <pattern> elements, those patterns
+     will be prepended to the pattern specified in the rule's 'pattern'
+     attribute. -->
+
+<!-- Bean Property Setter Rule -->
+<!ELEMENT bean-property-setter-rule EMPTY>
+<!ATTLIST bean-property-setter-rule
+    pattern      CDATA #IMPLIED
+    propertyname CDATA #IMPLIED>
+
+<!-- CallMethodRule
+  -
+  - Note that paramtypes is ignored unless paramcount is defined.
+  -->
+<!ELEMENT call-method-rule EMPTY>
+<!ATTLIST call-method-rule
+    pattern      CDATA #IMPLIED
+    targetoffset CDATA #IMPLIED
+    methodname   CDATA #REQUIRED
+    paramcount   CDATA #IMPLIED
+    paramtypes   CDATA #IMPLIED>
+
+<!-- 
+    CallParamRule 
+    attrname - set param from attribute value (cannot be combined with from-stack)
+    from-stack - set param from stack (cannot be combined with attrname)
+    -->
+<!ELEMENT call-param-rule EMPTY>
+<!ATTLIST call-param-rule
+    pattern  CDATA #IMPLIED
+    paramnumber CDATA #REQUIRED
+    attrname CDATA #IMPLIED
+    from-stack CDATA #IMPLIED
+    stack-index CDATA #IMPLIED>
+    
+<!--
+    ObjectParamRule
+    attrname  
+           - an arbitrary Object defined programatically, assigned if the 
+             element pattern AND specified attribute name are matched
+    param 
+           - an arbitrary Object defined programatically, assigned when the 
+             element pattern associated with the Rule is matched
+    type 
+           - class name for object
+    value 
+           - initial value for the object
+    -->
+<!ELEMENT object-param-rule EMPTY>
+<!ATTLIST object-param-rule
+    pattern  CDATA #IMPLIED
+    paramnumber CDATA #REQUIRED
+    param CDATA #REQUIRED
+    attrname CDATA #IMPLIED
+    type CDATA #REQUIRED
+    value CDATA #IMPLIED>
+
+<!-- 
+    FactoryCreateRule 
+    
+    ignore-exceptions - if this attribute is (ignore case) 'true' then any exceptions
+                        thrown by the object create rule will be ignore.
+                        This will allow processing to continue.
+    -->
+<!ELEMENT factory-create-rule EMPTY>
+<!ATTLIST factory-create-rule
+    pattern   CDATA #IMPLIED
+    classname CDATA #REQUIRED
+    attrname  CDATA #IMPLIED
+    ignore-exceptions  CDATA #IMPLIED> 
+
+<!-- ObjectCreateRule -->
+<!ELEMENT object-create-rule EMPTY>
+<!ATTLIST object-create-rule
+    pattern   CDATA #IMPLIED
+    classname CDATA #REQUIRED
+    attrname  CDATA #IMPLIED>
+
+<!-- SetPropertiesRule -->
+<!ELEMENT set-properties-rule (alias)*>
+<!ATTLIST set-properties-rule
+    pattern   CDATA #IMPLIED>
+
+<!-- SetNestedPropertiesRule -->
+<!ELEMENT set-nested-properties-rule (alias)*>
+<!ATTLIST set-nested-properties-rule
+    pattern                       CDATA #IMPLIED
+    allow-unknown-child-elements  CDATA #IMPLIED>
+
+<!-- An alias is a custom attribute->property name mapping -->
+<!ELEMENT alias EMPTY>
+<!ATTLIST alias
+ attr-name CDATA #REQUIRED
+ prop-name CDATA #IMPLIED>
+
+<!-- SetPropertyRule -->
+<!ELEMENT set-property-rule EMPTY>
+<!ATTLIST set-property-rule
+    pattern   CDATA #IMPLIED
+    name      CDATA #IMPLIED
+    value     CDATA #IMPLIED>
+
+<!-- SetTopRule -->
+<!ELEMENT set-top-rule EMPTY>
+<!ATTLIST set-top-rule
+    pattern    CDATA #IMPLIED
+    methodname CDATA #REQUIRED
+    paramtype  CDATA #IMPLIED>
+
+<!-- SetNextRule -->
+<!ELEMENT set-next-rule EMPTY>
+<!ATTLIST set-next-rule
+    pattern    CDATA #IMPLIED
+    methodname CDATA #REQUIRED
+    paramtype  CDATA #IMPLIED>
+
+<!-- SetRootRule -->
+<!ELEMENT set-root-rule EMPTY>
+<!ATTLIST set-root-rule
+    pattern    CDATA #IMPLIED
+    methodname CDATA #REQUIRED
+    paramtype  CDATA #IMPLIED>
+

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/digester-rules.dtd
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/exceptions.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/exceptions.properties?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/exceptions.properties (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/exceptions.properties Thu Aug 11 11:04:29 2005
@@ -0,0 +1,18 @@
+cat.unsupported.type=Unsupported type to display contents "{0}".
+missing.paramater=Missing parameter "{0}".
+file.flag.unset=The file flag is unset.
+file.not.found=File not found at {0}.
+illegalargument.no.iterator.under=Illegal argument. There is no iterator under "{0}".
+more.arguments.than.expected=More arguments than expected.
+no.attribute.for.name=No attribute for name "{0}" in Command "{1}".
+no.opt.for.name=No Option for name "{0}".
+no.option.for.name=No Option for name "{0}".
+no.flag.for.name=No Flag for name "{0}".
+no.command.in.catalog.for.name=No Command in Catalog for name "{0}".
+no.command.for.name=No Command for name "{0}".
+parse.input.empty=Unable to parse, input is empty.
+parse.arguments=Unable to parse arguments. {0}.
+parse.instantiate.command=Unable to instantiate Command "{0}".
+parse.command.property=Unable to set "{0}-{1}" with value "{2}".
+parse.unable.to.get.descriptor=Unable to get command descriptor. {0}.
+unkown.arguments=unkown arguments. Known arguments = {0}, received = {1}.

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/exceptions.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/package.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/package.html?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/package.html (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/package.html Thu Aug 11 11:04:29 2005
@@ -0,0 +1,2 @@
+<p>This package contains a JCR Command Line Interface backed by Commons chain 
+	commands.</p>
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/resources.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/resources.properties?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/resources.properties (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/resources.properties Thu Aug 11 11:04:29 2005
@@ -0,0 +1,231 @@
+#welcome
+welcome=welcome
+
+# common
+boolean=boolean
+classname=class name
+commandname=command name
+destination=destination
+elapsedtime=elapsed time
+exception.occurred=an exception occurred
+exception=exception
+export.overwrite=overwrite the file in the given path if necessary.
+exportview.from=Source node 
+exportview.to=Target file where the xml view will be stored
+exportview.skipBinary=if it's true the binary properties will be serialized as if they are empty
+exportview.noRecurse=if it's true it doesn't include the child nodes
+file=file
+flag=flag
+folder=folder
+fs.path=file system path
+from=from
+in=in
+jcr.path=jcr path
+message=message
+mixin.name=mixin name
+name.pattern=name pattern
+unknown.command=unknown command
+node.name=node name
+node.path=node path
+not.connected=not connected
+not.logged.in=not logged in
+overwrite=overwrite
+running=running
+show.max.items=max number of items to show
+stmt=statement
+source=source
+to=to
+var.name=variable name
+
+# ---------------------------------
+# CLI
+# ---------------------------------
+
+# prompt
+prompt.display.stacktrace=Do you want to see the stack trace? [y/n]
+
+# source
+source=Execute the script at the given file
+
+# ---------------------------------
+# JCR COMMANDS
+# ---------------------------------
+
+# addmixin
+addmixin=Add a mixin node type to the given node
+addmixin.mixin=mixin name 
+
+# addnode
+addnode=Add a node to the current working node
+
+# clear workspace
+clearworkspace=Clear the Workspace by removing all the nodes and properties. 
+
+# collect
+collectitems=Collect items under the current working node
+collectitems.target=target variable where the collected items will be stored
+
+# collect nodes
+collectnodes=Collect nodes under the current working node
+collectnodes.target=target variable where the collected nodes will be stored
+
+# collect properties
+collectproperties=Collect properties under the current working node
+collectproperties.target=target variable where the collected properties will be stored
+
+# copy
+copy=copy a node
+copy.from=source, absolute or relative path
+copy.to=destination, only absolute path
+
+# current node
+currentnode=Change the current working node to the given path 
+
+# export doc view
+exportdocview=Serialize the node to the given file using the document view format
+
+# export fs
+exportfilesystem=Export node of type nt:file and nt:folder to the file system.
+
+# export property
+exportproperty=Export the given property to the file system
+exportproperty.idx=value index to export
+
+# export sys view
+exportsysview=Serialize the node to the given file using the system view format
+
+# import fs
+importfilesystem= \
+This command imports data from the file system. \n \
+If the given path refers to a file, it's imported \
+to the repostitory to a node of type nt:file under \
+the current working node. \
+If the given path refers  to a folder, all the tree under the given folder is \
+imported.
+
+# import xml
+importxml=Import the given xml file either in system or documen view to the repository
+importxml.uuidBehaviour=uuid creation behaviour 
+
+# login
+login=login to the current repository.
+login.u=user name [default = anonymous]
+login.p=password  [default = anonymous]
+login.w=workspace
+
+#logout
+logout=logout from the current repository.
+
+#move
+move=move a node
+move.from=source, absolute or relative path
+move.to=destination, only absolute path
+
+# refresh
+refresh=Refresh the session to reflect the current saved state.
+refresh.keepChanges=keep or discard the changes flag
+
+# remove item
+remove=Remove the item at the given path.
+
+# remove items
+removeitems=Remove any item under the current working node that match the given name pattern.
+
+# removemixin
+removemixin=Remove a mixin from the given node
+
+# rename
+rename=rename the child node with the given name
+rename.from=source node
+rename.to=destination node 
+
+# Save session
+save=Save the current session 
+
+# Save node
+savenode=Save the current working node 
+
+# set multivalue property
+setmultivalueproperty=Set a multivalue property.
+setmultivalueproperty.regExp=Regular expression used to split the value into tokens.
+
+# set property
+setproperty=Set the given value to the property.
+setproperty.name=property name
+setproperty.value=property value
+setproperty.type=property type. Default is String.
+
+# set property
+setpropertyfromfile=Set the property's value with the content of the given path.
+setpropertyfromfile.path=path to the file
+
+# sql query
+sql=SQL query
+sql.statement=SQL statement
+sql.target=target variables to store the nodes included in te query result
+
+# start jackrabbit
+startjackrabbit=Start a local Jackrabbit instance
+startjackrabbit.config=Repository config file, usually called repository.xml
+startjackrabbit.home=Repository location
+
+# stop jackrabbit
+stopjackrabbit=Stop the Jackrabbit instance in use
+
+# ---------------------------------
+# INFO COMMANDS
+# ---------------------------------
+
+# help
+help=Show available commands
+help.command=[optional] Command help
+
+# ls items
+lsitems=Lists nodes and properties under the current node
+lsitems.pattern=filter pattern
+
+# lscollec
+lscollect=List collected items under the current node 
+lscollect.namepattern=[optional] name pattern
+
+# lsnodes
+lsnodes=List nodes under the current node
+lsnodes.nsize=Show the number of nodes under the current working node
+lsnodes.psize=Show the number of properties under the current working node
+lsnodes.rsize=Show the number of references that point to the current working node
+lsnodes.m=Show the full list o mixin that apply to the current working node
+lsnodes.v=Show whether the current working node is versionable
+lsnodes.l=Show whether the current working node is lockable
+lsnodes.r=Show whether the current working node is referenceable
+lsnodes.locked=Show whether the current working node is locked
+lsnodes.hasLock=Show whether the current working node has a lock
+lsnodes.new=Show whether the current working node is new
+lsnodes.mod=Show whether the current working node is modified
+lsnodes.path=Show the full path to the node
+
+# ls collect nodes
+lscollectnodes=List collected nodes under the current node
+lscollectnodes.namepattern=[optional] name pattern
+
+
+# ls collect properties
+lscollectproperties=List collected properties under the current node
+lscollectproperties.namepattern=[optional] name pattern
+
+# lsproperties
+lsproperties=List properties under the current node
+lsproperties.namepattern=[optional] name pattern
+
+# lsreferences
+lsreferences=List references to the given node.
+
+# cat property 
+cat=Display the content of a property, or the content of a node of type nt:file or nt:resource.
+cat.idx=index of the value to show
+
+# dump
+dump=Dump stored data from the current working node
+
+# xpathquery
+xpathquery=xpath query
+xpathquery.statement=statement
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/cli/resources.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractCollect.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractCollect.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractCollect.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractCollect.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ *
+ * 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
+ *
+ * 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.chain.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ResourceBundle;
+
+import javax.jcr.Node;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.CtxHelper;
+import org.apache.jackrabbit.util.ChildrenCollectorFilter;
+
+/**
+ * Collect the children items and store them under the given key. <br>
+ * The Command attributes are set from the specified literal values, or from the
+ * context attributes stored under the given keys.
+ * 
+ */
+public abstract class AbstractCollect implements Command
+{
+    /** Resource bundle */
+    protected ResourceBundle bundle = ResourceBundle.getBundle(this.getClass()
+        .getPackage().getName()
+            + ".resources");
+
+    // ---------------------------- < literals >
+
+    /** depth literal value */
+    private String depth;
+
+    /** name pattern literal value */
+    private String namePattern;
+
+    // ---------------------------- < keys >
+
+    /** context attribute key for the depth attribute */
+    private String depthKey;
+
+    /** context attribute key for the name pattern attribute */
+    private String namePatternKey;
+
+    /** context attribute key for the destination attribute */
+    private String toKey;
+
+    /**
+     * @inheritDoc
+     */
+    public final boolean execute(Context ctx) throws Exception
+    {
+        if (this.toKey == null || this.toKey.length() == 0)
+        {
+            throw new IllegalStateException("target variable is not set");
+        }
+
+        Node node = CtxHelper.getCurrentNode(ctx);
+
+        String namePattern = CtxHelper.getAttr(this.namePattern,
+            this.namePatternKey, ctx);
+
+        int depth = CtxHelper.getIntAttr(this.depth,
+            this.depthKey, 1, ctx);
+
+        if (namePattern == null || namePattern.length() == 0)
+        {
+            namePattern = "*";
+        }
+
+        Collection items = new ArrayList();
+        ChildrenCollectorFilter collector = new ChildrenCollectorFilter(
+            namePattern, items, isCollectNodes(), isCollectProperties(),
+            depth);
+        collector.visit(node);
+        ctx.put(this.toKey, items.iterator());
+
+        return false;
+    }
+
+    /**
+     * @return Returns the depth.
+     */
+    public String getDepth()
+    {
+        return depth;
+    }
+
+    /**
+     * @param depth
+     *            The depth to set.
+     */
+    public void setDepth(String depth)
+    {
+        this.depth = depth;
+    }
+
+    /**
+     * @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 namePattern.
+     */
+    public String getNamePattern()
+    {
+        return namePattern;
+    }
+
+    /**
+     * @param namePattern
+     *            The namePattern to set.
+     */
+    public void setNamePattern(String namePattern)
+    {
+        this.namePattern = namePattern;
+    }
+
+    /**
+     * @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;
+    }
+
+    /**
+     * @return Returns the toKey.
+     */
+    public String getToKey()
+    {
+        return toKey;
+    }
+
+    /**
+     * @param toKey
+     *            context attribute key for the destination attribute
+     */
+    public void setToKey(String toKey)
+    {
+        this.toKey = toKey;
+    }
+
+    /** Collect nodes flag */
+    protected abstract boolean isCollectNodes();
+
+    /** Collect properties flag */
+    protected abstract boolean isCollectProperties();
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractCollect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractSetProperty.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractSetProperty.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractSetProperty.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractSetProperty.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,153 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+import org.apache.commons.chain.Command;
+
+/**
+ * SetProperty superclass. <br>
+ * The Command attributes are set from the specified literal values, or from the
+ * context attributes stored under the given keys.
+ */
+public abstract class AbstractSetProperty implements Command
+{
+
+    // ---------------------------- < literals >
+
+    /** Property name */
+    protected String propertyName;
+
+    /** Propety type */
+    protected String propertyType;
+
+    /** Property value */
+    protected String value;
+
+    // ---------------------------- < keys >
+
+    /** Property name key */
+    protected String propertyNameKey;
+
+    /** Propety type key */
+    protected String propertyTypeKey;
+
+    /** Property value key */
+    protected String valueKey;
+
+    /**
+     * @return Returns the name.
+     */
+    public String getPropertyName()
+    {
+        return propertyName;
+    }
+
+    /**
+     * @param name
+     *            The name to set.
+     */
+    public void setPropertyName(String name)
+    {
+        this.propertyName = name;
+    }
+
+    /**
+     * @return Returns the type.
+     */
+    public String getPropertyType()
+    {
+        return propertyType;
+    }
+
+    /**
+     * @param type
+     *            The type to set.
+     */
+    public void setPropertyType(String type)
+    {
+        this.propertyType = type;
+    }
+
+    /**
+     * @return the property value
+     */
+    public String getValue()
+    {
+        return value;
+    }
+
+    /**
+     * Sets property value
+     * 
+     * @param value
+     */
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+
+    /**
+     * @return Returns the nameKey.
+     */
+    public String getPropertyNameKey()
+    {
+        return propertyNameKey;
+    }
+
+    /**
+     * @param nameKey
+     *            Set the context attribute key for the name attribute.
+     */
+    public void setPropertyNameKey(String nameKey)
+    {
+        this.propertyNameKey = nameKey;
+    }
+
+    /**
+     * @return Returns the propertyTypeKey.
+     */
+    public String getPropertyTypeKey()
+    {
+        return propertyTypeKey;
+    }
+
+    /**
+     * @param propertyTypeKey
+     *            Set the context attribute key for the property type  attribute.
+     */
+    public void setPropertyTypeKey(String propertyTypeKey)
+    {
+        this.propertyTypeKey = propertyTypeKey;
+    }
+
+    /**
+     * @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;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AbstractSetProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddMixin.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddMixin.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddMixin.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddMixin.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,126 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+import javax.jcr.Node;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.CtxHelper;
+
+/**
+ * Add a mixin to the given node
+ */
+public class AddMixin implements Command
+{
+    // ---------------------------- < literals >
+    /** node path */
+    private String path;
+
+    /** mixin name */
+    private String mixinName;
+
+    // ---------------------------- < keys >
+    /** node path */
+    private String pathKey;
+
+    /** mixin name */
+    private String mixinNameKey;
+
+    /**
+     * @return Returns the mixinName.
+     */
+    public String getMixinName()
+    {
+        return mixinName;
+    }
+
+    /**
+     * @param mixinName
+     *            The mixinName to set.
+     */
+    public void setMixinName(String mixinName)
+    {
+        this.mixinName = mixinName;
+    }
+
+    /**
+     * @return Returns the mixinNameKey.
+     */
+    public String getMixinNameKey()
+    {
+        return mixinNameKey;
+    }
+
+    /**
+     * @param mixinNameKey
+     *            The mixinNameKey to set.
+     */
+    public void setMixinNameKey(String mixinNameKey)
+    {
+        this.mixinNameKey = mixinNameKey;
+    }
+
+    /**
+     * @return Returns the path.
+     */
+    public String getPath()
+    {
+        return path;
+    }
+
+    /**
+     * @param path
+     *            The path to set.
+     */
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+
+    /**
+     * @return Returns the pathKey.
+     */
+    public String getPathKey()
+    {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *            The pathKey to set.
+     */
+    public void setPathKey(String pathKey)
+    {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String path = CtxHelper.getAttr(this.path, this.pathKey, ctx);
+        String mixin = CtxHelper
+            .getAttr(this.mixinName, this.mixinNameKey, ctx);
+
+        Node n = CtxHelper.getNode(ctx, path);
+        n.addMixin(mixin);
+
+        return false;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddMixin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java?rev=231495&r1=231494&r2=231495&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java Thu Aug 11 11:04:29 2005
@@ -20,60 +20,118 @@
 
 import org.apache.commons.chain.Command;
 import org.apache.commons.chain.Context;
-import org.apache.jackrabbit.chain.ContextHelper;
+import org.apache.jackrabbit.chain.CtxHelper;
 
 /**
- * Adds a node to the current working node.
+ * Add a node to the current working node. <br>
+ * The Command attributes are set from the specified literal values, or from the
+ * context attributes stored under the given keys.
  */
-public class AddNode implements Command {
-	/** Node type */
-	private String type;
-
-	/** Node name */
-	private String name;
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
-	 */
-	public boolean execute(Context ctx) throws Exception {
-		Node node = ContextHelper.getCurrentNode(ctx);
-		if (this.type == null) {
-			node.addNode(name);
-		} else {
-			node.addNode(type, name);
-		}
-		return false;
-	}
-
-	/**
-	 * @return Returns the name.
-	 */
-	public String getName() {
-		return name;
-	}
-
-	/**
-	 * @param name
-	 *            The name to set.
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	/**
-	 * @return Returns the type.
-	 */
-	public String getType() {
-		return type;
-	}
-
-	/**
-	 * @param type
-	 *            The type to set.
-	 */
-	public void setType(String type) {
-		this.type = type;
-	}
+public class AddNode implements Command
+{
+    
+    // ---------------------------- < literals >    
+    /** Node type */
+    private String nodeType;
+
+    /** Node name */
+    private String nodeName;
+
+    // ---------------------------- < keys >    
+    /** Node type key */
+    private String nodeTypeKey;
+
+    /** Node name key */
+    private String nodeNameKey;
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        Node node = CtxHelper.getCurrentNode(ctx);
+
+        String nodeType = CtxHelper.getAttr(this.nodeType,
+            this.nodeTypeKey, ctx);
+
+        String name = CtxHelper.getAttr(this.nodeName, this.nodeNameKey, ctx);
+
+        if (nodeType == null)
+        {
+            node.addNode(name);
+        } else
+        {
+            node.addNode(name, nodeType);
+        }
+        return false;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getNodeName()
+    {
+        return nodeName;
+    }
+
+    /**
+     * @param name
+     *            The literal name to set.
+     */
+    public void setNodeName(String name)
+    {
+        this.nodeName = name;
+    }
+
+    /**
+     * @return Returns the type.
+     */
+    public String getNodeType()
+    {
+        return nodeType;
+    }
+
+    /**
+     * @param type
+     *            The literal note type to set.
+     */
+    public void setNodeType(String type)
+    {
+        this.nodeType = type;
+    }
+
+    /**
+     * @return Returns the nameKey.
+     */
+    public String getNodeNameKey()
+    {
+        return nodeNameKey;
+    }
+
+    /**
+     * @param nameKey
+     *            Set the context attribute key for the name attribute.
+     */
+    public void setNodeNameKey(String nameKey)
+    {
+        this.nodeNameKey = nameKey;
+    }
+
+    /**
+     * @return Returns the nodeTypeKey.
+     */
+    public String getNodeTypeKey()
+    {
+        return nodeTypeKey;
+    }
+
+    /**
+     * @param nodeTypeKey
+     *            Set the context attribute key for the node type attribute.
+     */
+    public void setNodeTypeKey(String nodeTypeKey)
+    {
+        this.nodeTypeKey = nodeTypeKey;
+    }
+
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearWorkspace.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearWorkspace.java?rev=231495&r1=231494&r2=231495&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearWorkspace.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearWorkspace.java Thu Aug 11 11:04:29 2005
@@ -18,28 +18,40 @@
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
 import javax.jcr.Session;
 
 import org.apache.commons.chain.Command;
 import org.apache.commons.chain.Context;
 import org.apache.jackrabbit.JcrConstants;
-import org.apache.jackrabbit.chain.ContextHelper;
+import org.apache.jackrabbit.chain.CtxHelper;
 
 /**
- * Clears the Workspace
+ * Clear the Workspace
  */
 public class ClearWorkspace implements Command
 {
 
     public boolean execute(Context ctx) throws Exception
     {
-        Session s = ContextHelper.getSession(ctx) ;
-        NodeIterator iter = s.getRootNode().getNodes() ;
+        Session s = CtxHelper.getSession(ctx);
+        NodeIterator iter = s.getRootNode().getNodes();
         while (iter.hasNext())
         {
             Node n = (Node) iter.next();
-            if (!n.getName().equals(JcrConstants.JCR_SYSTEM)) {
-                n.remove() ;
+            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;

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectItems.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectItems.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectItems.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectItems.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+/**
+ * Collect children, either nodes or properties
+ */
+public class CollectItems extends AbstractCollect
+{
+
+    /**
+     * @inheritDoc
+     */
+    protected boolean isCollectNodes()
+    {
+        return true;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    protected boolean isCollectProperties()
+    {
+        return true;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectItems.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectNodes.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectNodes.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectNodes.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectNodes.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+/**
+ * Collect nodes only
+ */
+public class CollectNodes extends AbstractCollect
+{
+
+    /**
+     * @inheritDoc
+     */
+    protected boolean isCollectNodes()
+    {
+        return true;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    protected boolean isCollectProperties()
+    {
+        return false;
+    }
+    
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectNodes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectProperties.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectProperties.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectProperties.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectProperties.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+/**
+ * Collect properties only
+ */
+public class CollectProperties
+{
+
+    /**
+     * @inheritDoc
+     */
+    protected boolean isCollectNodes()
+    {
+        return false;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    protected boolean isCollectProperties()
+    {
+        return true;
+    }
+    
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CollectProperties.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Copy.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Copy.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Copy.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Copy.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,130 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.CtxHelper;
+
+/**
+ * Copy a Node. <br>
+ * The destination path must be absolute. <br>
+ * See Workspace.copy(String srcAbsPath, String destAbsPath).
+ */
+public class Copy implements Command
+{
+    // ---------------------------- < literals >
+    /** source path */
+    private String from;
+
+    /** destination path */
+    private String to;
+
+    // ---------------------------- < keys >
+    /** source path */
+    private String fromKey;
+
+    /** destination path */
+    private String toKey;
+
+    /**
+     * @return Returns the from.
+     */
+    public String getFrom()
+    {
+        return from;
+    }
+
+    /**
+     * @param from
+     *            The from to set.
+     */
+    public void setFrom(String from)
+    {
+        this.from = from;
+    }
+
+    /**
+     * @return Returns the fromKey.
+     */
+    public String getFromKey()
+    {
+        return fromKey;
+    }
+
+    /**
+     * @param fromKey
+     *            The fromKey to set.
+     */
+    public void setFromKey(String fromKey)
+    {
+        this.fromKey = fromKey;
+    }
+
+    /**
+     * @return Returns the to.
+     */
+    public String getTo()
+    {
+        return to;
+    }
+
+    /**
+     * @param to
+     *            The to to set.
+     */
+    public void setTo(String to)
+    {
+        this.to = to;
+    }
+
+    /**
+     * @return Returns the toKey.
+     */
+    public String getToKey()
+    {
+        return toKey;
+    }
+
+    /**
+     * @param toKey
+     *            The toKey to set.
+     */
+    public void setToKey(String toKey)
+    {
+        this.toKey = toKey;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String from = CtxHelper.getAttr(this.from, this.fromKey, ctx);
+        String to = CtxHelper.getAttr(this.to, this.toKey, ctx);
+
+        Node fromNode = CtxHelper.getNode(ctx, from);
+
+        Session s = CtxHelper.getSession(ctx);
+        s.getWorkspace().copy(fromNode.getPath(), to);
+
+        return false;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Copy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java?rev=231495&r1=231494&r2=231495&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java Thu Aug 11 11:04:29 2005
@@ -21,26 +21,34 @@
 
 import org.apache.commons.chain.Command;
 import org.apache.commons.chain.Context;
-import org.apache.jackrabbit.chain.ContextHelper;
+import org.apache.jackrabbit.chain.CtxHelper;
 
 /**
- * Sets the current working Node
+ * Set the current working Node. <br>
+ * The Command attributes are set from the specified literal values, or from the
+ * context attributes stored under the given keys.
  */
 public class CurrentNode implements Command
 {
+    // ---------------------------- < literals >
+    
     /** path to the current node */
     private String path;
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+    // ---------------------------- < keys >
+    
+    /** context attribute key for the path attribute */
+    private String pathKey;
+
+    /**
+     * @inheritDoc
      */
     public boolean execute(Context ctx) throws Exception
     {
-        Session s = ContextHelper.getSession(ctx);
-        Node n = ContextHelper.getNode(ctx, path);
-        ContextHelper.setCurrentNode(ctx, n);
+        String path = CtxHelper.getAttr(this.path, this.pathKey, ctx);
+        Session s = CtxHelper.getSession(ctx);
+        Node n = CtxHelper.getNode(ctx, path);
+        CtxHelper.setCurrentNode(ctx, n);
         return false;
     }
 
@@ -59,5 +67,22 @@
     public void setPath(String path)
     {
         this.path = path;
+    }
+
+    /**
+     * @return Returns the pathKey.
+     */
+    public String getPathKey()
+    {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *            Set the context attribute key for the path attribute.
+     */
+    public void setPathKey(String pathKey)
+    {
+        this.pathKey = pathKey;
     }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java?rev=231495&r1=231494&r2=231495&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java Thu Aug 11 11:04:29 2005
@@ -23,85 +23,181 @@
 
 import org.apache.commons.chain.Command;
 import org.apache.commons.chain.Context;
-import org.apache.jackrabbit.chain.ContextHelper;
+import org.apache.jackrabbit.chain.CtxHelper;
+import org.apache.jackrabbit.chain.JcrCommandException;
 
 /**
- * Login command.
+ * Login command. <br>
+ * The Command attributes are set from the specified literal values, or from the
+ * context attributes stored under the given keys.
  */
-public class Login implements Command {
-	/** user */
-	private String user;
-
-	/** password */
-	private String password;
-
-	/** workspace */
-	private String workspace;
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
-	 */
-	public boolean execute(Context ctx) throws Exception {
-		Session session = null;
-		Repository repo = ContextHelper.getRepository(ctx);
+public class Login implements Command
+{
+
+    // ---------------------------- < literals >
+
+    /** user */
+    private String user;
+
+    /** password */
+    private String password;
+
+    /** workspace */
+    private String workspace;
+
+    // ---------------------------- < keys >
+    /** user key */
+    private String userKey;
+
+    /** password key */
+    private String passwordKey;
+
+    /** workspace key */
+    private String workspaceKey;
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        if (CtxHelper.getSession(ctx) != null)
+        {
+            throw new JcrCommandException("already.logged.in");
+        }
+
+        String anon = "anonymous";
+
+        String user = CtxHelper.getAttr(this.user, this.userKey, anon,
+            ctx);
+
+        String password = CtxHelper.getAttr(this.password,
+            this.passwordKey, anon, ctx);
+
+        String workspace = CtxHelper.getAttr(this.workspace,
+            this.workspaceKey, ctx);
+
+        Session session = null;
+        Repository repo = CtxHelper.getRepository(ctx);
+
+        if (repo == null)
+        {
+            throw new JcrCommandException("repository.not.in.context");
+        }
 
         Credentials credentials = new SimpleCredentials(user, password
-				.toCharArray());
+            .toCharArray());
 
-		if (this.workspace == null) {
-			session = repo.login(credentials);
-		} else {
-			session = repo.login(credentials, workspace);
-		}
-		ContextHelper.setSession(ctx, session);
-		ContextHelper.setCurrentNode(ctx, session.getRootNode());
-		return false;
-	}
-
-	/**
-	 * @return Returns the password.
-	 */
-	public String getPassword() {
-		return password;
-	}
-
-	/**
-	 * @param password
-	 *            The password to set.
-	 */
-	public void setPassword(String password) {
-		this.password = password;
-	}
-
-	/**
-	 * @return Returns the user.
-	 */
-	public String getUser() {
-		return user;
-	}
-
-	/**
-	 * @param user
-	 *            The user to set.
-	 */
-	public void setUser(String user) {
-		this.user = user;
-	}
-
-	/**
-	 * @return Returns the workspace.
-	 */
-	public String getWorkspace() {
-		return workspace;
-	}
-
-	/**
-	 * @param workspace
-	 *            The workspace to set.
-	 */
-	public void setWorkspace(String workspace) {
-		this.workspace = workspace;
-	}
+        if (workspace == null)
+        {
+            session = repo.login(credentials);
+        } else
+        {
+            session = repo.login(credentials, workspace);
+        }
+        CtxHelper.setSession(ctx, session);
+        CtxHelper.setCurrentNode(ctx, session.getRootNode());
+        return false;
+    }
+
+    /**
+     * @return Returns the password.
+     */
+    public String getPassword()
+    {
+        return password;
+    }
+
+    /**
+     * @param password
+     *            The password to set.
+     */
+    public void setPassword(String password)
+    {
+        this.password = password;
+    }
+
+    /**
+     * @return Returns the user.
+     */
+    public String getUser()
+    {
+        return user;
+    }
+
+    /**
+     * @param user
+     *            The user to set.
+     */
+    public void setUser(String user)
+    {
+        this.user = user;
+    }
+
+    /**
+     * @return Returns the workspace.
+     */
+    public String getWorkspace()
+    {
+        return workspace;
+    }
+
+    /**
+     * @param workspace
+     *            The workspace to set.
+     */
+    public void setWorkspace(String workspace)
+    {
+        this.workspace = workspace;
+    }
+
+    /**
+     * @return Returns the passwordKey.
+     */
+    public String getPasswordKey()
+    {
+        return passwordKey;
+    }
+
+    /**
+     * @param passwordKey
+     *            Set the context attribute key for the password attribute.
+     */
+    public void setPasswordKey(String passwordKey)
+    {
+        this.passwordKey = passwordKey;
+    }
+
+    /**
+     * @return Returns the userKey.
+     */
+    public String getUserKey()
+    {
+        return userKey;
+    }
+
+    /**
+     * @param userKey
+     *            Set the context attribute key for the user attribute.
+     */
+    public void setUserKey(String userKey)
+    {
+        this.userKey = userKey;
+    }
+
+    /**
+     * @return Returns the workspaceKey.
+     */
+    public String getWorkspaceKey()
+    {
+        return workspaceKey;
+    }
+
+    /**
+     * @param workspaceKey
+     *            Set the context attribute key for the workspace attribute.
+     */
+    public void setWorkspaceKey(String workspaceKey)
+    {
+        this.workspaceKey = workspaceKey;
+    }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java?rev=231495&r1=231494&r2=231495&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java Thu Aug 11 11:04:29 2005
@@ -20,7 +20,7 @@
 
 import org.apache.commons.chain.Command;
 import org.apache.commons.chain.Context;
-import org.apache.jackrabbit.chain.ContextHelper;
+import org.apache.jackrabbit.chain.CtxHelper;
 
 /**
  * Logout command
@@ -35,9 +35,10 @@
      */
     public boolean execute(Context ctx) throws Exception
     {
-        Session session = ContextHelper.getSession(ctx);
+        Session session = CtxHelper.getSession(ctx);
         session.logout();
-        ContextHelper.setSession(ctx, null);
+        CtxHelper.setCurrentNode(ctx, null);
+        CtxHelper.setSession(ctx, null);
         return false;
     }
 }

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Move.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Move.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Move.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Move.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,130 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.CtxHelper;
+
+/**
+ * Move a Node. <br>
+ * The destination path must be absolute. <br>
+ * See Session.move(String srcAbsPath, String destAbsPath).
+ */
+public class Move implements Command
+{
+    // ---------------------------- < literals >
+    /** source path */
+    private String from;
+
+    /** destination path */
+    private String to;
+
+    // ---------------------------- < keys >
+    /** source path */
+    private String fromKey;
+
+    /** destination path */
+    private String toKey;
+
+    /**
+     * @return Returns the from.
+     */
+    public String getFrom()
+    {
+        return from;
+    }
+
+    /**
+     * @param from
+     *            The from to set.
+     */
+    public void setFrom(String from)
+    {
+        this.from = from;
+    }
+
+    /**
+     * @return Returns the fromKey.
+     */
+    public String getFromKey()
+    {
+        return fromKey;
+    }
+
+    /**
+     * @param fromKey
+     *            The fromKey to set.
+     */
+    public void setFromKey(String fromKey)
+    {
+        this.fromKey = fromKey;
+    }
+
+    /**
+     * @return Returns the to.
+     */
+    public String getTo()
+    {
+        return to;
+    }
+
+    /**
+     * @param to
+     *            The to to set.
+     */
+    public void setTo(String to)
+    {
+        this.to = to;
+    }
+
+    /**
+     * @return Returns the toKey.
+     */
+    public String getToKey()
+    {
+        return toKey;
+    }
+
+    /**
+     * @param toKey
+     *            The toKey to set.
+     */
+    public void setToKey(String toKey)
+    {
+        this.toKey = toKey;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String from = CtxHelper.getAttr(this.from, this.fromKey, ctx);
+        String to = CtxHelper.getAttr(this.to, this.toKey, ctx);
+
+        Node fromNode = CtxHelper.getNode(ctx, from);
+
+        Session s = CtxHelper.getSession(ctx);
+        s.move(fromNode.getPath(), to);
+
+        return false;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Move.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ReadValue.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ReadValue.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ReadValue.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ReadValue.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,160 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+import javax.jcr.Property;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.CtxHelper;
+
+/**
+ * Read the Value of the given property and store it under the given context
+ * attribute. <br>
+ * The Command attributes are set from the specified literal values, or from the
+ * context attributes stored under the given keys.
+ */
+public class ReadValue implements Command
+{
+
+    // ---------------------------- < literals >
+
+    /** property path */
+    private String path;
+
+    /** value index */
+    private String index;
+
+    // ---------------------------- < keys >
+
+    /** property path key */
+    private String pathKey;
+
+    /** value index key */
+    private String indexKey;
+
+    /** destination context attribute */
+    private String toKey;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String path = CtxHelper.getAttr(this.path, this.pathKey, ctx);
+        int index = CtxHelper.getIntAttr(this.index, this.indexKey, 0,
+            ctx);
+
+        Property p = (Property) CtxHelper.getItem(ctx, path);
+
+        if (p.getDefinition().isMultiple())
+        {
+            ctx.put(this.toKey, p.getValues()[index].getString());
+        } else
+        {
+            ctx.put(this.toKey, p.getValue().getString());
+        }
+        return false;
+    }
+
+    /**
+     * @return Returns the index.
+     */
+    public String getIndex()
+    {
+        return index;
+    }
+
+    /**
+     * @param index
+     *            The index to set.
+     */
+    public void setIndex(String index)
+    {
+        this.index = index;
+    }
+
+    /**
+     * @return Returns the indexKey.
+     */
+    public String getIndexKey()
+    {
+        return indexKey;
+    }
+
+    /**
+     * @param indexKey
+     *            Set the context attribute key for the index attribute.
+     */
+    public void setIndexKey(String indexKey)
+    {
+        this.indexKey = indexKey;
+    }
+
+    /**
+     * @return Returns the path.
+     */
+    public String getPath()
+    {
+        return path;
+    }
+
+    /**
+     * @param path
+     *            The path to set.
+     */
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+
+    /**
+     * @return Returns the pathKey.
+     */
+    public String getPathKey()
+    {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *            Set the context attribute key for the path attribute.
+     */
+    public void setPathKey(String pathKey)
+    {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return Returns the toKey.
+     */
+    public String getToKey()
+    {
+        return toKey;
+    }
+
+    /**
+     * @param toKey
+     *            The toKey to set.
+     */
+    public void setToKey(String toKey)
+    {
+        this.toKey = toKey;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ReadValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Refresh.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Refresh.java?rev=231495&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Refresh.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Refresh.java Thu Aug 11 11:04:29 2005
@@ -0,0 +1,135 @@
+/*
+ * 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
+ *
+ * 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.chain.command;
+
+import javax.jcr.Item;
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.CtxHelper;
+
+/**
+ * Refresh the session to reflect the current saved state. <br>
+ * If the path is set then only that Item is refreshed.
+ */
+public class Refresh implements Command
+{
+    // ---------------------------- < literals >
+    /** keep changes */
+    private String keepChanges;
+
+    /** path to the node to refresh */
+    private String path;
+
+    // ---------------------------- < keys >
+    /** keep changes key */
+    private String keepChangesKey;
+
+    /** path to the node to refresh key */
+    private String pathKey;
+
+    /**
+     * @return Returns the keepChanges.
+     */
+    public String getKeepChanges()
+    {
+        return keepChanges;
+    }
+
+    /**
+     * @param keepChanges
+     *            The keepChanges to set.
+     */
+    public void setKeepChanges(String keepChanges)
+    {
+        this.keepChanges = keepChanges;
+    }
+
+    /**
+     * @return Returns the keepChangesKey.
+     */
+    public String getKeepChangesKey()
+    {
+        return keepChangesKey;
+    }
+
+    /**
+     * @param keepChangesKey
+     *            The keepChangesKey to set.
+     */
+    public void setKeepChangesKey(String keepChangesKey)
+    {
+        this.keepChangesKey = keepChangesKey;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        boolean keepChanges = CtxHelper.getBooleanAttr(this.keepChanges,
+            this.keepChangesKey, true, ctx);
+
+        String path = CtxHelper.getAttr(this.path, this.pathKey, ctx);
+        if (path == null)
+        {
+            Session s = CtxHelper.getSession(ctx);
+            s.refresh(keepChanges);
+        } else
+        {
+            Item i = CtxHelper.getItem(ctx, path);
+            i.refresh(keepChanges);
+        }
+
+        return false;
+    }
+
+    /**
+     * @return Returns the path.
+     */
+    public String getPath()
+    {
+        return path;
+    }
+
+    /**
+     * @param path
+     *            The path to set.
+     */
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+
+    /**
+     * @return Returns the pathKey.
+     */
+    public String getPathKey()
+    {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *            The pathKey to set.
+     */
+    public void setPathKey(String pathKey)
+    {
+        this.pathKey = pathKey;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Refresh.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message