Author: reto
Date: Mon May 16 09:24:44 2011
New Revision: 1103658
URL: http://svn.apache.org/viewvc?rev=1103658&view=rev
Log:
CLEREZZA-525: added storage.web. to launcher, throwing NoSuchEntity wehn
TripleCollection cannot be retrievend from web
Modified:
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml
incubator/clerezza/trunk/parent/pom.xml
incubator/clerezza/trunk/parent/rdf.storage.web/src/main/scala/WebProxy.scala
Modified:
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml?rev=1103658&r1=1103657&r2=1103658&view=diff
==============================================================================
---
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml
(original)
+++
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml
Mon May 16 09:24:44 2011
@@ -272,6 +272,10 @@
<artifactId>rdf.ontologies</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.storage.web</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.content</artifactId>
Modified: incubator/clerezza/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/pom.xml?rev=1103658&r1=1103657&r2=1103658&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/pom.xml (original)
+++ incubator/clerezza/trunk/parent/pom.xml Mon May 16 09:24:44 2011
@@ -128,6 +128,7 @@
<module>web.resources.style</module>
<module>web.resources.yui</module>
<module>rdf.storage.externalizer</module>
+ <module>rdf.storage.web</module>
</modules>
</profile>
<profile>
@@ -1201,6 +1202,11 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.storage.web</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
<artifactId>shell</artifactId>
<version>0.1-incubating-SNAPSHOT</version>
</dependency>
Modified:
incubator/clerezza/trunk/parent/rdf.storage.web/src/main/scala/WebProxy.scala
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.storage.web/src/main/scala/WebProxy.scala?rev=1103658&r1=1103657&r2=1103658&view=diff
==============================================================================
---
incubator/clerezza/trunk/parent/rdf.storage.web/src/main/scala/WebProxy.scala
(original)
+++
incubator/clerezza/trunk/parent/rdf.storage.web/src/main/scala/WebProxy.scala
Mon May 16 09:24:44 2011
@@ -1,5 +1,3 @@
-package org.apache.clerezza.rdf.storage.web
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,8 +17,11 @@ package org.apache.clerezza.rdf.storage.
* under the License.
*/
-import org.apache.clerezza.platform.Constants
+package org.apache.clerezza.rdf.storage.web
+
+
import org.osgi.service.component.ComponentContext
+import java.io.IOException
import java.net.{HttpURLConnection, URL}
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat
import org.apache.clerezza.rdf.core.serializedform.Parser
@@ -60,10 +61,6 @@ class WebProxy extends WeightedTcProvide
tcProvider.removeWeightedTcProvider(provider)
}
- //todo: replace this with an appropriate graph
- protected val authoritativeLocalGraphs = Constants.CONFIG_GRAPH_URI
-
-
/**OSGI method, called on activation */
protected def activate(context: ComponentContext) = {
@@ -85,7 +82,7 @@ class WebProxy extends WeightedTcProvide
}
/**
- * we don't do mgraphs
+ * Any TripleCollection is available as Graph as well as immutable
MGraph
*
* @param name
* @return
@@ -103,7 +100,15 @@ class WebProxy extends WeightedTcProvide
}
def getGraph(name: UriRef): Graph = {
- getGraph(name, Cache.Fetch)
+ try {
+ getGraph(name, Cache.Fetch)
+ } catch {
+ case e: IOException => {
+ logger.debug("could not get graph by
dereferencing uri", e)
+ throw new NoSuchEntityException(name)
+ }
+
+ }
}
def getTriples(name: UriRef): TripleCollection = {
@@ -181,21 +186,16 @@ class WebProxy extends WeightedTcProvide
}
}
try {
- AccessController.doPrivileged(new
PrivilegedExceptionAction[Graph] {
- def run: Graph = {
- //the logic here is not quite right, as
we don't look at time of previous fetch.
- updatePolicy match {
- case Cache.Fetch => try {
-
tcProvider.getGraph(cacheGraphName)
- } catch {
- case e:
NoSuchEntityException => updateGraph(); tcProvider.getGraph(cacheGraphName)
- }
- case Cache.ForceUpdate =>
updateGraph(); tcProvider.getGraph(cacheGraphName)
- case Cache.CacheOnly =>
tcProvider.getGraph(cacheGraphName)
- }
-
+ //the logic here is not quite right, as we don't look
at time of previous fetch.
+ updatePolicy match {
+ case Cache.Fetch => try {
+ tcProvider.getGraph(cacheGraphName)
+ } catch {
+ case e: NoSuchEntityException =>
updateGraph(); tcProvider.getGraph(cacheGraphName)
}
- })
+ case Cache.ForceUpdate => updateGraph();
tcProvider.getGraph(cacheGraphName)
+ case Cache.CacheOnly =>
tcProvider.getGraph(cacheGraphName)
+ }
} catch {
case ex: PrivilegedActionException => {
var cause: Throwable = ex.getCause