Updated SDK manager to write SDK cache to disk whenever SDK list gets updated. C3_BUILDER_WORK
authorstechong
Thu, 19 Aug 2010 16:56:56 -0500
branchC3_BUILDER_WORK
changeset 1862 e3bac873e5c8
parent 1861 b068cf1b44ee
child 1863 0142fe025ce6
Updated SDK manager to write SDK cache to disk whenever SDK list gets updated.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java
core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java	Thu Aug 19 10:49:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java	Thu Aug 19 16:56:56 2010 -0500
@@ -343,6 +343,7 @@
 				entry.setEnabled(currSDK.isEnabled());
 				setSDKCacheEntry(entry);
 			}
+			flushSDKCache();
 		}
 	}
 
@@ -648,6 +649,14 @@
 		SDKCacheUtils.getCache().removeCache(SDK_MANAGER_CACHE_KEY, false);
 	}
 
+	protected void flushSDKCache() {
+		try {
+			SDKCacheUtils.getCache().flushCache(SDK_MANAGER_CACHE_KEY);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
 	@SuppressWarnings("unchecked")
 	protected List<String> getSDKCacheIdList() {
 		Map<String, SDKManagerCacheEntry> cacheMap = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0);
--- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java	Thu Aug 19 10:49:50 2010 -0500
+++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java	Thu Aug 19 16:56:56 2010 -0500
@@ -177,6 +177,13 @@
 		caches.clear();
 	}
 
+	public void flushCache(String identifier) throws Exception {
+		CacheEntry entry = caches.get(identifier);
+		if (entry != null) {
+			entry.flush();
+		}
+	}
+
 	public IPath getDefaultLocation() {
 		return defaultLocation;
 	}