Author: rareddy
Date: 2009-02-25 20:02:42 -0500 (Wed, 25 Feb 2009)
New Revision: 504
Modified:
trunk/client/src/main/java/com/metamatrix/admin/api/objects/Host.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/runtime/HostData.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
trunk/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java
trunk/server/src/main/java/com/metamatrix/platform/registry/HostControllerRegistryBinding.java
trunk/server/src/main/java/com/metamatrix/server/HostController.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
trunk/server/src/test/java/com/metamatrix/platform/registry/FakeRegistryUtil.java
trunk/server/src/test/java/com/metamatrix/platform/registry/TestClusteredRegistryState.java
Log:
TEIID-309: adding host properties to Host object, so that they can be viewed by the client
applications such as Admin API.
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/objects/Host.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/objects/Host.java 2009-02-25
21:59:42 UTC (rev 503)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/objects/Host.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -28,7 +28,7 @@
* Represents a host in the MetaMatrix system.
*
* <p>The identifier pattern for a host is
<code>"hostName"</code>.
- * A hostName is concidered to be unique across the system.</p>
+ * A hostName is considered to be unique across the system.</p>
* @since 4.3
*/
public interface Host extends AdminObject {
@@ -44,11 +44,6 @@
public static final String LOG_DIRECTORY = "metamatrix.log.dir";
//$NON-NLS-1$
/**
- * Data Directory Property
- */
- public static final String DATA_DIRECTORY = "metamatrix.data.dir";
//$NON-NLS-1$
-
- /**
* Host Directory Property
*/
public static final String HOST_DIRECTORY = "metamatrix.host.dir";
//$NON-NLS-1$
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
21:59:42 UTC (rev 503)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/config/CurrentConfiguration.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -217,7 +217,15 @@
public Host getDefaultHost() throws ConfigurationException {
String name = getBootStrapProperties().getProperty(CONFIGURATION_NAME);
BasicHost host = new BasicHost(new ConfigurationID(name), new HostID(name), new
ComponentTypeID(name));
- host.setProperties(getBootStrapProperties());
+
+ Properties props = new Properties();
+ props.setProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR,
getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.INSTALL_DIR));
+ props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY,
getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY));
+ props.setProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY,
getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY));
+ props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS,
getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_BIND_ADDRESS));
+ props.setProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS,
getBootStrapProperties().getProperty(com.metamatrix.admin.api.objects.Host.HOST_PHYSICAL_ADDRESS));
+
+ host.setProperties(props);
return host;
}
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/config/api/HostType.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -34,8 +34,6 @@
public static final String LOG_DIRECTORY =
com.metamatrix.admin.api.objects.Host.LOG_DIRECTORY;
- public static final String DATA_DIRECTORY =
com.metamatrix.admin.api.objects.Host.DATA_DIRECTORY;
-
public static final String HOST_DIRECTORY =
com.metamatrix.admin.api.objects.Host.HOST_DIRECTORY;
public static final String HOST_ENABLED =
com.metamatrix.admin.api.objects.Host.HOST_ENABLED;
Modified:
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/runtime/HostData.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/runtime/HostData.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/runtime/HostData.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -23,6 +23,7 @@
package com.metamatrix.platform.admin.api.runtime;
import java.util.Collection;
+import java.util.Properties;
/**
* This class contains information about a host that is running or deployed for this
system
@@ -31,6 +32,7 @@
// Collection of ProcessData objects
private Collection processes;
+ private Properties properties;
/**
@@ -38,9 +40,10 @@
*
* @param hostName Name of host
*/
- public HostData(String hostName, Collection processes, boolean deployed, boolean
registered) {
+ public HostData(String hostName, Collection processes, boolean deployed, boolean
registered, Properties props) {
super(hostName, deployed, registered);
this.processes = processes;
+ this.properties = props;
computeHashCode();
}
@@ -56,5 +59,9 @@
public Collection getProcesses() {
return processes;
}
+
+ public Properties getProperties() {
+ return this.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
21:59:42 UTC (rev 503)
+++
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -503,13 +503,13 @@
host.setRunning(hostData.isRegistered());
host.setRegistered(hostData.isRegistered());
host.setDeployed(false);
+ host.setProperties(hostData.getProperties());
runtimeMap.put(hostName.toUpperCase(), host);
results.add(host);
}
}
-
//get config data from ConfigurationServiceProxy
Collection hosts = getConfigurationServiceProxy().getHosts();
Modified:
trunk/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -29,6 +29,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.api.ComponentDefnID;
@@ -82,7 +83,7 @@
// Create a new HostData object for each running host.
for (HostControllerRegistryBinding host:allHosts) {
- hosts.add(createHostData(host.getHostName()));
+ hosts.add(createHostData(host));
hostIDs.add(new HostID(host.getHostName()));
}
@@ -103,8 +104,10 @@
/**
* Create a HostData object from the hostBinding.
*/
- private HostData createHostData(String hostName) throws Exception {
+ private HostData createHostData(HostControllerRegistryBinding host) throws Exception
{
+ String hostName = host.getHostName();
+
List vmBindings = this.registry.getVMs(hostName);
List processes = new ArrayList();
Collection deployedVMs = null;
@@ -134,8 +137,7 @@
boolean deployed = config.getHostIDs().contains(hostID);
boolean running = this.hostManagement.ping(hostName);
- return new HostData(hostName, processes, deployed, running);
-
+ return new HostData(hostName, processes, deployed, running,
host.getProperties());
}
/**
@@ -160,7 +162,7 @@
}
boolean running = this.hostManagement.ping(hostID.getFullName());
- return new HostData(hostID.getFullName(), processes, true, running);
+ return new HostData(hostID.getFullName(), processes, true, running, new
Properties());
}
Modified:
trunk/server/src/main/java/com/metamatrix/platform/registry/HostControllerRegistryBinding.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/registry/HostControllerRegistryBinding.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/server/src/main/java/com/metamatrix/platform/registry/HostControllerRegistryBinding.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -1,10 +1,11 @@
package com.metamatrix.platform.registry;
import java.io.Serializable;
+import java.util.Properties;
import com.metamatrix.common.messaging.MessageBus;
+import com.metamatrix.server.HostManagement;
import com.metamatrix.server.ResourceFinder;
-import com.metamatrix.server.HostManagement;
public class HostControllerRegistryBinding implements Serializable {
@@ -16,10 +17,13 @@
private String hostName;
+ private Properties hostProperties;
- public HostControllerRegistryBinding(String hostName, HostManagement controller,
MessageBus bus) {
+
+ public HostControllerRegistryBinding(String hostName, Properties properties,
HostManagement controller, MessageBus bus) {
this.messageBus = bus;
this.hostName = hostName;
+ this.hostProperties = properties;
setHostController(controller);
}
@@ -53,4 +57,8 @@
this.hostController = (HostManagement)bus.getRPCProxy(this.hostControllerStub);
return this.hostController;
}
+
+ public Properties getProperties() {
+ return new Properties(this.hostProperties);
+ }
}
Modified: trunk/server/src/main/java/com/metamatrix/server/HostController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/HostController.java 2009-02-25
21:59:42 UTC (rev 503)
+++ trunk/server/src/main/java/com/metamatrix/server/HostController.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -94,7 +94,7 @@
Runtime.getRuntime().addShutdownHook(new ShutdownThread());
- this.monitor.hostAdded(new HostControllerRegistryBinding(this.host.getFullName(), this,
this.messageBus));
+ this.monitor.hostAdded(new HostControllerRegistryBinding(this.host.getFullName(),
this.host.getProperties(), this, this.messageBus));
if (startProcesses ) {
try {
Modified:
trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/server/src/test/java/com/metamatrix/admin/server/FakeRuntimeStateAdminAPIHelper.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -27,6 +27,7 @@
import java.util.Date;
import java.util.HashSet;
import java.util.List;
+import java.util.Properties;
import java.util.Set;
import com.metamatrix.admin.api.objects.AdminObject;
@@ -240,14 +241,14 @@
VMControllerID vmControllerID1 = new VMControllerID(2, "2.2.2.2");
//$NON-NLS-1$
ProcessData process2 = new ProcessData(vmControllerID1, null,
"2.2.2.2", new ArrayList(), "process2", "31000", true,
true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
processes2.add(process2);
- HostData host2 = new HostData("2.2.2.2", processes2, true, true);
//$NON-NLS-1$
+ HostData host2 = new HostData("2.2.2.2", processes2, true, true, new
Properties()); //$NON-NLS-1$
hosts.add(host2);
List processes3 = new ArrayList();
VMControllerID vmControllerID3 = new VMControllerID(3, "3.3.3.3");
//$NON-NLS-1$
ProcessData process3 = new ProcessData(vmControllerID3, null,
"3.3.3.3", new ArrayList(), "process3", "31001", true,
true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
processes3.add(process3);
- HostData host3 = new HostData("3.3.3.3", processes3, true, true);
//$NON-NLS-1$
+ HostData host3 = new HostData("3.3.3.3", processes3, true, true, new
Properties()); //$NON-NLS-1$
hosts.add(host3);
Modified:
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -152,7 +152,7 @@
String hostIdentifier = BOGUS_HOST;
Properties hostProperties = new Properties();
hostProperties.setProperty(Host.INSTALL_DIR,
"D:\\MetaMatrix\\s43401\\"); //$NON-NLS-1$
- hostProperties.setProperty(Host.DATA_DIRECTORY,
"D:\\MetaMatrix\\s43401\\data"); //$NON-NLS-1$
+ hostProperties.setProperty(Host.HOST_DIRECTORY,
"D:\\MetaMatrix\\s43401\\host"); //$NON-NLS-1$
hostProperties.setProperty(Host.LOG_DIRECTORY,
"D:\\MetaMatrix\\s43401\\log"); //$NON-NLS-1$
hostProperties.setProperty(Host.HOST_ENABLED, "true"); //$NON-NLS-1$
admin.addHost(hostIdentifier, hostProperties);
@@ -162,7 +162,7 @@
String hostIdentifier = BOGUS_HOST_IP;
Properties hostProperties = new Properties();
hostProperties.setProperty(Host.INSTALL_DIR,
"D:\\MetaMatrix\\s43401\\"); //$NON-NLS-1$
- hostProperties.setProperty(Host.DATA_DIRECTORY,
"D:\\MetaMatrix\\s43401\\data"); //$NON-NLS-1$
+ hostProperties.setProperty(Host.HOST_DIRECTORY,
"D:\\MetaMatrix\\s43401\\host"); //$NON-NLS-1$
hostProperties.setProperty(Host.LOG_DIRECTORY,
"D:\\MetaMatrix\\s43401\\log"); //$NON-NLS-1$
hostProperties.setProperty(Host.HOST_ENABLED, "true"); //$NON-NLS-1$
admin.addHost(hostIdentifier, hostProperties);
@@ -172,7 +172,7 @@
String hostIdentifier = BOGUS_HOST_FULLY_QUALIFIED;
Properties hostProperties = new Properties();
hostProperties.setProperty(Host.INSTALL_DIR,
"D:\\MetaMatrix\\s43401\\"); //$NON-NLS-1$
- hostProperties.setProperty(Host.DATA_DIRECTORY,
"D:\\MetaMatrix\\s43401\\data"); //$NON-NLS-1$
+ hostProperties.setProperty(Host.HOST_DIRECTORY,
"D:\\MetaMatrix\\s43401\\host"); //$NON-NLS-1$
hostProperties.setProperty(Host.LOG_DIRECTORY,
"D:\\MetaMatrix\\s43401\\log"); //$NON-NLS-1$
hostProperties.setProperty(Host.HOST_ENABLED, "true"); //$NON-NLS-1$
admin.addHost(hostIdentifier, hostProperties);
Modified:
trunk/server/src/test/java/com/metamatrix/platform/registry/FakeRegistryUtil.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/platform/registry/FakeRegistryUtil.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/server/src/test/java/com/metamatrix/platform/registry/FakeRegistryUtil.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -24,6 +24,7 @@
import java.net.InetAddress;
import java.util.Date;
+import java.util.Properties;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.mockito.Mockito;
@@ -134,7 +135,7 @@
}
static HostControllerRegistryBinding buildHostRegistryBinding(String name) {
- return new HostControllerRegistryBinding(name, null, new NoOpMessageBus());
+ return new HostControllerRegistryBinding(name, new Properties(), null, new
NoOpMessageBus());
}
}
Modified:
trunk/server/src/test/java/com/metamatrix/platform/registry/TestClusteredRegistryState.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/platform/registry/TestClusteredRegistryState.java 2009-02-25
21:59:42 UTC (rev 503)
+++
trunk/server/src/test/java/com/metamatrix/platform/registry/TestClusteredRegistryState.java 2009-02-26
01:02:42 UTC (rev 504)
@@ -24,6 +24,7 @@
import java.util.Date;
import java.util.List;
+import java.util.Properties;
import junit.framework.TestCase;
@@ -308,6 +309,6 @@
}
static HostControllerRegistryBinding buildHostRegistryBinding(String name) {
- return new HostControllerRegistryBinding(name, null, new NoOpMessageBus());
+ return new HostControllerRegistryBinding(name, new Properties(), null, new
NoOpMessageBus());
}
}