jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edgarp...@apache.org
Subject svn commit: r208988 [2/3] - in /incubator/jackrabbit/trunk/contrib/jcr-commands: ./ applications/ applications/test/ benchmarking/ jmeter-chain/ jmeter-chain/src/ jmeter-chain/src/java/ jmeter-chain/src/java/org/ jmeter-chain/src/java/org/apache/ jmete...
Date Sun, 03 Jul 2005 22:00:15 GMT
Added: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/checkstyle.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/checkstyle.xml?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/checkstyle.xml (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/checkstyle.xml Sun Jul  3 15:00:10 2005
@@ -0,0 +1,171 @@
+<?xml version="1.0"?>
+<!--
+   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.
+  -->
+  
+<!DOCTYPE module PUBLIC
+    "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+
+<!--
+  Checkstyle checks configured for Maven.
+-->
+
+<module name="Checker">
+
+    <!-- Checks that a package.html file exists for each package.     -->
+    <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
+    <module name="PackageHtml"/>
+
+    <!-- Checks whether files end with a new line.                        -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+    <module name="NewlineAtEndOfFile"/>
+
+    <!-- Checks that property files contain the same keys.         -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+    <module name="Translation"/>
+
+    <module name="TreeWalker">
+
+        <property name="cacheFile" value="${checkstyle.cache.file}"/>
+
+        <!-- ************************************************************** -->
+        <!-- Checks that are different from the sun coding conventions ones -->
+        <!-- ************************************************************** -->
+
+        <module name="Header">
+            <property name="headerFile" value="${basedir}/HEADER.txt"/>
+        </module>
+        <!-- <property name="tabWidth" value="4"/> -->
+        <module name="LeftCurly">
+          <property name="option" value="eol"/>
+        </module>
+        <module name="LineLength">
+          <property name="max" value="132"/>
+          <property name="ignorePattern" value="\* \$"/>
+        </module>
+        <module name="MethodLength">
+          <property name="max" value="175"/>
+        </module>
+        <module name="ConstantName">
+          <property name="format" value="log|^[a-zA-Z][a-zA-Z0-9_]*$"/>
+        </module>
+
+        <!-- ************************************************************** -->
+        <!-- Default Sun coding conventions checks                          -->
+        <!-- ************************************************************** -->
+
+        <!-- Checks for Javadoc comments.                     -->
+        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+        <module name="JavadocMethod"/>
+        <module name="JavadocType"/>
+        <module name="JavadocVariable"/>
+
+        <!-- Checks for Naming Conventions.                  -->
+        <!-- See http://checkstyle.sf.net/config_naming.html -->
+        <module name="LocalFinalVariableName"/>
+        <module name="LocalVariableName"/>
+        <module name="MethodName"/>
+        <module name="PackageName"/>
+        <module name="ParameterName"/>
+        <module name="StaticVariableName"/>
+        <module name="TypeName"/>
+        <module name="MemberName"/>
+
+        <!-- Checks for imports                              -->
+        <!-- See http://checkstyle.sf.net/config_import.html -->
+        <module name="AvoidStarImport"/>
+        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+        <module name="RedundantImport"/>
+        <module name="UnusedImports"/>
+
+
+        <!-- Checks for Size Violations.                    -->
+        <!-- See http://checkstyle.sf.net/config_sizes.html -->
+        <module name="FileLength"/>
+        <module name="ParameterNumber"/>
+
+
+        <!-- Checks for whitespace                               -->
+        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+        <module name="EmptyForIteratorPad"/>
+        <module name="NoWhitespaceAfter"/>
+        <module name="NoWhitespaceBefore"/>
+        <module name="OperatorWrap"/>
+        <module name="TabCharacter"/>
+        <module name="WhitespaceAfter"/>
+        <module name="WhitespaceAround"/>
+
+
+        <!-- Modifier Checks                                    -->
+        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+        <module name="ModifierOrder"/>
+        <module name="RedundantModifier"/>
+
+
+        <!-- Checks for blocks. You know, those {}'s         -->
+        <!-- See http://checkstyle.sf.net/config_blocks.html -->
+        <module name="AvoidNestedBlocks"/>     
+        <module name="NeedBraces"/>
+
+        <!-- Checks for common coding problems               -->
+        <!-- See http://checkstyle.sf.net/config_coding.html -->
+        <!-- <module name="AvoidInlineConditionals"/> -->      <!-- DISABLED-->
+        <module name="DoubleCheckedLocking"/>
+        <module name="EqualsHashCode"/>
+        <module name="IllegalInstantiation"/>
+        <module name="InnerAssignment"/>
+        <module name="MissingSwitchDefault"/>
+        <module name="RedundantThrows">
+            <property name="allowUnchecked" value="true"/>   <!-- DISABLED -->
+            <property name="allowSubclasses" value="true"/>   <!-- DISABLED -->
+        </module>
+        <module name="SimplifyBooleanExpression"/>
+        <module name="SimplifyBooleanReturn"/>
+
+        <!-- Checks for class design                         -->
+        <!-- See http://checkstyle.sf.net/config_design.html -->
+        <module name="DesignForExtension">
+            <property name="severity" value="ignore"/>   <!-- DISABLED -->
+        </module>
+        <module name="HideUtilityClassConstructor"/>
+        <module name="InterfaceIsType"/>
+        <module name="VisibilityModifier">
+            <!-- Protected member variables are widely used in Jackrabbit -->
+            <property name="protectedAllowed" value="true"/>
+        </module>
+
+
+        <!-- Miscellaneous other checks.                   -->
+        <!-- See http://checkstyle.sf.net/config_misc.html -->
+        <module name="ArrayTypeStyle"/>
+        <module name="FinalParameters">
+            <property name="severity" value="ignore"/>   <!-- DISABLED -->
+        </module>
+        <module name="GenericIllegalRegexp">
+            <property name="format" value="\s+$"/>
+            <property name="message" value="Line has trailing spaces."/>
+        </module>
+        <module name="TodoComment"/>
+        <module name="UpperEll"/>
+
+    </module>
+    
+    <module name="SuppressionFilter">
+        <property name="file" value="checkstyle-suppressions.xml"/>
+    </module>    
+
+</module>

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/checkstyle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.properties?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.properties (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.properties Sun Jul  3 15:00:10 2005
@@ -0,0 +1,101 @@
+#  Copyright 2003-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.
+
+######################################################################
+# Apache Central Repository
+######################################################################
+maven.repo.central=www.apache.org
+maven.repo.central.directory=/www/www.apache.org/dist/java-repository
+maven.remote.group=apcvs
+maven.changelog.factory = org.apache.maven.svnlib.SvnChangeLogFactory
+
+######################################################################
+# JUnit Testing
+######################################################################
+maven.test.failure = false
+maven.junit.fork=true
+#maven.junit.sysproperties=org.xml.sax.driver java.security.auth.login.config
+maven.junit.sysproperties=org.xml.sax.driver
+org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
+#java.security.auth.login.config=applications/test/jaas.config
+
+
+#If you wish to skip tests when doing builds, uncomment
+# maven.test.skip = true
+
+######################################################################
+# Checkstyle
+######################################################################
+# maven.checkstyle.properties= checkstyle.xml
+# maven.linkcheck.enable=false 
+
+######################################################################
+# JavaDoc
+#
+# javadoc urls can be added here, multiple urls are appended using a comma
+#
+# maven.javadoc.links = http://foo/bar/api,\
+#                       http://flim/flam/api/
+######################################################################
+maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/
+maven.javadoc.author=false
+maven.javadoc.version=false
+
+######################################################################
+# Other opts
+######################################################################
+# uncomment the next line to work in offline mode (no jar download & no linkcheck)
+#maven.mode.online=
+
+maven.compile.debug=on
+maven.compile.deprecation=off
+maven.compile.optimize=off
+maven.compile.source=1.4
+maven.compile.target=1.4
+
+maven.jarResources.basedir=src/java
+maven.jar.excludes=**/package.html
+
+# Location of the generated query language parsers. Needed for
+# the Maven Eclipse plugin to automatically locate the generated
+# source files. Note that this value matches the hardcoded path
+# in the Maven JavaCC plugin. Therefore, do not change this value!
+maven.gen.src=${maven.build.dir}/generated-src/main
+
+# specifying additional remote repository for downloading dependencies 
+# not available at www.ibiblio.org/maven/
+maven.repo.remote = http://www.ibiblio.org/maven/
+
+######################################################################
+# Site L&F
+######################################################################
+# maven.xdoc.jsl=
+maven.xdoc.date=
+maven.xdoc.poweredby.image=maven-feather.png
+maven.xdoc.version=${pom.currentVersion}
+maven.xdoc.developmentProcessUrl=http://incubator.apache.org/projects/jackrabbit.html
+maven.changelog.range=60
+maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
+
+# ------------------------------------------------------------------------
+# M A V E N  J A R  O V E R R I D E
+# ------------------------------------------------------------------------
+#maven.jar.override = on
+#maven.jar.jcr = ${basedir}/lib/jcr.jar
+
+######################################################################
+# Site Deploy (into ../jackrabbit-site for checkout on incubator.apache.org)
+######################################################################
+maven.site.deploy.method=fs

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.xml?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.xml (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/project.xml Sun Jul  3 15:00:10 2005
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <pomVersion>3</pomVersion>
+  <artifactId>jmeter-chain</artifactId>
+  <name>JMeter chain</name>
+  <groupId>jackrabbit</groupId>
+  <currentVersion>1.0-dev</currentVersion>
+  <organization />
+  <inceptionYear>2005</inceptionYear>
+  <logo>/images/logo.gif</logo>
+  <repository />
+  <mailingLists>
+    <mailingList>
+      <name>${pom.name} Dev List</name>
+    </mailingList>
+    <mailingList>
+      <name>${pom.name} User List</name>
+    </mailingList>
+  </mailingLists>
+  <dependencies>
+    <dependency>
+      <groupId>commons-chain</groupId>
+      <artifactId>commons-chain</artifactId>
+      <version>1.0</version>
+      <type>jar</type>
+    </dependency>
+    <!--
+      cqfs-jackrabbit and cqfs are optional runtime dependencies 
+      (an alternative FileSystem implementation); 
+      commons-logging is a dependency of cqfs
+    -->
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.1</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>commons-beanutils</groupId>
+      <artifactId>commons-beanutils</artifactId>
+      <version>1.7.0</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>jmeter</groupId>
+      <artifactId>ApacheJMeter_core</artifactId>
+      <version>2.0.3</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/jmeter/</url>
+    </dependency>
+    <dependency>
+      <groupId>jmeter</groupId>
+      <artifactId>ApacheJMeter_java</artifactId>
+      <version>2.0.3</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/jmeter/</url>
+    </dependency>
+    <dependency>
+      <groupId>jmeter</groupId>
+      <artifactId>jorphan</artifactId>
+      <version>2.0.3</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>avalon-logkit</groupId>
+      <artifactId>logkit</artifactId>
+      <version>1.2</version>
+      <type>jar</type>
+      <url>http://avalon.apache.org</url>
+    </dependency>
+  </dependencies>
+  <build>
+    <sourceDirectory>src/java</sourceDirectory>
+    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+    <unitTest>
+      <includes>
+        <include>**/*Test.java</include>
+      </includes>
+    </unitTest>
+  </build>
+</project>
+

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/config/gui/ChainConfigGui.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/config/gui/ChainConfigGui.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/config/gui/ChainConfigGui.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/config/gui/ChainConfigGui.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,283 @@
+/*
+ * 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.jmeter.protocol.java.config.gui;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.chain.Command;
+import org.apache.jmeter.config.Argument;
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.config.gui.AbstractConfigGui;
+import org.apache.jmeter.config.gui.ArgumentsPanel;
+import org.apache.jmeter.gui.util.HorizontalPanel;
+import org.apache.jmeter.protocol.java.config.JavaConfig;
+import org.apache.jmeter.protocol.java.sampler.JavaSampler;
+import org.apache.jmeter.testelement.TestElement;
+import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.reflect.ClassFinder;
+import org.apache.log.Logger;
+
+/**
+ * The <code>ChainConfigGui</code> class provides the user interface for the
+ * {@link JavaConfig}object.
+ * 
+ * @author Edgar Poce
+ */
+public class ChainConfigGui extends AbstractConfigGui implements ActionListener {
+	/**
+     * <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 3545799879432615731L;
+
+    /** Logging */
+	private static transient Logger log = LoggingManager.getLoggerForClass();
+
+	/** The name of the classnameCombo JComboBox */
+	private static final String CLASSNAMECOMBO = "chainclassnamecombo";
+
+	/** A combo box allowing the user to choose a test class. */
+	private JComboBox classnameCombo;
+
+	/**
+	 * Indicates whether or not the name of this component should be displayed
+	 * as part of the GUI. If true, this is a standalone component. If false, it
+	 * is embedded in some other component.
+	 */
+	private boolean displayName = true;
+
+	/** A panel allowing the user to set arguments for this test. */
+	private ArgumentsPanel argsPanel;
+
+	/**
+	 * Create a new JavaConfigGui as a standalone component.
+	 */
+	public ChainConfigGui() {
+		this(true);
+	}
+
+	/**
+	 * Create a new JavaConfigGui as either a standalone or an embedded
+	 * component.
+	 * 
+	 * @param displayNameField
+	 *            tells whether the component name should be displayed with the
+	 *            GUI. If true, this is a standalone component. If false, this
+	 *            component is embedded in some other component.
+	 */
+	public ChainConfigGui(boolean displayNameField) {
+		this.displayName = displayNameField;
+		init();
+	}
+
+	public String getLabelResource() {
+		return "chain_config_title";
+	}
+
+	/**
+	 * Initialize the GUI components and layout.
+	 */
+	protected void init() {
+		setLayout(new BorderLayout(0, 5));
+
+		if (displayName) {
+			setBorder(makeBorder());
+			add(makeTitlePanel(), BorderLayout.NORTH);
+		}
+
+		JPanel classnameRequestPanel = new JPanel(new BorderLayout(0, 5));
+		classnameRequestPanel.add(createClassnamePanel(), BorderLayout.NORTH);
+		classnameRequestPanel.add(createParameterPanel(), BorderLayout.CENTER);
+
+		add(classnameRequestPanel, BorderLayout.CENTER);
+	}
+
+	/**
+	 * Create a panel with GUI components allowing the user to select a test
+	 * class.
+	 * 
+	 * @return a panel containing the relevant components
+	 */
+	private JPanel createClassnamePanel() {
+		List possibleClasses = null;
+
+		try {
+			// Find all the classes which implement the JavaSamplerClient
+			// interface.
+			possibleClasses = ClassFinder.findClassesThatExtend(JMeterUtils
+					.getSearchPaths(), new Class[] { Command.class });
+
+			// Remove the JavaConfig class from the list since it only
+			// implements the interface for error conditions.
+
+			possibleClasses.remove(Command.class.getName()
+					+ "$ErrorSamplerClient");
+		} catch (Exception e) {
+			log.debug("Exception getting interfaces.", e);
+		}
+
+		JLabel label = new JLabel(JMeterUtils
+				.getResString("protocol_java_classname"));
+
+		classnameCombo = new JComboBox(possibleClasses.toArray());
+		classnameCombo.addActionListener(this);
+		classnameCombo.setName(CLASSNAMECOMBO);
+		classnameCombo.setEditable(false);
+		label.setLabelFor(classnameCombo);
+
+		HorizontalPanel panel = new HorizontalPanel();
+		panel.add(label);
+		panel.add(classnameCombo);
+
+		return panel;
+	}
+
+	/**
+	 * Handle action events for this component. This method currently handles
+	 * events for the classname combo box.
+	 * 
+	 * @param evt
+	 *            the ActionEvent to be handled
+	 */
+public void actionPerformed(ActionEvent evt)
+    {
+        if (evt.getSource() == classnameCombo)
+        {
+            String className =
+                ((String) classnameCombo.getSelectedItem()).trim();
+            try
+            {
+                Command command = (Command) Class.forName(
+                            className,
+                            true,
+                            Thread.currentThread().getContextClassLoader()
+                        ).newInstance();
+
+                Arguments currArgs = new Arguments();
+                argsPanel.modifyTestElement(currArgs);
+                Map currArgsMap = currArgs.getArgumentsAsMap();
+
+                Arguments newArgs = new Arguments();
+                Arguments testParams = new Arguments();
+                try
+                {
+                	Map descrip =  BeanUtils.describe(command) ;
+                	Iterator iter = descrip.entrySet().iterator() ;
+                	while (iter.hasNext()) {
+						Map.Entry entry = (Map.Entry)iter.next();
+						if (!entry.getKey().equals("type") && !entry.getKey().equals("class")) {
+							String key = entry.getKey().toString() ;
+							String value = ((entry.getValue()==null)?"":entry.getValue().toString()); 
+							testParams.addArgument(new Argument(key, value)) ;
+						}
+						
+					}
+                }
+                catch (AbstractMethodError e)
+                {
+                    log.warn ("JavaSamplerClient doesn't implement "
+                            + "getDefaultParameters.  Default parameters won't "
+                            + "be shown.  Please update your client class: "
+                            + className);
+                }
+                
+                if (testParams != null)
+                {
+                    PropertyIterator i = testParams.getArguments().iterator();
+                    while (i.hasNext())
+                    {
+                        Argument arg = (Argument) i.next().getObjectValue();
+                        String name = arg.getName();
+                        String value = arg.getValue();
+
+                        // If a user has set parameters in one test, and then
+                        // selects a different test which supports the same
+                        // parameters, those parameters should have the same
+                        // values that they did in the original test.
+                        if (currArgsMap.containsKey(name))
+                        {
+                            String newVal = (String) currArgsMap.get(name);
+                            if (newVal != null
+                                    && newVal.length() > 0)
+                            {
+                                value = newVal;
+                            }
+                        }
+                        newArgs.addArgument(name, value);
+                    }
+                }
+
+                argsPanel.configure(newArgs);
+            }
+            catch (Exception e)
+            {
+                log.error("Error getting argument list for " + className, e);
+            }
+        }
+    }
+	/**
+	 * Create a panel containing components allowing the user to provide
+	 * arguments to be passed to the test class instance.
+	 * 
+	 * @return a panel containing the relevant components
+	 */
+	private JPanel createParameterPanel() {
+		argsPanel = new ArgumentsPanel(JMeterUtils.getResString("paramtable"));
+		return argsPanel;
+	}
+
+	/* Overrides AbstractJMeterGuiComponent.configure(TestElement) */
+	public void configure(TestElement config) {
+		super.configure(config);
+
+		argsPanel.configure((Arguments) config.getProperty(
+				JavaSampler.ARGUMENTS).getObjectValue());
+
+		classnameCombo.setSelectedItem(config
+				.getPropertyAsString(JavaSampler.CLASSNAME));
+	}
+
+	/* Implements JMeterGUIComponent.createTestElement() */
+	public TestElement createTestElement() {
+        JavaConfig config = new JavaConfig();
+		modifyTestElement(config);
+		return config;
+	}
+
+	/* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+	public void modifyTestElement(TestElement config) {
+		configureTestElement(config);
+		((JavaConfig) config).setArguments((Arguments) argsPanel
+				.createTestElement());
+        if (classnameCombo.getSelectedItem()!=null ) {
+            ((JavaConfig) config).setClassname(classnameCombo.getSelectedItem()
+                .toString());
+        }
+	}
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/config/gui/ChainConfigGui.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/control/gui/ChainTestSamplerGui.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/control/gui/ChainTestSamplerGui.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/control/gui/ChainTestSamplerGui.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/control/gui/ChainTestSamplerGui.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,94 @@
+/*
+ * 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.jmeter.protocol.java.control.gui;
+
+import java.awt.BorderLayout;
+
+import org.apache.jmeter.protocol.java.config.JavaConfig;
+import org.apache.jmeter.protocol.java.config.gui.ChainConfigGui;
+import org.apache.jmeter.protocol.java.sampler.ChainSampler;
+import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
+import org.apache.jmeter.testelement.TestElement;
+
+/**
+ * Sample GUI for Commons Chain Commands
+ * 
+ * @author Edgar Poce
+ */
+public class ChainTestSamplerGui extends AbstractSamplerGui
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 3256721766930788918L;
+    
+    /** Panel containing the configuration options. */
+    private ChainConfigGui javaPanel = null;
+
+    /**
+     * Constructor for JavaTestSamplerGui
+     */
+    public ChainTestSamplerGui()
+    {
+        super();
+        init();
+    }
+
+    public String getLabelResource()
+    {
+        return "chain_request";
+    }
+
+    /**
+     * Initialize the GUI components and layout.
+     */
+    private void init()
+    {
+        setLayout(new BorderLayout(0, 5));
+        setBorder(makeBorder());
+
+        add(makeTitlePanel(), BorderLayout.NORTH);
+
+        javaPanel = new ChainConfigGui(false);
+
+        add(javaPanel, BorderLayout.CENTER);
+    }
+
+    /* Implements JMeterGuiComponent.createTestElement() */
+    public TestElement createTestElement()
+    {
+        ChainSampler sampler = new ChainSampler();
+        modifyTestElement(sampler);
+        return sampler;
+    }
+
+    /* Implements JMeterGuiComponent.modifyTestElement(TestElement) */
+    public void modifyTestElement(TestElement sampler)
+    {
+        sampler.clear();
+        JavaConfig config = (JavaConfig) javaPanel.createTestElement();
+        configureTestElement(sampler);
+        sampler.addTestElement(config);
+    }
+
+    /* Overrides AbstractJMeterGuiComponent.configure(TestElement) */
+    public void configure(TestElement el)
+    {
+        super.configure(el);
+        javaPanel.configure(el);
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/control/gui/ChainTestSamplerGui.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/sampler/ChainSampler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/sampler/ChainSampler.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/sampler/ChainSampler.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/sampler/ChainSampler.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,318 @@
+/*
+ * 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.jmeter.protocol.java.sampler;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.chain.impl.ContextBase;
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.engine.event.LoopIterationEvent;
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.AbstractSampler;
+import org.apache.jmeter.samplers.Entry;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.testelement.TestListener;
+import org.apache.jmeter.testelement.property.TestElementProperty;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * A sampler for executing custom Commons Chain Commands 
+ * 
+ * @author Edgar Poce
+ */
+public class ChainSampler extends AbstractSampler implements TestListener
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 3618986663356151348L;
+
+    /**
+     * chainCtx key
+     */
+    public static final String CHAINS_CONTEXT = "chainCtx";
+
+    /**
+     * The Command instance used by this sampler to actually perform the sample.
+     */
+    private transient Command command = null;
+
+    /**
+     * Logging
+     */
+    private static transient Logger log = LoggingManager.getLoggerForClass();
+
+    /**
+     * Set used to register all active JavaSamplers. This is used so that the
+     * samplers can be notified when the test ends.
+     */
+    private static Set allSamplers = new HashSet();
+
+    /**
+     * Create a JavaSampler.
+     */
+    public ChainSampler()
+    {
+        setArguments(new Arguments());
+        synchronized (allSamplers)
+        {
+            allSamplers.add(this);
+        }
+    }
+
+    /**
+     * Set the arguments (parameters) for the JavaSamplerClient to be executed
+     * with.
+     * 
+     * @param args
+     *            the new arguments. These replace any existing arguments.
+     */
+    public void setArguments(Arguments args)
+    {
+        setProperty(new TestElementProperty(JavaSampler.ARGUMENTS, args));
+    }
+
+    /**
+     * Get the arguments (parameters) for the JavaSamplerClient to be executed
+     * with.
+     * 
+     * @return the arguments
+     */
+    public Arguments getArguments()
+    {
+        return (Arguments) getProperty(JavaSampler.ARGUMENTS).getObjectValue();
+    }
+
+    /**
+     * Releases Command Client.
+     */
+    private void releaseClient()
+    {
+        this.command = null;
+    }
+
+    /**
+     * Sets the Classname attribute of the JavaConfig object
+     * 
+     * @param classname
+     *            the new Classname value
+     */
+    public void setClassname(String classname)
+    {
+        setProperty(JavaSampler.CLASSNAME, classname);
+    }
+
+    /**
+     * Gets the Classname attribute of the JavaConfig object
+     * 
+     * @return the Classname value
+     */
+    public String getClassname()
+    {
+        return getPropertyAsString(JavaSampler.CLASSNAME);
+    }
+
+    /**
+     * Performs a test sample.
+     * 
+     * The <code>sample()</code> method retrieves the reference to the command
+     * and calls its <code>runTest()</code> method.
+     * 
+     * @param entry
+     *            the Entry for this sample
+     * @return test SampleResult
+     */
+    public SampleResult sample(Entry entry)
+    {
+        SampleResult results = new SampleResult();
+        try
+        {
+            if (command == null)
+            {
+                log.debug(whoAmI() + "Creating Command");
+                createCommand();
+            }
+            results.setSampleLabel("Chain Test = "
+                    + command.getClass().getName());
+            results.sampleStart();
+            command.execute(getContext());
+            results.sampleEnd();
+            results.setSuccessful(true);
+        } catch (Exception e)
+        {
+            results.setSuccessful(false);
+            log.error("Unable to run test", e);
+        }
+        return results;
+    }
+
+    private Context getContext()
+    {
+        Context ctx = (Context) getThreadContext().getVariables().getObject(
+            CHAINS_CONTEXT);
+        if (ctx == null)
+        {
+            ctx = new ContextBase();
+            getThreadContext().getVariables().putObject(CHAINS_CONTEXT, ctx);
+        }
+        return ctx;
+    }
+
+    /**
+     * Returns reference to <code>Command</code>.
+     * 
+     * The <code>createJavaClient()</code> method uses reflection to create
+     * the Command. If the class can not be found, the method returns a
+     * reference to <code>this</code> object.
+     * 
+     * @return Command reference.
+     */
+    private Command createCommand() throws Exception
+    {
+        Class javaClass = Class.forName(
+            getClassname().trim(),
+            false,
+            Thread.currentThread().getContextClassLoader());
+
+        command = (Command) javaClass.newInstance();
+
+        Map descrip = BeanUtils.describe(command);
+        Iterator iter = descrip.keySet().iterator();
+        while (iter.hasNext())
+        {
+            String key = (String) iter.next();
+            Object value = this.getArguments().getArgumentsAsMap().get(key);
+            if (value != null && value.toString().length()>0)
+            {
+                BeanUtils.setProperty(command, key, value);
+            }
+        }
+
+        if (log.isDebugEnabled())
+        {
+            log.debug(whoAmI() + "\tCreated:\t" + getClassname() + "@"
+                    + Integer.toHexString(command.hashCode()));
+        }
+
+        return command;
+    }
+
+    /**
+     * Retrieves reference to JavaSamplerClient.
+     * 
+     * Convience method used to check for null reference without actually
+     * creating a JavaSamplerClient
+     * 
+     * @return reference to JavaSamplerClient NOTUSED private JavaSamplerClient
+     *         retrieveJavaClient() { return javaClient; }
+     */
+
+    /**
+     * Generate a String identifier of this instance for debugging purposes.
+     * 
+     * @return a String identifier for this sampler instance
+     */
+    private String whoAmI()
+    {
+        StringBuffer sb = new StringBuffer();
+        sb.append(Thread.currentThread().getName());
+        sb.append("@");
+        sb.append(Integer.toHexString(hashCode()));
+        return sb.toString();
+    }
+
+    // TestListener implementation
+    /* Implements TestListener.testStarted() */
+    public void testStarted()
+    {
+        log.debug(whoAmI() + "\ttestStarted");
+    }
+
+    /* Implements TestListener.testStarted(String) */
+    public void testStarted(String host)
+    {
+        log.debug(whoAmI() + "\ttestStarted(" + host + ")");
+    }
+
+    /**
+     * Method called at the end of the test. This is called only on one instance
+     * of JavaSampler. This method will loop through all of the other
+     * JavaSamplers which have been registered (automatically in the
+     * constructor) and notify them that the test has ended, allowing the
+     * JavaSamplerClients to cleanup.
+     */
+    public void testEnded()
+    {
+        log.debug(whoAmI() + "\ttestEnded");
+        synchronized (allSamplers)
+        {
+            Iterator i = allSamplers.iterator();
+            while (i.hasNext())
+            {
+                ChainSampler sampler = (ChainSampler) i.next();
+                sampler.releaseClient();
+                i.remove();
+            }
+        }
+    }
+
+    /* Implements TestListener.testEnded(String) */
+    public void testEnded(String host)
+    {
+        testEnded();
+    }
+
+    /* Implements TestListener.testIterationStart(LoopIterationEvent) */
+    public void testIterationStart(LoopIterationEvent event)
+    {
+    }
+
+    /**
+     * A {@link JavaSamplerClient}implementation used for error handling. If an
+     * error occurs while creating the real JavaSamplerClient object, it is
+     * replaced with an instance of this class. Each time a sample occurs with
+     * this class, the result is marked as a failure so the user can see that
+     * the test failed.
+     */
+    class ErrorSamplerClient extends AbstractJavaSamplerClient
+    {
+        /**
+         * Return SampleResult with data on error.
+         * 
+         * @see JavaSamplerClient#runTest()
+         */
+        public SampleResult runTest(JavaSamplerContext context)
+        {
+            log.debug(whoAmI() + "\trunTest");
+            Thread.yield();
+            SampleResult results = new SampleResult();
+            results.setSuccessful(false);
+            results.setResponseData(("Class not found: " + getClassname()).getBytes());
+            results.setSampleLabel("ERROR: " + getClassname());
+            return results;
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/sampler/ChainSampler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/test/SleepChainTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/test/SleepChainTest.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/test/SleepChainTest.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/test/SleepChainTest.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,54 @@
+/*
+ * 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.jmeter.protocol.java.test;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+
+/**
+ * <p>
+ * The <code>SleepChainTest</code> class is a simple example class of a Chain
+ * command for a JMeter Java protocol client. The class implements the
+ * <code>Command</code> interface.
+ * </p>
+ * <p>
+ * During each sample, this client will sleep for some amount of time. The
+ * amount of time to sleep is determined from the single parameter SleepTime
+ * </p>
+ * 
+ */
+public class SleepChainTest implements Command
+{
+    /** time to sleep */
+    private long time = 1000 ;
+
+    public boolean execute(Context arg0) throws Exception
+    {
+        Thread.sleep(time);
+        return false;
+    }
+
+    public long getTime()
+    {
+        return time;
+    }
+
+    public void setTime(long time)
+    {
+        this.time = time;
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/jmeter-chain/src/java/org/apache/jmeter/protocol/java/test/SleepChainTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/maven.xml?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/maven.xml (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/maven.xml Sun Jul  3 15:00:10 2005
@@ -0,0 +1,41 @@
+<!--
+   Copyright 2004-2005 The Apache Software Foundation or its licensors,
+                       as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<project
+    default="jar:jar"
+    xmlns:deploy="deploy"
+    xmlns:j="jelly:core"
+    xmlns:ant="jelly:ant"
+    xmlns:maven="jelly:maven">
+
+    <!-- Additionally cleans the test data created -->
+    <postGoal name="clean">
+        <attainGoal name="test:clean"/>
+    </postGoal>
+
+    <!-- deletes the test data -->
+    <goal name="test:clean">
+        <ant:delete includeEmptyDirs="true">
+            <ant:fileset dir="applications/test">
+                <ant:include name="**/*"/>
+                <ant:exclude name="repository.xml"/>
+                <ant:exclude name="log4j.properties"/>
+            </ant:fileset>
+        </ant:delete>
+    </goal>
+
+</project>

Propchange: incubator/jackrabbit/trunk/contrib/jcr-commands/maven.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/project.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/project.properties?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/project.properties (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/project.properties Sun Jul  3 15:00:10 2005
@@ -0,0 +1,101 @@
+#  Copyright 2003-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.
+
+######################################################################
+# Apache Central Repository
+######################################################################
+maven.repo.central=www.apache.org
+maven.repo.central.directory=/www/www.apache.org/dist/java-repository
+maven.remote.group=apcvs
+maven.changelog.factory = org.apache.maven.svnlib.SvnChangeLogFactory
+
+######################################################################
+# JUnit Testing
+######################################################################
+maven.test.failure = false
+maven.junit.fork=true
+#maven.junit.sysproperties=org.xml.sax.driver java.security.auth.login.config
+maven.junit.sysproperties=org.xml.sax.driver
+org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
+#java.security.auth.login.config=applications/test/jaas.config
+
+
+#If you wish to skip tests when doing builds, uncomment
+# maven.test.skip = true
+
+######################################################################
+# Checkstyle
+######################################################################
+# maven.checkstyle.properties= checkstyle.xml
+# maven.linkcheck.enable=false 
+
+######################################################################
+# JavaDoc
+#
+# javadoc urls can be added here, multiple urls are appended using a comma
+#
+# maven.javadoc.links = http://foo/bar/api,\
+#                       http://flim/flam/api/
+######################################################################
+maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/
+maven.javadoc.author=false
+maven.javadoc.version=false
+
+######################################################################
+# Other opts
+######################################################################
+# uncomment the next line to work in offline mode (no jar download & no linkcheck)
+#maven.mode.online=
+
+maven.compile.debug=on
+maven.compile.deprecation=off
+maven.compile.optimize=off
+maven.compile.source=1.4
+maven.compile.target=1.4
+
+maven.jarResources.basedir=src/java
+maven.jar.excludes=**/package.html
+
+# Location of the generated query language parsers. Needed for
+# the Maven Eclipse plugin to automatically locate the generated
+# source files. Note that this value matches the hardcoded path
+# in the Maven JavaCC plugin. Therefore, do not change this value!
+maven.gen.src=${maven.build.dir}/generated-src/main
+
+# specifying additional remote repository for downloading dependencies 
+# not available at www.ibiblio.org/maven/
+maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/
+
+######################################################################
+# Site L&F
+######################################################################
+# maven.xdoc.jsl=
+maven.xdoc.date=
+maven.xdoc.poweredby.image=maven-feather.png
+maven.xdoc.version=${pom.currentVersion}
+maven.xdoc.developmentProcessUrl=http://incubator.apache.org/projects/jackrabbit.html
+maven.changelog.range=60
+maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
+
+# ------------------------------------------------------------------------
+# M A V E N  J A R  O V E R R I D E
+# ------------------------------------------------------------------------
+#maven.jar.override = on
+#maven.jar.jcr = ${basedir}/lib/jcr.jar
+
+######################################################################
+# Site Deploy (into ../jackrabbit-site for checkout on incubator.apache.org)
+######################################################################
+maven.site.deploy.method=fs

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/project.xml?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/project.xml (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/project.xml Sun Jul  3 15:00:10 2005
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <pomVersion>3</pomVersion>
+  <artifactId>jcr-commands</artifactId>
+  <name>JCR commands</name>
+  <groupId>jackrabbit</groupId>
+  <currentVersion>1.0-dev</currentVersion>
+  <inceptionYear>2005</inceptionYear>
+  <logo>/images/logo.gif</logo>
+  <mailingLists>
+    <mailingList>
+      <name>${pom.name} Dev List</name>
+    </mailingList>
+    <mailingList>
+      <name>${pom.name} User List</name>
+    </mailingList>
+  </mailingLists>
+  <dependencies>
+    <dependency>
+      <groupId>commons-chain</groupId>
+      <artifactId>commons-chain</artifactId>
+      <version>1.0</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>lucene</groupId>
+      <artifactId>lucene</artifactId>
+      <version>1.4.3</version>
+      <type>jar</type>
+    </dependency>
+    <!--
+      cqfs-jackrabbit and cqfs are optional runtime dependencies 
+      (an alternative FileSystem implementation); 
+      commons-logging is a dependency of cqfs
+    -->
+    <dependency>
+      <groupId>cqfs</groupId>
+      <artifactId>cqfs</artifactId>
+      <version>3.5.6</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>concurrent</groupId>
+      <artifactId>concurrent</artifactId>
+      <version>1.3.4</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.1</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>javacc</groupId>
+      <artifactId>javacc</artifactId>
+      <version>3.2</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.8</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>jackrabbit</groupId>
+      <artifactId>jackrabbit</artifactId>
+      <version>0.16.4.1-dev</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>geronimo-spec</groupId>
+      <artifactId>geronimo-spec-jta</artifactId>
+      <version>1.0-M1</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>jsr170</groupId>
+      <artifactId>jcr</artifactId>
+      <version>0.16.4.1</version>
+      <type>jar</type>
+      <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.4.1.jar</url>
+    </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <version>2.6.2</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>xml-apis</groupId>
+      <artifactId>xmlParserAPIs</artifactId>
+      <version>2.0.2</version>
+      <type>jar</type>
+    </dependency>
+    <dependency>
+      <groupId>cqfs</groupId>
+      <artifactId>cqfs-jackrabbit</artifactId>
+      <version>3.5.6</version>
+      <type>jar</type>
+    </dependency>
+  </dependencies>
+  <build>
+    <sourceDirectory>src/java</sourceDirectory>
+    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+    <unitTest>
+      <includes>
+        <include>**/*Test.java</include>
+      </includes>
+    </unitTest>
+  </build>
+</project>

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/ContextHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/ContextHelper.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/ContextHelper.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/ContextHelper.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain;
+
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Context;
+
+/**
+ * Context helper to facilitate the Commands to access common context's
+ * resources
+ */
+public class ContextHelper
+{
+    /** Current node key */
+    private static String CURRENT_NODE_KEY = "currentNode";
+
+    /** repository key */
+    private static String REPOSITORY_KEY = "repository";
+
+    /** session key */
+    private static String SESSION_KEY = "session";
+
+    /**
+     * Sets the current working Node
+     * @param ctx
+     * @param node
+     */
+    public static void setCurrentNode(Context ctx, Node node)
+    {
+        ctx.put(CURRENT_NODE_KEY, node);
+    }
+
+    /**
+     * Sets the current working Repository
+     * @param ctx
+     * @param repository
+     */
+    public static void setRepository(Context ctx, Repository repository)
+    {
+        ctx.put(REPOSITORY_KEY, repository);
+    }
+
+    /**
+     * Sets the current working Session
+     * @param ctx
+     * @param session
+     */
+    public static void setSession(Context ctx, Session session)
+    {
+        ctx.put(SESSION_KEY, session);
+    }
+
+    /**
+     * Gets the current working Node
+     * @param ctx
+     * @return
+     */
+    public static Node getCurrentNode(Context ctx)
+    {
+        return (Node) ctx.get(CURRENT_NODE_KEY);
+    }
+
+    /**
+     * Gets the current working Repository
+     * @param ctx
+     * @return
+     */
+    public static Repository getRepository(Context ctx)
+    {
+        return (Repository) ctx.get(REPOSITORY_KEY);
+    }
+
+    /**
+     * Gets the current working Session
+     * @param ctx
+     * @return
+     */
+    public static Session getSession(Context ctx)
+    {
+        return (Session) ctx.get(SESSION_KEY);
+    }
+
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/RepositoryPool.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/RepositoryPool.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/RepositoryPool.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/RepositoryPool.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jcr.Repository;
+
+/**
+ * Repository pool
+ */
+public class RepositoryPool
+{
+    /** singleton */
+    private static RepositoryPool singleton = new RepositoryPool();
+
+    /** cache of repository instances */
+    private Map cache = Collections.synchronizedMap(new HashMap());
+
+    /**
+     * Private Constructor
+     */
+    private RepositoryPool()
+    {
+        super();
+    }
+
+    public synchronized Repository get(String conf, String home)
+    {
+        return (Repository) cache.get(getKey(conf, home));
+    }
+
+    public synchronized void put(String conf, String home, Repository repo)
+    {
+        if (cache.containsKey(getKey(conf, home)))
+        {
+            throw new IllegalArgumentException(
+                "There's already a repository for the given key. Remove it first.");
+        }
+        cache.put(getKey(conf, home), repo);
+    }
+
+    private String getKey(String conf, String home)
+    {
+        return "conf:" + conf + "-home:" + home;
+    }
+
+    public static RepositoryPool getInstance()
+    {
+        return singleton;
+    }
+
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/AddNode.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Node;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Adds a node to the current working node.
+ */
+public class AddNode implements Command {
+	/** Node type */
+	private String type;
+
+	/** Node name */
+	private String name;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+	 */
+	public boolean execute(Context ctx) throws Exception {
+		Node node = ContextHelper.getCurrentNode(ctx);
+		if (this.type == null) {
+			node.addNode(name);
+		} else {
+			node.addNode(type, name);
+		}
+		return false;
+	}
+
+	/**
+	 * @return Returns the name.
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * @param name
+	 *            The name to set.
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * @return Returns the type.
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * @param type
+	 *            The type to set.
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearContext.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearContext.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearContext.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/ClearContext.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+
+/**
+ * Clears the Context
+ */
+public class ClearContext implements Command
+{
+
+    public boolean execute(Context ctx) throws Exception
+    {
+        ctx.clear() ;
+        return false;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/CurrentNode.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Sets the current working Node
+ */
+public class CurrentNode implements Command
+{
+    /** path to the current node */
+    private String path;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        Session s = ContextHelper.getSession(ctx);
+        Node n = null;
+        if (path.startsWith("/"))
+        {
+            n = s.getRootNode().getNode(path.substring(1));
+        } else
+        {
+            n = ContextHelper.getCurrentNode(ctx).getNode(path);
+        }
+
+        ContextHelper.setCurrentNode(ctx, n);
+        return false;
+    }
+
+    /**
+     * @return Returns the path.
+     */
+    public String getPath()
+    {
+        return path;
+    }
+
+    /**
+     * @param path
+     *            The path to set.
+     */
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Login.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Login command.
+ */
+public class Login implements Command {
+	/** user */
+	private String user;
+
+	/** password */
+	private String password;
+
+	/** workspace */
+	private String workspace;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+	 */
+	public boolean execute(Context ctx) throws Exception {
+		Session session = null;
+		Repository repo = ContextHelper.getRepository(ctx);
+
+        Credentials credentials = new SimpleCredentials(user, password
+				.toCharArray());
+
+		if (this.workspace == null) {
+			session = repo.login(credentials);
+		} else {
+			session = repo.login(credentials, workspace);
+		}
+		ContextHelper.setSession(ctx, session);
+		ContextHelper.setCurrentNode(ctx, session.getRootNode());
+		return false;
+	}
+
+	/**
+	 * @return Returns the password.
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * @param password
+	 *            The password to set.
+	 */
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	/**
+	 * @return Returns the user.
+	 */
+	public String getUser() {
+		return user;
+	}
+
+	/**
+	 * @param user
+	 *            The user to set.
+	 */
+	public void setUser(String user) {
+		this.user = user;
+	}
+
+	/**
+	 * @return Returns the workspace.
+	 */
+	public String getWorkspace() {
+		return workspace;
+	}
+
+	/**
+	 * @param workspace
+	 *            The workspace to set.
+	 */
+	public void setWorkspace(String workspace) {
+		this.workspace = workspace;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Logout.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Logout command
+ */
+public class Logout implements Command
+{
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        Session session = ContextHelper.getSession(ctx);
+        session.logout();
+        ContextHelper.setSession(ctx, null);
+        return false;
+    }
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveNode.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveNode.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveNode.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Node;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Removes the current working Node (CWN) and 
+ * and sets the CWN to the parent.
+ */
+public class RemoveNode implements Command {
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+	 */
+	public boolean execute(Context ctx) throws Exception {
+		Node node = ContextHelper.getCurrentNode(ctx);
+        ContextHelper.setCurrentNode(ctx, node.getParent());
+		node.remove() ;
+		return false;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveProperty.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveProperty.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveProperty.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/RemoveProperty.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Node;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Removes a property from the current working node.
+ */
+public class RemoveProperty implements Command {
+	/** proeprty name */
+	private String name;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+	 */
+	public boolean execute(Context ctx) throws Exception {
+		Node node = ContextHelper.getCurrentNode(ctx);
+		node.getProperties(name).remove();
+		return false;
+	}
+
+	/**
+	 * @return Returns the name.
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * @param name
+	 *            The name to set.
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Save.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Save.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Save.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/Save.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Session;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Saves the current Session.
+ */
+public class Save implements Command {
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+	 */
+	public boolean execute(Context ctx) throws Exception {
+		Session s = ContextHelper.getSession(ctx);
+		s.save() ;
+		return false;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SaveNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SaveNode.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SaveNode.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SaveNode.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Node;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Saves the current working node.
+ */
+public class SaveNode implements Command {
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+	 */
+	public boolean execute(Context ctx) throws Exception {
+		Node node = ContextHelper.getCurrentNode(ctx);
+		node.save() ;
+		return false;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SetProperty.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SetProperty.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SetProperty.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/SetProperty.java Sun Jul  3 15:00:10 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.chain.command;
+
+import javax.jcr.Node;
+import javax.jcr.PropertyType;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+
+/**
+ * Sets a property to the current working Node
+ */
+public class SetProperty implements Command {
+	/** Property name */
+	private String name;
+	
+	/** Propety type */
+	private String type;
+
+	/** Property value */
+	private String value;
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+	 */
+	public boolean execute(Context ctx) throws Exception {
+		Node node = ContextHelper.getCurrentNode(ctx);
+		node.setProperty(name, value, PropertyType.valueFromName(type));
+		return false;
+	}
+
+	/**
+	 * @return Returns the name.
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * @param name
+	 *            The name to set.
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * @return Returns the type.
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * @param type
+	 *            The type to set.
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+}

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

Added: incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/StartJackrabbit.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/StartJackrabbit.java?rev=208988&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/StartJackrabbit.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/src/java/org/apache/jackrabbit/chain/command/StartJackrabbit.java Sun Jul  3 15:00:10 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.chain.command;
+
+import javax.jcr.Repository;
+
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.jackrabbit.chain.ContextHelper;
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+
+/**
+ * Starts Jackrabbit. <br>
+ * Note that this command doesn't check whether there's a Jackrabbit
+ * instance already running with the same configuration. Remember that two
+ * jackrabbit instances using the same persistence storage might lead to a
+ * corrupt Repository.<br>
+ */
+public class StartJackrabbit implements Command
+{
+    /** config file */
+    private String config;
+
+    /** home folder */
+    private String home;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
+     */
+    public boolean execute(Context ctx) throws Exception
+    {
+        RepositoryConfig conf = RepositoryConfig.create(config, home);
+        Repository repo = RepositoryImpl.create(conf);
+        ContextHelper.setRepository(ctx, repo);
+        return false;
+    }
+
+    /**
+     * @return Returns the config.
+     */
+    public String getConfig()
+    {
+        return config;
+    }
+
+    /**
+     * @param config
+     *            The config to set.
+     */
+    public void setConfig(String config)
+    {
+        this.config = config;
+    }
+
+    /**
+     * @return Returns the home.
+     */
+    public String getHome()
+    {
+        return home;
+    }
+
+    /**
+     * @param home
+     *            The home to set.
+     */
+    public void setHome(String home)
+    {
+        this.home = home;
+    }
+}

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



Mime
View raw message