[teiid-commits] teiid SVN: r4176 - trunk/jboss-integration/src/main/java/org/teiid/jboss.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Jun 12 13:03:59 EDT 2012


Author: rareddy
Date: 2012-06-12 13:03:58 -0400 (Tue, 12 Jun 2012)
New Revision: 4176

Modified:
   trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
Log:
TEIID-2066: cached files or being written wrong. Each model metadata needs to be saved in its own cache file. The same schema is being written as multiple models, thus leading to duplicate schema exceptions.

Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java	2012-06-12 14:05:05 UTC (rev 4175)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java	2012-06-12 17:03:58 UTC (rev 4176)
@@ -355,7 +355,7 @@
 			    		
 			    		if (!cached) {
 				    		// cache the schema to disk
-							cacheMetadataStore(vdb, factory);
+							cacheMetadataStore(model, factory);
 			    		}
 						
 						// merge into VDB metadata
@@ -404,21 +404,18 @@
     }
         
     // if is not dynamic always cache; else check for the flag (this may need to be revisited with index vdb)
-	private void cacheMetadataStore(final VDBMetaData vdb, MetadataFactory schema) {
+	private void cacheMetadataStore(final ModelMetaData model, MetadataFactory schema) {
 		boolean cache = !vdb.isDynamic();
 		if (vdb.isDynamic()) {
 			cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
 		}
 		
 		if (cache) {
-			for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
-				final File cachedFile = getSerializer().buildModelFile(vdb, model.getName());
-				try {
-					// TODO: save the model not VDB here.
-					getSerializer().saveAttachment(cachedFile, schema, false);
-				} catch (IOException e) {
-					LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50044, vdb.getName(), vdb.getVersion(), model.getName()));
-				}
+			final File cachedFile = getSerializer().buildModelFile(vdb, model.getName());
+			try {
+				getSerializer().saveAttachment(cachedFile, schema, false);
+			} catch (IOException e) {
+				LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50044, vdb.getName(), vdb.getVersion(), model.getName()));
 			}
 		}
 	}    



More information about the teiid-commits mailing list