[jboss-svn-commits] JBL Code SVN: r28649 - in labs/jbosstm/trunk/ArjunaJTS: jts/classes/com/arjuna/ats/internal/jts and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jul 31 09:33:41 EDT 2009
Author: jhalliday
Date: 2009-07-31 09:33:41 -0400 (Fri, 31 Jul 2009)
New Revision: 28649
Added:
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/common/JTSEnvironmentBean.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/BeanPopulatorTest.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/BeanPopulatorTest.java
Modified:
labs/jbosstm/trunk/ArjunaJTS/jts/build.xml
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/OTSImpleManager.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/TransactionServer.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMClient.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMTest.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml
labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/Services.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/Configuration.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java
Log:
Add EnvironmentBeans for ArjunaJTS. JBTM-596
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/build.xml 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/build.xml 2009-07-31 13:33:41 UTC (rev 28649)
@@ -27,6 +27,7 @@
<target name="init" depends="sharedbuild.init">
<import-module.macro module="common"/>
+ <import-module.macro module="common_tests"/>
<import-module.macro module="arjuna"/>
<import-module.macro module="txoj"/>
<import-module.macro module="orbportability"/>
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/OTSImpleManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/OTSImpleManager.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/OTSImpleManager.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -36,6 +36,7 @@
import com.arjuna.ats.jts.logging.*;
import com.arjuna.orbportability.*;
+import com.arjuna.orbportability.common.opPropertyManager;
import com.arjuna.ats.internal.jts.orbspecific.CurrentImple;
import com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple;
@@ -204,7 +205,7 @@
{
requireTransactionManager = true;
- String resolveMechanism = jtsPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.RESOLVE_SERVICE, "CONFIGURATION_FILE");
+ String resolveMechanism = opPropertyManager.getOrbPortabilityEnvironmentBean().getResolveService();
if (resolveMechanism.compareTo("NAME_SERVICE") == 0)
resolver = Services.NAME_SERVICE;
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/TransactionServer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/TransactionServer.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/TransactionServer.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -36,6 +36,7 @@
import com.arjuna.ats.internal.jts.ORBManager;
import com.arjuna.orbportability.*;
+import com.arjuna.orbportability.common.opPropertyManager;
import org.omg.CosTransactions.*;
@@ -46,7 +47,7 @@
public static final int getResolver ()
{
int resolver = com.arjuna.orbportability.common.Configuration.bindDefault();
- final String resolveService = jtsPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.RESOLVE_SERVICE);
+ final String resolveService = opPropertyManager.getOrbPortabilityEnvironmentBean().getResolveService();
if (resolveService != null)
{
Added: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/common/JTSEnvironmentBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/common/JTSEnvironmentBean.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/common/JTSEnvironmentBean.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -0,0 +1,219 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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) 2009,
+ * @author JBoss, a division of Red Hat.
+ */
+package com.arjuna.ats.jts.common;
+
+import com.arjuna.common.internal.util.propertyservice.FullPropertyName;
+import com.arjuna.common.internal.util.propertyservice.PropertyPrefix;
+
+/**
+ * A JavaBean containing configuration properties for the JTS system.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com)
+ */
+ at PropertyPrefix(prefix = "com.arjuna.ats.jts.")
+public class JTSEnvironmentBean
+{
+ @FullPropertyName(name= "com.arjuna.ats.jts.common.propertiesFile")
+ private String propertiesFile;
+
+ private boolean transactionManager = false;
+ private boolean needTranContext = false;
+ private boolean alwaysPropagateContext = false;
+ private String interposition = null;
+ private boolean checkedTransactions = false;
+ private boolean supportSubtransactions = true;
+ private boolean supportRollbackSync = true;
+ private boolean supportInterposedSynchronization = false;
+ private int defaultTimeout = 60; // deprecated
+ private boolean propagateTerminator = false;
+ private String contextPropMode = null;
+ private int recoveryManagerPort = 4711;
+ private String recoveryManagerAddress = "";
+
+ @FullPropertyName(name = "com.arjuna.ats.jts.ots_1_0.timeoutPropagation")
+ private String timeoutPropagation;
+
+
+// public static final String PROPERTIES_FILE = "com.arjuna.ats.jts.common.propertiesFile";
+ public String getPropertiesFile()
+ {
+ return propertiesFile;
+ }
+
+ public void setPropertiesFile(String propertiesFile)
+ {
+ this.propertiesFile = propertiesFile;
+ }
+
+// public static final String TRANSACTION_MANAGER = "com.arjuna.ats.jts.transactionManager";
+ public boolean isTransactionManager()
+ {
+ return transactionManager;
+ }
+
+ public void setTransactionManager(boolean transactionManager)
+ {
+ this.transactionManager = transactionManager;
+ }
+
+// public static final String NEED_TRAN_CONTEXT = "com.arjuna.ats.jts.needTranContext";
+ public boolean isNeedTranContext()
+ {
+ return needTranContext;
+ }
+
+ public void setNeedTranContext(boolean needTranContext)
+ {
+ this.needTranContext = needTranContext;
+ }
+
+// public static final String ALWAYS_PROPAGATE_CONTEXT = "com.arjuna.ats.jts.alwaysPropagateContext";
+ public boolean isAlwaysPropagateContext()
+ {
+ return alwaysPropagateContext;
+ }
+
+ public void setAlwaysPropagateContext(boolean alwaysPropagateContext)
+ {
+ this.alwaysPropagateContext = alwaysPropagateContext;
+ }
+
+// public static final String INTERPOSITION = "com.arjuna.ats.jts.interposition";
+ public String getInterposition()
+ {
+ return interposition;
+ }
+
+ public void setInterposition(String interposition)
+ {
+ this.interposition = interposition;
+ }
+
+// public static final String CHECKED_TRANSACTIONS = "com.arjuna.ats.jts.checkedTransactions";
+ public boolean isCheckedTransactions()
+ {
+ return checkedTransactions;
+ }
+
+ public void setCheckedTransactions(boolean checkedTransactions)
+ {
+ this.checkedTransactions = checkedTransactions;
+ }
+
+// public static final String SUPPORT_SUBTRANSACTIONS = "com.arjuna.ats.jts.supportSubtransactions";
+ public boolean isSupportSubtransactions()
+ {
+ return supportSubtransactions;
+ }
+
+ public void setSupportSubtransactions(boolean supportSubtransactions)
+ {
+ this.supportSubtransactions = supportSubtransactions;
+ }
+
+// public static final String SUPPORT_ROLLBACK_SYNC = "com.arjuna.ats.jts.supportRollbackSync";
+ public boolean isSupportRollbackSync()
+ {
+ return supportRollbackSync;
+ }
+
+ public void setSupportRollbackSync(boolean supportRollbackSync)
+ {
+ this.supportRollbackSync = supportRollbackSync;
+ }
+
+// public static final String SUPPORT_INTERPOSED_SYNCHRONIZATION = "com.arjuna.ats.jts.supportInterposedSynchronization";
+ public boolean isSupportInterposedSynchronization()
+ {
+ return supportInterposedSynchronization;
+ }
+
+ public void setSupportInterposedSynchronization(boolean supportInterposedSynchronization)
+ {
+ this.supportInterposedSynchronization = supportInterposedSynchronization;
+ }
+
+// public static final String DEFAULT_TIMEOUT = "com.arjuna.ats.jts.defaultTimeout"; // deprecated
+ public int getDefaultTimeout()
+ {
+ return defaultTimeout;
+ }
+
+ public void setDefaultTimeout(int defaultTimeout)
+ {
+ this.defaultTimeout = defaultTimeout;
+ }
+
+// public static final String PROPAGATE_TERMINATOR = "com.arjuna.ats.jts.propagateTerminator";
+ public boolean isPropagateTerminator()
+ {
+ return propagateTerminator;
+ }
+
+ public void setPropagateTerminator(boolean propagateTerminator)
+ {
+ this.propagateTerminator = propagateTerminator;
+ }
+
+// public static final String CONTEXT_PROP_MODE = "com.arjuna.ats.jts.contextPropMode";
+ public String getContextPropMode()
+ {
+ return contextPropMode;
+ }
+
+ public void setContextPropMode(String contextPropMode)
+ {
+ this.contextPropMode = contextPropMode;
+ }
+
+// public static final String RECOVERY_MANAGER_ORB_PORT = "com.arjuna.ats.jts.recoveryManagerPort";
+ public int getRecoveryManagerPort()
+ {
+ return recoveryManagerPort;
+ }
+
+ public void setRecoveryManagerPort(int recoveryManagerPort)
+ {
+ this.recoveryManagerPort = recoveryManagerPort;
+ }
+
+// public static final String RECOVERY_MANAGER_ADDRESS = "com.arjuna.ats.jts.recoveryManagerAddress";
+ public String getRecoveryManagerAddress()
+ {
+ return recoveryManagerAddress;
+ }
+
+ public void setRecoveryManagerAddress(String recoveryManagerAddress)
+ {
+ this.recoveryManagerAddress = recoveryManagerAddress;
+ }
+
+// public static final String OTS_1_0_TIMEOUT_PROPAGATION = "com.arjuna.ats.jts.ots_1_0.timeoutPropagation";
+ public String getTimeoutPropagation()
+ {
+ return timeoutPropagation;
+ }
+
+ public void setTimeoutPropagation(String timeoutPropagation)
+ {
+ this.timeoutPropagation = timeoutPropagation;
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/BeanPopulatorTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/BeanPopulatorTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/BeanPopulatorTest.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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) 2009,
+ * @author JBoss, a division of Red Hat.
+ */
+package com.hp.mwtests.ts.jts;
+
+import com.arjuna.common.tests.simple.DummyPropertyManager;
+import com.arjuna.common.internal.util.propertyservice.BeanPopulator;
+import com.arjuna.ats.jts.common.JTSEnvironmentBean;
+import com.arjuna.ats.jts.common.Environment;
+
+import java.util.Set;
+import java.util.HashSet;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Check behaviour of the BeanPopulator util which copies old PropertyManager values into new EnvironmentBeans.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com)
+ */
+public class BeanPopulatorTest
+{
+ @Test
+ public void testJTSPropertiesPopulation() throws Exception {
+
+ // check that all the Environment properties are looked for
+ // by the set of beans which wrap them and conversely that no undefined
+ // properties are looked for. i.e. that the Environment and Beans are in sync
+
+ DummyPropertyManager testManager = new DummyPropertyManager(null);
+
+ BeanPopulator.configureFromPropertyManager(new JTSEnvironmentBean(), testManager);
+
+ Set<String> expectedKeys = new HashSet<String>();
+ expectedKeys.addAll( DummyPropertyManager.extractKeys(Environment.class));
+
+ assertEquals(expectedKeys, testManager.usedKeys);
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMClient.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMClient.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMClient.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -37,6 +37,7 @@
import com.arjuna.ats.jts.common.jtsPropertyManager;
import com.arjuna.orbportability.*;
+import com.arjuna.orbportability.common.opPropertyManager;
import com.arjuna.ats.internal.jts.ORBManager;
@@ -79,7 +80,7 @@
Services serv = new Services(myORB);
int resolver = com.arjuna.orbportability.common.Configuration.bindDefault();
- String resolveService = jtsPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.RESOLVE_SERVICE);
+ String resolveService = opPropertyManager.getOrbPortabilityEnvironmentBean().getResolveService();
if (resolveService != null)
{
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMTest.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/remote/transactionserver/TMTest.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -32,6 +32,7 @@
package com.hp.mwtests.ts.jts.remote.transactionserver;
import com.arjuna.orbportability.*;
+import com.arjuna.orbportability.common.opPropertyManager;
import com.arjuna.ats.jts.common.jtsPropertyManager;
@@ -64,7 +65,7 @@
Control topLevelControl = null;
Services serv = new Services(myORB);
int resolver = com.arjuna.orbportability.common.Configuration.bindDefault();
- String resolveService = jtsPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.RESOLVE_SERVICE);
+ String resolveService = opPropertyManager.getOrbPortabilityEnvironmentBean().getResolveService();
if (resolveService != null)
{
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml 2009-07-31 13:33:41 UTC (rev 28649)
@@ -27,6 +27,7 @@
<target name="init" depends="sharedbuild.init">
<import-module.macro module="common"/>
+ <import-module.macro module="common_tests"/>
</target>
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/Services.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/Services.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/Services.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -185,11 +185,10 @@
break;
case CONFIGURATION_FILE:
{
- String cosservicesRoot = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_ROOT);
+ String cosservicesRoot = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesRoot();
if (cosservicesRoot == null || cosservicesRoot.length() == 0)
cosservicesRoot = com.arjuna.orbportability.common.Configuration.configFileRoot();
- String configLocation = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_FILE,
- com.arjuna.orbportability.common.Configuration.configFile());
+ String configLocation = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesFile();
String configFile = cosservicesRoot+File.separatorChar+configLocation;
LineNumberReader input;
@@ -274,7 +273,7 @@
{
try
{
- String fileDir = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.FILE_DIR, null);
+ String fileDir = opPropertyManager.getOrbPortabilityEnvironmentBean().getFileDir();
File f = null;
if (fileDir != null && fileDir.length() != 0)
@@ -394,11 +393,10 @@
break;
case CONFIGURATION_FILE:
{
- String cosservicesRoot = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_ROOT);
+ String cosservicesRoot = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesRoot();
if (cosservicesRoot == null || cosservicesRoot.length() == 0)
cosservicesRoot = com.arjuna.orbportability.common.Configuration.configFileRoot();
- String configLocation = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_FILE,
- com.arjuna.orbportability.common.Configuration.configFile());
+ String configLocation = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesFile();
String configFile = cosservicesRoot+File.separatorChar+configLocation;
LineNumberReader input = null;
String objString = _orb.orb().object_to_string(objRef);
@@ -496,7 +494,7 @@
break;
case FILE:
{
- String fileDir = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.FILE_DIR, null);
+ String fileDir = opPropertyManager.getOrbPortabilityEnvironmentBean().getFileDir();
FileOutputStream ofile = null;
if (fileDir != null && fileDir.length() != 0)
@@ -556,11 +554,10 @@
* Now check the configuration file equivalent.
*/
- String cosservicesRoot = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_ROOT);
+ String cosservicesRoot = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesRoot();
if (cosservicesRoot == null || cosservicesRoot.length() == 0)
cosservicesRoot = com.arjuna.orbportability.common.Configuration.configFileRoot();
- String configLocation = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.INITIAL_REFERENCES_FILE,
- com.arjuna.orbportability.common.Configuration.configFile());
+ String configLocation = opPropertyManager.getOrbPortabilityEnvironmentBean().getInitialReferencesFile();
String configFile = cosservicesRoot+File.separatorChar+configLocation;
LineNumberReader input = null;
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/Configuration.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/Configuration.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/Configuration.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -214,7 +214,7 @@
if (!_bindDefaultSet)
{
- String configuredMechanism = opPropertyManager.getPropertyManager().getProperty(Environment.BIND_MECHANISM);
+ String configuredMechanism = opPropertyManager.getOrbPortabilityEnvironmentBean().getBindMechanism();
if (configuredMechanism != null)
{
Added: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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) 2009,
+ * @author JBoss, a division of Red Hat.
+ */
+package com.arjuna.orbportability.common;
+
+import com.arjuna.common.internal.util.propertyservice.PropertyPrefix;
+
+/**
+ * A JavaBean containing assorted configuration properties for the Orb Portability layer.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com)
+ */
+ at PropertyPrefix(prefix = "com.arjuna.orbportability.")
+public class OrbPortabilityEnvironmentBean
+{
+ private String propertiesFile;
+
+ private String corbaDiagnostics; // key only
+ private String initialReferencesRoot = com.arjuna.orbportability.common.Configuration.configFileRoot();
+ private String initialReferencesFile = com.arjuna.orbportability.common.Configuration.configFile();
+ private String fileDir = null;
+ private String resolveService = "CONFIGURATION_FILE";
+ private String eventHandler;
+ private String orbImplementation = null;
+ private String oaImplementation = null;
+ private String bindMechanism = "CONFIGURATION_FILE";
+ private String defaultConfigurationFilename;
+
+// public static final String PROPERTIES_FILE = "com.arjuna.orbportability.propertiesFile";
+ public String getPropertiesFile()
+ {
+ return propertiesFile;
+ }
+
+ public void setPropertiesFile(String propertiesFile)
+ {
+ this.propertiesFile = propertiesFile;
+ }
+
+// public static final String CORBA_DIAGNOSTICS = "com.arjuna.orbportability.corbaDiagnostics";
+ public String getCorbaDiagnostics()
+ {
+ return corbaDiagnostics;
+ }
+
+ public void setCorbaDiagnostics(String corbaDiagnostics)
+ {
+ this.corbaDiagnostics = corbaDiagnostics;
+ }
+
+// public static final String INITIAL_REFERENCES_ROOT = "com.arjuna.orbportability.initialReferencesRoot";
+ public String getInitialReferencesRoot()
+ {
+ return initialReferencesRoot;
+ }
+
+ public void setInitialReferencesRoot(String initialReferencesRoot)
+ {
+ this.initialReferencesRoot = initialReferencesRoot;
+ }
+
+// public static final String INITIAL_REFERENCES_FILE = "com.arjuna.orbportability.initialReferencesFile";
+ public String getInitialReferencesFile()
+ {
+ return initialReferencesFile;
+ }
+
+ public void setInitialReferencesFile(String initialReferencesFile)
+ {
+ this.initialReferencesFile = initialReferencesFile;
+ }
+
+// public static final String FILE_DIR = "com.arjuna.orbportability.fileDir";
+ public String getFileDir()
+ {
+ return fileDir;
+ }
+
+ public void setFileDir(String fileDir)
+ {
+ this.fileDir = fileDir;
+ }
+
+// public static final String RESOLVE_SERVICE = "com.arjuna.orbportability.resolveService";
+ public String getResolveService()
+ {
+ return resolveService;
+ }
+
+ public void setResolveService(String resolveService)
+ {
+ this.resolveService = resolveService;
+ }
+
+// public static final String EVENT_HANDLER = "com.arjuna.orbportability.eventHandler";
+ public String getEventHandler()
+ {
+ return eventHandler;
+ }
+
+ public void setEventHandler(String eventHandler)
+ {
+ this.eventHandler = eventHandler;
+ }
+
+// public static final String ORB_IMPLEMENTATION = "com.arjuna.orbportability.orbImplementation";
+ public String getOrbImplementation()
+ {
+ return orbImplementation;
+ }
+
+ public void setOrbImplementation(String orbImplementation)
+ {
+ this.orbImplementation = orbImplementation;
+ }
+
+// public static final String OA_IMPLEMENTATION = "com.arjuna.orbportability.oaImplementation";
+ public String getOaImplementation()
+ {
+ return oaImplementation;
+ }
+
+ public void setOaImplementation(String oaImplementation)
+ {
+ this.oaImplementation = oaImplementation;
+ }
+
+// public static final String BIND_MECHANISM= "com.arjuna.orbportability.bindMechanism";
+ public String getBindMechanism()
+ {
+ return bindMechanism;
+ }
+
+ public void setBindMechanism(String bindMechanism)
+ {
+ this.bindMechanism = bindMechanism;
+ }
+
+// public static final String DEFAULT_ORB_CONFIGURATION = "com.arjuna.orbportability.defaultConfigurationFilename";
+ public String getDefaultConfigurationFilename()
+ {
+ return defaultConfigurationFilename;
+ }
+
+ public void setDefaultConfigurationFilename(String defaultConfigurationFilename)
+ {
+ this.defaultConfigurationFilename = defaultConfigurationFilename;
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -33,7 +33,10 @@
import com.arjuna.common.util.propertyservice.PropertyManager;
import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
+import com.arjuna.common.internal.util.propertyservice.BeanPopulator;
+import java.util.concurrent.atomic.AtomicBoolean;
+
/**
* Property manager wrapper for the ORB Portability module.
*
@@ -45,4 +48,24 @@
{
return PropertyManagerFactory.getPropertyManagerForModule("orbportability", Environment.PROPERTIES_FILE);
}
+
+ public static OrbPortabilityEnvironmentBean getOrbPortabilityEnvironmentBean()
+ {
+ synchronized (opEnvironmentBeanInit) {
+ if(!opEnvironmentBeanInit.get()) {
+ try {
+ BeanPopulator.configureFromPropertyManager(opEnvironmentBean, getPropertyManager());
+ opEnvironmentBeanInit.set(true);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return opEnvironmentBean;
+ }
+
+ private static final AtomicBoolean opEnvironmentBeanInit = new AtomicBoolean(false);
+ private static final OrbPortabilityEnvironmentBean opEnvironmentBean = new OrbPortabilityEnvironmentBean();
+
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -127,7 +127,7 @@
*/
private final void initialise ()
{
- String className = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.OA_IMPLEMENTATION);
+ String className = opPropertyManager.getOrbPortabilityEnvironmentBean().getOaImplementation();
if (className == null)
{
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java 2009-07-31 13:33:07 UTC (rev 28648)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -108,7 +108,7 @@
* Let the application provide its own ORB implementation.
*/
- String className = opPropertyManager.getPropertyManager().getProperty(com.arjuna.orbportability.common.Environment.ORB_IMPLEMENTATION);
+ String className = opPropertyManager.getOrbPortabilityEnvironmentBean().getOrbImplementation();
if (className == null)
{
Added: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/BeanPopulatorTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/BeanPopulatorTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/BeanPopulatorTest.java 2009-07-31 13:33:41 UTC (rev 28649)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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) 2009,
+ * @author JBoss, a division of Red Hat.
+ */
+package com.hp.mwtests.orbportability.initialisation;
+
+import com.arjuna.common.tests.simple.DummyPropertyManager;
+import com.arjuna.common.internal.util.propertyservice.BeanPopulator;
+import com.arjuna.orbportability.common.OrbPortabilityEnvironmentBean;
+import com.arjuna.orbportability.common.Environment;
+
+import java.util.Set;
+import java.util.HashSet;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Check behaviour of the BeanPopulator util which copies old PropertyManager values into new EnvironmentBeans.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com)
+ */
+public class BeanPopulatorTest
+{
+ @Test
+ public void testOrbPortabilityPropertiesPopulation() throws Exception {
+
+ // check that all the Environment properties are looked for
+ // by the set of beans which wrap them and conversely that no undefined
+ // properties are looked for. i.e. that the Environment and Beans are in sync
+
+ DummyPropertyManager testManager = new DummyPropertyManager(null);
+
+ BeanPopulator.configureFromPropertyManager(new OrbPortabilityEnvironmentBean(), testManager);
+
+ Set<String> expectedKeys = new HashSet<String>();
+ expectedKeys.addAll( DummyPropertyManager.extractKeys(Environment.class));
+
+ assertEquals(expectedKeys, testManager.usedKeys);
+ }
+}
More information about the jboss-svn-commits
mailing list