[jboss-svn-commits] JBL Code SVN: r5835 - in labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo: . ant ant/src ant/src/org ant/src/org/jboss ant/src/org/jboss/antx banks conf java/src/org/jboss/soa/esb/samples/loanbroker/domain

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Aug 13 08:21:57 EDT 2006


Author: tfennelly
Date: 2006-08-13 08:21:50 -0400 (Sun, 13 Aug 2006)
New Revision: 5835

Added:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/ToURI.java
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/banks/bank.properties.template
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/conf/LoanBrokerConfig.xml.template
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/loanbroker.properties.template
Modified:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java
Log:
Making the trailblazer a little easier to configure

Added: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/ToURI.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/ToURI.java	2006-08-13 07:52:26 UTC (rev 5834)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/ant/src/org/jboss/antx/ToURI.java	2006-08-13 12:21:50 UTC (rev 5835)
@@ -0,0 +1,81 @@
+/*
+ * 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 take an file path attribute value, convert it to fully qualified
+ * URI and store the result in a new 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 ToURI extends Task {
+
+	private String path;
+	private String property;
+
+	/* (non-Javadoc)
+	 * @see org.apache.tools.ant.Task#execute()
+	 */
+	@Override
+	public void execute() throws BuildException {
+		if(path == null || property == null) {
+			throw new BuildException("The 'path' and 'property' attributes must be set on the touri task.");
+		}
+		getProject().setNewProperty(property, new File(path).toURI().toString());
+	}
+	
+	/**
+	 * @return The property property value.
+	 */
+	public String getProperty() {
+		return property;
+	}
+
+	/**
+	 * @param property The property property value to set.
+	 */
+	public void setProperty(String property) {
+		this.property = property;
+	}
+
+	/**
+	 * @return The path property value.
+	 */
+	public String getPath() {
+		return path;
+	}
+
+	/**
+	 * @param path The path property value to set.
+	 */
+	public void setPath(String path) {
+		this.path = path;
+	}
+}

Added: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/banks/bank.properties.template
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/banks/bank.properties.template	2006-08-13 07:52:26 UTC (rev 5834)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/banks/bank.properties.template	2006-08-13 12:21:50 UTC (rev 5835)
@@ -0,0 +1,5 @@
+jms.provider.url=@jndi.host@
+file.monitored.directory=@cwd.dir@/@trail.runtime.dir@/BankInput
+
+jms.queue.in=queue/C
+jms.queue.out=queue/D

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml	2006-08-13 07:52:26 UTC (rev 5834)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/build.xml	2006-08-13 12:21:50 UTC (rev 5835)
@@ -11,6 +11,7 @@
 	<property name="org.jboss.esb.samples.loanbroker.jar.dest"         value="${basedir}/build/dist/lib/"/>
 	<property name="org.jboss.esb.samples.loanbroker.lib.ext.dir"      value="${basedir}/lib"/>
 	<property name="org.jboss.esb.samples.loanbroker.tests.report.dir" value="${basedir}/build/tests"/>
+	<property environment="env" />
 		
 	<path id="org.jboss.esb.samples.loanbroker.classpath">
 	    <fileset dir="${org.jboss.esb.samples.loanbroker.lib.ext.dir}" includes="*.jar"/>
@@ -123,4 +124,88 @@
 		</java>
 	</target>	
 	
+	<!-- Compile the ant task used to convert file paths to fully qualified file URIs -->
+	<target name="compile-antx">
+		<mkdir dir="ant/classes" />
+		<javac srcdir="ant/src" destdir="ant/classes" />
+	</target>
+	
+	<target name="configure" depends="compile-antx">
+		<taskdef name="touri" classname="org.jboss.antx.ToURI" classpath="ant/classes"/>
+		
+		<touri path="./" property="cwd.uri" />
+		<dirname file="${ant.file}" property="cwd.dir"/>
+
+		<property name="trail.runtime.dir" value="./TrailBlazer-rtfiles"/>
+
+		<echo message="----------------------------------------------------------------------------------------------------------------" />
+		<echo message="|                                                                                                              |" />
+		<echo message="|                  J B O S S    E S B    T R A I L B L A Z E R    C O N F I G U R A T I O N                    |" />
+		<echo message="|                                                                                                              |" />
+		<echo message="----------------------------------------------------------------------------------------------------------------" />
+		<echo message="" />
+		<echo message="" />
+		<input message="This script will help you configure your local project for running the JBoss ESB LoanBroker Trailblazer.  You can reconfigure the Trailblazer at any time by re-running this script. ${line.separator}Press enter to start..." />
+		<echo message="" />
+		<input addproperty="jndi.host" message='Enter the host address of the JBoss Application Server on which your deployed JBoss ESB is running (for "localhost" simply press return):' defaultvalue="localhost" />
+		<echo message="" />
+		<input addproperty="jboss.as.installdir" message='Enter the path to the root of your local JBoss Application Server Installation (required for access to JBoss libraries):' />
+		<echo message="" />
+		<echo message="" />
+		<input message="The following questions will configure the email notification parameters required by the Trailblazer.${line.separator}Press enter to continue..." />
+		<echo message="" />
+		<input addproperty="smtp.host" message='Enter the SMTP Host Name (for "localhost" simply press return):' defaultvalue="localhost" />
+		<echo message="" />
+		<input addproperty="smtp.port" message='Enter the SMTP Host Port (for "25" simply press return):' defaultvalue="25" />
+		<echo message="" />
+		<input addproperty="smtp.user" message='Enter the SMTP User Name of your user account on "${smtp.host}":' />
+		<echo message="" />
+		<input addproperty="smtp.password" message='Enter the password associated with your SMTP User account "${smtp.user}":'/>
+		<echo message="" />
+		<input addproperty="smtp.auth" message='Is authentication of the SMTP User account "${smtp.user}" required by your SMTP host "${smtp.host}":' validargs="true,false" />
+		<echo message="" />
+		<input addproperty="smtp.from" message='Enter the "From" address for email notifications from your user account "${smtp.user}" on "${smtp.host}":'/>
+
+		<mkdir dir="${trail.runtime.dir}"/>
+		<mkdir dir="${trail.runtime.dir}/BankInput/outgoing"/>
+		<mkdir dir="${trail.runtime.dir}/notification_output_files"/>
+		<mkdir dir="${trail.runtime.dir}/outgoing/errorDir"/>
+		<mkdir dir="${trail.runtime.dir}/outgoing/inputDoneDir"/>
+		
+		<ant target="fileter-file">
+			<property name="file" value="loanbroker.properties.template"/><property name="toFile" value="loanbroker.properties"/>
+		</ant>
+		<ant target="fileter-file">
+			<property name="file" value="conf/LoanBrokerConfig.xml.template"/><property name="toFile" value="conf/LoanBrokerConfig.xml"/>
+		</ant>
+		<ant target="fileter-file">
+			<property name="file" value="banks/bank.properties.template"/><property name="toFile" value="banks/bank.properties"/>
+		</ant>
+
+		<echo message="" />
+		<echo message="" />
+		<input message="That's it, the Trailblazer is now configured!  You can reconfigure the Trailblazer at any time by re-running this script. ${line.separator}Press enter to finish..." />
+		<echo message="" />
+		<echo message="" />
+
+	</target>
+	
+	<target name="fileter-file">
+		 <copy file="${file}" tofile="${toFile}" overwrite="true">
+			<filterset>
+		    	<filter token="cwd.uri" value="${cwd.uri}"/>
+		    	<filter token="cwd.dir" value="${cwd.dir}"/>
+		    	<filter token="trail.runtime.dir" value="${trail.runtime.dir}"/>
+		    	<filter token="jndi.host" value="${jndi.host}"/>
+				<filter token="jboss.as.installdir" value="${jboss.as.installdir}"/>
+				<filter token="smtp.host" value="${smtp.host}"/>
+				<filter token="smtp.port" value="${smtp.port}"/>
+				<filter token="smtp.from" value="${smtp.from}"/>
+				<filter token="smtp.user" value="${smtp.user}"/>
+				<filter token="smtp.password" value="${smtp.password}"/>
+				<filter token="smtp.auth" value="${smtp.auth}"/>
+		    </filterset>
+		  </copy>
+	</target>
+	
 </project>

Added: 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-13 07:52:26 UTC (rev 5834)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/conf/LoanBrokerConfig.xml.template	2006-08-13 12:21:50 UTC (rev 5835)
@@ -0,0 +1,104 @@
+<JBossESB-LoanBroker-TrailBlazer
+	commandConnFactoryClass="ConnectionFactory"
+	commandJndiType="jboss"
+	commandJndiURL="@jndi.host@"
+	commandIsTopic="false"
+	messageSelector="esbApp='esbApp'"
+	commandJndiName="queue/A"
+	parameterReloadSecs="60"
+>
+
+
+<CreditAgencyJMSInput
+   	listenerClass="org.jboss.soa.esb.listeners.JmsQueueListener"   	
+   	actionClass="org.jboss.soa.esb.samples.loanbroker.actions.ProcessCreditRequest"   	
+	maxThreads="3"
+	queueConnFactoryClass="ConnectionFactory"
+	listenJndiType="jboss"
+	listenJndiURL="@jndi.host@"
+	listenQueue="queue/A"
+	listenMsgSelector="sample_loanbroker_servicecode='creditRequest'"
+> 
+	<NotificationList type="OK">   
+	     <target class="NotifyQueues" >
+	       <queue jndiName="queue/A">
+	       	<messageProp name="sample_loanbroker_servicecode" value="creditResponse" />
+	       </queue>       
+	     </target>
+ 	</NotificationList>	
+   </CreditAgencyJMSInput>
+   
+<CreditAgencyJMSOutput
+      	listenerClass="org.jboss.soa.esb.listeners.JmsQueueListener"
+      	actionClass="org.jboss.soa.esb.samples.loanbroker.actions.ProcessCreditResponse"      	
+   	maxThreads="1"
+   	queueConnFactoryClass="ConnectionFactory"
+   	listenJndiType="jboss"
+   	listenJndiURL="@jndi.host@"
+   	listenQueue="queue/A"
+   	listenMsgSelector="sample_loanbroker_servicecode='creditResponse'"
+> 
+   	<NotificationList type="OK"> 
+		<target class="NotifyFiles">
+			<file URI="@cwd.uri@@trail.runtime.dir@/notification_output_files/creditAgency.notifOK" append="true"/>
+		</target> 
+	</NotificationList> 
+</CreditAgencyJMSOutput>
+
+<BanksJMSResponse
+      	listenerClass="org.jboss.soa.esb.listeners.JmsQueueListener"
+      	actionClass="org.jboss.soa.esb.samples.loanbroker.actions.ProcessBanksJMSResponse"      	
+   	maxThreads="1"
+   	queueConnFactoryClass="ConnectionFactory"
+   	listenJndiType="jboss"
+   	listenJndiURL="@jndi.host@"
+   	listenQueue="queue/D"   	
+> 
+   	<NotificationList type="OK"> 
+		<target class="NotifyFiles">
+			<file URI="@cwd.uri@@trail.runtime.dir@/notification_output_files/JMSBanksResponse.notifOK" append="true"/>
+		</target> 
+	</NotificationList> 
+</BanksJMSResponse>
+
+<BanksFilePoller
+       listenerClass="org.jboss.soa.esb.listeners.DirectoryPoller"
+       actionClass="org.jboss.soa.esb.samples.loanbroker.actions.ProcessBanksFileResponse"
+       pollLatencySecs="5" 
+    maxThreads="2"
+    inputDirURI="@cwd.uri@@trail.runtime.dir@/BankInput/outgoing"
+    inputSuffix=".dat"
+    workSuffix=".INPROC"
+    errorDirURI="@cwd.uri@@trail.runtime.dir@/outgoing/errorDir"
+    errorSuffix=".ERR"
+    postDirURI="@cwd.uri@@trail.runtime.dir@/outgoing/inputDoneDir"
+    postSuffix=".DONE"
+    postDelete="n"
+   > 
+    <NotificationList type="OK"> 
+        <target class="NotifyFiles">
+            <file URI="@cwd.uri@@trail.runtime.dir@/notification_output_files/FileBanksResponse.notifOK" append="true"/> 
+                 append="true"
+            />
+        </target> 
+    </NotificationList> 
+    
+    <NotificationList type="err"> 
+        <target class="NotifyFiles">
+            <file URI="@cwd.uri@@trail.runtime.dir@/notification_output_files/FileBanksResponse.notifErr" append="true"/> 
+                 append="true"
+            />
+        </target> 
+    </NotificationList>
+   </BanksFilePoller>
+
+<EmailProperties   
+   org.jboss.soa.esb.mail.smtp.host="@smtp.host@"
+   org.jboss.soa.esb.mail.smtp.port="@smtp.port@"
+   org.jboss.soa.esb.mail.smtp.from="@smtp.from@"
+   org.jboss.soa.esb.mail.smtp.user="@smtp.user@"
+   org.jboss.soa.esb.mail.smtp.password="@smtp.password@"
+   org.jboss.soa.esb.mail.smtp.auth="@smtp.auth@"
+/>
+   
+</JBossESB-LoanBroker-TrailBlazer>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java	2006-08-13 07:52:26 UTC (rev 5834)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java	2006-08-13 12:21:50 UTC (rev 5835)
@@ -33,10 +33,7 @@
 	public static final String JNDI_URL					= "localhost";
 	public static final String JNDI_TYPE				= AppServerContext.SERVER_TYPE.jboss.toString();
 	public static final int	   MAX_LOAN_OFFERS			= 2;
-	public static final String BANK_REQUEST_DIR			= "/temp/bankInput";
-	public static final String EMAIL_TEMPLATE_PATH		= "/dev/jbossesb/product/docs/samples/trailblazer/bankloanbrokerdemo/template";
+	public static final String BANK_REQUEST_DIR			= "/home/tfennelly/TrailBlazer";
+	public static final String EMAIL_TEMPLATE_PATH		= "/home/tfennelly/JBoss/ESB/product/docs/samples/trailblazer/bankloanbrokerdemo/template";
 	public static final String EMAIL_TEMPLATE_FILE		= "quotes";
-	
-	
-
 }

Added: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/loanbroker.properties.template
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/loanbroker.properties.template	2006-08-13 07:52:26 UTC (rev 5834)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/loanbroker.properties.template	2006-08-13 12:21:50 UTC (rev 5835)
@@ -0,0 +1,12 @@
+# The home of your JBoss Appserver Install
+org.jboss.soa.esb.samples.loanbroker.jboss_home=@jboss.as.installdir@
+
+# The home of your JBoss server configuration
+org.jboss.soa.esb.samples.loanbroker.jboss_server=default
+
+# A reference to the root dir where you checked out your 
+# copy of the esb project.  Note the default assumes you checked
+# out and are building the LoanBroker from inside the ESB Project
+# Structure.  If you've checked out the LoanBroker seperately, you'll need
+# to modify this property.
+org.jboss.soa.esb.samples.loanbroker.esb_home=../../../../../




More information about the jboss-svn-commits mailing list