Author: reto
Date: Mon Feb 28 08:08:47 2011
New Revision: 1075233
URL: http://svn.apache.org/viewvc?rev=1075233&view=rev
Log:
CLEREZZA-432: removing old cache-graphs on activation
Modified:
incubator/clerezza/trunk/parent/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
Modified:
incubator/clerezza/trunk/parent/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala?rev=1075233&r1=1075232&r2=1075233&view=diff
==============================================================================
---
incubator/clerezza/trunk/parent/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
(original)
+++
incubator/clerezza/trunk/parent/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
Mon Feb 28 08:08:47 2011
@@ -50,6 +50,7 @@ object BundleFsLoader {
class BundleFsLoader extends BundleListener with Logger with
WeightedTcProvider {
private val RESOURCE_MGRAPH_URI = new
UriRef("http://zz.localhost/web-resources.graph")
+ private val cacheGraphPrefix =
"http://zz.localhost/web-resources-cache.graph"
private var currentCacheUri: UriRef = null
private var tcManager: TcManager = null
@@ -98,8 +99,18 @@ class BundleFsLoader extends BundleListe
private var updateThread: UpdateThread = null
+ private def deleteCacheGraphs() {
+ import collection.JavaConversions._
+ for(mGraphUri <- tcManager.listMGraphs) {
+
if(mGraphUri.getUnicodeString.startsWith(cacheGraphPrefix)) {
+ tcManager.deleteTripleCollection(mGraphUri);
+ }
+ }
+ }
+
protected def activate(context: ComponentContext) {
synchronized {
+ deleteCacheGraphs()
for (bundle <- context.getBundleContext().getBundles();
if bundle.getState == Bundle.ACTIVE) {
bundleList ::= bundle
@@ -137,7 +148,7 @@ class BundleFsLoader extends BundleListe
}
synchronized {
val sortedList = Sorting.stableSort(bundleList,
(b:Bundle) => -startLevel.getBundleStartLevel(b))
- val newCacheUri = new
UriRef("http://zz.localhost/web-resources-cache.graph"+System.currentTimeMillis)
+ val newCacheUri = new
UriRef(cacheGraphPrefix+System.currentTimeMillis)
val newChacheMGraph =
tcManager.createMGraph(newCacheUri);
tcManager.getTcAccessController.setRequiredReadPermissions(
newCacheUri, Collections.singleton(new
TcPermission(Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ)))