jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edgarp...@apache.org
Subject svn commit: r294914 [5/6] - in /incubator/jackrabbit/trunk/contrib/jcr-commands: ./ applications/test/ applications/test/fs/ benchmarking/ src/cli/ src/java/ src/java/META-INF/ src/java/org/apache/jackrabbit/chain/ src/java/org/apache/jackrabbit/comman...
Date Tue, 04 Oct 2005 20:54:30 GMT
Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/lock/Unlock.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/lock/Unlock.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/lock/Unlock.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/lock/Unlock.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,67 @@
+/*
+ * 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.command.lock;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Unlocks the current working node
+ */
+public class Unlock implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(Unlock.class);
+
+    // ---------------------------- < keys >
+    /** Node path key */
+    private String pathKey = "path";
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String path = (String) ctx.get(this.pathKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("Unlocking node at " + path);
+        }
+        CommandHelper.getNode(ctx, path).unlock();
+        return false;
+    }
+
+    /**
+     * @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/command/lock/Unlock.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/AddMixin.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/AddMixin.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/AddMixin.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/AddMixin.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.command.mixin;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Add a mixin to the given node
+ */
+public class AddMixin implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(AddMixin.class);
+
+    // ---------------------------- < keys >
+    /** node path */
+    private String pathKey = "path";
+
+    /** mixin name */
+    private String mixinKey = "mixin";
+
+    /**
+     * @return Returns the mixinNameKey.
+     */
+    public String getMixinKey()
+    {
+        return mixinKey;
+    }
+
+    /**
+     * @param mixinNameKey
+     *            The mixinNameKey to set.
+     */
+    public void setMixinKey(String mixinNameKey)
+    {
+        this.mixinKey = mixinNameKey;
+    }
+
+    /**
+     * @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 = (String) ctx.get(this.pathKey);
+        String mixin = (String) ctx.get(this.mixinKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("adding mixin " + mixin + " to node " + path);
+        }
+        CommandHelper.getNode(ctx, path).addMixin(mixin);
+        return false;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/RemoveMixin.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/RemoveMixin.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/RemoveMixin.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/mixin/RemoveMixin.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.command.mixin;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Remove a mixin from the given node
+ */
+public class RemoveMixin implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(RemoveMixin.class);
+
+    // ---------------------------- < keys >
+    /** node path */
+    private String pathKey = "path";
+
+    /** mixin name */
+    private String mixinKey = "mixin";
+
+    /**
+     * @return Returns the mixinNameKey.
+     */
+    public String getMixinKey()
+    {
+        return mixinKey;
+    }
+
+    /**
+     * @param mixinNameKey
+     *            The mixinNameKey to set.
+     */
+    public void setMixinKey(String mixinNameKey)
+    {
+        this.mixinKey = mixinNameKey;
+    }
+
+    /**
+     * @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 = (String) ctx.get(this.pathKey) ;
+        String mixin = (String) ctx.get(this.mixinKey) ;
+        if (log.isDebugEnabled())
+        {
+            log.debug("removing mixin " + mixin + " from node " + path);
+        }
+        CommandHelper.getNode(ctx, path).removeMixin(mixin);
+        return false;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/RegisterNamespace.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/RegisterNamespace.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/RegisterNamespace.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/RegisterNamespace.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,89 @@
+/*
+ * 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.command.namespace;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Registers a namespace
+ */
+public class RegisterNamespace implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(RegisterNamespace.class);
+
+    // ---------------------------- < keys >
+    /** prefix key */
+    private String prefixKey = "prefix";
+
+    /** uri key */
+    private String uriKey = "uri";
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String prefix = (String) ctx.get(this.prefixKey);
+        String uri = (String) ctx.get(this.uriKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("registering namespace uri=" + uri + " prefix=" + prefix);
+        }
+        CommandHelper.getSession(ctx).getWorkspace().getNamespaceRegistry()
+            .registerNamespace(prefix, uri);
+        return false;
+    }
+
+    /**
+     * @return Returns the prefixKey.
+     */
+    public String getPrefixKey()
+    {
+        return prefixKey;
+    }
+
+    /**
+     * @param prefixKey
+     *            The prefixKey to set.
+     */
+    public void setPrefixKey(String prefixKey)
+    {
+        this.prefixKey = prefixKey;
+    }
+
+    /**
+     * @return Returns the uriKey.
+     */
+    public String getUriKey()
+    {
+        return uriKey;
+    }
+
+    /**
+     * @param uriKey
+     *            The uriKey to set.
+     */
+    public void setUriKey(String uriKey)
+    {
+        this.uriKey = uriKey;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/UnregisterNamespace.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/UnregisterNamespace.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/UnregisterNamespace.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/namespace/UnregisterNamespace.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,68 @@
+/*
+ * 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.command.namespace;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Unregister a namespace
+ */
+public class UnregisterNamespace implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(UnregisterNamespace.class);
+
+    // ---------------------------- < keys >
+    /** prefix key */
+    private String prefixKey = "prefix";
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String prefix = (String) ctx.get(this.prefixKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("unregistering namespace with prefix=" + prefix);
+        }
+        CommandHelper.getSession(ctx).getWorkspace().getNamespaceRegistry()
+            .unregisterNamespace(prefix);
+        return false;
+    }
+
+    /**
+     * @return Returns the prefixKey.
+     */
+    public String getPrefixKey()
+    {
+        return prefixKey;
+    }
+
+    /**
+     * @param prefixKey
+     *            The prefixKey to set.
+     */
+    public void setPrefixKey(String prefixKey)
+    {
+        this.prefixKey = prefixKey;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/AbstractQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/AbstractQuery.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/AbstractQuery.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/AbstractQuery.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,95 @@
+/*
+ * 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.command.query;
+
+import javax.jcr.Session;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Query the repository through either SQL or XPATH.
+ */
+public abstract class AbstractQuery implements Command
+{
+
+    // ---------------------------- < keys >
+
+    /** query statement key */
+    private String statementKey = "statement";
+
+    /** destination key */
+    private String destKey = "collected";
+
+    /**
+     * @inheritDoc
+     */
+    public final boolean execute(Context ctx) throws Exception
+    {
+        String statement = (String) ctx.get(this.statementKey) ;
+        Session session = CommandHelper.getSession(ctx);
+        Query query = session.getWorkspace().getQueryManager()
+            .createQuery(statement, this.getLanguage());
+        QueryResult result = query.execute();
+        ctx.put(destKey, result.getNodes());
+        return false;
+    }
+
+    /**
+     * Query language
+     * 
+     * @return
+     */
+    protected abstract String getLanguage();
+
+    /**
+     * @return Returns the statementKey.
+     */
+    public String getStatementKey()
+    {
+        return statementKey;
+    }
+
+    /**
+     * @param statementKey
+     *            Set the context attribute key for the statement attribute.
+     */
+    public void setStatementKey(String statementKey)
+    {
+        this.statementKey = statementKey;
+    }
+
+    /**
+     * @return Returns the toKey.
+     */
+    public String getDestKey()
+    {
+        return destKey;
+    }
+
+    /**
+     * @param toKey
+     *            Set the context attribute key for the to attribute.
+     */
+    public void setDestKey(String toKey)
+    {
+        this.destKey = toKey;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/SQLQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/SQLQuery.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/SQLQuery.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/SQLQuery.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,30 @@
+/*
+ * 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.command.query;
+
+
+/**
+ * SQL query
+ */
+public class SQLQuery extends AbstractQuery
+{
+
+    protected String getLanguage()
+    {
+        return javax.jcr.query.Query.SQL;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/XPathQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/XPathQuery.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/XPathQuery.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/query/XPathQuery.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,30 @@
+/*
+ * 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.command.query;
+
+
+/**
+ * XPath query
+ */
+public class XPathQuery extends AbstractQuery
+{
+
+    protected String getLanguage()
+    {
+        return javax.jcr.query.Query.XPATH;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/resources.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/resources.properties?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/resources.properties (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/resources.properties Tue Oct  4 13:51:32 2005
@@ -0,0 +1,249 @@
+
+cmd.addlocktoken                   = add the given lock token to the current session
+cmd.addlocktoken.token             = lock token
+cmd.addlocktoken.token.desc        = the lock token empowers the active session to alter the nodes to which the lock applies
+cmd.addmixin                       = add a mixin node type to the given node
+cmd.addmixin.mixin                 = mixin name
+cmd.addmixin.mixin.desc            = a mixin node type name
+cmd.addmixin.path                  = path
+cmd.addmixin.path.desc             = path to the given node
+cmd.addnode                        = add a node to the gven node
+cmd.addversionlabel                = Adds the specified label to the specified version.
+cmd.addversionlabel.label          = label
+cmd.addversionlabel.label.desc     = label to add
+cmd.addversionlabel.moveLabel      = 
+cmd.addversionlabel.moveLabel.desc = If the specified label is already assigned to a version in this history and moveLabel is true then the label is removed from its current location and added to the version with the specified versionName.
+cmd.addversionlabel.version        = version
+cmd.addversionlabel.version.desc   = the version name on which the label will be applied
+cmd.cat                            = Display the content of a property, or the content of a node of type nt:file or nt:resource.
+cmd.checkin                        = check in the ginven versionable node
+cmd.checkout                       = checkout the given versionable node
+cmd.clearworkspace                 = Clear the Workspace by removing all the nodes and properties.
+cmd.clone                          = clone the given node
+cmd.clone.destAbsPath              = absolute path
+cmd.clone.destAbsPath.desc         = absolute path to the destination node
+cmd.clone.removeExisting           = boolean
+cmd.clone.removeExisting.desc      = remove node if present at the destination path
+cmd.clone.srcAbsPath               = absolute path
+cmd.clone.srcAbsPath.desc          = source node
+cmd.connect                        = Connect to a remote repository through jcr-rmi
+cmd.connect.url                    = url
+cmd.connect.url.desc               = String with the url where a jcr-rmi server instance is running
+cmd.copy                           = copy a node
+cmd.copy.destAbsPath               = path
+cmd.copy.destAbsPath.desc          = absolute path to the destination
+cmd.copy.fromWorkspace             = name
+cmd.copy.fromWorkspace.desc        = workspace name
+cmd.copy.srcAbsPath                = path
+cmd.copy.srcAbsPath.desc           = absolute path to the source node
+cmd.createworkspace                = create a workspace
+cmd.createworkspace.name           = name
+cmd.createworkspace.name.desc      = workspace name
+cmd.currentnode                    = Change the current working node to the given path
+cmd.dump                           = Dump stored data from the current working node
+cmd.exportdocview                  = Serialize the node to the given file using the document view format
+cmd.exportfilesystem               = Export node of type nt:file and nt:folder to the file system.
+cmd.exportproperty                 = Export the given property to the file system
+cmd.exportsysview                  = Serialize the node to the given file using the system view format
+cmd.help                           = Show available commands. If a command is specified it will show the command description, usage and parameters details.
+cmd.help.command                   = name
+cmd.help.command.desc              = name of the command to describe
+cmd.importfilesystem               = importxml.uuidBehaviour=uuid creation behaviour
+cmd.importxml                      = Import the given xml file either in system or documen view to the repository
+cmd.lock                           = lock the given node
+cmd.lock.deep.desc                 = A deep lock applies to its holding node and all its descendants.
+cmd.lock.session.desc              = session scoped locks expire with the session
+cmd.login                          = login to the current repository.
+cmd.login.password.desc            = password  [default = anonymous]
+cmd.login.user.desc                = registered user name [default=anonymous]
+cmd.login.workspace.desc           = workspace
+cmd.logout                         = logout from the current repository.
+cmd.lscollect                      = List collected items under the current node
+cmd.lscollectnodes                 = List collected nodes under the current node
+cmd.lscollectproperties            = List collected properties under the current node
+cmd.lsitems                        = Lists nodes and properties under the current node
+cmd.lsnodes                        = List nodes under the current node
+cmd.lsnodes.hasLock                = Show whether the current working node has a lock
+cmd.lsnodes.l                      = Show whether the current working node is lockable
+cmd.lsnodes.locked                 = Show whether the current working node is locked
+cmd.lsnodes.locktoken              = token
+cmd.lsnodes.locktoken.desc         = lock token
+cmd.lsnodes.m                      = Show the full list o mixin that apply to the current working node
+cmd.lsnodes.mod                    = Show whether the current working node is modified
+cmd.lsnodes.new                    = Show whether the current working node is new
+cmd.lsnodes.nsize                  = Show the number of nodes under the current working node
+cmd.lsnodes.path                   = Show the full path to the node
+cmd.lsnodes.psize                  = Show the number of properties under the current working node
+cmd.lsnodes.r                      = Show whether the current working node is referenceable
+cmd.lsnodes.rsize                  = Show the number of references that point to the current working node
+cmd.lsnodes.uuid                   = uuid
+cmd.lsnodes.v                      = Show whether the current working node is versionable
+cmd.lsproperties                   = List properties under the current node
+cmd.lsreferences                   = List references to the given node.
+cmd.lsversions                     = list versions of the given node
+cmd.merge                          = merge versions
+cmd.merge.bestEffort.desc          = merge best effort
+cmd.move                           = move a node
+cmd.move.from                      = source, absolute or relative path
+cmd.move.to                        = destination, only absolute path
+cmd.orderbefore                    = order value1 before value2
+cmd.refresh                        = Refresh the session to reflect the current saved state.
+cmd.refresh.keepChanges            = keep or discard the changes flag
+cmd.refreshlock                    = refresh the lock
+cmd.registernamespace              = register a namespace
+cmd.removeitem                     = Remove the item at the given path.
+cmd.removeitems                    = Remove any item under the current working node that match the given name pattern.
+cmd.removelocktoken                = remove the lock token from the session
+cmd.removemixin                    = Remove a mixin from the given node
+cmd.removeversion                  = remove the version for the given name
+cmd.removeversionbylabel           = remove the version for the given label
+cmd.removeversionlabel             = remove the label from the version history
+cmd.rename                         = rename the child node with the given name
+cmd.rename.from                    = source node
+cmd.rename.to                      = destination node
+cmd.restore                        = restore the node to the state of the given version
+cmd.restorebylabel                 = restore the node to the state of the version with the given label
+cmd.save                           = Save the current session
+cmd.setmultivalueproperty          = Set a multivalue property.
+cmd.setmultivalueproperty.regExp   = Regular expression used to split the value into tokens.
+cmd.setproperty                    = Set the given value to the property.
+cmd.setproperty.name               = property name
+cmd.setproperty.type               = property type. Default is String.
+cmd.setproperty.value              = property value
+cmd.setpropertyfromfile            = Set the property's value with the content of the given path.
+cmd.setpropertyfromfile.path       = path to the file
+cmd.source                         = source
+cmd.sqlquery                       = SQL query
+cmd.sqlquery.statement             = SQL statement
+cmd.sqlquery.target                = target variables to store the nodes included in te query result
+cmd.startjackrabbit                = Start a local Jackrabbit instance
+cmd.startjackrabbit.config         = Repository config file, usually called repository.xml
+cmd.startjackrabbit.home           = Repository location
+cmd.stopjackrabbit                 = Stop the Jackrabbit instance in use
+cmd.unlock                         = unlock the given node
+cmd.xpathquery                     = xpath query
+cmd.xpathquery.statement           = statement
+
+common.exportview.from       = Source node
+common.exportview.noRecurse  = if it's true it doesn't include the child nodes
+common.exportview.skipBinary = if it's true the binary properties will be serialized as if they are empty
+common.exportview.to         = Target file where the xml view will be stored
+common.fspath                = path
+common.fspath.desc           = file system path
+common.index                 = index of the value to show
+common.index.desc            = The indexing is based on the order in which child nodes are\r\nreturned in the iterator acquired through Node.getNodes().
+common.jcrabspath            = jcr absolute path
+common.jcrabspath.desc       = a path string representing the absolute path in the current workspace.
+common.jcrname               = jcr name
+common.jcrname.desc          = a valid jcr item name
+common.jcrpath               = jcr path
+common.jcrpath.desc          = a path string representing either a relative or absolute path in the current workspace.
+common.jcrrelpath            = jcr relative path
+common.jcrrelpath.desc       = a path string representing the relative path in the current workspace.
+common.namepattern           = pattern
+common.namepattern.desc      = name pattern
+common.nodetype              = node type
+common.nodetype.desc         = valid node type name
+common.source                = source
+common.uuidBehaviour         = int
+common.uuidBehaviour.desc    = The flag uuidBehavior governs how the UUIDs of incoming (deserialized) nodes are handled.
+
+exception = exception
+
+exception.alias.already.in.use              = Alias "{0}" already in use.
+exception.already.logged.in                 = You are already logged in. Please logout.
+exception.cat.unsupported.type              = Unsupported type to display contents "{0}".
+exception.file.exists                       = File already exists. {0}.
+exception.file.not.created                  = The file was not created. {0}.
+exception.file.not.found                    = File not found. {0}.
+exception.folder.not.created                = The folder was not created. {0}.
+exception.fspath.is.null                    = The file system path is unset.
+exception.illegalargument                   = illegal argument
+exception.illegalargument.no.iterator.under = Illegal argument. There is no iterator under {0}.
+exception.illegalargument.not.a.command     = Illegal argument. "{0}" is not a command.
+exception.illegalargument.null              = Null arguments are illegal.
+exception.jackrabbit.command                = jackrabbit specific command
+exception.no.command.for.name               = No Command for name "{0}".
+exception.no.current.node                   = The current working node isn't set. Please start a jcr implementation before trying to get the current working node.
+exception.not.file.or.folder                = The given node is not nt:file nor nt:folder. {0}.
+exception.occurred                          = an exception occurred
+exception.only.absolute.path                = only absolute paths are allowed
+exception.parse.input.empty                 = input is empty
+exception.repository.not.in.context         = The repository can't be found in the application context. You need to start a jcr implementation before trying to login.
+exception.unabletoinit                      = Unable to init
+
+phrase.commandlist        = command list
+phrase.commandreference   = command reference
+phrase.display.stacktrace = display stack trace
+phrase.elapsedtime        = elapsed time
+phrase.haslock            = has lock
+phrase.jackrabbit.command = jackrabbit specific command
+phrase.keepchanges        = keep changes
+phrase.locktoken          = lock token
+phrase.maxitems           = max number of items to show
+phrase.not.available      = not available
+phrase.not.connected      = not connected
+phrase.not.logged.in      = not logged in
+phrase.regexp             = regular expression
+phrase.removeExisting     = remove existing
+
+word.alias         = alias
+word.argument      = argument
+word.arguments     = arguments
+word.boolean       = boolean
+word.classname     = class name
+word.commandname   = command name
+word.commands      = commands
+word.default       = default
+word.depth         = depth
+word.description   = description
+word.destination   = destination
+word.elapsedtime   = elapsed time
+word.flag          = flag
+word.flags         = flags
+word.folder        = folder
+word.from          = from
+word.in            = in
+word.int           = int
+word.label         = label
+word.labels        = labels
+word.length        = length
+word.listed        = listed
+word.lockable      = lockable
+word.locked        = locked
+word.locktoken     = lock token
+word.message       = message
+word.mixin         = mixin
+word.modified      = modified
+word.multiple      = multiple
+word.name          = name
+word.new           = new
+word.node          = node
+word.nodes         = nodes
+word.nodetype      = node type
+word.options       = options
+word.overview      = overview
+word.overwrite     = overwrite
+word.password      = password
+word.pattern       = pattern
+word.prefix        = prefix
+word.preview       = preview
+word.properties    = properties
+word.property      = property
+word.referenceable = referenceable
+word.references    = references
+word.required      = required
+word.running       = running
+word.savenode      = Save the current working node
+word.source        = source
+word.stmt          = statement
+word.total         = total
+word.type          = type
+word.uri           = uri
+word.usage         = usage
+word.user          = user
+word.value         = value
+word.version       = version
+word.versionable   = versionable
+word.versions      = versions
+word.welcome       = welcome

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/AddVersionLabel.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/AddVersionLabel.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/AddVersionLabel.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/AddVersionLabel.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,133 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Adds a label to the given version
+ */
+public class AddVersionLabel implements Command
+{
+	/** logger */
+	private static Log log = LogFactory.getLog(AddVersionLabel.class);
+
+	// ---------------------------- < keys >
+	/** node path */
+	private String pathKey = "path";
+
+	/** version name key */
+	private String versionKey = "version";
+
+	/** version label key */
+	private String labelKey = "label";
+
+	/** move label key */
+	private String moveLabelKey = "moveLabel";
+
+	/**
+	 * @inheritDoc
+	 */
+	public boolean execute(Context ctx) throws Exception
+	{
+		String path = (String) ctx.get(this.pathKey);
+		String versionName = (String) ctx.get(this.versionKey);
+		boolean moveLabel = Boolean
+				.valueOf((String) ctx.get(this.moveLabelKey)).booleanValue();
+		String versionLabel = (String) ctx.get(this.labelKey);
+		if (log.isDebugEnabled())
+		{
+			log.debug("Add label " + versionLabel + " to version  "
+					+ versionName + " of node at " + path);
+		}
+		CommandHelper.getNode(ctx, path).getVersionHistory().addVersionLabel(
+				versionName, versionLabel, moveLabel);
+		return false;
+	}
+
+	/**
+	 * @return Returns the moveLabelKey.
+	 */
+	public String getMoveLabelKey()
+	{
+		return moveLabelKey;
+	}
+
+	/**
+	 * @param moveLabelKey
+	 *            The moveLabelKey to set.
+	 */
+	public void setMoveLabelKey(String moveLabelKey)
+	{
+		this.moveLabelKey = moveLabelKey;
+	}
+
+	/**
+	 * @return Returns the pathKey.
+	 */
+	public String getPathKey()
+	{
+		return pathKey;
+	}
+
+	/**
+	 * @param pathKey
+	 *            The pathKey to set.
+	 */
+	public void setPathKey(String pathKey)
+	{
+		this.pathKey = pathKey;
+	}
+
+	/**
+	 * @return Returns the versionLabelKey.
+	 */
+	public String getLabelKey()
+	{
+		return labelKey;
+	}
+
+	/**
+	 * @param versionLabelKey
+	 *            The versionLabelKey to set.
+	 */
+	public void setLabelKey(String versionLabelKey)
+	{
+		this.labelKey = versionLabelKey;
+	}
+
+	/**
+	 * @return Returns the versionNameKey.
+	 */
+	public String getVersionKey()
+	{
+		return versionKey;
+	}
+
+	/**
+	 * @param versionNameKey
+	 *            The versionNameKey to set.
+	 */
+	public void setVersionKey(String versionNameKey)
+	{
+		this.versionKey = versionNameKey;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkin.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkin.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkin.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkin.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,67 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Creates a new version
+ */
+public class Checkin implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(Checkin.class);
+
+    // ---------------------------- < keys >
+    /** node path */
+    private String pathKey = "path";
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String path = (String) ctx.get(this.pathKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("cheking in node at " + path);
+        }
+        CommandHelper.getNode(ctx, path).checkin();
+        return false;
+    }
+
+    /**
+     * @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/command/version/Checkin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkout.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkout.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkout.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Checkout.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,67 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Checkout a node
+ */
+public class Checkout implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(Checkout.class);
+
+    // ---------------------------- < keys >
+    /** node path */
+    private String pathKey = "path";
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String path = (String) ctx.get(this.pathKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("cheking out node at " + path);
+        }
+        CommandHelper.getNode(ctx, path).checkout();
+        return false;
+    }
+
+    /**
+     * @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/command/version/Checkout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Merge.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Merge.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Merge.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Merge.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,111 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Merge
+ */
+public class Merge implements Command
+{
+	/** logger */
+	private static Log log = LogFactory.getLog(Merge.class);
+
+	// ---------------------------- < keys >
+	/** node path */
+	private String pathKey = "path";
+
+	/** source workspace key */
+	private String srcWorkspaceKey = "srcWorkspace";
+
+	/** best effort key */
+	private String bestEffortKey = "bestEffort";
+
+	/**
+	 * @inheritDoc
+	 */
+	public boolean execute(Context ctx) throws Exception
+	{
+		String path = (String) ctx.get(this.pathKey);
+		String srcWorkspace = (String) ctx.get(this.srcWorkspaceKey);
+		boolean bestEffort = Boolean.valueOf(
+				(String) ctx.get(this.bestEffortKey)).booleanValue();
+		if (log.isDebugEnabled())
+		{
+			log.debug("merging node at " + path + " from workspace "
+					+ srcWorkspace + " besteffort=" + bestEffort);
+		}
+		CommandHelper.getNode(ctx, path).merge(srcWorkspace, bestEffort);
+		return false;
+	}
+
+	/**
+	 * @return Returns the bestEffortKey.
+	 */
+	public String getBestEffortKey()
+	{
+		return bestEffortKey;
+	}
+
+	/**
+	 * @param bestEffortKey
+	 *            The bestEffortKey to set.
+	 */
+	public void setBestEffortKey(String bestEffortKey)
+	{
+		this.bestEffortKey = bestEffortKey;
+	}
+
+	/**
+	 * @return Returns the pathKey.
+	 */
+	public String getPathKey()
+	{
+		return pathKey;
+	}
+
+	/**
+	 * @param pathKey
+	 *            The pathKey to set.
+	 */
+	public void setPathKey(String pathKey)
+	{
+		this.pathKey = pathKey;
+	}
+
+	/**
+	 * @return Returns the srcWorkspaceKey.
+	 */
+	public String getSrcWorkspaceKey()
+	{
+		return srcWorkspaceKey;
+	}
+
+	/**
+	 * @param srcWorkspaceKey
+	 *            The srcWorkspaceKey to set.
+	 */
+	public void setSrcWorkspaceKey(String srcWorkspaceKey)
+	{
+		this.srcWorkspaceKey = srcWorkspaceKey;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersion.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersion.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersion.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersion.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,89 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * remove a version from the versio history
+ */
+public class RemoveVersion implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(RemoveVersion.class);
+
+    // ---------------------------- < keys >
+    /** node path */
+    private String pathKey = "path";
+
+    /** version label key */
+    private String nameKey = "name";
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String path = (String) ctx.get(this.pathKey);
+        String versionName = (String) ctx.get(this.nameKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("Remove version " + versionName + " from node " + path);
+        }
+        CommandHelper.getNode(ctx, path).getVersionHistory().removeVersion(
+            versionName);
+        return false;
+    }
+
+    /**
+     * @return Returns the pathKey.
+     */
+    public String getPathKey()
+    {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *            The pathKey to set.
+     */
+    public void setPathKey(String pathKey)
+    {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return Returns the versionNameKey.
+     */
+    public String getNameKey()
+    {
+        return nameKey;
+    }
+
+    /**
+     * @param versionNameKey
+     *            The versionNameKey to set.
+     */
+    public void setNameKey(String versionNameKey)
+    {
+        this.nameKey = versionNameKey;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionByLabel.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionByLabel.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionByLabel.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionByLabel.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,95 @@
+/*
+ * 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.command.version;
+
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionHistory;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * remove a version from the versio history
+ */
+public class RemoveVersionByLabel implements Command
+{
+	/** logger */
+	private static Log log = LogFactory.getLog(RemoveVersionByLabel.class);
+
+	// ---------------------------- < keys >
+	/** node path */
+	private String pathKey = "path";
+
+	/** version label key */
+	private String labelKey = "label";
+
+	/**
+	 * @inheritDoc
+	 */
+	public boolean execute(Context ctx) throws Exception
+	{
+		String path = (String) ctx.get(this.pathKey);
+		String label = (String) ctx.get(this.labelKey);
+		if (log.isDebugEnabled())
+		{
+			log.debug("Remove version with label " + label + " from node "
+					+ path);
+		}
+		VersionHistory vh = CommandHelper.getNode(ctx, path)
+				.getVersionHistory();
+		Version v = vh.getVersionByLabel(label);
+		vh.removeVersion(v.getName());
+		return false;
+	}
+
+	/**
+	 * @return Returns the pathKey.
+	 */
+	public String getPathKey()
+	{
+		return pathKey;
+	}
+
+	/**
+	 * @param pathKey
+	 *            The pathKey to set.
+	 */
+	public void setPathKey(String pathKey)
+	{
+		this.pathKey = pathKey;
+	}
+
+	/**
+	 * @return Returns the versionNameKey.
+	 */
+	public String getLabelKey()
+	{
+		return labelKey;
+	}
+
+	/**
+	 * @param versionNameKey
+	 *            The versionNameKey to set.
+	 */
+	public void setLabelKey(String versionNameKey)
+	{
+		this.labelKey = versionNameKey;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionLabel.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionLabel.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionLabel.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RemoveVersionLabel.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,89 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * remove version label
+ */
+public class RemoveVersionLabel implements Command
+{
+	/** logger */
+	private static Log log = LogFactory.getLog(RemoveVersionLabel.class);
+
+	// ---------------------------- < keys >
+	/** node path */
+	private String pathKey = "path";
+
+	/** version label key */
+	private String labelKey = "label";
+
+	/**
+	 * @inheritDoc
+	 */
+	public boolean execute(Context ctx) throws Exception
+	{
+		String path = (String) ctx.get(this.pathKey);
+		String versionLabel = (String) ctx.get(this.labelKey);
+		if (log.isDebugEnabled())
+		{
+			log.debug("Remove label " + versionLabel + " from node " + path);
+		}
+		CommandHelper.getNode(ctx, path).getVersionHistory()
+				.removeVersionLabel(versionLabel);
+		return false;
+	}
+
+	/**
+	 * @return Returns the pathKey.
+	 */
+	public String getPathKey()
+	{
+		return pathKey;
+	}
+
+	/**
+	 * @param pathKey
+	 *            The pathKey to set.
+	 */
+	public void setPathKey(String pathKey)
+	{
+		this.pathKey = pathKey;
+	}
+
+	/**
+	 * @return Returns the versionLabelKey.
+	 */
+	public String getLabelKey()
+	{
+		return labelKey;
+	}
+
+	/**
+	 * @param versionLabelKey
+	 *            The versionLabelKey to set.
+	 */
+	public void setLabelKey(String versionLabelKey)
+	{
+		this.labelKey = versionLabelKey;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Restore.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Restore.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Restore.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/Restore.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,111 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Restore a node to the given version
+ */
+public class Restore implements Command
+{
+	/** logger */
+	private static Log log = LogFactory.getLog(Restore.class);
+
+	// ---------------------------- < keys >
+	/** node path */
+	private String pathKey = "path";
+
+	/** version name key */
+	private String versionKey = "version";
+
+	/** remove existing node key */
+	private String removeExistingKey = "removeExisting";
+
+	/**
+	 * @inheritDoc
+	 */
+	public boolean execute(Context ctx) throws Exception
+	{
+		String path = (String) ctx.get(this.pathKey);
+		String versionName = (String) ctx.get(this.versionKey);
+		boolean removeExisting = Boolean.valueOf(
+				(String) ctx.get(this.removeExistingKey)).booleanValue();
+		if (log.isDebugEnabled())
+		{
+			log.debug("restoring node at " + path + " to version "
+					+ versionName + " removeexisting=" + removeExisting);
+		}
+		CommandHelper.getNode(ctx, path).restore(versionName, removeExisting);
+		return false;
+	}
+
+	/**
+	 * @return Returns the pathKey.
+	 */
+	public String getPathKey()
+	{
+		return pathKey;
+	}
+
+	/**
+	 * @param pathKey
+	 *            The pathKey to set.
+	 */
+	public void setPathKey(String pathKey)
+	{
+		this.pathKey = pathKey;
+	}
+
+	/**
+	 * @return Returns the removeExistingKey.
+	 */
+	public String getRemoveExistingKey()
+	{
+		return removeExistingKey;
+	}
+
+	/**
+	 * @param removeExistingKey
+	 *            The removeExistingKey to set.
+	 */
+	public void setRemoveExistingKey(String removeExistingKey)
+	{
+		this.removeExistingKey = removeExistingKey;
+	}
+
+	/**
+	 * @return Returns the versionNameKey.
+	 */
+	public String getVersionKey()
+	{
+		return versionKey;
+	}
+
+	/**
+	 * @param versionNameKey
+	 *            The versionNameKey to set.
+	 */
+	public void setVersionKey(String versionNameKey)
+	{
+		this.versionKey = versionNameKey;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RestoreByLabel.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RestoreByLabel.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RestoreByLabel.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/version/RestoreByLabel.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,112 @@
+/*
+ * 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.command.version;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Restore a node to the version with the specified label
+ */
+public class RestoreByLabel implements Command
+{
+	/** logger */
+	private static Log log = LogFactory.getLog(RestoreByLabel.class);
+
+	// ---------------------------- < keys >
+	/** node path */
+	private String pathKey = "path";
+
+	/** version name key */
+	private String labelKey = "label";
+
+	/** remove existing node key */
+	private String removeExistingKey = "removeExisting";
+
+	/**
+	 * @inheritDoc
+	 */
+	public boolean execute(Context ctx) throws Exception
+	{
+		String path = (String) ctx.get(this.pathKey);
+		String versionLabel = (String) ctx.get(this.labelKey);
+		boolean removeExisting = Boolean.valueOf(
+				(String) ctx.get(this.removeExistingKey)).booleanValue();
+		if (log.isDebugEnabled())
+		{
+			log.debug("restoring node at " + path + " to version label "
+					+ versionLabel + " removeexisting=" + removeExisting);
+		}
+		CommandHelper.getNode(ctx, path).restoreByLabel(versionLabel,
+				removeExisting);
+		return false;
+	}
+
+	/**
+	 * @return Returns the pathKey.
+	 */
+	public String getPathKey()
+	{
+		return pathKey;
+	}
+
+	/**
+	 * @param pathKey
+	 *            The pathKey to set.
+	 */
+	public void setPathKey(String pathKey)
+	{
+		this.pathKey = pathKey;
+	}
+
+	/**
+	 * @return Returns the removeExistingKey.
+	 */
+	public String getRemoveExistingKey()
+	{
+		return removeExistingKey;
+	}
+
+	/**
+	 * @param removeExistingKey
+	 *            The removeExistingKey to set.
+	 */
+	public void setRemoveExistingKey(String removeExistingKey)
+	{
+		this.removeExistingKey = removeExistingKey;
+	}
+
+	/**
+	 * @return Returns the versionNameKey.
+	 */
+	public String getLabelKey()
+	{
+		return labelKey;
+	}
+
+	/**
+	 * @param versionNameKey
+	 *            The versionNameKey to set.
+	 */
+	public void setLabelKey(String versionNameKey)
+	{
+		this.labelKey = versionNameKey;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/AbstractExportViewToFile.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/AbstractExportViewToFile.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/AbstractExportViewToFile.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/AbstractExportViewToFile.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,215 @@
+/*
+ * 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.command.xml;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.command.CommandException;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Export the xml view to a file
+ */
+public abstract class AbstractExportViewToFile implements Command
+{
+    /** logger */
+    private static Log log = LogFactory.getLog(AbstractExportViewToFile.class);
+
+    // ---------------------------- < keys >
+    /** from literal */
+    protected String srcAbsPathKey = "srcAbsPath";
+
+    /** target file key */
+    protected String desFsPathKey = "desFsPath";
+
+    /** overwrite flag key */
+    protected String overwriteKey = "overwrite";
+
+    /** skip binary flag key */
+    protected String skipBinaryKey = "skipBinary";
+
+    /** no recurse flag key */
+    protected String noRecurseKey = "noRecurse";
+
+    /**
+     * @return the OutputStream for the given file
+     * @throws CommandException
+     * @throws IOException
+     */
+    protected OutputStream getOutputStream(Context ctx)
+            throws CommandException, IOException
+    {
+        String to = (String) ctx.get(this.desFsPathKey);
+        boolean overwrite = Boolean
+            .valueOf((String) ctx.get(this.overwriteKey)).booleanValue();
+        File f = new File(to);
+
+        if (f.exists() && !overwrite)
+        {
+            throw new CommandException("exception.file.exists", new String[]
+            {
+                to
+            });
+        }
+
+        if (!f.exists())
+        {
+            f.createNewFile();
+        }
+
+        BufferedOutputStream out = new BufferedOutputStream(
+            new FileOutputStream(f));
+
+        return out;
+    }
+
+    /**
+     * @return Returns the noRecurseKey.
+     */
+    public String getNoRecurseKey()
+    {
+        return noRecurseKey;
+    }
+
+    /**
+     * @param noRecurseKey
+     *            Set the context attribute key for the noRecurse attribute.
+     */
+    public void setNoRecurseKey(String noRecurseKey)
+    {
+        this.noRecurseKey = noRecurseKey;
+    }
+
+    /**
+     * @return Returns the overwriteKey.
+     */
+    public String getOverwriteKey()
+    {
+        return overwriteKey;
+    }
+
+    /**
+     * @param overwriteKey
+     *            Set the context attribute key for the overwrite attribute.
+     */
+    public void setOverwriteKey(String overwriteKey)
+    {
+        this.overwriteKey = overwriteKey;
+    }
+
+    /**
+     * @return Returns the skipBinaryKey.
+     */
+    public String getSkipBinaryKey()
+    {
+        return skipBinaryKey;
+    }
+
+    /**
+     * @param skipBinaryKey
+     *            Set the context attribute key for the skipBinary attribute.
+     */
+    public void setSkipBinaryKey(String skipBinaryKey)
+    {
+        this.skipBinaryKey = skipBinaryKey;
+    }
+
+    /**
+     * @return Returns the fromKey.
+     */
+    public String getSrcAbsPathKey()
+    {
+        return srcAbsPathKey;
+    }
+
+    /**
+     * @param fromKey
+     *            The fromKey to set.
+     */
+    public void setSrcAbsPathKey(String fromKey)
+    {
+        this.srcAbsPathKey = fromKey;
+    }
+
+    /**
+     * @return Returns the toKey.
+     */
+    public String getDesFsPathKey()
+    {
+        return desFsPathKey;
+    }
+
+    /**
+     * @param toKey
+     *            The toKey to set.
+     */
+    public void setDesFsPathKey(String toKey)
+    {
+        this.desFsPathKey = toKey;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public final boolean execute(Context ctx) throws Exception
+    {
+        boolean skipBinary = Boolean.valueOf(
+            (String) ctx.get(this.skipBinaryKey)).booleanValue();
+        boolean noRecurse = Boolean
+            .valueOf((String) ctx.get(this.noRecurseKey)).booleanValue();
+        String fromStr = (String) ctx.get(this.srcAbsPathKey);
+        if (log.isDebugEnabled())
+        {
+            log.debug("exporting view from " + fromStr);
+        }
+        Node from = CommandHelper.getNode(ctx, fromStr);
+        OutputStream out = getOutputStream(ctx);
+        exportView(from, out, skipBinary, noRecurse);
+        out.close();
+        return false;
+    }
+
+    /**
+     * Export the view to the given OutputStream
+     * 
+     * @param node
+     * @param out
+     * @param skipBinary
+     * @param noRecurse
+     * @throws RepositoryException
+     * @throws IOException
+     * @throws PathNotFoundException
+     */
+    protected abstract void exportView(
+        Node node,
+        OutputStream out,
+        boolean skipBinary,
+        boolean noRecurse) throws PathNotFoundException, IOException,
+            RepositoryException;
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportDocViewToFile.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportDocViewToFile.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportDocViewToFile.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportDocViewToFile.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,23 @@
+package org.apache.jackrabbit.command.xml;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+/**
+ * Serializes the node to the given file using the Document View Format
+ */
+public class ExportDocViewToFile extends AbstractExportViewToFile
+{
+
+	protected void exportView(Node node, OutputStream out, boolean skipBinary,
+			boolean noRecurse) throws PathNotFoundException, IOException,
+			RepositoryException
+	{
+		node.getSession().exportDocumentView(node.getPath(), out, skipBinary,
+				noRecurse);
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportSysViewToFile.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportSysViewToFile.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportSysViewToFile.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ExportSysViewToFile.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,27 @@
+package org.apache.jackrabbit.command.xml;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+/**
+ * Serializes the node to the given file using the System View Format
+ */
+public class ExportSysViewToFile extends AbstractExportViewToFile
+{
+
+	/**
+	 * @inheritDoc
+	 */
+	protected void exportView(Node node, OutputStream out, boolean skipBinary,
+			boolean noRecurse) throws PathNotFoundException, IOException,
+			RepositoryException
+	{
+		node.getSession().exportSystemView(node.getPath(), out, skipBinary,
+				noRecurse);
+	}
+
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ImportXmlFromFile.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ImportXmlFromFile.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ImportXmlFromFile.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/command/xml/ImportXmlFromFile.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,122 @@
+/*
+ * 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.command.xml;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.command.CommandException;
+import org.apache.jackrabbit.command.CommandHelper;
+
+/**
+ * Imports the xml view from the given file to the current working node.
+ */
+public class ImportXmlFromFile implements Command
+{
+
+    // ---------------------------- < keys >
+
+    /** doc view file key */
+    private String srcFsPathKey = "srcFsPath";
+
+    /** target node */
+    private String destJcrPathKey = "destJcrPath";
+
+    /** uuid behaviour key */
+    private String uuidBehaviourKey = "uuidBehaviour";
+
+    /**
+     * @inheritDoc
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        String file = (String) ctx.get(this.srcFsPathKey);
+        String dest = (String) ctx.get(this.destJcrPathKey);
+        int uuidBehaviour = Integer.valueOf(
+            (String) ctx.get(this.uuidBehaviourKey)).intValue();
+        File f = new File(file);
+        if (!f.exists())
+        {
+            throw new CommandException("exception.file.not.found", new String[]
+            {
+                file
+            });
+        }
+        BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
+        Session s = CommandHelper.getSession(ctx);
+        Node n = CommandHelper.getNode(ctx, dest);
+        s.importXML(n.getPath(), in, uuidBehaviour);
+        return false;
+    }
+
+    /**
+     * @return Returns the fromKey.
+     */
+    public String getSrcFsPathKey()
+    {
+        return srcFsPathKey;
+    }
+
+    /**
+     * @param fromKey
+     *            Set the context attribute key for the from attribute.
+     */
+    public void setSrcFsPathKey(String fromKey)
+    {
+        this.srcFsPathKey = fromKey;
+    }
+
+    /**
+     * @return Returns the uuidBehaviourKey.
+     */
+    public String getUuidBehaviourKey()
+    {
+        return uuidBehaviourKey;
+    }
+
+    /**
+     * @param uuidBehaviourKey
+     *            Set the context attribute key for the uuidBehaviour attribute.
+     */
+    public void setUuidBehaviourKey(String uuidBehaviourKey)
+    {
+        this.uuidBehaviourKey = uuidBehaviourKey;
+    }
+
+    /**
+     * @return Returns the destJcrPathKey.
+     */
+    public String getDestJcrPathKey()
+    {
+        return destJcrPathKey;
+    }
+
+    /**
+     * @param destJcrPathKey
+     *            The destJcrPathKey to set.
+     */
+    public void setDestJcrPathKey(String destJcrPathKey)
+    {
+        this.destJcrPathKey = destJcrPathKey;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/log4j.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/log4j.properties?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/log4j.properties (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/log4j.properties Tue Oct  4 13:51:32 2005
@@ -0,0 +1,13 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=ERROR, stdout
+#log4j.rootLogger=DEBUG, stdout, file
+#log4j.rootLogger=ERROR, stdout, file
+
+log4j.logger.org.apache.jackrabbit.command=INFO
+
+# 'stdout' is set to be a ConsoleAppender.
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+
+# 'stdout' uses PatternLayout
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/org/apache/jackrabbit/command/cli/CliTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/org/apache/jackrabbit/command/cli/CliTest.java?rev=294914&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/org/apache/jackrabbit/command/cli/CliTest.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/test/org/apache/jackrabbit/command/cli/CliTest.java Tue Oct  4 13:51:32 2005
@@ -0,0 +1,99 @@
+/*
+ * 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.command.cli;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.Chain;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.config.ConfigParser;
+import org.apache.commons.chain.impl.CatalogFactoryBase;
+import org.apache.jackrabbit.command.CommandException;
+
+import junit.framework.TestCase;
+
+public class CliTest extends TestCase
+{
+	static
+	{
+		try
+		{
+			ConfigParser parser = new ConfigParser();
+			parser.parse(CommandLine.class.getResource("command.xml"));
+		} catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+
+	/** catalog */
+	protected Catalog catalog = CatalogFactoryBase.getInstance().getCatalog();
+
+	public void testCommandExist() throws CommandException
+	{
+		Iterator iter = CommandLineFactory.getInstance().getCommandLines()
+				.iterator();
+		while (iter.hasNext())
+		{
+			CommandLine cl = (CommandLine) iter.next();
+			String impl = cl.getImpl();
+			if (impl == null)
+			{
+				impl = cl.getName();
+			}
+			assertTrue(impl + " not found", catalog.getCommand(impl) != null);
+		}
+	}
+
+	public void testArgumentsExist() throws CommandException,
+			IllegalAccessException, InvocationTargetException,
+			NoSuchMethodException
+	{
+		Iterator iter = CommandLineFactory.getInstance().getCommandLines()
+				.iterator();
+		while (iter.hasNext())
+		{
+			CommandLine cl = (CommandLine) iter.next();
+			String impl = cl.getImpl();
+			if (impl == null)
+			{
+				impl = cl.getName();
+			}
+			Command cmd = catalog.getCommand(impl);
+			// don't test chain
+			if (!(cmd instanceof Chain))
+			{
+				Map props = BeanUtils.describe(cmd);
+				Iterator params = cl.getAllParameters();
+				while (params.hasNext())
+				{
+					AbstractParameter param = (AbstractParameter) params.next();
+					if (!props.containsValue(param.getContextKey()))
+					{
+						fail("Command: " + cl.getName() + ". Param "
+								+ param.getContextKey() + " not found");
+					}
+				}
+			}
+		}
+	}
+
+}

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



Mime
View raw message