[jboss-svn-commits] JBL Code SVN: r5889 - in labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo: . ant/src/org/jboss/antx conf

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Aug 15 05:48:02 EDT 2006


Author: tfennelly
Date: 2006-08-15 05:47:59 -0400 (Tue, 15 Aug 2006)
New Revision: 5889

Added:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/StringReplace.java
Modified:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/conf/LoanBrokerConfig.xml.template
Log:
Fix for JIRA issue JBESB-131:
http://jira.jboss.com/jira/browse/JBESB-131

Added: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/StringReplace.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/StringReplace.java	2006-08-15 09:38:05 UTC (rev 5888)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/StringReplace.java	2006-08-15 09:47:59 UTC (rev 5889)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.antx;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Simple task to perform a replace operation on a string and store the result in a
+ * property. 
+ * <p/>
+ * I'd have thought there was some way of doing this within ant already but I couldn't
+ * find out if or how :-).
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class StringReplace extends Task {
+	
+	private String string;
+	private String find;
+	private String replace;
+	private String property;
+
+	/* (non-Javadoc)
+	 * @see org.apache.tools.ant.Task#execute()
+	 */
+	@Override
+	public void execute() throws BuildException {
+		if(string == null || find == null || replace == null || property == null) {
+			throw new BuildException("The 'string', 'find', 'replace' and 'property' attributes must be set on the strreplace task.");
+		}
+		getProject().setNewProperty(property, string.replace(find, replace));
+	}
+
+	/**
+	 * @param property The property property value to set.
+	 */
+	public void setProperty(String property) {
+		this.property = property;
+	}
+
+	/**
+	 * @param string The string property value to set.
+	 */
+	public void setString(String path) {
+		this.string = path;
+	}
+
+	/**
+	 * @param find The find property value to set.
+	 */
+	public void setFind(String find) {
+		this.find = find;
+	}
+
+	/**
+	 * @param replace The replace property value to set.
+	 */
+	public void setReplace(String replace) {
+		this.replace = replace;
+	}
+}

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml	2006-08-15 09:38:05 UTC (rev 5888)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml	2006-08-15 09:47:59 UTC (rev 5889)
@@ -142,11 +142,13 @@
 	
 	<target name="configure" depends="compile-antx">
 		<taskdef name="touri" classname="org.jboss.antx.ToURI" classpath="ant/classes"/>
-		
+		<taskdef name="strreplace" classname="org.jboss.antx.StringReplace" classpath="ant/classes"/>
+
 		<touri path="./" property="cwd.uri" />
 		<dirname file="${ant.file}" property="cwd.dir"/>
+		<strreplace string="${cwd.dir}" find="\" replace="/" property="cwd.dir" />
 
-		<property name="trail.runtime.dir" value="./TrailBlazer-rtfiles"/>
+		<property name="trail.runtime.dir" value="TrailBlazer-rtfiles"/>
 
 		<echo message="----------------------------------------------------------------------------------------------------------------" />
 		<echo message="|                                                                                                              |" />

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/conf/LoanBrokerConfig.xml.template
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/conf/LoanBrokerConfig.xml.template	2006-08-15 09:38:05 UTC (rev 5888)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/conf/LoanBrokerConfig.xml.template	2006-08-15 09:47:59 UTC (rev 5889)
@@ -10,8 +10,8 @@
 	loanbrokerJndiType="jboss"
 	loanbrokerCreditQueue="queue/A"
 	loanbrokerJmsRequestQueue="queue/C"
-	loanbrokerRequestDir="/temp/bankInput"
-	loanbrokerEmailTemplatePath="/cygwin/home/kstam/dev1.6/loanbrokerdemo/template"
+	loanbrokerRequestDir="@cwd.dir@/@trail.runtime.dir@/BankInput"
+	loanbrokerEmailTemplatePath="@cwd.dir@/template"
 	loanbrokerEmailTemplateFile="quotes"
 >
 




More information about the jboss-svn-commits mailing list