[jboss-svn-commits] JBL Code SVN: r10455 - in labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer: client/src/org/jboss/soa/esb/samples/trailblazer/loanbroker and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Mar 22 16:38:54 EDT 2007


Author: tfennelly
Date: 2007-03-22 16:38:54 -0400 (Thu, 22 Mar 2007)
New Revision: 10455

Added:
   labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TrailblazerProperties.java
   labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/trailblazer.properties
Removed:
   labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/jbossesb-properties.xml
Modified:
   labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/build.xml
   labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/client/src/org/jboss/soa/esb/samples/trailblazer/loanbroker/LoanBroker.java
   labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/ProcessEmail.java
   labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/readme.txt
Log:
Scrapped PropertyManager.

Modified: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/build.xml	2007-03-22 20:24:29 UTC (rev 10454)
+++ labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/build.xml	2007-03-22 20:38:54 UTC (rev 10455)
@@ -97,7 +97,8 @@
 		<fileset dir="${org.jboss.soa.esb.lib.dir}" includes="*.jar"/>
 		<fileset dir="${org.jboss.esb.samples.trailblazer.client.lib.dir}/ext" includes="*.jar"/>
 		<fileset dir="${org.jboss.esb.samples.trailblazer.esb.dest}/dist" includes="trailblazer-esb.jar"/>
-	</path>
+        <pathelement location="${org.jboss.esb.samples.trailblazer.esb.classes.dir}"/>
+    </path>
 
 
 
@@ -165,7 +166,7 @@
             <fileset dir="${org.jboss.esb.samples.trailblazer.esb.classes.dir}" excludes="**/web/*.class" />            
             <fileset dir="${esb.build.dir}" includes="META-INF/**" />
             <fileset dir="esb/conf" includes="jbmq-service.xml" />
-            <fileset dir="${basedir}" includes="jbossesb-properties.xml,template/**" />
+            <fileset dir="${basedir}" includes="trailblazer.properties,template/**" />
         </jar>
 
 		<!-- Web side WAR -->
@@ -175,7 +176,7 @@
 		        webxml="${basedir}/client/resources/web.xml">
 			<classes dir="${org.jboss.esb.samples.trailblazer.client.classes.dir}" includes="**/web/**/*.class"/>
 			<classes dir="${org.jboss.esb.samples.trailblazer.client.classes.dir}" includes="**/loanbroker/**/*.class"/>
-            <classes dir="${basedir}" includes="jbossesb-properties.xml" />
+            <classes dir="${basedir}" includes="trailblazer.properties" />
 			<lib dir="${org.jboss.soa.esb.lib.dir}">
 				<include name="*.jar"/>
 			</lib>
@@ -220,9 +221,9 @@
         </copy>
 
         <!-- copy file="${basedir}/esb-trailblazer-service.xml" overwrite="true"
-				todir="${org.jboss.soa.samples.trailblazer.jboss_home}/server/${org.jboss.soa.samples.trailblazer.jboss_server}/deploy"/ -->
+				todir="${org.jboss.soa.samples.trailblazer.jboss_home}/server/${org.jboss.soa.samples.trailblazer.jboss_server}/deploy"/>
 		<copy file="${basedir}/jbossesb-properties.xml" 
-				tofile="${org.jboss.soa.samples.trailblazer.jboss_home}/server/${org.jboss.soa.samples.trailblazer.jboss_server}/deploy/jbossesb.sar/jbossesb-properties.xml" overwrite="true"/>
+				tofile="${org.jboss.soa.samples.trailblazer.jboss_home}/server/${org.jboss.soa.samples.trailblazer.jboss_server}/deploy/jbossesb.sar/jbossesb-properties.xml" overwrite="true"/ -->
 	</target>
 	
 	<!-- Short target names -->

Modified: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/client/src/org/jboss/soa/esb/samples/trailblazer/loanbroker/LoanBroker.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/client/src/org/jboss/soa/esb/samples/trailblazer/loanbroker/LoanBroker.java	2007-03-22 20:24:29 UTC (rev 10454)
+++ labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/client/src/org/jboss/soa/esb/samples/trailblazer/loanbroker/LoanBroker.java	2007-03-22 20:38:54 UTC (rev 10455)
@@ -34,9 +34,12 @@
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.jboss.soa.esb.samples.trailblazer.web.WebCustomer;
+import org.jboss.soa.esb.samples.trailblazer.util.TrailblazerProperties;
 import org.jboss.soa.esb.services.registry.Registry;
 import org.jboss.soa.esb.services.registry.RegistryFactory;
 
+import java.util.Properties;
+
 /*
  * LoanBroker is responsible for getting customer requests for loans onto the JBoss ESB
  * Requests will come from a JSR-181 pojo web service (@org.jboss.soa.esb.samples.trailblazer.web.LoanBrokerWS)
@@ -52,11 +55,11 @@
 	private static Logger logger = Logger.getLogger(LoanBroker.class);
 	//used to locate our entries in the trailblazer-properties
 	private final String MODULE_NAME = "trailblazer";
-	private final String SERVICE_NAME = "org.jboss.soa.esb.trailblazer.request.service.epr.name";
-	private final String SERVICE_CAT  = "org.jboss.soa.esb.trailblazer.request.service.category";
-	private final String JMS_BANK_QUEUE="org.jboss.soa.esb.trailblazer.jmsbank.queue";
+	private final String SERVICE_NAME = "request.service.epr.name";
+	private final String SERVICE_CAT  = "request.service.category";
+	private final String JMS_BANK_QUEUE="jmsbank.queue";
+    private Properties properties = new TrailblazerProperties();
 	
-	
 	public LoanBroker() {
 //		System.setProperty("org.jboss.soa.esb.propertyFile", "jbossesb-properties.xml");
 //		System.setProperty("juddi.propertiesFile", "juddi.properties");
@@ -115,7 +118,7 @@
 			quote.customerEmail=customer.email;
 			
 			SendJMSMessage sender = new SendJMSMessage();
-			String queue = ModulePropertyManager.getPropertyManager(MODULE_NAME).getProperty(JMS_BANK_QUEUE);
+			String queue = properties.getProperty(JMS_BANK_QUEUE);
 			sender.setupConnection(queue);
 			logger.debug("setting up jms connection to queue: " + queue);
 			logger.debug("sending text message to bank: " + quote.toString());
@@ -138,8 +141,8 @@
 			logger.debug("sending to credit agency");
 			//registry setup stuff
 			Registry registry = RegistryFactory.getRegistry();
-			String serviceCategoryName = ModulePropertyManager.getPropertyManager(MODULE_NAME).getProperty(SERVICE_CAT);
-			String serviceName = ModulePropertyManager.getPropertyManager(MODULE_NAME).getProperty(SERVICE_NAME);			
+			String serviceCategoryName = properties.getProperty(SERVICE_CAT);
+			String serviceName = properties.getProperty(SERVICE_NAME);			
 			logger.debug("looking for the following service in the registry -- Category: " + serviceCategoryName);
 			logger.debug("looking for the following service in the registry -- Name: " + serviceName);
 			

Modified: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/ProcessEmail.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/ProcessEmail.java	2007-03-22 20:24:29 UTC (rev 10454)
+++ labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/ProcessEmail.java	2007-03-22 20:38:54 UTC (rev 10455)
@@ -29,15 +29,18 @@
 import org.jboss.soa.esb.common.Configuration;
 import org.jboss.soa.esb.common.ModulePropertyManager;
 import org.jboss.soa.esb.helpers.Email;
+import org.jboss.soa.esb.ConfigurationException;
 
+import java.util.Properties;
 
+
 public class ProcessEmail {
 	
 	private Logger logger = Logger.getLogger(this.getClass());	
 	private String emailTo, quoteID, rate, code, ssn;
+    private Properties properties = new TrailblazerProperties();
 
-
-	public ProcessEmail(String email, String quoteID, String rate, String code, String ssn) {
+    public ProcessEmail(String email, String quoteID, String rate, String code, String ssn) {
 		this.emailTo=email;
 		this.quoteID=quoteID;
 		this.rate=rate;
@@ -57,7 +60,7 @@
 			Email emailMessage = new Email();			
 			emailMessage.setSendTo(emailTo);
 			emailMessage.setSubject("TrailBlazer Quote from Bank");
-			String emailFrom = Configuration.getSmtpFrom();
+			String emailFrom = properties.getProperty("email.from");
 			emailMessage.setFrom(emailFrom);
 //			File emailTemplate = new File(LoanBrokerConstants.EMAIL_TEMPLATE);
 //			String quoteMsg=FileUtil.readTextFile(emailTemplate);
@@ -70,12 +73,8 @@
 	}
 	
 	private String fillTemplate() throws Exception{
-		//load up the email templates from the StringTemplate files
-		System.setProperty("com.arjuna.common.util.propertyservice.verbosePropertyManager", "ON");
-		String templatePath = ModulePropertyManager.getPropertyManager("trailblazer").
-			getProperty("org.jboss.soa.esb.trailblazer.email.template.path", "template");
-		String templateFile = ModulePropertyManager.getPropertyManager("trailblazer").
-			getProperty("org.jboss.soa.esb.trailblazer.email.template.file", "quote");
+		String templatePath = properties.getProperty("email.template.path", "template");
+		String templateFile = properties.getProperty("email.template.file", "quote");
 		                 
 		logger.info("loading StringTemplate from path: "+templatePath);
 		logger.info("loading StringTemplate from file: "+templateFile);

Added: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TrailblazerProperties.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TrailblazerProperties.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TrailblazerProperties.java	2007-03-22 20:38:54 UTC (rev 10455)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.trailblazer.util;
+
+import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.soa.esb.ConfigurationException;
+import org.apache.log4j.Logger;
+
+import java.util.Properties;
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * Trilablazer Properties.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class TrailblazerProperties extends Properties {
+
+    public static final String CONFIG_FILE = "trailblazer.properties";
+    private static Logger logger = Logger.getLogger(TrailblazerProperties.class);
+
+    public TrailblazerProperties() {
+        InputStream config = ClassUtil.getResourceAsStream("/" + CONFIG_FILE, TrailblazerProperties.class);
+
+        if(config == null) {
+            logger.error("Failed to locate '" + CONFIG_FILE + "' in the root of the classpath.");
+            return;
+        }
+
+        try {
+            load(config);
+        } catch (IOException e) {
+            logger.error("Error reading '" + CONFIG_FILE + "'.", e);
+        } finally {
+            try {
+                config.close();
+            } catch (IOException e) {
+                logger.warn("Failed to close stream to '" + CONFIG_FILE + "'.");
+            }
+        }
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/esb/src/org/jboss/soa/esb/samples/trailblazer/util/TrailblazerProperties.java
___________________________________________________________________
Name: svn:eol-style
   + native

Deleted: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/jbossesb-properties.xml	2007-03-22 20:24:29 UTC (rev 10454)
+++ labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/jbossesb-properties.xml	2007-03-22 20:38:54 UTC (rev 10455)
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  JBoss, Home of Professional Open Source
-  Copyright 2006, JBoss Inc., and others contributors as indicated 
-  by the @authors tag. All rights reserved. 
-  See the copyright.txt in the distribution for a
-  full listing of individual contributors. 
-  This copyrighted material is made available to anyone wishing to use,
-  modify, copy, or redistribute it subject to the terms and conditions
-  of the GNU Lesser General Public License, v. 2.1.
-  This program is distributed in the hope that it will be useful, but WITHOUT A 
-  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,
-  v.2.1 along with this distribution; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
-  MA  02110-1301, USA.
-  
-  (C) 2005-2006,
-  @author JBoss Inc.
--->
-<!-- $Id: default-jbossesb-properties.xml $ -->
-<!--
-  These options are described in the JBossESB manual.
-  Defaults are provided here for convenience only.
- 
-  Please read through this file prior to using the system, and consider
-  updating the specified entries.
--->
-<esb
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
-    <properties name="core">
-		<property name="org.jboss.soa.esb.jndi.server.type" 			value="jboss"/>
-		<property name="org.jboss.soa.esb.jndi.server.url" 			value="localhost"/>
-		<property name="org.jboss.soa.esb.persistence.connection.factory" 	value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
-    </properties>
-    <properties name="registry">
-    	<property name="org.jboss.soa.esb.registry.queryManagerURI" value="org.apache.juddi.registry.local.InquiryService#inquire"/>
-    	<property name="org.jboss.soa.esb.registry.lifeCycleManagerURI" value="org.apache.juddi.registry.local.PublishService#publish"/>
-    	<property name="org.jboss.soa.esb.registry.implementationClass" value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
-    	<property name="org.jboss.soa.esb.registry.factoryClass" value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
-    	<property name="org.jboss.soa.esb.registry.user" value="jbossesb"/>
-    	<property name="org.jboss.soa.esb.registry.password" value="password"/>
-    	<!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
-    	<property name="org.jboss.soa.esb.scout.proxy.transportClass" value="org.apache.ws.scout.transport.LocalTransport"/>
-    </properties>
-    <properties name="transports" depends="core">
-    	<property name="org.jboss.soa.esb.mail.smtp.host" value="your.mailserver.net"/>
-    	<property name="org.jboss.soa.esb.mail.smtp.user" value="your_username"/>
-    	<property name="org.jboss.soa.esb.mail.smtp.from" value="your.email at mail.net"/>
-    	<property name="org.jboss.soa.esb.mail.smtp.password" value="your_password_if_needed"/>
-    	<property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
-	    <!-- if your mail server requires this - most do now a days -->
-	<property name="org.jboss.soa.esb.mail.smtp.auth" value="false"/>
-
-    </properties>
-    <properties name="connection">
-    	<property name="min-pool-size" value="5"/>
-    	<property name="max-pool=size" value="10"/>
-    	<property name="blocking-timeout-millis" value="5000"/>
-    	<property name="abandoned-connection-timeout" value="10000"/>
-    	<property name="abandoned-connection-time-interval" value="30000"/>
-    </properties>
-    <properties name="dbstore">
-		<property name="org.jboss.soa.esb.persistence.messagestore.factory" 	value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
-		<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
-		<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
-		<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
-		<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
-		<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
-		<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
-		<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
-		<!--table managed by pool to test for valid connections - created by pool automatically -->
-		<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
-		<!-- # of milliseconds to timeout waiting for a connection from pool -->
-		<property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis"	value="5000"/> 
-    </properties>
-    <properties name="messagerouting">
-    	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
-    </properties>
-    <!-- this section added for the convenience of the trailblazer only -->
-    <properties name="trailblazer">
-		<property name="org.jboss.soa.esb.trailblazer.request.service.epr.name" value="creditagency"/>
-		<property name="org.jboss.soa.esb.trailblazer.request.service.category" value="tbCreditAGency"/>
-		<property name="org.jboss.soa.esb.trailblazer.jmsbank.queue" value="queue/esb-tb-bankRequestQueue"/>
-		<property name="org.jboss.soa.esb.trailblazer.email.template.path" value="template"/>
-		<property name="org.jboss.soa.esb.trailblazer.email.template.file" value="quote"/>		
-    </properties>
-</esb>

Modified: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/readme.txt
===================================================================
--- labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/readme.txt	2007-03-22 20:24:29 UTC (rev 10454)
+++ labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/readme.txt	2007-03-22 20:38:54 UTC (rev 10455)
@@ -6,12 +6,12 @@
 - ANT
 - A mail server to send email notifications
 - JBoss AS 4.0.4 or higher with EJB3 and JBossWS support.  You can install the latest JBoss AS JEMS installer and select the "EJB3" install config to get the right one installed.
+- JBoss AS 4.0.4 or higher with the JBoss ESB SAR deployment (jbossesb.sar). 
 
 Settings required to edit before running:
 
-File: jbossesb-properties.xml
+File: jbossesb-properties.xml (jbossesb.sar/jbossesb-properties.xml)
 - Update the section titled "transports" and specify all of the SMTP mail server settings for your environment.
-- you can change the settings in the "trailblazer" to work on different queues, etc but you can leave all of these as is for the default settings.
 
 File: build.properties
 - update with the 2 settings below to where you have your JBoss deployed to, along with the server instance you are using:

Added: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/trailblazer.properties
===================================================================
--- labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/trailblazer.properties	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/trailblazer.properties	2007-03-22 20:38:54 UTC (rev 10455)
@@ -0,0 +1,12 @@
+
+# Credit Agency configs
+request.service.epr.name=creditagency
+request.service.category=tbCreditAGency
+
+# JMS Bank configs
+jmsbank.queue=queue/esb-tb-bankRequestQueue
+
+# Customer email notification configs
+email.from=jbossesb.trailblazer at localhost
+email.template.path=template
+email.template.file=quote
\ No newline at end of file


Property changes on: labs/jbossesb/branches/JBESB_4_0_MP1/product/samples/trailblazer/trailblazer.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list