Author: vhalbert(a)redhat.com
Date: 2009-04-23 14:28:52 -0400 (Thu, 23 Apr 2009)
New Revision: 831
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java
Log:
Teiid - 528 - changed so that when the configuration model is loaded, that the
configuration object is loaded with its defaults and its overrides.
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java
===================================================================
---
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java 2009-04-23
18:25:52 UTC (rev 830)
+++
trunk/common-internal/src/main/java/com/metamatrix/common/config/model/ConfigurationModelContainerImpl.java 2009-04-23
18:28:52 UTC (rev 831)
@@ -366,22 +366,7 @@
return result;
}
-// public ConfigurationModelContainer copyAs(ConfigurationID configID) throws
ConfigurationException {
-// BasicConfigurationObjectEditor ceditor = new
BasicConfigurationObjectEditor(false);
-//
-//
-// Configuration newConfig = ceditor.createConfiguration(configuration,
configID.getFullName());
-// ConfigurationModelContainerImpl newConfigModel = new
ConfigurationModelContainerImpl(newConfig);
-//
-// newConfigModel.setComponentTypes(this.compTypes);
-//// newConfigModel.setProductTypes(this.prodTypes.values());
-//
-// newConfigModel.setResources(this.resources);
-//
-// return newConfigModel;
-// }
-
public void setComponentTypes(Map newCompTypes) {
this.compTypes = Collections.synchronizedMap(new HashMap(newCompTypes.size()));
@@ -391,16 +376,7 @@
}
}
-// public void setProductTypes(Collection newProdTypes) {
-// this.prodTypes = Collections.synchronizedMap(new
HashMap(newProdTypes.size()));
-//
-// Iterator it = newProdTypes.iterator();
-// while (it.hasNext()) {
-// addProductType((ProductType)it.next());
-// }
-// }
-
public void setResources(Map theResources) {
this.resources = Collections.synchronizedMap(new HashMap(theResources.size()));
this.resources.putAll(theResources);
@@ -431,13 +407,6 @@
}
-// public void addProductType(ProductType type) {
-// prodTypes.put(type.getFullName(), type);
-// }
-
-
-
-
public void addResource(SharedResource rd) {
resources.put(rd.getID().getFullName(), rd);
}
@@ -483,16 +452,6 @@
configuration.addHost(host);
-// } else if (obj instanceof ProductServiceConfig) {
-// ProductServiceConfig psc = (ProductServiceConfig) obj;
-//
-//
-// if (configuration == null) {
-// throw new ConfigurationException(ErrorMessageKeys.CONFIG_0001,
CommonPlugin.Util.getString(ErrorMessageKeys.CONFIG_0001));
-// }
-//
-// ConfigurationObjectEditorHelper.addConfigurationComponentDefn(configuration, psc);
-
} else if (obj instanceof SharedResource) {
SharedResource rd = (SharedResource) obj;
@@ -547,7 +506,7 @@
}
// first time thru update the configuration first
// and load the component types
-// Collection hold = new ArrayList(objects.size());
+
Iterator configIt = objects.iterator();
while (configIt.hasNext()) {
Object obj = configIt.next();
@@ -559,27 +518,12 @@
}
}
+
+ Properties allprops =
this.getDefaultPropertyValues(this.configuration.getComponentTypeID());
+ allprops.putAll(this.configuration.getProperties());
+
+ this.configuration.setProperties(allprops);
-// else if (obj instanceof ComponentType) {
-// addComponentType((ComponentType) obj);
-// } else {
-// hold.add(obj);
-// }
-//
-//
-// }
-//
-// // second time thru update all other objects
-// Iterator iterator = hold.iterator();
-// while (iterator.hasNext()) {
-//
-// Object obj = iterator.next();
-//
-// addObject(obj);
-//
-// }
-//
-
}
public void remove(BaseID objID) throws ConfigurationException {
@@ -595,9 +539,6 @@
} else if (objID instanceof HostID) {
remove((HostID) objID);
-
-// } else if (objID instanceof ProductServiceConfigID) {
-// remove((ProductServiceConfigID) objID);
} else if (objID instanceof SharedResourceID) {
removeSharedResource((SharedResourceID) objID);
@@ -621,12 +562,7 @@
if (compTypes.containsKey(typeID.getFullName())) {
compTypes.remove(typeID.getFullName());
}
-
-// Collection c = getProductTypes();
-// for (final Iterator i = c.iterator(); i.hasNext();) {
-// final BasicProductType type = (BasicProductType)i.next();
-// type.removeServiceTypeID(typeID);
-// } // for
+
}
@@ -637,16 +573,6 @@
}
}
-// private void remove(ComponentTypeID typeID) {
-// removeComponentType(typeID);
-// }
-//
-//
-// private void remove(SharedResourceID rdID) {
-// removeSharedResource(rdID);
-// }
-
-
private void remove(ServiceComponentDefnID defnID) throws ConfigurationException {
if (configuration == null) {
@@ -699,15 +625,13 @@
ConfigurationModelContainerImpl newConfig = new
ConfigurationModelContainerImpl(config);
newConfig.setComponentTypes(this.compTypes);
-// newConfig.setProductTypes(this.prodTypes.values());
newConfig.setResources(this.resources);
return newConfig;
}
private Configuration delete( ComponentObjectID targetID, Configuration configuration )
throws ConfigurationException {
- //System.out.println("<!><!><!><!>deleting " +
target + ", delete dependencies: " + deleteDependencies);
-
+
BasicConfiguration basicConfig = (BasicConfiguration) configuration;
basicConfig.removeComponentObject( targetID);
Show replies by thread