Author: rareddy
Date: 2009-02-25 10:28:27 -0500 (Wed, 25 Feb 2009)
New Revision: 496
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicHost.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfig_42_HelperImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
trunk/server/src/main/java/com/metamatrix/server/HostController.java
trunk/server/src/main/java/com/metamatrix/server/Main.java
trunk/server/src/main/resources/com/metamatrix/platform/i18n.properties
trunk/server/src/test/java/com/metamatrix/platform/config/spi/xml/TestCurrentConfiguration.java
Log:
TEIID-309: The host specific properties are moved to bootstrap properties, since host
properties are specific to a given host not to the entire system. This way they can be
configured correctly during the setupmm.
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-02-25
03:49:52 UTC (rev 495)
+++
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -117,7 +117,7 @@
List<HostInfo> hostKeys = new
ArrayList<HostInfo>(this.serverDiscovery.getKnownHosts());
List<HostInfo> hostCopy = new ArrayList<HostInfo>(hostKeys);
int knownHosts = hostKeys.size();
- for (int i = 0; i < hostKeys.size(); i++) {
+ while (hostKeys.size() > 0) {
HostInfo hostInfo = hostKeys.remove((int) (Math.random() * hostKeys.size()));
SocketServerInstance instance = existingConnections.get(hostInfo);
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-02-25
03:49:52 UTC (rev 495)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -28,12 +28,16 @@
import java.util.Properties;
import com.metamatrix.common.CommonPlugin;
+import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.Configuration;
+import com.metamatrix.common.config.api.ConfigurationID;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
import com.metamatrix.common.config.api.Host;
+import com.metamatrix.common.config.api.HostID;
import com.metamatrix.common.config.api.ResourceModel;
import com.metamatrix.common.config.api.SharedResource;
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
+import com.metamatrix.common.config.model.BasicHost;
import com.metamatrix.common.config.reader.CurrentConfigurationReader;
import com.metamatrix.common.config.reader.PropertiesConfigurationReader;
import com.metamatrix.common.properties.UnmodifiableProperties;
@@ -69,7 +73,7 @@
public static final String BOOTSTRAP_FILE_NAME = "metamatrix.properties";
//$NON-NLS-1$
public static final String CONFIGURATION_READER_CLASS_PROPERTY_NAME =
"metamatrix.config.reader"; //$NON-NLS-1$
public static final String CLUSTER_NAME = "metamatrix.cluster.name";
//$NON-NLS-1$
- private static final String CONFIGURATION_NAME= "configuration.name";
//$NON-NLS-1$
+ public static final String CONFIGURATION_NAME= "configuration.name";
//$NON-NLS-1$
private CurrentConfigurationReader reader;
private Properties bootstrapProperties;
@@ -212,12 +216,11 @@
*/
public Host getDefaultHost() throws ConfigurationException {
String name = getBootStrapProperties().getProperty(CONFIGURATION_NAME);
- return getReader().getConfigurationModel().getHost(name);
+ BasicHost host = new BasicHost(new ConfigurationID(name), new HostID(name), new
ComponentTypeID(name));
+ host.setProperties(getBootStrapProperties());
+ return host;
}
- public Host getHost(String name) throws ConfigurationException {
- return getReader().getConfigurationModel().getHost(name);
- }
/**
* Reset causes not just a refresh, but the bootstrapping process
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java 2009-02-25
03:49:52 UTC (rev 495)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/VMComponentDefnType.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -62,10 +62,4 @@
*/
public static final String JAVA_OPTS = "vm.starter.cmd.java_opts";
//$NON-NLS-1$
- public static final String JAVA_MAIN = "vm.starter.cmd.java_main";
//$NON-NLS-1$
- public static final String JAVA_ARGS = "vm.starter.cmd.java_args";
//$NON-NLS-1$
-
-
-
-
}
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicHost.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicHost.java 2009-02-25
03:49:52 UTC (rev 495)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/BasicHost.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -23,7 +23,9 @@
package com.metamatrix.common.config.model;
+import java.io.File;
import java.io.Serializable;
+import java.util.Properties;
import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.ConfigurationID;
@@ -49,7 +51,7 @@
* @since 4.3
*/
public String getDataDirectory() {
- return getProperty(HostType.DATA_DIRECTORY);
+ return getProperty(HostType.HOST_DIRECTORY)+File.separator+ "data";
//$NON-NLS-1$
}
/**
* @see com.metamatrix.common.config.api.Host#getLogDirectory()
@@ -103,4 +105,8 @@
public String getHostAddress() {
return getProperty(HostType.HOST_PHYSICAL_ADDRESS);
}
+
+ public void setProperties(Properties props) {
+ super.setProperties(props);
+ }
}
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfig_42_HelperImpl.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfig_42_HelperImpl.java 2009-02-25
03:49:52 UTC (rev 495)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/config/xml/XMLConfig_42_HelperImpl.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -2377,23 +2377,22 @@
public ComponentObject addProperties(Element propertiesElement, ComponentObject
object, ConfigurationObjectEditor editor) throws InvalidConfigurationElementException{
if
(!propertiesElement.getName().equals(XMLConfig_42_ElementNames.Properties.ELEMENT)) {
-
propertiesElement =
propertiesElement.getChild(XMLConfig_42_ElementNames.Properties.ELEMENT);
+ }
- if (propertiesElement == null) {
- throw new InvalidConfigurationElementException("A Properties object
cannot be created from a null properties element", null); //$NON-NLS-1$
-
- }
+ Properties props = null;
+ if (propertiesElement == null) {
+ props = new Properties();
}
+ else {
+ props = getProperties(propertiesElement);
+ }
- Properties props = getProperties(propertiesElement);
-
object = editor.modifyProperties(object, props, ConfigurationObjectEditor.ADD);
return object;
}
-
private Properties getProperties(Element propertiesElement) {
Properties props = new Properties();
Modified:
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-02-25
03:49:52 UTC (rev 495)
+++
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -628,6 +628,7 @@
process.setQueueWorkerPool(workerPool);
}
}
+
process.setInetAddress(getRuntimeStateAdminAPIHelper().getVMHostName(processID));
} catch (MetaMatrixComponentException e) {
//do nothing: sometimes when the process is just starting the
RMI stub
//for SocketVMController is not initialized yet
@@ -635,7 +636,6 @@
}
process.setDeployed(false);
-
process.setInetAddress(getRuntimeStateAdminAPIHelper().getVMHostName(processID));
String key =
MMAdminObject.buildIdentifier(identifierParts).toUpperCase();
runtimeMap.put(key, process);
results.add(process);
Modified: trunk/server/src/main/java/com/metamatrix/server/HostController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/HostController.java 2009-02-25
03:49:52 UTC (rev 495)
+++ trunk/server/src/main/java/com/metamatrix/server/HostController.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -23,7 +23,6 @@
package com.metamatrix.server;
import java.io.File;
-import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -39,7 +38,6 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.StartupStateController;
-import com.metamatrix.common.config.StartupStateException;
import com.metamatrix.common.config.api.ConfigurationModelContainer;
import com.metamatrix.common.config.api.Host;
import com.metamatrix.common.config.api.VMComponentDefn;
@@ -82,7 +80,7 @@
this.messageBus = bus;
}
- public void run(boolean startProcesses) throws ConfigurationException, IOException,
StartupStateException {
+ public void run(boolean startProcesses) throws Throwable {
if (isHostRunning()) {
System.err.println(PlatformPlugin.Util.getString("HostController.Host_is_already_running_startprocesses",
host.getFullName())); //$NON-NLS-1$
@@ -101,8 +99,9 @@
if (startProcesses ) {
try {
startServers(host.getFullName());
- } catch (MetaMatrixComponentException e) {
+ } catch (Throwable e) {
LogManager.logError(LogCommonConstants.CTX_CONTROLLER, e, e.getMessage());
+ shutdown(this.host.getFullName());
}
}
}
@@ -146,7 +145,7 @@
return null;
}
- private void createTempDirectories() throws ConfigurationException, IOException {
+ private void createTempDirectories() {
// If the java-i-tmp directory doesn't exist, it needs to be created
// because extension jars class loading will fail because
// java internals can' write to a non-existent directory.
@@ -280,6 +279,7 @@
} catch (Throwable e) {
LogManager.logError(LogCommonConstants.CTX_CONTROLLER, e, "ERROR "
+ PlatformPlugin.Util.getString(ErrorMessageKeys.HOST_0011));//$NON-NLS-1$
+ e.printStackTrace();
System.exit(1);
}
}
@@ -291,12 +291,12 @@
}
private Process startDeployVM( String vmName, String hostName, Properties vmprops) {
- LogManager.logInfo(LogCommonConstants.CTX_CONTROLLER, "Start deploy VM " +
vmName + " on host"+ hostName); //$NON-NLS-1$ //$NON-NLS-2$
- String command = buildVMCommand(vmprops);
+ LogManager.logInfo(LogCommonConstants.CTX_CONTROLLER, "Start deploy VM = "
+ vmName + " on host = "+ hostName); //$NON-NLS-1$ //$NON-NLS-2$
+ String command = buildVMCommand(vmName, vmprops);
return execCommand(command);
}
- private String buildVMCommand(Properties vmprops) {
+ private String buildVMCommand(String vmName, Properties vmprops) {
String java = null;
String java_home = System.getProperty("java.home"); //$NON-NLS-1$
if (java_home != null) {
@@ -306,15 +306,11 @@
}
String java_opts = vmprops.getProperty(VMComponentDefnType.JAVA_OPTS, "");
//$NON-NLS-1$
java_opts = java_opts + " -Dcom.sun.management.jmxremote " +
System.getProperty(VMComponentDefnType.JAVA_OPTS, ""); //$NON-NLS-1$
//$NON-NLS-2$
- String java_main = vmprops.getProperty(VMComponentDefnType.JAVA_MAIN,
DEFAULT_JAVA_MAIN);
- String java_args = vmprops.getProperty(VMComponentDefnType.JAVA_ARGS, "");
//$NON-NLS-1$
java = replaceToken(java, vmprops);
java_opts = replaceToken(java_opts, vmprops);
- java_main = replaceToken(java_main, vmprops);
- java_args = replaceToken(java_args, vmprops);
- String cmd = java + " " +java_opts+ " " +java_main + "
" +java_args; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String cmd = java + " " +java_opts+ " " + DEFAULT_JAVA_MAIN +
" " + vmName; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return cmd;
}
@@ -332,7 +328,7 @@
if (endidx < startidx) return rtn;
String tokenprop = rtn.substring(startidx + 2, endidx);
- String tokenvalue = props.getProperty(tokenprop);
+ String tokenvalue = props.getProperty(tokenprop).trim();
StringBuffer buf = new StringBuffer(rtn);
rtn = buf.replace(startidx, endidx + 1, tokenvalue).toString();
}
Modified: trunk/server/src/main/java/com/metamatrix/server/Main.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/Main.java 2009-02-25 03:49:52 UTC
(rev 495)
+++ trunk/server/src/main/java/com/metamatrix/server/Main.java 2009-02-25 15:28:27 UTC
(rev 496)
@@ -58,26 +58,25 @@
public static void main(String[] args) {
try {
- if (args.length < 2 || args.length > 4) {
- System.out.println("Usage: java com.metamatrix.server.Main <vm_name>
<host_name>"); //$NON-NLS-1$
+ if (args.length != 1) {
+ System.out.println("Usage: java com.metamatrix.server.Main
<vm_name>"); //$NON-NLS-1$
System.exit(1);
}
String vmName = args[0];
- String hostName = args[1];
Host host = null;
try {
- host = CurrentConfiguration.getInstance().getHost(hostName);
+ host = CurrentConfiguration.getInstance().getDefaultHost();
} catch (ConfigurationException e) {
}
if (host == null) {
- System.err.println(PlatformPlugin.Util.getString("SocketVMController.5",
hostName)); //$NON-NLS-1$
+
System.err.println(PlatformPlugin.Util.getString("SocketVMController.5"));
//$NON-NLS-1$
System.exit(-1);
}
- VMComponentDefn deployedVM =
CurrentConfiguration.getInstance().getConfiguration().getVMForHost(hostName, vmName);
+ VMComponentDefn deployedVM =
CurrentConfiguration.getInstance().getConfiguration().getVMForHost(host.getName(),
vmName);
String bindAddress = deployedVM.getBindAddress();
VMNaming.setVMName(vmName);
Modified: trunk/server/src/main/resources/com/metamatrix/platform/i18n.properties
===================================================================
--- trunk/server/src/main/resources/com/metamatrix/platform/i18n.properties 2009-02-25
03:49:52 UTC (rev 495)
+++ trunk/server/src/main/resources/com/metamatrix/platform/i18n.properties 2009-02-25
15:28:27 UTC (rev 496)
@@ -1281,7 +1281,7 @@
SocketVMController.2=Problem starting server binding to address {0} and listening on port
{1}
SocketVMController.3=Setting Server Listener listenerFilter={0}
SocketVMController.4=Getting ServerListener Registry: {0}
-SocketVMController.5=Could not find host <{0}> in configuration.
+SocketVMController.5=Could not find host information. Run the "setupmm" to
configure the server before trying to start.
RemoteProxy.localCallFailed=Remote client could not invoke local service method {0} on
{1}
JGroupsMessageBus.noResponse=No response for remote method call
\ No newline at end of file
Modified:
trunk/server/src/test/java/com/metamatrix/platform/config/spi/xml/TestCurrentConfiguration.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/platform/config/spi/xml/TestCurrentConfiguration.java 2009-02-25
03:49:52 UTC (rev 495)
+++
trunk/server/src/test/java/com/metamatrix/platform/config/spi/xml/TestCurrentConfiguration.java 2009-02-25
15:28:27 UTC (rev 496)
@@ -135,30 +135,7 @@
printMsg("Completed testCurrentHost"); //$NON-NLS-1$
}
- public void testFindHostByFullyQualifiedName() {
-
- printMsg("Starting testFindHostByFullyQualifiedName");
//$NON-NLS-1$
-
- try {
- init(CONFIG_FILE);
-
- CurrentConfiguration.getInstance().performSystemInitialization(true);
-
- Host host =
CurrentConfiguration.getInstance().getHost("slwxp141.quadrian.com");
//$NON-NLS-1$
-
- if (host == null) {
- fail(" host was not found in configuration");//$NON-NLS-1$
- }
-
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- printMsg("Completed testFindHostByFullyQualifiedName");
//$NON-NLS-1$
- }
-
+
public void test30SystemInitialization() {
printMsg("**** Starting test30SystemInitialization");
//$NON-NLS-1$