[jboss-svn-commits] JBL Code SVN: r6440 - in labs/jbossesb/trunk: product/core/common/src/org/jboss/soa/esb/common product/core/common/src/org/jboss/soa/esb/connection product/core/common/src/org/jboss/soa/esb/helpers product/core/common/src/org/jboss/soa/esb/parameters product/core/common/src/org/jboss/soa/esb/util product/core/common/tests/src/org/jboss/soa/esb/common/tests product/core/common/tests/src/org/jboss/soa/esb/parameters product/core/listeners/src/org/jboss/soa/esb/actions product/core/listeners/src/org/jboss/soa/esb/listeners product/core/listeners/src/org/jboss/soa/esb/nagios product/core/services/src/org/jboss/soa/esb/internal/core/objectstore product/docs product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web product/etc product/lib/ext qa/junit/src/org/jboss/soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 27 10:05:23 EDT 2006
Author: mark.little at jboss.com
Date: 2006-09-27 10:05:01 -0400 (Wed, 27 Sep 2006)
New Revision: 6440
Added:
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/Configuration.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/Environment.java
labs/jbossesb/trunk/product/etc/jbossesb-properties.xml
labs/jbossesb/trunk/product/lib/ext/jbossts-common.jar
Removed:
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java
Modified:
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/ConnectionProperties.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamFileRepository.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java
labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/Util.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/EJBContainerSetup.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamRepositoryFactoryUnitTest.java
labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamsFileRepositoryUnitTest.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/JMSRouter.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
labs/jbossesb/trunk/product/docs/Trailblazer.doc
labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksResponse.java
labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java
labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java
Log:
Added initial PropertyManager support.
Copied: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/Configuration.java (from rev 6438, labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java)
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java 2006-09-27 11:42:32 UTC (rev 6438)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/Configuration.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -0,0 +1,154 @@
+/*
+ * 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.soa.esb.common;
+
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+import com.arjuna.common.internal.util.propertyservice.plugins.io.XMLFilePlugin;
+import com.arjuna.common.util.propertyservice.PropertyManager;
+import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
+
+public class Configuration
+{
+ public static PropertyManager propertyManager;
+
+ public static PropertyManager getPropertyManager()
+ {
+ return propertyManager;
+ }
+
+ private static KeyValuePair[] s_oaKV = new KeyValuePair[]
+ {
+ new KeyValuePair(Environment.SMTP_HOST, getSmtpHost()),
+ new KeyValuePair(Environment.SMTP_USERNAME, getSmtpUsername()),
+ new KeyValuePair(Environment.SMTP_PASSWORD, getSmtpPassword()),
+ new KeyValuePair(Environment.SMTP_PORT, getSmtpPort()),
+ new KeyValuePair(Environment.SMTP_FROM, getSmtpFrom()),
+ new KeyValuePair(Environment.SMTP_AUTH, getSmtpAuth()),
+ new KeyValuePair(Environment.JNDI_SERVER_TYPE, getJndiServerType()),
+ new KeyValuePair(Environment.JNDI_SERVER_URL, getJndiServerURL()),
+ new KeyValuePair(Environment.PARAMS_REPOS_IMPL_CLASS,
+ getParamRepositoryImplClass()),
+ new KeyValuePair(Environment.OBJECT_STORE_CONFIG_FILE, getObjStoreConfigFile()),
+ new KeyValuePair(Environment.ENCRYPT_FACTORY_CLASS, getEncryptionFactoryClass())
+
+ };
+
+ public static String dump()
+ {
+ StringBuilder sb = new StringBuilder("Dump of Configuration:\n");
+ for (KeyValuePair oCurr : s_oaKV)
+ {
+ sb.append(oCurr.getKey()).append("=").append(oCurr.getValue())
+ .append("\n");
+ }
+ return sb.append("______________________________________").toString();
+ } // ________________________________
+
+ public static String getSmtpHost()
+ {
+ return getPropertyManager().getProperty(Environment.SMTP_HOST, Environment.DEFAULT_HOST);
+ }
+
+ public static String getSmtpUsername()
+ {
+ return System
+ .getProperty(Environment.SMTP_USERNAME, Environment.DEFAULT_USERNAME);
+ }
+
+ public static String getSmtpPassword()
+ {
+ return System
+ .getProperty(Environment.SMTP_PASSWORD, Environment.DEFAULT_PASSWORD);
+ }
+
+ public static String getSmtpPort()
+ {
+ return getPropertyManager().getProperty(Environment.SMTP_PORT, Environment.DEFAULT_PORT);
+ }
+
+ public static String getSmtpFrom()
+ {
+ return getPropertyManager().getProperty(Environment.SMTP_FROM);
+ }
+
+ public static String getSmtpAuth()
+ {
+ return getPropertyManager().getProperty(Environment.SMTP_AUTH);
+ }
+
+ public static String getJndiServerType()
+ {
+ return getPropertyManager().getProperty(Environment.JNDI_SERVER_TYPE,
+ Environment.DEFAULT_SERVER_TYPE);
+ }
+
+ public static String getJndiServerURL()
+ {
+ return getPropertyManager().getProperty(Environment.JNDI_SERVER_URL, Environment.DEFAULT_HOST);
+ }
+
+ public static String getParamRepositoryImplClass()
+ {
+ return getPropertyManager().getProperty(Environment.PARAMS_REPOS_IMPL_CLASS);
+ }
+
+ public static String getObjStoreConfigFile()
+ {
+ String property = getPropertyManager().getProperty(Environment.OBJECT_STORE_CONFIG_FILE);
+ return property;
+ }
+
+ public static String getEncryptionFactoryClass()
+ {
+ return getPropertyManager().getProperty(Environment.ENCRYPT_FACTORY_CLASS,
+ org.jboss.soa.esb.services.DefaultEncryptionFactory.class
+ .getName());
+ }
+
+ static
+ {
+ /**
+ * Retrieve the property manager from the factory and add the ESB properties file to it.
+ *
+ * Ideally the various components in the ESB should have their own sections within the
+ * property file and the each component uses its own PropertyManager instance. However, the
+ * current structure of the ESB does not lend itself well to that.
+ *
+ * TODO
+ */
+
+ propertyManager = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager");
+
+ String propertiesFilename = getPropertyManager().getProperty(Environment.PROPERTIES_FILE, Environment.DEFAULT_PROPERTY_FILE);
+
+ try
+ {
+ propertyManager.load(XMLFilePlugin.class.getName(), propertiesFilename);
+ }
+ catch (Exception e)
+ {
+ throw new ExceptionInInitializerError(e.toString());
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/Environment.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/Environment.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -0,0 +1,50 @@
+/*
+ * 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.soa.esb.common;
+
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+public class Environment
+{
+ public static final String PROPERTIES_FILE = "org.jboss.soa.esb.propertyFile";
+
+ public static final String SMTP_HOST = "org.jboss.soa.esb.mail.smtp.host";
+ public static final String SMTP_USERNAME = "org.jboss.soa.esb.mail.smtp.user";
+ public static final String SMTP_PASSWORD = "org.jboss.soa.esb.mail.smtp.password";
+ public static final String SMTP_PORT = "org.jboss.soa.esb.mail.smtp.port";
+ public static final String SMTP_FROM = "org.jboss.soa.esb.mail.smtp.from";
+ public static final String SMTP_AUTH = "org.jboss.soa.esb.mail.smtp.auth";
+ public static final String JNDI_SERVER_TYPE = "org.jboss.soa.esb.jndi.server.type";
+ public static final String JNDI_SERVER_URL = "org.jboss.soa.esb.jndi.server.url";
+ public static final String PARAMS_REPOS_IMPL_CLASS = "org.jboss.soa.esb.paramsRepository.class";
+ public static final String OBJECT_STORE_CONFIG_FILE = "org.jboss.soa.esb.objStore.configfile";
+ public static final String ENCRYPT_FACTORY_CLASS = "org.jboss.soa.esb.encryption.factory.class";
+
+ public static final String DEFAULT_PROPERTY_FILE = "jbossesb-properties.xml";
+ public static final String DEFAULT_HOST = "localhost";
+ public static final String DEFAULT_USERNAME = "";
+ public static final String DEFAULT_PASSWORD = "";
+ public static final String DEFAULT_PORT = "25";
+ public static final String DEFAULT_SERVER_TYPE = "jboss";
+
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/common/SystemProperties.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -1,132 +0,0 @@
-/*
- * 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.soa.esb.common;
-
-import org.jboss.soa.esb.helpers.KeyValuePair;
-
-public class SystemProperties {
-
- public static final String SMTP_HOST = "org.jboss.soa.esb.mail.smtp.host";
-
- public static final String SMTP_USERNAME = "org.jboss.soa.esb.mail.smtp.user";
-
- public static final String SMTP_PASSWORD = "org.jboss.soa.esb.mail.smtp.password";
-
- public static final String SMTP_PORT = "org.jboss.soa.esb.mail.smtp.port";
-
- public static final String SMTP_FROM = "org.jboss.soa.esb.mail.smtp.from";
-
- public static final String SMTP_AUTH = "org.jboss.soa.esb.mail.smtp.auth";
-
- public static final String JNDI_SERVER_TYPE = "org.jboss.soa.esb.jndi.server.type";
-
- public static final String JNDI_SERVER_URL = "org.jboss.soa.esb.jndi.server.url";
-
- public static final String PARAMS_REPOS_IMPL_CLASS = "org.jboss.soa.esb.paramsRepository.class";
-
- public static final String OBJECT_STORE_CONFIG_FILE = "org.jboss.soa.esb.objStore.configfile";
-
- public static final String ENCRYPT_FACTORY_CLASS = "org.jboss.soa.esb.encryption.factory.class";
-
- public static final String DEFAULT_HOST = "localhost";
-
- public static final String DEFAULT_USERNAME = "";
-
- public static final String DEFAULT_PASSWORD = "";
-
- public static final String DEFAULT_PORT = "25";
-
- public static final String DEFAULT_SERVER_TYPE = "jboss";
-
- private static KeyValuePair[] s_oaKV = new KeyValuePair[] {
- new KeyValuePair(SMTP_HOST, getSmtpHost()),
- new KeyValuePair(SMTP_USERNAME, getSmtpUsername()),
- new KeyValuePair(SMTP_PASSWORD, getSmtpPassword()),
- new KeyValuePair(SMTP_PORT, getSmtpPort()),
- new KeyValuePair(SMTP_FROM, getSmtpFrom()),
- new KeyValuePair(SMTP_AUTH, getSmtpAuth()),
- new KeyValuePair(JNDI_SERVER_TYPE, getJndiServerType()),
- new KeyValuePair(JNDI_SERVER_URL, getJndiServerURL()),
- new KeyValuePair(PARAMS_REPOS_IMPL_CLASS,
- getParamRepositoryImplClass()),
- new KeyValuePair(OBJECT_STORE_CONFIG_FILE, getObjStoreConfigFile()),
- new KeyValuePair(ENCRYPT_FACTORY_CLASS, getEncryptionFactoryClass())
-
- };
-
- public static String dump() {
- StringBuilder sb = new StringBuilder("Dump of SystemProperties:\n");
- for (KeyValuePair oCurr : s_oaKV) {
- sb.append(oCurr.getKey()).append("=").append(oCurr.getValue()).append("\n");
- }
- return sb.append("______________________________________").toString();
- } // ________________________________
-
- public static String getSmtpHost() {
- return System.getProperty(SMTP_HOST, SystemProperties.DEFAULT_HOST);
- }
-
- public static String getSmtpUsername() {
- return System.getProperty(SMTP_USERNAME, SystemProperties.DEFAULT_USERNAME);
- }
-
- public static String getSmtpPassword() {
- return System.getProperty(SMTP_PASSWORD, SystemProperties.DEFAULT_PASSWORD);
- }
-
- public static String getSmtpPort() {
- return System.getProperty(SMTP_PORT, SystemProperties.DEFAULT_PORT);
- }
-
- public static String getSmtpFrom() {
- return System.getProperty(SMTP_FROM);
- }
-
- public static String getSmtpAuth() {
- return System.getProperty(SMTP_AUTH);
- }
-
- public static String getJndiServerType() {
- return System.getProperty(JNDI_SERVER_TYPE,
- SystemProperties.DEFAULT_SERVER_TYPE);
- }
-
- public static String getJndiServerURL() {
- return System.getProperty(JNDI_SERVER_URL, SystemProperties.DEFAULT_HOST);
- }
-
- public static String getParamRepositoryImplClass() {
- return System.getProperty(PARAMS_REPOS_IMPL_CLASS);
- }
-
- public static String getObjStoreConfigFile() {
- String property = System.getProperty(OBJECT_STORE_CONFIG_FILE);
- return property;
- }
-
- public static String getEncryptionFactoryClass() {
- return System.getProperty(ENCRYPT_FACTORY_CLASS,
- org.jboss.soa.esb.services.DefaultEncryptionFactory.class
- .getName());
- }
-}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/ConnectionProperties.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/ConnectionProperties.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/connection/ConnectionProperties.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -1,251 +1,358 @@
/*
-* 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.
-*/
+ * 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.soa.esb.connection;
import org.apache.log4j.Logger;
+import org.jboss.soa.esb.common.Configuration;
import java.util.Properties;
/**
- * Connection Property class which stores all connection and connection pool properties. It keeps the properties ready
- * so that is can be used by the pool and connection factory
- *
- * @author MohitK
- * Date: Jul 18, 2006
+ * Connection Property class which stores all connection and connection pool
+ * properties. It keeps the properties ready so that is can be used by the pool
+ * and connection factory
+ *
+ * @author MohitK Date: Jul 18, 2006
*/
-public class ConnectionProperties {
+public class ConnectionProperties
+{
- private static Logger Log = Logger.getLogger(ConnectionProperties.class);
+ private static Logger Log = Logger.getLogger(ConnectionProperties.class);
- private Properties m_oConnectionProperties;
+ private Properties m_oConnectionProperties;
- public static final String DRIVER_CLASSNAME = "driver-class";
- public static final String CONNECTION_URL = "connection-url";
- public static final String USERNAME = "user-name";
- public static final String PASSWORD = "password";
- public static final String AUTO_COMMIT = "auto-commit";
- public static final String ISOLATION_LEVEL = "isolation";
- public static final String MIN_POOL_SIZE = "min-pool-size";
- public static final String MAX_POOL_SIZE = "max-pool-size";
- public static final String BLOCKING_CONNECTION_TIME = "blocking-timeout-millis";
- public static final String CONNECTION_POOL_CLASS = "connection-pool-class";
- public static final String PASSWORD_DECODER = "password-decrypter";
- public static final String ABANDONED_CONNECTION_TIMEOUT = "abandoned-connection-timeout";
- public static final String ABANDONED_CONNECTION_CHECK_INTERVAL = "abandoned-connection-time-interval";
+ public static final String DRIVER_CLASSNAME = "driver-class";
- private boolean m_bAutoCommit;
- private Integer m_iIsolationLvl;
- private int m_iMinPoolSize;
- private int m_iMaxPoolSize;
- private long m_lConnBlockTime;
- private String m_sConnectionPoolClass;
- private String m_sUser;
- private String m_sPassword;
- private String m_sConnectionUrl;
- private long m_lAbandonedConnectionTimeout;
- private long m_lAbandonedConnectionCheckInterval;
- private String m_sDriverClassName;
+ public static final String CONNECTION_URL = "connection-url";
+ public static final String USERNAME = "user-name";
- public static final String DEFAULT_MIN_POOL_SIZE = "5";
- public static final String DEFAULT_MAX_POOL_SIZE = "10";
- public static final String DEFAULT_CONN_BLOCK_TIME_MILLIS = "5000";
- public static final String DEFAULT_CONNECTION_POOL_CLASS = DefaultConnectionPoolImpl.class.getName();
- public static final String DEFAULT_ABANDONED_CONNECTION_TIMEOUT = "10000";
- public static final String DEFAULT_ABANDONED_CONNECTION_CHECK_INTERVAL = "30000";
+ public static final String PASSWORD = "password";
- public ConnectionProperties(Properties connectionProperties) {
- this.m_oConnectionProperties = connectionProperties;
- setDriverClassName();
- setConnectionUrl();
- setUser();
- setPassword();
- setConnectionPoolClass();
- setAutoCommit();
- setIsolationLevel();
- setMinPoolSize();
- setMaxPoolSize();
- setBlockingConnectionTime();
- setAbandonedConnectionTimeOut();
- setAbandonedConnectionCheckInterval();
- }
+ public static final String AUTO_COMMIT = "auto-commit";
- private void setDriverClassName() {
- m_sDriverClassName = m_oConnectionProperties.getProperty(DRIVER_CLASSNAME);
- if (m_sDriverClassName == null) {
- m_sDriverClassName = System.getProperty(DRIVER_CLASSNAME);
- }
- }
+ public static final String ISOLATION_LEVEL = "isolation";
- protected String getDriverClassName() {
- return m_sDriverClassName;
- }
+ public static final String MIN_POOL_SIZE = "min-pool-size";
- protected String getConnectionUrl() {
- return m_sConnectionUrl;
- }
+ public static final String MAX_POOL_SIZE = "max-pool-size";
- private void setConnectionUrl() {
- m_sConnectionUrl = m_oConnectionProperties.getProperty(CONNECTION_URL);
- if (m_sConnectionUrl == null) {
- m_sConnectionUrl = System.getProperty(CONNECTION_URL);
- }
- }
+ public static final String BLOCKING_CONNECTION_TIME = "blocking-timeout-millis";
- protected boolean getAutoCommit() {
- return m_bAutoCommit;
- }
+ public static final String CONNECTION_POOL_CLASS = "connection-pool-class";
- protected Integer getIsolationLevel() {
- return m_iIsolationLvl;
- }
+ public static final String PASSWORD_DECODER = "password-decrypter";
- private void setIsolationLevel() {
- String isolation = (String) m_oConnectionProperties.get(ISOLATION_LEVEL);
- if (isolation == null) {
- isolation = System.getProperty(ISOLATION_LEVEL);
- }
- this.m_iIsolationLvl = (isolation != null) ? new Integer(isolation) : null;
- }
+ public static final String ABANDONED_CONNECTION_TIMEOUT = "abandoned-connection-timeout";
- protected int getMinPoolSize() {
- return m_iMinPoolSize;
- }
+ public static final String ABANDONED_CONNECTION_CHECK_INTERVAL = "abandoned-connection-time-interval";
- protected int getMaxPoolSize() {
- return m_iMaxPoolSize;
- }
+ private boolean m_bAutoCommit;
- private void setMinPoolSize() {
- String strPoolSize = m_oConnectionProperties.getProperty(MIN_POOL_SIZE);
- if (strPoolSize == null) {
- strPoolSize = System.getProperty(MIN_POOL_SIZE, DEFAULT_MIN_POOL_SIZE);
- }
- this.m_iMinPoolSize = Integer.parseInt(strPoolSize);
- }
+ private Integer m_iIsolationLvl;
- private void setMaxPoolSize() {
- String strPoolSize = (String) m_oConnectionProperties.get(MAX_POOL_SIZE);
- if (strPoolSize == null) {
- strPoolSize = System.getProperty(MAX_POOL_SIZE, DEFAULT_MAX_POOL_SIZE);
- }
- this.m_iMaxPoolSize = Integer.parseInt(strPoolSize);
- }
+ private int m_iMinPoolSize;
- private void setBlockingConnectionTime() {
- String strBlockTimeMillis = (String) m_oConnectionProperties.get(BLOCKING_CONNECTION_TIME);
- if (strBlockTimeMillis == null) {
- strBlockTimeMillis = System.getProperty(BLOCKING_CONNECTION_TIME, DEFAULT_CONN_BLOCK_TIME_MILLIS);
- }
- this.m_lConnBlockTime = Integer.parseInt(strBlockTimeMillis);
- }
+ private int m_iMaxPoolSize;
- protected long getConnectionBlockTimeInMillis() {
- return m_lConnBlockTime;
- }
+ private long m_lConnBlockTime;
- private void setAutoCommit() {
- String autoCommit = (String) m_oConnectionProperties.get(AUTO_COMMIT);
- if (autoCommit == null || autoCommit.equals("false")) {
- m_bAutoCommit = Boolean.FALSE;
- } else {
- m_bAutoCommit = Boolean.TRUE;
- }
- }
+ private String m_sConnectionPoolClass;
- private void setConnectionPoolClass() {
- m_sConnectionPoolClass = m_oConnectionProperties.getProperty(CONNECTION_POOL_CLASS);
- if (m_sConnectionPoolClass == null) {
- m_sConnectionPoolClass = System.getProperty(CONNECTION_POOL_CLASS, DEFAULT_CONNECTION_POOL_CLASS);
- }
- }
+ private String m_sUser;
+ private String m_sPassword;
- protected String getUser() {
- return m_sUser;
- }
+ private String m_sConnectionUrl;
- public void setUser() {
- this.m_sUser = m_oConnectionProperties.getProperty(USERNAME);
- if (m_sUser == null) {
- m_sUser = System.getProperty(USERNAME);
- }
- }
+ private long m_lAbandonedConnectionTimeout;
- protected String getPassword() {
- return m_sPassword;
- }
+ private long m_lAbandonedConnectionCheckInterval;
- protected void setPassword() {
- this.m_sPassword = m_oConnectionProperties.getProperty(PASSWORD);
- if (m_sPassword == null) {
- m_sPassword = System.getProperty(PASSWORD);
- }
- String strPasswordDecoder = m_oConnectionProperties.getProperty(PASSWORD_DECODER);
- if (strPasswordDecoder == null) {
- strPasswordDecoder = System.getProperty(PASSWORD_DECODER);
- }
- if (strPasswordDecoder != null) {
- try {
- PasswordDecoder decoder = (PasswordDecoder) Class.forName(strPasswordDecoder).newInstance();
- this.m_sPassword = decoder.decode(m_sPassword);
- } catch (InstantiationException e) {
- Log.error("Error in creating instance of Password Decoder Class:-" + strPasswordDecoder,e);
- } catch (IllegalAccessException e) {
- Log.error("Error in creating instance of Password Decoder Class:-" + strPasswordDecoder,e);
- } catch (ClassNotFoundException e) {
- Log.error("Password Decoder Class:-" + strPasswordDecoder + " not found in Classpath");
- Log.error("Please check the property:-" + PASSWORD_DECODER);
- Log.error(e);
- }
- }
- }
+ private String m_sDriverClassName;
- protected String getConnectionPoolClass() {
- return m_sConnectionPoolClass;
- }
+ public static final String DEFAULT_MIN_POOL_SIZE = "5";
- private void setAbandonedConnectionTimeOut() {
- String strAbandonedConnectionTimeout = m_oConnectionProperties.getProperty(ABANDONED_CONNECTION_TIMEOUT);
- if (strAbandonedConnectionTimeout == null) {
- strAbandonedConnectionTimeout = System.getProperty(ABANDONED_CONNECTION_TIMEOUT, DEFAULT_ABANDONED_CONNECTION_TIMEOUT);
- }
- this.m_lAbandonedConnectionTimeout = Long.parseLong(strAbandonedConnectionTimeout);
- }
+ public static final String DEFAULT_MAX_POOL_SIZE = "10";
- private void setAbandonedConnectionCheckInterval() {
- String strAbandonedConnectionCheckInterval = m_oConnectionProperties.getProperty(ABANDONED_CONNECTION_CHECK_INTERVAL);
- if (strAbandonedConnectionCheckInterval == null || strAbandonedConnectionCheckInterval.trim().length() == 0) {
- strAbandonedConnectionCheckInterval = System.getProperty(ABANDONED_CONNECTION_CHECK_INTERVAL, DEFAULT_ABANDONED_CONNECTION_CHECK_INTERVAL);
- }
- this.m_lAbandonedConnectionCheckInterval = Long.parseLong(strAbandonedConnectionCheckInterval);
- }
+ public static final String DEFAULT_CONN_BLOCK_TIME_MILLIS = "5000";
- protected long getAbandonedConnectionTimeOut() {
- return this.m_lAbandonedConnectionTimeout;
- }
+ public static final String DEFAULT_CONNECTION_POOL_CLASS = DefaultConnectionPoolImpl.class
+ .getName();
- protected long getAbandonedConnectionCheckInterval() {
- return this.m_lAbandonedConnectionCheckInterval;
- }
+ public static final String DEFAULT_ABANDONED_CONNECTION_TIMEOUT = "10000";
+ public static final String DEFAULT_ABANDONED_CONNECTION_CHECK_INTERVAL = "30000";
+
+ public ConnectionProperties(Properties connectionProperties)
+ {
+ this.m_oConnectionProperties = connectionProperties;
+ setDriverClassName();
+ setConnectionUrl();
+ setUser();
+ setPassword();
+ setConnectionPoolClass();
+ setAutoCommit();
+ setIsolationLevel();
+ setMinPoolSize();
+ setMaxPoolSize();
+ setBlockingConnectionTime();
+ setAbandonedConnectionTimeOut();
+ setAbandonedConnectionCheckInterval();
+ }
+
+ private void setDriverClassName()
+ {
+ m_sDriverClassName = m_oConnectionProperties
+ .getProperty(DRIVER_CLASSNAME);
+ if (m_sDriverClassName == null)
+ {
+ m_sDriverClassName = Configuration.getPropertyManager()
+ .getProperty(DRIVER_CLASSNAME);
+ }
+ }
+
+ protected String getDriverClassName()
+ {
+ return m_sDriverClassName;
+ }
+
+ protected String getConnectionUrl()
+ {
+ return m_sConnectionUrl;
+ }
+
+ private void setConnectionUrl()
+ {
+ m_sConnectionUrl = m_oConnectionProperties.getProperty(CONNECTION_URL);
+ if (m_sConnectionUrl == null)
+ {
+ m_sConnectionUrl = Configuration.getPropertyManager().getProperty(
+ CONNECTION_URL);
+ }
+ }
+
+ protected boolean getAutoCommit()
+ {
+ return m_bAutoCommit;
+ }
+
+ protected Integer getIsolationLevel()
+ {
+ return m_iIsolationLvl;
+ }
+
+ private void setIsolationLevel()
+ {
+ String isolation = (String) m_oConnectionProperties
+ .get(ISOLATION_LEVEL);
+ if (isolation == null)
+ {
+ isolation = Configuration.getPropertyManager().getProperty(
+ ISOLATION_LEVEL);
+ }
+ this.m_iIsolationLvl = (isolation != null) ? new Integer(isolation)
+ : null;
+ }
+
+ protected int getMinPoolSize()
+ {
+ return m_iMinPoolSize;
+ }
+
+ protected int getMaxPoolSize()
+ {
+ return m_iMaxPoolSize;
+ }
+
+ private void setMinPoolSize()
+ {
+ String strPoolSize = m_oConnectionProperties.getProperty(MIN_POOL_SIZE);
+ if (strPoolSize == null)
+ {
+ strPoolSize = Configuration.getPropertyManager().getProperty(
+ MIN_POOL_SIZE, DEFAULT_MIN_POOL_SIZE);
+ }
+ this.m_iMinPoolSize = Integer.parseInt(strPoolSize);
+ }
+
+ private void setMaxPoolSize()
+ {
+ String strPoolSize = (String) m_oConnectionProperties
+ .get(MAX_POOL_SIZE);
+ if (strPoolSize == null)
+ {
+ strPoolSize = Configuration.getPropertyManager().getProperty(
+ MAX_POOL_SIZE, DEFAULT_MAX_POOL_SIZE);
+ }
+ this.m_iMaxPoolSize = Integer.parseInt(strPoolSize);
+ }
+
+ private void setBlockingConnectionTime()
+ {
+ String strBlockTimeMillis = (String) m_oConnectionProperties
+ .get(BLOCKING_CONNECTION_TIME);
+ if (strBlockTimeMillis == null)
+ {
+ strBlockTimeMillis = Configuration.getPropertyManager()
+ .getProperty(BLOCKING_CONNECTION_TIME,
+ DEFAULT_CONN_BLOCK_TIME_MILLIS);
+ }
+ this.m_lConnBlockTime = Integer.parseInt(strBlockTimeMillis);
+ }
+
+ protected long getConnectionBlockTimeInMillis()
+ {
+ return m_lConnBlockTime;
+ }
+
+ private void setAutoCommit()
+ {
+ String autoCommit = (String) m_oConnectionProperties.get(AUTO_COMMIT);
+ if (autoCommit == null || autoCommit.equals("false"))
+ {
+ m_bAutoCommit = Boolean.FALSE;
+ } else
+ {
+ m_bAutoCommit = Boolean.TRUE;
+ }
+ }
+
+ private void setConnectionPoolClass()
+ {
+ m_sConnectionPoolClass = m_oConnectionProperties
+ .getProperty(CONNECTION_POOL_CLASS);
+ if (m_sConnectionPoolClass == null)
+ {
+ m_sConnectionPoolClass = Configuration.getPropertyManager()
+ .getProperty(CONNECTION_POOL_CLASS,
+ DEFAULT_CONNECTION_POOL_CLASS);
+ }
+ }
+
+ protected String getUser()
+ {
+ return m_sUser;
+ }
+
+ public void setUser()
+ {
+ this.m_sUser = m_oConnectionProperties.getProperty(USERNAME);
+ if (m_sUser == null)
+ {
+ m_sUser = Configuration.getPropertyManager().getProperty(USERNAME);
+ }
+ }
+
+ protected String getPassword()
+ {
+ return m_sPassword;
+ }
+
+ protected void setPassword()
+ {
+ this.m_sPassword = m_oConnectionProperties.getProperty(PASSWORD);
+ if (m_sPassword == null)
+ {
+ m_sPassword = Configuration.getPropertyManager().getProperty(
+ PASSWORD);
+ }
+ String strPasswordDecoder = m_oConnectionProperties
+ .getProperty(PASSWORD_DECODER);
+ if (strPasswordDecoder == null)
+ {
+ strPasswordDecoder = Configuration.getPropertyManager()
+ .getProperty(PASSWORD_DECODER);
+ }
+ if (strPasswordDecoder != null)
+ {
+ try
+ {
+ PasswordDecoder decoder = (PasswordDecoder) Class.forName(
+ strPasswordDecoder).newInstance();
+ this.m_sPassword = decoder.decode(m_sPassword);
+ } catch (InstantiationException e)
+ {
+ Log.error(
+ "Error in creating instance of Password Decoder Class:-"
+ + strPasswordDecoder, e);
+ } catch (IllegalAccessException e)
+ {
+ Log.error(
+ "Error in creating instance of Password Decoder Class:-"
+ + strPasswordDecoder, e);
+ } catch (ClassNotFoundException e)
+ {
+ Log.error("Password Decoder Class:-" + strPasswordDecoder
+ + " not found in Classpath");
+ Log.error("Please check the property:-" + PASSWORD_DECODER);
+ Log.error(e);
+ }
+ }
+ }
+
+ protected String getConnectionPoolClass()
+ {
+ return m_sConnectionPoolClass;
+ }
+
+ private void setAbandonedConnectionTimeOut()
+ {
+ String strAbandonedConnectionTimeout = m_oConnectionProperties
+ .getProperty(ABANDONED_CONNECTION_TIMEOUT);
+ if (strAbandonedConnectionTimeout == null)
+ {
+ strAbandonedConnectionTimeout = Configuration.getPropertyManager()
+ .getProperty(ABANDONED_CONNECTION_TIMEOUT,
+ DEFAULT_ABANDONED_CONNECTION_TIMEOUT);
+ }
+ this.m_lAbandonedConnectionTimeout = Long
+ .parseLong(strAbandonedConnectionTimeout);
+ }
+
+ private void setAbandonedConnectionCheckInterval()
+ {
+ String strAbandonedConnectionCheckInterval = m_oConnectionProperties
+ .getProperty(ABANDONED_CONNECTION_CHECK_INTERVAL);
+ if (strAbandonedConnectionCheckInterval == null
+ || strAbandonedConnectionCheckInterval.trim().length() == 0)
+ {
+ strAbandonedConnectionCheckInterval = Configuration
+ .getPropertyManager().getProperty(
+ ABANDONED_CONNECTION_CHECK_INTERVAL,
+ DEFAULT_ABANDONED_CONNECTION_CHECK_INTERVAL);
+ }
+ this.m_lAbandonedConnectionCheckInterval = Long
+ .parseLong(strAbandonedConnectionCheckInterval);
+ }
+
+ protected long getAbandonedConnectionTimeOut()
+ {
+ return this.m_lAbandonedConnectionTimeout;
+ }
+
+ protected long getAbandonedConnectionCheckInterval()
+ {
+ return this.m_lAbandonedConnectionCheckInterval;
+ }
+
}
Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -24,6 +24,8 @@
import java.io.*;
import java.util.*;
+
+import org.jboss.soa.esb.common.Configuration;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
@@ -45,7 +47,7 @@
* @author <a href="mailto:schifest at gmail.com">Esteban Shifman</a>
*/
public class DomElement {
- protected static final String LINE_BREAK = System.getProperty("line.separator");
+ protected static final String LINE_BREAK = Configuration.getPropertyManager().getProperty("line.separator");
private static final transient String s_sCharset = "ISO-8859-1";
Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/Email.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -31,7 +31,8 @@
import javax.mail.internet.*;
import org.apache.log4j.Logger;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.util.*;
/**
@@ -360,25 +361,25 @@
*/
private Session initMailServerSession() {
Authenticator oAuth = null;
- String sSmtpUser = SystemProperties.getSmtpUsername();
+ String sSmtpUser = Configuration.getSmtpUsername();
if (! Util.isNullString(sSmtpUser)) {
- oAuth = new MyAuth(sSmtpUser, SystemProperties.getSmtpPassword());
+ oAuth = new MyAuth(sSmtpUser, Configuration.getSmtpPassword());
}
Properties oMailP = new Properties();
- oMailP.setProperty("mail.smtp.host", SystemProperties.getSmtpHost());
- String sAuth = SystemProperties.getSmtpAuth();
+ oMailP.setProperty("mail.smtp.host", Configuration.getSmtpHost());
+ String sAuth = Configuration.getSmtpAuth();
if(sAuth != null) {
if(!sAuth.trim().equals("")) {
- logger.warn("'" + SystemProperties.SMTP_AUTH + "' set to an empty value.");
+ logger.warn("'" + Environment.SMTP_AUTH + "' set to an empty value.");
}
oMailP.setProperty("mail.smtp.auth", sAuth);
}
try {
- String sPort = SystemProperties.getSmtpPort();
- this.from = SystemProperties.getSmtpFrom();
+ String sPort = Configuration.getSmtpPort();
+ this.from = Configuration.getSmtpFrom();
Integer.parseInt(sPort);
oMailP.setProperty("mail.smtp.port", sPort);
}
Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamFileRepository.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamFileRepository.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamFileRepository.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -11,6 +11,7 @@
import javax.naming.InvalidNameException;
import org.apache.log4j.Logger;
+import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.util.StreamUtils;
@@ -46,7 +47,7 @@
* Public default constructor.
*/
public ParamFileRepository() {
- String rootDir = System.getProperty(FILE_PARAMS_REPOS_ROOT);
+ String rootDir = Configuration.getPropertyManager().getProperty(FILE_PARAMS_REPOS_ROOT);
// Set the repository root directory.
if(rootDir == null) {
Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -21,7 +21,7 @@
*/
package org.jboss.soa.esb.parameters;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
/**
* Factory class for Singleton {@link ParamRepository} creation.
@@ -65,7 +65,7 @@
// at the start of this synch block will simply fall through and return the
// instance created by the thread that got in ahead of them.
if(instance == null) {
- String runtimeClassName = SystemProperties.getParamRepositoryImplClass();
+ String runtimeClassName = Configuration.getParamRepositoryImplClass();
if(runtimeClassName == null) {
// If there's no repository name configured, return the
Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/Util.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/Util.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/util/Util.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -26,17 +26,18 @@
import java.io.*;
import javax.naming.*;
import org.apache.log4j.*;
+import org.jboss.soa.esb.common.Configuration;
public class Util {
private Util() {
}
public static void dumpSysProps(PrintStream p_OS) {
- String[] sa = new String[System.getProperties().size()];
- System.getProperties().keySet().toArray(sa);
+ String[] sa = new String[Configuration.getPropertyManager().getProperties().size()];
+ Configuration.getPropertyManager().getProperties().keySet().toArray(sa);
Arrays.sort(sa);
for (String sCurr : sa)
- p_OS.println(sCurr + "=" + System.getProperty(sCurr));
+ p_OS.println(sCurr + "=" + Configuration.getPropertyManager().getProperty(sCurr));
} // __________________________________
public static boolean isNullString(String p_s) {
Modified: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/BaseTest.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -28,7 +28,8 @@
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Environment;
import junit.framework.TestCase;
@@ -39,6 +40,11 @@
* @version <tt>$Revision:$</tt>
* $Id:$
*/
+
+/*
+ * This should probably use its own property file.
+ */
+
public class BaseTest extends TestCase {
/** The Database driver used for unit tests */
@@ -83,10 +89,10 @@
private HashMap<String,String> readSystemParameters()
{
//Reading system parameter
- String dbDriver = System.getProperty(DB_DRIVER , "org.hsqldb.jdbcDriver");
- String dbUrl = System.getProperty(DB_URL, "jdbc:hsqldb:.");
- String dbUsername = System.getProperty(DB_USERNAME, "sa");
- String dbPassword = System.getProperty(DB_PASSWORD, "");
+ String dbDriver = Configuration.getPropertyManager().getProperty(DB_DRIVER , "org.hsqldb.jdbcDriver");
+ String dbUrl = Configuration.getPropertyManager().getProperty(DB_URL, "jdbc:hsqldb:.");
+ String dbUsername = Configuration.getPropertyManager().getProperty(DB_USERNAME, "sa");
+ String dbPassword = Configuration.getPropertyManager().getProperty(DB_PASSWORD, "");
//Setting the paremeters in the HashMap
HashMap<String,String> systemParameters = new HashMap<String,String>();
systemParameters.put(DB_DRIVER, dbDriver);
@@ -135,9 +141,9 @@
*/
public void setObjStoreConfigFile(String filePath) {
if(filePath == null) {
- System.getProperties().remove(SystemProperties.OBJECT_STORE_CONFIG_FILE);
+ Configuration.getPropertyManager().getProperties().remove(Environment.OBJECT_STORE_CONFIG_FILE);
} else {
- System.setProperty(SystemProperties.OBJECT_STORE_CONFIG_FILE, filePath);
+ Configuration.getPropertyManager().setProperty(Environment.OBJECT_STORE_CONFIG_FILE, filePath);
}
}
Modified: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/EJBContainerSetup.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/EJBContainerSetup.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/common/tests/EJBContainerSetup.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -40,6 +40,7 @@
import org.apache.log4j.Logger;
import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap;
+import org.jboss.soa.esb.common.Configuration;
public class EJBContainerSetup extends TestSetup {
@@ -71,7 +72,7 @@
return;
// TODO should not have to do this....
- System.setProperty(
+ Configuration.getPropertyManager().setProperty(
"javax.security.jacc.PolicyConfigurationFactory.provider",
"org.jboss.security.jacc.JBossPolicyConfigurationFactory");
@@ -84,13 +85,13 @@
EJB3StandaloneBootstrap.deployXmlResource("ejb3-deployment.xml");
EJB3StandaloneBootstrap.deployXmlResource("security-beans.xml");
log.info("scanClasspath: "
- + System.getProperty("java.class.path"));
+ + Configuration.getPropertyManager().getProperty("java.class.path"));
EJB3StandaloneBootstrap.scanClasspath();
// Create InitialContext from jndi.properties
- System.setProperty("java.naming.factory.initial",
+ Configuration.getPropertyManager().setProperty("java.naming.factory.initial",
"org.jnp.interfaces.LocalOnlyContextFactory");
- System.setProperty("java.naming.factory.url.pkgs",
+ Configuration.getPropertyManager().setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
initialContext = new InitialContext();
Modified: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamRepositoryFactoryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamRepositoryFactoryUnitTest.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamRepositoryFactoryUnitTest.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -21,7 +21,8 @@
*/
package org.jboss.soa.esb.parameters;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Environment;
import junit.framework.TestCase;
@@ -38,7 +39,7 @@
assertTrue(repo instanceof ParamFileRepository);
ParamRepositoryFactory.reset();
- System.setProperty(SystemProperties.PARAMS_REPOS_IMPL_CLASS, TestParamRepo.class.getName());
+ Configuration.getPropertyManager().setProperty(Environment.PARAMS_REPOS_IMPL_CLASS, TestParamRepo.class.getName());
repo = ParamRepositoryFactory.getInstance();
assertTrue(repo instanceof TestParamRepo);
}
Modified: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamsFileRepositoryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamsFileRepositoryUnitTest.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/parameters/ParamsFileRepositoryUnitTest.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -23,6 +23,8 @@
import java.io.File;
+import org.jboss.soa.esb.common.Configuration;
+
import junit.framework.TestCase;
/**
@@ -42,12 +44,12 @@
// Check it can pick up from the System prop...
root = new File("build/tests/");
- System.setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, root.getPath());
+ Configuration.getPropertyManager().setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, root.getPath());
fileRepo = new ParamFileRepository();
assertEquals(root, fileRepo.getRoot());
// Check for error on invalid System prop...
- System.setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, "blah/blah");
+ Configuration.getPropertyManager().setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, "blah/blah");
try {
new ParamFileRepository();
fail("expected IllegalStateException");
@@ -57,7 +59,7 @@
}
public void test_add_get_remove_badargs() throws Exception {
- System.setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, "build/tests/");
+ Configuration.getPropertyManager().setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, "build/tests/");
ParamFileRepository fileRepo = new ParamFileRepository();
test_add_badargs(fileRepo, null, "val");
@@ -100,7 +102,7 @@
}
public void test_add_get_remove() throws Exception {
- System.setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, "build/tests/");
+ Configuration.getPropertyManager().setProperty(ParamFileRepository.FILE_PARAMS_REPOS_ROOT, "build/tests/");
ParamFileRepository fileRepo = new ParamFileRepository();
String name = "repostests/jboss/testparam";
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/JMSRouter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/JMSRouter.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/JMSRouter.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -39,7 +39,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.helpers.AppServerContext;
import org.jboss.soa.esb.helpers.KeyValuePair;
@@ -172,8 +172,8 @@
private JMSSendQueueSetup(String queueName) throws NamingException, JMSException {
Context m_oCtx = AppServerContext.getServerContext(
- SystemProperties.getJndiServerType(),
- SystemProperties.getJndiServerURL());
+ Configuration.getJndiServerType(),
+ Configuration.getJndiServerURL());
QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx.lookup("ConnectionFactory");
QueueConnection oQconn = qcf.createQueueConnection();
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/GpListener.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -38,7 +38,8 @@
import org.jboss.soa.esb.command.CommandQueue;
import org.jboss.soa.esb.command.CommandQueueException;
import org.jboss.soa.esb.command.JmsCommandQueue;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.helpers.DomElement;
import org.jboss.soa.esb.notification.NotificationList;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
@@ -514,10 +515,10 @@
return (endNotRequested() && !timeToReload());
} // ________________________________
- private static final String[] s_saMailProps = { SystemProperties.SMTP_HOST,
- SystemProperties.SMTP_USERNAME, SystemProperties.SMTP_PASSWORD,
- SystemProperties.SMTP_PORT, SystemProperties.SMTP_FROM,
- SystemProperties.SMTP_AUTH };
+ private static final String[] s_saMailProps = { Environment.SMTP_HOST,
+ Environment.SMTP_USERNAME, Environment.SMTP_PASSWORD,
+ Environment.SMTP_PORT, Environment.SMTP_FROM,
+ Environment.SMTP_AUTH };
private void setEmailSystemProperties() {
DomElement oEmail = m_oParms.getFirstElementChild(CHLD_EMAIL_PARMS);
@@ -525,7 +526,7 @@
for (String sCurr : s_saMailProps) {
String sProp = oEmail.getAttr(sCurr);
if (null != sProp)
- System.setProperty(sCurr, sProp);
+ Configuration.getPropertyManager().setProperty(sCurr, sProp);
}
} // ________________________________
@@ -635,8 +636,8 @@
if (null == s_oNH)
try {
s_oNH = NotificationHandlerFactory.getNotifHandler(
- "remote", SystemProperties.getJndiServerType(),
- SystemProperties.getJndiServerURL());
+ "remote", Configuration.getJndiServerType(),
+ Configuration.getJndiServerURL());
} catch (Exception e) {
Logger.getLogger(GpListener.class).error(
"Notification FAILED", e);
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/nagios/Runner.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -23,6 +23,8 @@
package org.jboss.soa.esb.nagios;
+import org.jboss.soa.esb.common.Configuration;
+
public class Runner
{
private static final String MONITOR_PROP = "jbossEsb.nagios.monitor.host";
@@ -33,7 +35,7 @@
NagiosAgent agent = new NagiosAgent();
agent.setInterval(5000);
String sNagiosMonitor
- = System.getProperty(MONITOR_PROP,DEFAULT_HOST);
+ = Configuration.getPropertyManager().getProperty(MONITOR_PROP,DEFAULT_HOST);
agent.setHost(sNagiosMonitor);
agent.setPort(5667);
Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -22,7 +22,8 @@
package org.jboss.soa.esb.internal.core.objectstore;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.helpers.DomElement;
import org.jboss.soa.esb.util.BaseBusinessObject;
import org.jboss.soa.esb.util.BobjStdDTO;
@@ -144,17 +145,17 @@
* Tries reading it from the classpath. If that fails, tries reading it through a URI stream.
*/
protected static DomElement readConfiguration() throws IOException, MalformedURLException, SAXException {
- String configPath = SystemProperties.getObjStoreConfigFile();
+ String configPath = Configuration.getObjStoreConfigFile();
URI configURI;
InputStream configStream = null;
if(configPath == null) {
- throw new IllegalStateException("ObjStoreConfigFile location not configured (param name: " + SystemProperties.OBJECT_STORE_CONFIG_FILE + ").");
+ throw new IllegalStateException("ObjStoreConfigFile location not configured (param name: " + Environment.OBJECT_STORE_CONFIG_FILE + ").");
}
configURI = URI.create(configPath);
if(!configURI.isAbsolute() || configURI.getPath() == null) {
- throw new IllegalStateException("ObjStoreConfigFile location configuration error (" + SystemProperties.OBJECT_STORE_CONFIG_FILE + "=" + configPath + "). Must be an absolute URI e.g. http://, file:/, classpath:/ etc.");
+ throw new IllegalStateException("ObjStoreConfigFile location configuration error (" + Environment.OBJECT_STORE_CONFIG_FILE + "=" + configPath + "). Must be an absolute URI e.g. http://, file:/, classpath:/ etc.");
}
// Is it on the classpath...
Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoSnapTable.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -23,7 +23,7 @@
package org.jboss.soa.esb.internal.core.objectstore;
import org.apache.log4j.Logger;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
import org.jboss.soa.esb.helpers.persist.SqlDbTable;
import org.jboss.soa.esb.services.DefaultEncryptionFactory;
@@ -235,7 +235,7 @@
{ if (null!=m_oMangler)
return m_oMangler;
- String sFactoryName = SystemProperties.getEncryptionFactoryClass();
+ String sFactoryName = Configuration.getEncryptionFactoryClass();
Class oFactClass = DefaultEncryptionFactory.class;
if (null!=sFactoryName)
oFactClass = Class.forName(sFactoryName);
Modified: labs/jbossesb/trunk/product/docs/Trailblazer.doc
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksResponse.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksResponse.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksResponse.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -28,7 +28,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.samples.loanbroker.banks.BankQuoteResponse;
import org.jboss.soa.esb.samples.loanbroker.domain.Customer;
import org.jboss.soa.esb.samples.loanbroker.domain.LoanOffer;
@@ -54,8 +54,8 @@
try {
// get handle to the JBossESB Event object store
IpersistHandler esbHandler = PersistHandlerFactory.getPersistHandler("remote",
- SystemProperties.getJndiServerType(),
- SystemProperties.getJndiServerURL());
+ Configuration.getJndiServerType(),
+ Configuration.getJndiServerURL());
Customer customer = (Customer) esbHandler.getObject(org.jboss.soa.esb.samples.loanbroker.domain.Customer.class, bankResponse.customerUID);
logger.info(this.getClass().getSimpleName() + " -- Business Object BEFORE Loan Offer is added: \n" + customer.toDTO().toXml());
Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -27,7 +27,7 @@
import org.apache.log4j.Logger;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.actions.ActionProcessor;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.samples.loanbroker.BankQuote;
import org.jboss.soa.esb.samples.loanbroker.adapters.CustomerAdapter;
import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckResponseNotification;
@@ -58,8 +58,8 @@
try {
// get handle to the JBossESB Event object store
esbHandler = PersistHandlerFactory.getPersistHandler("remote",
- SystemProperties.getJndiServerType(),
- SystemProperties.getJndiServerURL());
+ Configuration.getJndiServerType(),
+ Configuration.getJndiServerURL());
Customer customer = (Customer) esbHandler.getObject(org.jboss.soa.esb.samples.loanbroker.domain.Customer.class, response.customerUID);
logger.info(this.getClass().getSimpleName() + " -- Business Object BEFORE Credit Rating is added: \n" + customer.toDTO().toXml());
Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -33,7 +33,7 @@
import javax.jws.soap.SOAPBinding;
import javax.naming.Context;
-import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.helpers.AppServerContext;
import org.jboss.soa.esb.samples.loanbroker.adapters.CustomerAdapter;
import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckRequest;
@@ -57,8 +57,8 @@
// get handle to the JBossESB Event object store
IpersistHandler esbHandler = PersistHandlerFactory
- .getPersistHandler("remote", SystemProperties
- .getJndiServerType(), SystemProperties
+ .getPersistHandler("remote", Configuration
+ .getJndiServerType(), Configuration
.getJndiServerURL());
// convert the WebCustomer to an ESB Customer capable of being
Added: labs/jbossesb/trunk/product/etc/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/etc/jbossesb-properties.xml 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/product/etc/jbossesb-properties.xml 2006-09-27 14:05:01 UTC (rev 6440)
@@ -0,0 +1,46 @@
+<?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.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ <!-- property name="org.jboss.soa.esb.mail.smtp.from" value="" -->
+ <!-- property name="org.jboss.soa.esb.mail.smtp.auth" value="" -->
+ <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.paramsRepository.class" value="" -->
+ <!-- property name="org.jboss.soa.esb.encryption.factory.class" value="" -->
+ <!-- property name="org.jboss.soa.esb.objStore.configFile" value="" -->
+ </properties>
+</esb>
Copied: labs/jbossesb/trunk/product/lib/ext/jbossts-common.jar (from rev 6434, labs/jbossesb/workspace/rearchitecture/product/lib/ext/jbossts-common.jar)
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java 2006-09-27 13:21:42 UTC (rev 6439)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/DbUtils.java 2006-09-27 14:05:01 UTC (rev 6440)
@@ -32,6 +32,7 @@
import java.util.Properties;
import org.apache.log4j.Logger;
+import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.connection.ConnectionPool;
import org.jboss.soa.esb.connection.ConnectionPoolFactory;
import org.jboss.soa.esb.connection.ConnectionProperties;
@@ -41,7 +42,8 @@
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public abstract class DbUtils {
+public abstract class DbUtils
+{
private static Logger logger = Logger.getLogger(DbUtils.class);
@@ -50,14 +52,22 @@
private static String DB_USER = "org.jboss.esb.db.user";
private static String DB_PASSWORD = "org.jboss.esb.db.password";
- public static String dbDriver = System.getProperty(DB_DRIVER);
- public static String dbUrl = System.getProperty(DB_URL);
- public static String dbUser = System.getProperty(DB_USER);
- public static String dbPassword = System.getProperty(DB_PASSWORD);
+ public static String dbDriver = Configuration.getPropertyManager()
+ .getProperty(DB_DRIVER);
+ public static String dbUrl = Configuration.getPropertyManager()
+ .getProperty(DB_URL);
+
+ public static String dbUser = Configuration.getPropertyManager()
+ .getProperty(DB_USER);
+
+ public static String dbPassword = Configuration.getPropertyManager()
+ .getProperty(DB_PASSWORD);
+
private static Properties properties = new Properties();
- static {
+ static
+ {
properties.put(ConnectionProperties.DRIVER_CLASSNAME, dbDriver);
properties.put(ConnectionProperties.CONNECTION_URL, dbUrl);
properties.put(ConnectionProperties.USERNAME, dbUser);
@@ -65,23 +75,27 @@
}
/**
- * Execute an SQL statement.
- * <p/>
- * Calls {@link Statement#execute(java.lang.String)}. Manages getting and cleaning up of all
- * DB resources needed to execute the SQL.
+ * Execute an SQL statement. <p/> Calls
+ * {@link Statement#execute(java.lang.String)}. Manages getting and
+ * cleaning up of all DB resources needed to execute the SQL.
*
- * @param sql SQL to Execute.
+ * @param sql
+ * SQL to Execute.
* @return The return value from {@link Statement#execute(java.lang.String)}.
*/
- public static boolean execute(String sql) {
+ public static boolean execute(String sql)
+ {
DbResources dbResources = null;
- try {
+ try
+ {
dbResources = new DbResources();
return dbResources.stat.execute(sql);
- } catch (SQLException e) {
+ } catch (SQLException e)
+ {
TestCaseUtils.logAndFail("SQL execution failed: " + sql, logger, e);
- } finally {
+ } finally
+ {
dbResources.close();
}
@@ -89,54 +103,66 @@
}
/**
- * Execute an SQL statement.
- * <p/>
- * Calls {@link Statement#executeQuery(java.lang.String)}. Manages getting and cleaning up of all
- * DB resources needed to execute the SQL.
+ * Execute an SQL statement. <p/> Calls
+ * {@link Statement#executeQuery(java.lang.String)}. Manages getting and
+ * cleaning up of all DB resources needed to execute the SQL.
*
- * @param query SQL to Execute.
- * @return Returns a Proxied {@link ResultSet} object which manages closing of all associated DB resources
- * on the call to {@link ResultSet#close()} to the returned {@link ResultSet} object.
+ * @param query
+ * SQL to Execute.
+ * @return Returns a Proxied {@link ResultSet} object which manages closing
+ * of all associated DB resources on the call to
+ * {@link ResultSet#close()} to the returned {@link ResultSet}
+ * object.
*/
- public static ResultSet executeQuery(String query) {
+ public static ResultSet executeQuery(String query)
+ {
DbResources dbResources = null;
ResultSet resultSet = null;
- try {
+ try
+ {
dbResources = new DbResources();
resultSet = dbResources.stat.executeQuery(query);
-
- // Proxy the calls to the ResultSet object so we can close the DbResources
+
+ // Proxy the calls to the ResultSet object so we can close the
+ // DbResources
// when the call to close the resultset is made.
- return (ResultSet) Proxy.newProxyInstance(ResultSet.class.getClassLoader(),
- new Class[] { ResultSet.class },
- new ResultSetInvocationHandler(resultSet, dbResources));
- } catch (SQLException e) {
+ return (ResultSet) Proxy.newProxyInstance(ResultSet.class
+ .getClassLoader(), new Class[]
+ { ResultSet.class }, new ResultSetInvocationHandler(resultSet,
+ dbResources));
+ } catch (SQLException e)
+ {
// Close the ResultSet and DbResources objects...
closeResultSet(resultSet);
dbResources.close();
- TestCaseUtils.logAndFail("SQL execution failed: " + query, logger, e);
+ TestCaseUtils.logAndFail("SQL execution failed: " + query, logger,
+ e);
}
return null;
}
/**
- * Execute an SQL statement.
- * <p/>
- * Calls {@link Statement#executeUpdate(java.lang.String)}. Manages getting and cleaning up of all
- * DB resources needed to execute the SQL.
+ * Execute an SQL statement. <p/> Calls
+ * {@link Statement#executeUpdate(java.lang.String)}. Manages getting and
+ * cleaning up of all DB resources needed to execute the SQL.
*
- * @param sql SQL to Execute.
- * @return The return value from {@link Statement#executeUpdate(java.lang.String)}.
+ * @param sql
+ * SQL to Execute.
+ * @return The return value from
+ * {@link Statement#executeUpdate(java.lang.String)}.
*/
- public static int executeUpdate(String sql) {
+ public static int executeUpdate(String sql)
+ {
DbResources dbResources = null;
- try {
+ try
+ {
dbResources = new DbResources();
return dbResources.stat.executeUpdate(sql);
- } catch (SQLException e) {
+ } catch (SQLException e)
+ {
// Close the DbResources objects...
dbResources.close();
TestCaseUtils.logAndFail("SQL execution failed: " + sql, logger, e);
@@ -144,117 +170,170 @@
return 0;
}
-
+
/**
- * Convienience method for closing a DB ResultSet.
- * <p/>
- * Handles Exceptions etc.
- * @param resultSet The ResultSet to close.
+ * Convienience method for closing a DB ResultSet. <p/> Handles Exceptions
+ * etc.
+ *
+ * @param resultSet
+ * The ResultSet to close.
*/
- public static void closeResultSet(ResultSet resultSet) {
- if(resultSet != null) {
- try {
+ public static void closeResultSet(ResultSet resultSet)
+ {
+ if (resultSet != null)
+ {
+ try
+ {
resultSet.close();
- } catch (SQLException e) {
- TestCaseUtils.logAndFail("Failed to close resultset.", logger, e);
+ } catch (SQLException e)
+ {
+ TestCaseUtils.logAndFail("Failed to close resultset.", logger,
+ e);
}
- }
+ }
}
/**
- * Assert that the specified query does not return an empty resultset.
- * @param query The query to execute.
- * @param maxWait The maximum length of time (ms) to wait for the query to return a non-empty resultset.
+ * Assert that the specified query does not return an empty resultset.
+ *
+ * @param query
+ * The query to execute.
+ * @param maxWait
+ * The maximum length of time (ms) to wait for the query to
+ * return a non-empty resultset.
*/
- public static void assertNonEmptyResultSet(String query, int maxWait) {
+ public static void assertNonEmptyResultSet(String query, int maxWait)
+ {
long endTime = System.currentTimeMillis() + maxWait;
-
- while(System.currentTimeMillis() < endTime) {
+
+ while (System.currentTimeMillis() < endTime)
+ {
ResultSet resSet = executeQuery(query);
-
- try {
- if(resSet.next()) {
+
+ try
+ {
+ if (resSet.next())
+ {
// There were rows in the resultset...
return;
}
Thread.sleep(500);
- } catch (Exception e) {
- TestCaseUtils.logAndFail("Error while executing SQL query [" + query + "].", logger, e);
- } finally {
+ } catch (Exception e)
+ {
+ TestCaseUtils.logAndFail("Error while executing SQL query ["
+ + query + "].", logger, e);
+ } finally
+ {
closeResultSet(resSet);
}
}
- TestCaseUtils.logAndFail("SQL query [" + query + "] failed to return a non-empty resultset. Waited for " + maxWait + "ms.", logger, null);
- }
-
+ TestCaseUtils.logAndFail("SQL query [" + query
+ + "] failed to return a non-empty resultset. Waited for "
+ + maxWait + "ms.", logger, null);
+ }
+
/**
- * ResultSet Proxying InvocationHandler.
- * <p/>
- * This class is used simply to "catch" the close method call on the ResultSet so
- * we can also close the underlying DbResources.
+ * ResultSet Proxying InvocationHandler. <p/> This class is used simply to
+ * "catch" the close method call on the ResultSet so we can also close the
+ * underlying DbResources.
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
- private static class ResultSetInvocationHandler implements InvocationHandler {
+ private static class ResultSetInvocationHandler implements
+ InvocationHandler
+ {
private ResultSet resultSet;
+
private DbResources dbResources;
-
- private ResultSetInvocationHandler(ResultSet resultSet, DbResources dbResources) {
+
+ private ResultSetInvocationHandler(ResultSet resultSet,
+ DbResources dbResources)
+ {
this.resultSet = resultSet;
this.dbResources = dbResources;
}
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if(method.getName().equals("close")) {
- try {
- // Caught the call to close the resultset - close the associated DbResources too!
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ if (method.getName().equals("close"))
+ {
+ try
+ {
+ // Caught the call to close the resultset - close the
+ // associated DbResources too!
return method.invoke(resultSet, args);
- } catch (Exception e) {
- TestCaseUtils.logAndFail("Failed to close database Resultset. Connection Properties: " + properties, logger, e);
- } finally {
+ } catch (Exception e)
+ {
+ TestCaseUtils.logAndFail(
+ "Failed to close database Resultset. Connection Properties: "
+ + properties, logger, e);
+ } finally
+ {
dbResources.close();
}
}
-
+
// Call to something other than the "close" method.
return method.invoke(resultSet, args);
}
}
-
+
/**
- * Container Object for a "standard" set of DB resources.
- * <p/>
- * Provides convienience methods closing the resources etc.
+ * Container Object for a "standard" set of DB resources. <p/> Provides
+ * convienience methods closing the resources etc.
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
- private static class DbResources {
+ private static class DbResources
+ {
private Connection con = null;
+
private Statement stat = null;
-
- private DbResources() {
- try {
+
+ private DbResources()
+ {
+ try
+ {
// Register the driver..
Class.forName(dbDriver).newInstance();
// Create the connection...
con = DriverManager.getConnection(dbUrl, dbUser, dbPassword);
// Create a regular statement for execution...
stat = con.createStatement();
- } catch (Exception e) {
- TestCaseUtils.logAndFail("Failed to connect to database. Connection Properties: " + properties, logger, e);
+ } catch (Exception e)
+ {
+ TestCaseUtils.logAndFail(
+ "Failed to connect to database. Connection Properties: "
+ + properties, logger, e);
}
}
-
- private void close() {
- try {
- if (stat != null) {
+
+ private void close()
+ {
+ try
+ {
+ if (stat != null)
+ {
stat.close();
}
- } catch (SQLException e) {
- TestCaseUtils.logAndFail("Failed to close database Statement. Connection Properties: " + properties, logger, e);
- } finally {
- if (con != null) {
- try {
+ } catch (SQLException e)
+ {
+ TestCaseUtils.logAndFail(
+ "Failed to close database Statement. Connection Properties: "
+ + properties, logger, e);
+ } finally
+ {
+ if (con != null)
+ {
+ try
+ {
con.close();
- } catch (SQLException e) {
- TestCaseUtils.logAndFail("Failed to close database Connection. Connection Properties: " + properties, logger, e);
+ } catch (SQLException e)
+ {
+ TestCaseUtils.logAndFail(
+ "Failed to close database Connection. Connection Properties: "
+ + properties, logger, e);
}
}
}
More information about the jboss-svn-commits
mailing list