[teiid-commits] teiid SVN: r4012 - branches/8.0.x/runtime/src/main/java/org/teiid/deployers.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Apr 17 15:10:22 EDT 2012


Author: shawkins
Date: 2012-04-17 15:10:19 -0400 (Tue, 17 Apr 2012)
New Revision: 4012

Modified:
   branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
Log:
TEIID-1998 reusing the initial build

Modified: branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java	2012-04-17 18:54:37 UTC (rev 4011)
+++ branches/8.0.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java	2012-04-17 19:10:19 UTC (rev 4012)
@@ -58,6 +58,7 @@
 	private ConnectorManagerRepository cmr;
 	private FunctionTree systemFunctions;
 	private boolean metadataloadFinished = false;
+	private boolean modified;
 	
 	// used as cached item to avoid rebuilding
 	private volatile VDBMetaData mergedVDB;
@@ -81,6 +82,7 @@
 		}
 		VDBMetaData childVDB = child.getVDB();
 		this.children.put(new VDBKey(childVDB.getName(), childVDB.getVersion()), child);
+		modified = true;
 		update();
 	}
 	
@@ -88,29 +90,34 @@
 		if (this.children != null) {
 			this.children.remove(child);
 		}
+		modified = true;
 		update();
 	}	
 	
 	private synchronized void update() {
-		if (this.metadataloadFinished) {
-			
-			VDBMetaData newVDB = buildVDB();
-			
-			MetadataStore mergedStore = getMetadataStore();
-			
-			for (ModelMetaData model:newVDB.getModelMetaDatas().values()) {
-				MetadataRepository repo = model.getAttachment(MetadataRepository.class);
-				if (repo instanceof DefaultMetadataRepository) {
-					updateFromMetadataRepository(newVDB, mergedStore.getSchema(model.getName()), (DefaultMetadataRepository)repo);
-				}
+		if (!this.metadataloadFinished) {
+			return;
+		}
+		VDBMetaData newVDB = mergedVDB;
+		if (modified) {
+			newVDB = buildVDB();
+		}
+		
+		MetadataStore mergedStore = getMetadataStore();
+		
+		for (ModelMetaData model:newVDB.getModelMetaDatas().values()) {
+			MetadataRepository repo = model.getAttachment(MetadataRepository.class);
+			if (repo instanceof DefaultMetadataRepository) {
+				updateFromMetadataRepository(newVDB, mergedStore.getSchema(model.getName()), (DefaultMetadataRepository)repo);
 			}
-			
-			TransformationMetadata metadata = buildTransformationMetaData(newVDB, getVisibilityMap(), mergedStore, getUDF(), systemFunctions, this.additionalStores);
-			newVDB.addAttchment(QueryMetadataInterface.class, metadata);
-			newVDB.addAttchment(TransformationMetadata.class, metadata);
-			newVDB.addAttchment(MetadataStore.class, mergedStore);
-			this.mergedVDB = newVDB;
 		}
+		
+		TransformationMetadata metadata = buildTransformationMetaData(newVDB, getVisibilityMap(), mergedStore, getUDF(), systemFunctions, this.additionalStores);
+		newVDB.addAttchment(QueryMetadataInterface.class, metadata);
+		newVDB.addAttchment(TransformationMetadata.class, metadata);
+		newVDB.addAttchment(MetadataStore.class, mergedStore);
+		this.mergedVDB = newVDB;
+		this.modified = false;
 	}
 	
 	private static TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, MetadataStore store, UDFMetaData udf, FunctionTree systemFunctions, MetadataStore[] additionalStores) {



More information about the teiid-commits mailing list