jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r1855719 [5/6] - in /jackrabbit/trunk: ./ jackrabbit-standalone-components/ jackrabbit-standalone-components/src/ jackrabbit-standalone-components/src/main/ jackrabbit-standalone-components/src/main/java/ jackrabbit-standalone-components/sr...
Date Sun, 17 Mar 2019 21:44:47 GMT
Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Lock.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Lock.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Lock.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Lock.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Lock the given <code>Node</code>
+ */
+public class Lock implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(Lock.class);
+
+    // ---------------------------- < keys >
+    /** Node path key */
+    private String pathKey = "path";
+
+    /**
+     * depth lock
+     */
+    private String deepKey = "deep";
+
+    /**
+     * Session scoped lock <br>
+     * Key that refers to a <code>Boolean</code> context variable
+     */
+    private String sessionScopedKey = "sessionScoped";
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean execute(Context ctx) throws Exception {
+        String path = (String) ctx.get(this.pathKey);
+        boolean deep = Boolean.valueOf((String) ctx.get(this.deepKey))
+            .booleanValue();
+        boolean sessionScoped = Boolean.valueOf(
+            (String) ctx.get(this.sessionScopedKey)).booleanValue();
+        if (log.isDebugEnabled()) {
+            log.debug("locking node at " + path + " deep=" + deep
+                    + " sessionScoped=" + sessionScoped);
+        }
+        CommandHelper.getNode(ctx, path).lock(deep, sessionScoped);
+        return false;
+    }
+
+    /**
+     * @return deep key
+     */
+    public String getDeepKey() {
+        return deepKey;
+    }
+
+    /**
+     * @param deepKey
+     *        deep key to set
+     */
+    public void setDeepKey(String deepKey) {
+        this.deepKey = deepKey;
+    }
+
+    /**
+     * @return the session scoped key
+     */
+    public String getSessionScopedKey() {
+        return sessionScopedKey;
+    }
+
+    /**
+     * @param sessionScopedKey
+     *        the session scoped key to set
+     */
+    public void setSessionScopedKey(String sessionScopedKey) {
+        this.sessionScopedKey = sessionScopedKey;
+    }
+
+    /**
+     * @return the source path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param srcPathKey
+     *        the source path key to set
+     */
+    public void setPathKey(String srcPathKey) {
+        this.pathKey = srcPathKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RefreshLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RefreshLock.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RefreshLock.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RefreshLock.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.lock;
+
+import javax.jcr.Node;
+
+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.standalone.cli.CommandHelper;
+
+/**
+ * Reset the <code>Lock</code> timer
+ */
+public class RefreshLock implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(RefreshLock.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("refreshing lock at " + path);
+        }
+        Node n = CommandHelper.getNode(ctx, path);
+        n.getLock().refresh();
+        return false;
+    }
+
+    /**
+     * @return the source path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param srcPathKey
+     *        the source path key to set
+     */
+    public void setPathKey(String srcPathKey) {
+        this.pathKey = srcPathKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RemoveLockToken.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RemoveLockToken.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RemoveLockToken.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/RemoveLockToken.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.lock;
+
+import javax.jcr.Session;
+
+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.standalone.cli.CommandHelper;
+
+/**
+ * Remove the given <code>Lock</code> token to the current
+ * <code>Session</code>
+ */
+public class RemoveLockToken implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(RemoveLockToken.class);
+
+    // ---------------------------- < keys >
+    /**
+     * token key
+     */
+    private String tokenKey = "token";
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean execute(Context ctx) throws Exception {
+        String token = (String) ctx.get(this.tokenKey);
+        if (log.isDebugEnabled()) {
+            log.debug("Removing lock token " + token
+                    + " from the current session.");
+        }
+        Session s = CommandHelper.getSession(ctx);
+        s.removeLockToken(token);
+        return false;
+    }
+
+    /**
+     * @return the token key
+     */
+    public String getTokenKey() {
+        return tokenKey;
+    }
+
+    /**
+     * @param tokenKey
+     *        the token key to set
+     */
+    public void setTokenKey(String tokenKey) {
+        this.tokenKey = tokenKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Unlock.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Unlock.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Unlock.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/lock/Unlock.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Unlock the current working <code>Node</code>
+ */
+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 the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/AddMixin.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/AddMixin.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/AddMixin.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/AddMixin.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Add a mixin to the given <code>Node</code>
+ */
+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;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/RemoveMixin.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/RemoveMixin.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/RemoveMixin.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/mixin/RemoveMixin.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Remove a mixin from the given <code>Node</code>
+ */
+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 the mixin name key
+     */
+    public String getMixinKey() {
+        return mixinKey;
+    }
+
+    /**
+     * @param mixinNameKey
+     *        the mixin name key to set
+     */
+    public void setMixinKey(String mixinNameKey) {
+        this.mixinKey = mixinNameKey;
+    }
+
+    /**
+     * @return he path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key 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;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/RegisterNamespace.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/RegisterNamespace.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/RegisterNamespace.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/RegisterNamespace.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Register 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 the prefix key.
+     */
+    public String getPrefixKey() {
+        return prefixKey;
+    }
+
+    /**
+     * @param prefixKey
+     *        the prefix key to set
+     */
+    public void setPrefixKey(String prefixKey) {
+        this.prefixKey = prefixKey;
+    }
+
+    /**
+     * @return the uri key
+     */
+    public String getUriKey() {
+        return uriKey;
+    }
+
+    /**
+     * @param uriKey
+     *        the uri key to set
+     */
+    public void setUriKey(String uriKey) {
+        this.uriKey = uriKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/SetNamespacePrefix.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/SetNamespacePrefix.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/SetNamespacePrefix.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/SetNamespacePrefix.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Sets a namespace prefix
+ */
+public class SetNamespacePrefix implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(SetNamespacePrefix.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("setting namespace prefix uri=" + uri + " new prefix=" + prefix);
+        }
+        CommandHelper.getSession(ctx).setNamespacePrefix(prefix, uri);
+        return false;
+    }
+
+    /**
+     * @return the prefix key.
+     */
+    public String getPrefixKey() {
+        return prefixKey;
+    }
+
+    /**
+     * @param prefixKey
+     *        the prefix key to set
+     */
+    public void setPrefixKey(String prefixKey) {
+        this.prefixKey = prefixKey;
+    }
+
+    /**
+     * @return the uri key
+     */
+    public String getUriKey() {
+        return uriKey;
+    }
+
+    /**
+     * @param uriKey
+     *        the uri key to set
+     */
+    public void setUriKey(String uriKey) {
+        this.uriKey = uriKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/UnregisterNamespace.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/UnregisterNamespace.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/UnregisterNamespace.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/namespace/UnregisterNamespace.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.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 the prefix key.
+     */
+    public String getPrefixKey() {
+        return prefixKey;
+    }
+
+    /**
+     * @param prefixKey
+     *        the prefix key to set
+     */
+    public void setPrefixKey(String prefixKey) {
+        this.prefixKey = prefixKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/nodetype/RegisterNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/nodetype/RegisterNodeType.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/nodetype/RegisterNodeType.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/nodetype/RegisterNodeType.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.nodetype;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+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.commons.cnd.CndImporter;
+import org.apache.jackrabbit.standalone.cli.CommandHelper;
+
+/**
+ * Register node types via CND file
+ *
+ */
+public class RegisterNodeType implements Command {
+
+    private static final Log log = LogFactory.getLog(RegisterNodeType.class);
+
+    private final String srcFsPathKey = "srcFsPath";
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+     */
+    public boolean execute(Context context) throws Exception {
+        String path = (String) context.get(srcFsPathKey);
+
+        // Register the custom node types defined in the CND file
+        InputStream is = new FileInputStream(path);
+
+        if (log.isDebugEnabled()) {
+              log.debug("Import CND from path " + path);
+        } 
+        CndImporter.registerNodeTypes(new InputStreamReader(is), CommandHelper.getSession(context));
+        return false;
+    }
+
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/AbstractQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/AbstractQuery.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/AbstractQuery.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/AbstractQuery.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Query the <code>Repository</code> through either SQL or XPATH language.
+ */
+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;
+    }
+
+    /**
+     * @return the query language
+     */
+    protected abstract String getLanguage();
+
+    /**
+     * @return the statement key
+     */
+    public String getStatementKey() {
+        return statementKey;
+    }
+
+    /**
+     * @param statementKey
+     *        the statement key to set
+     */
+    public void setStatementKey(String statementKey) {
+        this.statementKey = statementKey;
+    }
+
+    /**
+     * @return the destination key
+     */
+    public String getDestKey() {
+        return destKey;
+    }
+
+    /**
+     * @param toKey
+     *        the destination key to set
+     */
+    public void setDestKey(String toKey) {
+        this.destKey = toKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/SQLQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/SQLQuery.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/SQLQuery.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/SQLQuery.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.query;
+
+import javax.jcr.query.Query;
+
+/**
+ * SQL <code>Query</code>
+ */
+public class SQLQuery extends AbstractQuery {
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getLanguage() {
+        return Query.SQL;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/XPathQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/XPathQuery.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/XPathQuery.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/query/XPathQuery.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.query;
+
+import javax.jcr.query.Query;
+
+/**
+ * XPath <code>Query</code>
+ */
+public class XPathQuery extends AbstractQuery {
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getLanguage() {
+        return Query.XPATH;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/AddVersionLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/AddVersionLabel.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/AddVersionLabel.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/AddVersionLabel.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Add a label to the given <code>Version</code>
+ */
+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 the move label key
+     */
+    public String getMoveLabelKey() {
+        return moveLabelKey;
+    }
+
+    /**
+     * @param moveLabelKey
+     *        the move label key to set
+     */
+    public void setMoveLabelKey(String moveLabelKey) {
+        this.moveLabelKey = moveLabelKey;
+    }
+
+    /**
+     * @return the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return the version label key
+     */
+    public String getLabelKey() {
+        return labelKey;
+    }
+
+    /**
+     * @param versionLabelKey
+     *        the version label key to set
+     */
+    public void setLabelKey(String versionLabelKey) {
+        this.labelKey = versionLabelKey;
+    }
+
+    /**
+     * @return the version name key
+     */
+    public String getVersionKey() {
+        return versionKey;
+    }
+
+    /**
+     * @param versionNameKey
+     *        the version name key to set
+     */
+    public void setVersionKey(String versionNameKey) {
+        this.versionKey = versionNameKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkin.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkin.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkin.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkin.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.version;
+
+import javax.jcr.version.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.standalone.cli.CommandHelper;
+
+/**
+ * Check in the given versionable <code>Node</code>
+ */
+public class Checkin implements Command {
+    /** logger */
+    private static Log log = LogFactory.getLog(Checkin.class);
+
+    // ---------------------------- < keys >
+    /** node path */
+    private String pathKey = "path";
+    
+    /** target version number **/
+    private String targetVersion = "version";
+
+    /**
+     * {@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);
+        }
+        Version v = CommandHelper.getNode(ctx, path).checkin();
+        ctx.put(this.targetVersion, v.getName()) ;
+        return false;
+    }
+
+    /**
+     * @return the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+	public String getTargetVersion() {
+		return targetVersion;
+	}
+
+	public void setTargetVersion(String targetVersion) {
+		this.targetVersion = targetVersion;
+	}
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkout.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkout.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkout.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Checkout.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Checkout the given versionable <code>Node</code>
+ */
+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 the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Merge.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Merge.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Merge.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Merge.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.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 the best effort key
+     */
+    public String getBestEffortKey() {
+        return bestEffortKey;
+    }
+
+    /**
+     * @param bestEffortKey
+     *        the best effort key to set
+     */
+    public void setBestEffortKey(String bestEffortKey) {
+        this.bestEffortKey = bestEffortKey;
+    }
+
+    /**
+     * @return the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return the source <code>Workspace</code> key
+     */
+    public String getSrcWorkspaceKey() {
+        return srcWorkspaceKey;
+    }
+
+    /**
+     * @param srcWorkspaceKey
+     *        the source <code>Workspace</code> key to set
+     */
+    public void setSrcWorkspaceKey(String srcWorkspaceKey) {
+        this.srcWorkspaceKey = srcWorkspaceKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersion.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersion.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersion.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Remove a <code>Version</code> from the <code>VersionHistory</code>
+ */
+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 the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return the version name key
+     */
+    public String getNameKey() {
+        return nameKey;
+    }
+
+    /**
+     * @param versionNameKey
+     *        the version name key to set
+     */
+    public void setNameKey(String versionNameKey) {
+        this.nameKey = versionNameKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionByLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionByLabel.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionByLabel.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionByLabel.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Remove the <code>Version</code> from the <code>VersionHistory</code> that
+ * match the given label
+ */
+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 the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return the version name key
+     */
+    public String getLabelKey() {
+        return labelKey;
+    }
+
+    /**
+     * @param versionNameKey
+     *        the version name key to set
+     */
+    public void setLabelKey(String versionNameKey) {
+        this.labelKey = versionNameKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionLabel.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionLabel.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RemoveVersionLabel.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Remove a label from the <code>VersionHistory</code>
+ */
+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 path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return the version label key.
+     */
+    public String getLabelKey() {
+        return labelKey;
+    }
+
+    /**
+     * @param versionLabelKey
+     *        the version label key to set
+     */
+    public void setLabelKey(String versionLabelKey) {
+        this.labelKey = versionLabelKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Restore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Restore.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Restore.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/Restore.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Restore a <code>Node</code> to the state of the given <code>Version</code>
+ */
+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 the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return the remove existing key
+     */
+    public String getRemoveExistingKey() {
+        return removeExistingKey;
+    }
+
+    /**
+     * @param removeExistingKey
+     *        the remove existing key to set
+     */
+    public void setRemoveExistingKey(String removeExistingKey) {
+        this.removeExistingKey = removeExistingKey;
+    }
+
+    /**
+     * @return the version name key
+     */
+    public String getVersionKey() {
+        return versionKey;
+    }
+
+    /**
+     * @param versionNameKey
+     *        the version name key to set
+     */
+    public void setVersionKey(String versionNameKey) {
+        this.versionKey = versionNameKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RestoreByLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RestoreByLabel.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RestoreByLabel.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/version/RestoreByLabel.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandHelper;
+
+/**
+ * Restore a <code>Node</code> to the state of the <code>Version</code> 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 the path key
+     */
+    public String getPathKey() {
+        return pathKey;
+    }
+
+    /**
+     * @param pathKey
+     *        the path key to set
+     */
+    public void setPathKey(String pathKey) {
+        this.pathKey = pathKey;
+    }
+
+    /**
+     * @return the remove existing key
+     */
+    public String getRemoveExistingKey() {
+        return removeExistingKey;
+    }
+
+    /**
+     * @param removeExistingKey
+     *        the remove existing key to set
+     */
+    public void setRemoveExistingKey(String removeExistingKey) {
+        this.removeExistingKey = removeExistingKey;
+    }
+
+    /**
+     * @return the version name key
+     */
+    public String getLabelKey() {
+        return labelKey;
+    }
+
+    /**
+     * @param versionNameKey
+     *        the version name key to set
+     */
+    public void setLabelKey(String versionNameKey) {
+        this.labelKey = versionNameKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/AbstractExportViewToFile.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/AbstractExportViewToFile.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/AbstractExportViewToFile.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/AbstractExportViewToFile.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.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.standalone.cli.CommandException;
+import org.apache.jackrabbit.standalone.cli.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 the no recurse key
+     */
+    public String getNoRecurseKey() {
+        return noRecurseKey;
+    }
+
+    /**
+     * @param noRecurseKey
+     *        the no recurse key to set
+     */
+    public void setNoRecurseKey(String noRecurseKey) {
+        this.noRecurseKey = noRecurseKey;
+    }
+
+    /**
+     * @return the overwrite key
+     */
+    public String getOverwriteKey() {
+        return overwriteKey;
+    }
+
+    /**
+     * @param overwriteKey
+     *        the overwrite key to set
+     */
+    public void setOverwriteKey(String overwriteKey) {
+        this.overwriteKey = overwriteKey;
+    }
+
+    /**
+     * @return the skip binary key
+     */
+    public String getSkipBinaryKey() {
+        return skipBinaryKey;
+    }
+
+    /**
+     * @param skipBinaryKey
+     *        the skip binary key to set
+     */
+    public void setSkipBinaryKey(String skipBinaryKey) {
+        this.skipBinaryKey = skipBinaryKey;
+    }
+
+    /**
+     * @return the from key
+     */
+    public String getSrcAbsPathKey() {
+        return srcAbsPathKey;
+    }
+
+    /**
+     * @param fromKey
+     *        the from key to set
+     */
+    public void setSrcAbsPathKey(String fromKey) {
+        this.srcAbsPathKey = fromKey;
+    }
+
+    /**
+     * @return the to key
+     */
+    public String getDesFsPathKey() {
+        return desFsPathKey;
+    }
+
+    /**
+     * @param toKey
+     *        the to key 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
+     *        the <code>Node</code>
+     * @param out
+     *        the <code>OutputStream</code>
+     * @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;
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportDocViewToFile.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportDocViewToFile.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportDocViewToFile.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportDocViewToFile.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.xml;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+/**
+ * Serialize the <code>Node</code> to the given file using the Document View
+ * Format
+ */
+public class ExportDocViewToFile extends AbstractExportViewToFile {
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void exportView(
+        Node node,
+        OutputStream out,
+        boolean skipBinary,
+        boolean noRecurse) throws PathNotFoundException, IOException,
+            RepositoryException {
+        node.getSession().exportDocumentView(node.getPath(), out, skipBinary,
+            noRecurse);
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportSysViewToFile.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportSysViewToFile.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportSysViewToFile.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ExportSysViewToFile.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.xml;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+/**
+ * Serialize the <code>Node</code> 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);
+    }
+
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ImportXmlFromInputStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ImportXmlFromInputStream.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ImportXmlFromInputStream.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/xml/ImportXmlFromInputStream.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.standalone.cli.xml;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.standalone.cli.CommandHelper;
+
+/**
+ * Import the xml view to the target <code>Node</code>
+ */
+public class ImportXmlFromInputStream implements Command {
+
+    // ---------------------------- < keys >
+
+    /** doc view file key */
+    private String inputStreamKey = "inputStream";
+
+    /** flag that indicates whether to use the transient space or not */
+    private String persistentKey = "persistent";
+
+    /** target node */
+    private String destJcrPathKey = "destJcrPath";
+
+    /** uuid behaviour key */
+    private String uuidBehaviourKey = "uuidBehaviour";
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean execute(Context ctx) throws Exception {
+        InputStream is = (InputStream) ctx.get(this.inputStreamKey);
+        String dest = (String) ctx.get(this.destJcrPathKey);
+        String persistent = (String) ctx.get(this.persistentKey);
+
+        int uuidBehaviour = Integer.valueOf(
+                (String) ctx.get(this.uuidBehaviourKey)).intValue();
+
+        BufferedInputStream bis = new BufferedInputStream(is);
+        Session s = CommandHelper.getSession(ctx);
+        Node n = CommandHelper.getNode(ctx, dest);
+
+        if (persistent != null
+                && Boolean.valueOf(persistent).equals(Boolean.TRUE)) {
+            s.getWorkspace().importXML(n.getPath(), bis, uuidBehaviour);
+        } else {
+            s.importXML(n.getPath(), bis, uuidBehaviour);
+        }
+
+        return false;
+    }
+
+    /**
+     * @return the uuidBehaviourKey
+     */
+    public String getUuidBehaviourKey() {
+        return uuidBehaviourKey;
+    }
+
+    /**
+     * @param uuidBehaviourKey
+     *            the uuidBehaviourKey to set
+     */
+    public void setUuidBehaviourKey(String uuidBehaviourKey) {
+        this.uuidBehaviourKey = uuidBehaviourKey;
+    }
+
+    /**
+     * @return the destination jcr path key
+     */
+    public String getDestJcrPathKey() {
+        return destJcrPathKey;
+    }
+
+    /**
+     * @param destJcrPathKey
+     *            the destination jcr path key to set
+     */
+    public void setDestJcrPathKey(String destJcrPathKey) {
+        this.destJcrPathKey = destJcrPathKey;
+    }
+
+    /**
+     * @return the inputStreamKey
+     */
+    public String getInputStreamKey() {
+        return inputStreamKey;
+    }
+
+    /**
+     * @param inputStreamKey
+     *            the inputStreamKey to set
+     */
+    public void setInputStreamKey(String inputStreamKey) {
+        this.inputStreamKey = inputStreamKey;
+    }
+
+    /**
+     * @return the persistentKey
+     */
+    public String getPersistentKey() {
+        return persistentKey;
+    }
+
+    /**
+     * @param persistentKey
+     *            the persistentKey to set
+     */
+    public void setPersistentKey(String persistentKey) {
+        this.persistentKey = persistentKey;
+    }
+}

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/package-info.java?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/package-info.java (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/package-info.java Sun Mar 17 21:44:46 2019
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+/* see JCR-4060 */
+@org.osgi.annotation.versioning.Version("2.13.5")
+package org.apache.jackrabbit.standalone;

Propchange: jackrabbit/trunk/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/package-info.java
------------------------------------------------------------------------------
    svn:executable = *

Added: jackrabbit/trunk/jackrabbit-standalone-components/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-standalone-components/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory?rev=1855719&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-standalone-components/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory (added)
+++ jackrabbit/trunk/jackrabbit-standalone-components/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory Sun Mar 17 21:44:46 2019
@@ -0,0 +1,20 @@
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You 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.
+
+org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory
+org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory
+org.apache.jackrabbit.commons.JndiRepositoryFactory
+org.apache.jackrabbit.core.RepositoryFactoryImpl
+org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory



Mime
View raw message