You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by bb...@apache.org on 2011/03/18 18:32:13 UTC
svn commit: r1082989 - in /incubator/clerezza/trunk/parent: ./
platform.accountcontrolpanel/platform.accountcontrolpanel.core/
platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/
platform.accountcontrolpanel/plat...
Author: bblfish
Date: Fri Mar 18 17:32:11 2011
New Revision: 1082989
URL: http://svn.apache.org/viewvc?rev=1082989&view=rev
Log:
first part of CLEREZZA-463 refactoring. Creates a new rdf.web.proxy.core package and make the WebDescriptionProvider classes subclass the proxy. This simplifies a lot of code, and makes it easier to understand the WebDescriptionProvider.
additionally removed a requirement to HttpServletRequest
Added:
incubator/clerezza/trunk/parent/rdf.web.proxy/
incubator/clerezza/trunk/parent/rdf.web.proxy/pom.xml
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/pom.xml
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/resources/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/resources/OSGI-INF/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/resources/OSGI-INF/serviceComponents.xml
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/web/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/web/proxy/
incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/web/proxy/WebProxy.scala
Removed:
incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebDescriptionProvider.scala
Modified:
incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml
incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml
incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/PersonPanel.scala
incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/person_panel.scala
incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/profile_panel.scala
incubator/clerezza/trunk/parent/platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml
incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml
incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/resources/OSGI-INF/serviceComponents.xml
incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/auth/FoafSslAuthentication.scala
incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala
incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
incubator/clerezza/trunk/parent/platform.users/core/pom.xml
incubator/clerezza/trunk/parent/platform.users/core/src/main/resources/OSGI-INF/serviceComponents.xml
incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdGraphsService.scala
incubator/clerezza/trunk/parent/pom.xml
incubator/clerezza/trunk/parent/ssl.keygen/base/pom.xml
incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/CertSerialisation.java
incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/bouncy/DefaultCertSerialisation.java
Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml Fri Mar 18 17:32:11 2011
@@ -110,7 +110,12 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.users.core</artifactId>
</dependency>
- <!--dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy.core</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ </dependency>
+ <!--dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version></version>
Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml Fri Mar 18 17:32:11 2011
@@ -43,8 +43,6 @@
cardinality="1..1" policy="static" bind="bindWebIdGraphsService" unbind="unbindWebIdGraphsService"/>
<reference name="platformConfig" interface="org.apache.clerezza.platform.config.PlatformConfig"
cardinality="1..1" policy="static" bind="bindPlatformConfig" unbind="unbindPlatformConfig"/>
- <reference name="webDescriptionProvider" interface="org.apache.clerezza.platform.users.WebDescriptionProvider"
- cardinality="1..1" policy="static" bind="bindWebDescriptionProvider" unbind="unbindWebDescriptionProvider"/>
</scr:component>
<scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.PersonPanel">
<implementation class="org.apache.clerezza.platform.accountcontrolpanel.PersonPanel"/>
@@ -53,10 +51,6 @@
</service>
<property name="javax.ws.rs" type="Boolean" value="true"/>
<property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.PersonPanel"/>
- <reference name="webIdGraphsService" interface="org.apache.clerezza.platform.users.WebIdGraphsService"
- cardinality="1..1" policy="static" bind="bindWebIdGraphsService" unbind="unbindWebIdGraphsService"/>
- <reference name="webDescriptionProvider" interface="org.apache.clerezza.platform.users.WebDescriptionProvider"
- cardinality="1..1" policy="static" bind="bindWebDescriptionProvider" unbind="unbindWebDescriptionProvider"/>
<reference name="renderletManager" interface="org.apache.clerezza.platform.typerendering.RenderletManager"
cardinality="1..1" policy="static" bind="bindRenderletManager" unbind="unbindRenderletManager"/>
</scr:component>
Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/PersonPanel.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/PersonPanel.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/PersonPanel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/PersonPanel.scala Fri Mar 18 17:32:11 2011
@@ -65,7 +65,6 @@ import java.util.List
import org.apache.clerezza.platform.typerendering.scala.PageRenderlet
import org.apache.clerezza.rdf.ontologies.RDFS
import org.apache.clerezza.ssl.keygen.KeygenService
-import org.apache.clerezza.platform.users.{Cache, WebDescriptionProvider, WebIdGraphsService}
object PersonPanel {
private val logger: Logger = LoggerFactory.getLogger(classOf[ProfilePanel])
@@ -106,25 +105,6 @@ class PersonPanel {
return resultNode
}
- protected def bindWebIdGraphsService(webidgraphsservice: WebIdGraphsService): Unit = {
- webIdGraphsService = webidgraphsservice
- }
-
- protected def unbindWebIdGraphsService(webidgraphsservice: WebIdGraphsService): Unit = {
- if (webIdGraphsService == webidgraphsservice) {
- webIdGraphsService = null
- }
- }
-
- protected def bindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- this.descriptionProvider = descriptionProvider
- }
-
- protected def unbindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- if (descriptionProvider == this.descriptionProvider) {
- this.descriptionProvider = null
- }
- }
protected def bindRenderletManager(renderletmanager: RenderletManager): Unit = {
@@ -138,20 +118,7 @@ class PersonPanel {
}
- //
- //needed by code
- //
- private var descriptionProvider: WebDescriptionProvider = null
- private var webIdGraphsService: WebIdGraphsService = null
-
- //
- //needed by framework
- //
-
//called by the ssp, web component
private var renderletManager: RenderletManager = null
- //set in activate. But is it useful to keep an pointer to it?
- //private var componentContext: ComponentContext = null
-
}
\ No newline at end of file
Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala Fri Mar 18 17:32:11 2011
@@ -31,10 +31,8 @@ import org.apache.clerezza.jaxrs.utils.T
import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
import org.apache.clerezza.platform.config.PlatformConfig
import org.apache.clerezza.platform.typerendering.RenderletManager
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet
import org.apache.clerezza.platform.usermanager.UserManager
import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.rdf.core.access.TcManager
import org.apache.clerezza.rdf.core.impl.SimpleMGraph
import org.apache.clerezza.rdf.core.impl.TripleImpl
import org.apache.clerezza.rdf.ontologies.DC
@@ -43,11 +41,6 @@ import org.apache.clerezza.rdf.ontologie
import org.apache.clerezza.rdf.ontologies.RDF
import org.apache.clerezza.rdf.utils.GraphNode
import org.apache.clerezza.rdf.utils.UnionMGraph
-import org.apache.clerezza.web.fileserver.FileServer
-import org.apache.felix.scr.annotations.Component
-import org.apache.felix.scr.annotations.Property
-import org.apache.felix.scr.annotations.Reference
-import org.apache.felix.scr.annotations.Service
import org.osgi.service.component.ComponentContext
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -57,14 +50,12 @@ import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import javax.ws.rs.core.UriInfo
import java.math.BigInteger
-import java.net.URL
import java.security.AccessController
import java.security.PrivilegedAction
import java.security.interfaces.RSAPublicKey
-import org.apache.clerezza.platform.typerendering.scala.PageRenderlet
import org.apache.clerezza.rdf.ontologies.RDFS
import org.apache.clerezza.ssl.keygen.KeygenService
-import org.apache.clerezza.platform.users.{WebDescriptionProvider, WebIdGraphsService}
+import org.apache.clerezza.platform.users.WebIdGraphsService
object ProfilePanel {
private val logger: Logger = LoggerFactory.getLogger(classOf[ProfilePanel])
@@ -133,10 +124,10 @@ class ProfilePanel {
* the local graph. Local changes can be written to a buffer graph, that will have not be saved.
*/
private def getProfileInUserGraph(webId: UriRef, profile: UriRef): GraphNode = {
- var webIdGraphs: WebIdGraphsService#WebIdGraphs = webIdGraphsService.getWebIdGraphs(webId)
- var userGraph: MGraph = webIdGraphs.publicUserGraph
+ var webIDInfo = webIdGraphsService.getWebIDInfo(webId)
+ var userGraph: MGraph = webIDInfo.publicUserGraph
var resultNode: GraphNode = new GraphNode(profile, new UnionMGraph(new SimpleMGraph, userGraph))
- resultNode.addProperty(CONTROLPANEL.isLocalProfile, LiteralFactory.getInstance.createTypedLiteral(webIdGraphs.isLocal))
+ resultNode.addProperty(CONTROLPANEL.isLocalProfile, LiteralFactory.getInstance.createTypedLiteral(webIDInfo.isLocal))
resultNode.addProperty(FOAF.primaryTopic, webId)
return resultNode
}
@@ -161,8 +152,12 @@ class ProfilePanel {
@PathParam(value = "id") userName: String): Response = {
val ppd: UriRef = getSuggestedPPDUri(userName)
val webId: UriRef = new UriRef(ppd.getUnicodeString + "#me")
- val webIdGraphs: WebIdGraphsService#WebIdGraphs = webIdGraphsService.getWebIdGraphs(webId)
- webIdGraphs.localGraph.addAll(Arrays.asList(new TripleImpl(ppd, RDF.`type`, FOAF.PersonalProfileDocument), new TripleImpl(ppd, FOAF.primaryTopic, webId)))
+ val webIDInfo = webIdGraphsService.getWebIDInfo(webId)
+ webIDInfo.localGraph.addAll(
+ Arrays.asList(
+ new TripleImpl(ppd, RDF.`type`, FOAF.PersonalProfileDocument),
+ new TripleImpl(ppd, FOAF.primaryTopic, webId))
+ )
return AccessController.doPrivileged(new PrivilegedAction[Response] {
def run: Response = {
var userInSystemGraph: GraphNode = userManager.getUserInSystemGraph(userName)
@@ -185,9 +180,8 @@ class ProfilePanel {
}
})
for (contactWebID <- newContacts) {
- val webIdGraphs: WebIdGraphsService#WebIdGraphs = webIdGraphsService.getWebIdGraphs(me.getNode.asInstanceOf[UriRef])
+ val webIdGraphs = webIdGraphsService.getWebIDInfo(me.getNode.asInstanceOf[UriRef])
var meGrph: GraphNode = new GraphNode(me.getNode, webIdGraphs.localGraph)
- webIdGraphsService.getWebIdGraphs(contactWebID)
meGrph.addProperty(FOAF.knows, contactWebID)
} //todo: one should catch errors here (bad uris sent for ex
}
@@ -251,8 +245,8 @@ class ProfilePanel {
var pubKey: RSAPublicKey = cert.getSubjectPublicKey.getPublicKey.asInstanceOf[RSAPublicKey]
var publicExponent: BigInteger = pubKey.getPublicExponent
var modulus: BigInteger = pubKey.getModulus
- val webIdGraphs: WebIdGraphsService#WebIdGraphs = webIdGraphsService.getWebIdGraphs(webId)
- val certNode: GraphNode = new GraphNode(new BNode, webIdGraphs.localGraph)
+ val webIdInfo: WebIdGraphsService#WebIDInfo = webIdGraphsService.getWebIDInfo(webId)
+ val certNode: GraphNode = new GraphNode(new BNode, webIdInfo.localGraph)
certNode.addProperty(RDF.`type`, RSA.RSAPublicKey)
certNode.addProperty(CERT.identity, webId)
certNode.addPropertyValue(RSA.modulus, modulus)
@@ -270,8 +264,8 @@ class ProfilePanel {
def deleteKey(@Context uriInfo: UriInfo,
@FormParam("webId") webId: UriRef,
@FormParam("keyhash") keys: List[String]): Response = {
- val webIdGraphs: WebIdGraphsService#WebIdGraphs = webIdGraphsService.getWebIdGraphs(webId)
- val agent: GraphNode = new GraphNode(webId, webIdGraphs.localGraph)
+ val webIDInfo = webIdGraphsService.getWebIDInfo(webId)
+ val agent: GraphNode = new GraphNode(webId, webIDInfo.localGraph)
var subjects: Iterator[GraphNode] = agent.getSubjectNodes(CERT.identity)
import scala.util.control.Breaks._
breakable {
@@ -305,13 +299,13 @@ class ProfilePanel {
@FormParam("webId") webId: UriRef,
@FormParam("name") name: String,
@FormParam("description") description: String): Response = {
- val webIdGraphs: WebIdGraphsService#WebIdGraphs = webIdGraphsService.getWebIdGraphs(webId)
- val agent: GraphNode = new GraphNode(webId, webIdGraphs.localGraph)
+ val webIDInfo = webIdGraphsService.getWebIDInfo(webId)
+ val agent: GraphNode = new GraphNode(webId, webIDInfo.localGraph)
agent.deleteProperties(FOAF.name)
agent.addPropertyValue(FOAF.name, name)
agent.deleteProperties(DC.description)
agent.addPropertyValue(DC.description, description)
- logger.debug("local graph (uri: {}) is now of size {}", webIdGraphs.localGraphUri, webIdGraphs.localGraph.size)
+ logger.debug("local graph (uri: {}) is now of size {}", webIDInfo.localGraphUri, webIDInfo.localGraph.size)
return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
}
@@ -365,16 +359,6 @@ class ProfilePanel {
}
}
- protected def bindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- this.descriptionProvider = descriptionProvider
- }
-
- protected def unbindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- if (descriptionProvider == this.descriptionProvider) {
- this.descriptionProvider = null
- }
- }
-
protected def activate(componentContext: ComponentContext): Unit = {
this.componentContext = componentContext
}
@@ -382,9 +366,7 @@ class ProfilePanel {
private var userManager: UserManager = null
- //todo: does one need both of these?
private var webIdGraphsService: WebIdGraphsService = null
- private var descriptionProvider: WebDescriptionProvider = null
private var keygenSrvc: KeygenService = null
private var platformConfig: PlatformConfig = null
Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/person_panel.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/person_panel.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/person_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/person_panel.scala Fri Mar 18 17:32:11 2011
@@ -25,9 +25,9 @@ import org.apache.clerezza.platform.type
import org.apache.clerezza.rdf.core.UriRef
import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
import org.apache.clerezza.rdf.utils.GraphNode
-import org.apache.clerezza.rdf.ontologies.{RDFS, RDF, FOAF}
import xml.{NodeSeq, NodeBuffer, Text, Node}
import java.net.{URLEncoder, URL}
+import org.apache.clerezza.rdf.ontologies.{RDF, FOAF, RDFS}
object person_panel {
final val emptyText = new Text("")
@@ -154,7 +154,7 @@ class person_panel extends PageRenderlet
val it: CollectedIter[RichGraphNode] = res / FOAF.primaryTopic
val primeTpc: RichGraphNode = it.apply(0)
val agent : RichGraphNode= primeTpc! match {
- case uri : UriRef => fetch(uri)
+ case uri : UriRef => fetch(uri) match { case Some(grph) => grph; case None => res};
case _ => res
}
Modified: incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/profile_panel.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/profile_panel.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/profile_panel.scala (original)
+++ incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/profile_panel.scala Fri Mar 18 17:32:11 2011
@@ -129,7 +129,10 @@ class profile_panel extends PageRenderle
val friends = for (friend <- agent/FOAF.knows) yield {
import person_panel._
val node = friend.getNode() match {
- case uri: UriRef => personInABox(fetch(uri))
+ case uri: UriRef => fetch(uri) match {
+ case Some(grp) => personInABox(grp)
+ case None => emptyText
+ }
case _ => emptyText //one could show info with bnodes too...
}
<td>{node}</td>
Modified: incubator/clerezza/trunk/parent/platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java (original)
+++ incubator/clerezza/trunk/parent/platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java Fri Mar 18 17:32:11 2011
@@ -141,6 +141,7 @@ public class PlatformConfig {
* A base Uri is the shortest URI of a URI-Hierarhy the platform handles.
* @return the base URI of the Clerezza platform
*/
+ //todo: if this is the only class that sets and reads base uris then getBaseURIs should keep a cache
public Set<UriRef> getBaseUris() {
return AccessController.doPrivileged(new PrivilegedAction<Set<UriRef>>() {
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=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml (original)
+++ incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml Fri Mar 18 17:32:11 2011
@@ -257,7 +257,7 @@
<artifactId>rdf.ontologies</artifactId>
<scope>runtime</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.content</artifactId>
<scope>runtime</scope>
@@ -349,6 +349,11 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy.core</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
<artifactId>platform.security</artifactId>
<scope>runtime</scope>
</dependency>
Modified: incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml (original)
+++ incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml Fri Mar 18 17:32:11 2011
@@ -43,10 +43,10 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.security</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.users.core</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy.core</artifactId>
+ </dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
Modified: incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/resources/OSGI-INF/serviceComponents.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/resources/OSGI-INF/serviceComponents.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/resources/OSGI-INF/serviceComponents.xml (original)
+++ incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/resources/OSGI-INF/serviceComponents.xml Fri Mar 18 17:32:11 2011
@@ -11,22 +11,14 @@
<service servicefactory="false">
<provide interface="org.apache.clerezza.platform.security.auth.WeightedAuthenticationMethod"/>
</service>
- <reference name="webDescriptionProvider" interface="org.apache.clerezza.platform.users.WebDescriptionProvider"
- cardinality="1..1" policy="static" bind="bindWebDescriptionProvider" unbind="unbindWebDescriptionProvider"/>
- <!-- <reference name="conceptProviderManager"
- interface="org.apache.clerezza.platform.concepts.core.ConceptProviderManager"
- cardinality="1..1" policy="static" bind="bindConceptProviderManager" unbind="unbindConceptProviderManager"/>
- <reference name="renderletManager"
- interface="org.apache.clerezza.platform.typerendering.RenderletManager"
- cardinality="1..1" policy="static" bind="bindRenderletManager" unbind="unbindRenderletManager"/> -->
</scr:component>
<scr:component enabled="true" name="org.apache.clerezza.foafssl.ssl.X509TrustManagerWrapperService">
<implementation class="org.apache.clerezza.foafssl.ssl.X509TrustManagerWrapperService"/>
<service servicefactory="false">
<provide interface="org.apache.clerezza.foafssl.ssl.X509TrustManagerWrapperService"/>
</service>
- <reference name="tcManager" interface="org.apache.clerezza.platform.users.WebDescriptionProvider"
- cardinality="1..1" policy="static" bind="bindWebDescriptionProvider" unbind="unbindWebDescriptionProvider"/>
+ <reference name="webProxy" interface="org.apache.clerezza.rdf.web.proxy.WebProxy"
+ cardinality="1..1" policy="static" bind="bindWebProxy" unbind="unbindWebProxy"/>
<reference name="systemGraph" interface="org.apache.clerezza.rdf.core.access.LockableMGraph"
cardinality="1..1" policy="static" target="(name=http://tpf.localhost/system.graph)"
bind="bindSystemGraph" unbind="unbindSystemGraph"/>
Modified: incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/auth/FoafSslAuthentication.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/auth/FoafSslAuthentication.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/auth/FoafSslAuthentication.scala (original)
+++ incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/auth/FoafSslAuthentication.scala Fri Mar 18 17:32:11 2011
@@ -20,7 +20,6 @@
package org.apache.clerezza.foafssl.auth
import org.apache.clerezza.foafssl.Utilities
-import org.apache.clerezza.platform.users.WebDescriptionProvider
import org.apache.clerezza.platform.security.auth._
import org.apache.clerezza.rdf.core._
import org.wymiwyg.wrhapi.Request
@@ -33,16 +32,6 @@ import org.wymiwyg.wrhapi.Response
*/
class FoafSslAuthentication extends WeightedAuthenticationMethod {
- private var descriptionProvider: WebDescriptionProvider = null;
-
- protected def bindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- this.descriptionProvider = descriptionProvider
- }
-
- protected def unbindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- this.descriptionProvider = null
- }
-
def authenticate(request: Request): String = {
val certificates = request.getCertificates()
Modified: incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala (original)
+++ incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala Fri Mar 18 17:32:11 2011
@@ -56,19 +56,19 @@ import org.apache.clerezza.rdf.scala.uti
import org.jsslutils.sslcontext.X509TrustManagerWrapper
import org.jsslutils.sslcontext.trustmanagers.TrustAllClientsWrappingTrustManager
import org.slf4j.LoggerFactory
-import org.apache.clerezza.platform.users.{Cache, WebDescriptionProvider}
+import org.apache.clerezza.rdf.web.proxy.{WebProxy, Cache}
class X509TrustManagerWrapperService() extends X509TrustManagerWrapper {
private val logger = LoggerFactory.getLogger(classOf[X509TrustManagerWrapperService])
- private var descriptionProvider: WebDescriptionProvider = null;
+ private var webproxy: WebProxy = null;
- protected def bindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- this.descriptionProvider = descriptionProvider
+ protected def bindWebProxy(webcache: WebProxy) = {
+ this.webproxy = webcache
}
- protected def unbindWebDescriptionProvider(descriptionProvider: WebDescriptionProvider) = {
- this.descriptionProvider = null
+ protected def unbindWebProxy(webcache: WebProxy) = {
+ this.webproxy = null
}
private var systemGraph: MGraph = null
@@ -116,23 +116,22 @@ class X509TrustManagerWrapperService() e
private val systemGraphUri = Constants.SYSTEM_GRAPH_URI;
- private def verify(uriRef: UriRef, publicKey: PublicKey): Unit = {
- var webDescription = descriptionProvider.getWebDescription(uriRef, Cache.CacheOnly)
+ private def verify(webidClaim: UriRef, publicKey: PublicKey): Unit = {
+ var webIdInfo = webproxy.getResourceInfo(webidClaim, Cache.CacheOnly)
if (
- !verify(uriRef, publicKey, webDescription.getGraph)
+ !verify(webidClaim, publicKey, webIdInfo.localCache)
) {
- webDescription = descriptionProvider.getWebDescription(uriRef, Cache.ForceUpdate)
+ webIdInfo = webproxy.getResourceInfo(webidClaim, Cache.ForceUpdate)
if (
- !verify(uriRef, publicKey, webDescription.getGraph)
+ !verify(webidClaim, publicKey, webIdInfo.localCache)
) throw new CertificateException
}
- systemGraph.addAll(createSystemUserDescription(webDescription))
+ systemGraph.addAll(createSystemUserDescription(webidClaim))
}
- def createSystemUserDescription(webDescription: GraphNode) = {
+ def createSystemUserDescription(webId: UriRef): MGraph = {
val result = new SimpleMGraph()
- val webId = webDescription.getNode.asInstanceOf[UriRef]
- result.add(new TripleImpl(webId, PLATFORM.userName,
+ result.add(new TripleImpl(webId, PLATFORM.userName,
new PlainLiteralImpl(Utilities.createUsernameForWebId(webId))))
result.add(new TripleImpl(webId, RDF.`type` ,
FOAF.Agent))
Modified: incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml (original)
+++ incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml Fri Mar 18 17:32:11 2011
@@ -30,7 +30,7 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
- <artifactId>platform.users.core</artifactId>
+ <artifactId>rdf.web.proxy.core</artifactId>
</dependency>
</dependencies>
Modified: incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala (original)
+++ incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala Fri Mar 18 17:32:11 2011
@@ -33,7 +33,7 @@ import org.apache.clerezza.rdf.utils._
import org.apache.clerezza.rdf.scala.utils.Preamble._
import java.security.{PrivilegedAction, AccessController}
import org.osgi.framework.{BundleContext, ServiceReference}
-import org.apache.clerezza.platform.users.{WebDescriptionProvider, Cache}
+import org.apache.clerezza.rdf.web.proxy.{WebProxy,Cache}
import org.apache.clerezza.rdf.scala.utils.RichGraphNode
/**
@@ -78,13 +78,13 @@ abstract class RenderedPage(arguments: R
parseNodeSeq(new String(baos.toByteArray))
}
- def fetch(uri: UriRef) : GraphNode = {
- val webSrvc = AccessController.doPrivileged(new PrivilegedAction[WebDescriptionProvider] {
- def run: WebDescriptionProvider = {
+ def fetch(uri: UriRef) : Option[GraphNode] = {
+ val webSrvc = AccessController.doPrivileged(new PrivilegedAction[WebProxy] {
+ def run: WebProxy = {
val cntxt: BundleContext = requestProperties.bundleContext
- var serviceReference: ServiceReference = cntxt.getServiceReference("org.apache.clerezza.platform.users.WebDescriptionProvider")
+ var serviceReference: ServiceReference = cntxt.getServiceReference("org.apache.clerezza.rdf.web.proxy.WebProxy")
if (serviceReference != null) {
- return cntxt.getService(serviceReference).asInstanceOf[WebDescriptionProvider]
+ return cntxt.getService(serviceReference).asInstanceOf[WebProxy]
} else {
return null
}
@@ -93,8 +93,7 @@ abstract class RenderedPage(arguments: R
//This should return not a graph, but a graph surrounded with HTTP metadata, so that the user
//connection error messages can be designed, and so on.
//The graph should be fetched as the user also if this is required.
- val grph = webSrvc.fetchSemantics(uri,Cache.Fetch)
- return new GraphNode(uri,grph)
+ return webSrvc.fetchSemantics(uri,Cache.Fetch)
}
/**
Modified: incubator/clerezza/trunk/parent/platform.users/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.users/core/pom.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.users/core/pom.xml (original)
+++ incubator/clerezza/trunk/parent/platform.users/core/pom.xml Fri Mar 18 17:32:11 2011
@@ -39,7 +39,10 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.scala.utils</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy.core</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.security</artifactId>
@@ -69,7 +72,7 @@
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
- <testSourceDirectory>src/test/scala</testSourceDirectory>
+ <!--testSourceDirectory>src/test/scala</testSourceDirectory-->
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
Modified: incubator/clerezza/trunk/parent/platform.users/core/src/main/resources/OSGI-INF/serviceComponents.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.users/core/src/main/resources/OSGI-INF/serviceComponents.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.users/core/src/main/resources/OSGI-INF/serviceComponents.xml (original)
+++ incubator/clerezza/trunk/parent/platform.users/core/src/main/resources/OSGI-INF/serviceComponents.xml Fri Mar 18 17:32:11 2011
@@ -7,16 +7,6 @@
<provide interface="org.apache.clerezza.platform.security.WebIdBasedPermissionProvider"/>
</service>
</scr:component>
- <scr:component enabled="true" name="org.apache.clerezza.platform.users.WebDescriptionProvider">
- <implementation class="org.apache.clerezza.platform.users.WebDescriptionProvider"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.platform.users.WebDescriptionProvider"/>
- </service>
- <reference name="tcManager" interface="org.apache.clerezza.rdf.core.access.TcManager"
- cardinality="1..1" policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
- <reference name="webIdGraphsService" interface="org.apache.clerezza.platform.users.WebIdGraphsService"
- cardinality="1..1" policy="static" bind="bindWebIdGraphsService" unbind="unbindWebIdGraphsService"/>
- </scr:component>
<scr:component enabled="true" name="org.apache.clerezza.platform.users.WebIdGraphsService">
<implementation class="org.apache.clerezza.platform.users.WebIdGraphsService"/>
<service servicefactory="false">
@@ -24,8 +14,6 @@
</service>
<reference name="tcManager" interface="org.apache.clerezza.rdf.core.access.TcManager"
cardinality="1..1" policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
- <reference name="parser" interface="org.apache.clerezza.rdf.core.serializedform.Parser"
- cardinality="1..1" policy="static" bind="bindParser" unbind="unbindParser"/>
<reference name="platformConfig" interface="org.apache.clerezza.platform.config.PlatformConfig"
cardinality="1..1" policy="static" bind="bindPlatformConfig" unbind="unbindPlatformConfig"/>
<!-- <reference name="tcManager" interface="org.apache.clerezza.platform.users.WebDescriptionProvider"
Modified: incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdGraphsService.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdGraphsService.scala?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdGraphsService.scala (original)
+++ incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdGraphsService.scala Fri Mar 18 17:32:11 2011
@@ -18,120 +18,90 @@
*/
package org.apache.clerezza.platform.users
-import java.net.HttpURLConnection
-import java.net.URL
import java.security.AccessController
import java.security.PrivilegedAction
import org.apache.clerezza.platform.Constants
-import org.apache.clerezza.platform.config.PlatformConfig
import org.apache.clerezza.platform.config.SystemConfig
import org.apache.clerezza.rdf.core.MGraph
import org.apache.clerezza.rdf.core.UriRef
import org.apache.clerezza.rdf.core.access.NoSuchEntityException
import org.apache.clerezza.rdf.core.access.SecuredMGraph
-import org.apache.clerezza.rdf.core.access.TcManager
import org.apache.clerezza.rdf.core.access.security.TcPermission
import org.apache.clerezza.rdf.core.impl.SimpleMGraph
-import org.apache.clerezza.rdf.core.serializedform.Parser
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat
import org.apache.clerezza.rdf.ontologies.PLATFORM
import org.apache.clerezza.rdf.utils.UnionMGraph
-
+import org.apache.clerezza.rdf.web.proxy.{Cache, WebProxy}
//todo: this class can be generalised to a generalised semweb caching service
/**
* For agents with a Web-Id various graphs are available, these graphs are
* grouped by <code>WebIdGraphs</code> which this service provides.
*/
-class WebIdGraphsService() {
-
- private var parser: Parser = null
-
- protected def bindParser(p: Parser) = {
- parser = p
- }
-
- protected def unbindParser(p: Parser) = {
- parser = null
- }
-
- private var tcManager: TcManager = null;
+class WebIdGraphsService extends WebProxy {
- protected def bindTcManager(tcManager: TcManager) = {
- this.tcManager = tcManager
- }
-
- protected def unbindTcManager(tcManager: TcManager) = {
- this.tcManager = null
- }
-
- private var platformConfig: PlatformConfig = null;
- protected def bindPlatformConfig(c: PlatformConfig) = {
- this.platformConfig = c
- }
-
- protected def unbindPlatformConfig(c: PlatformConfig) = {
- this.platformConfig = null
- }
- private lazy val acceptHeader = {
- import scala.collection.JavaConversions._
- (for (f <- parser.getSupportedFormats) yield {
- val qualityOfFormat = {
- f match {
- //the default, well established format
- case SupportedFormat.RDF_XML => "1.0";
- //we prefer most dedicated formats to (X)HTML, not because those are "better",
- //but just because it is quite likely that the pure RDF format will be
- //lighter (contain less presentation markup), and it is also possible that HTML does not
- //contain any RDFa, but just points to another format.
- case SupportedFormat.XHTML => "0.5";
- //we prefer XHTML over html, because parsing (should) be easier
- case SupportedFormat.HTML => "0.4";
- //all other formats known currently are structured formats
- case _ => "0.8"
- }
- }
- f+"; q="+qualityOfFormat+","
- }).mkString +" *; q=.1" //is that for GRDDL?
- }
-
- def getWebIdGraphs(webId: UriRef): WebIdGraphs = {
- new WebIdGraphs(webId)
- }
-
- class WebIdGraphs(webId: UriRef) {
- val uriString = webId.getUnicodeString
-
- lazy val isLocal: Boolean = {
- import scala.collection.JavaConversions._
- platformConfig.getBaseUris.exists(baseUri => uriString.startsWith(baseUri.getUnicodeString))
+ //todo: Here we duplicate the WebProxy Method and extend the ResourceInfo objects
+ //The advantage is that it shows clearly what code is specific to WebIDs.
+ //But it also feels a bit dangerous to extend inner classes like this.
+
+ /**
+ *
+ * @param uri for which info should be fetched
+ * @param update, a Cache.Value for how much to force the info for the resource. By default get what is in the cache
+ * if this is still valid
+ * @return a resource info, more or less updated
+ */
+ def getWebIDInfo(uri: UriRef, update: Cache.Value = Cache.Fetch): WebIDInfo = {
+ val resource = new WebIDInfo(uri)
+ if (resource.isLocal) return resource
+
+ //the logic here is not quite right, as we don't look at time of previous fetch.
+ update match {
+ case Cache.Fetch => if (resource.localCache.size() == 0) resource.updateLocalCache()
+ case Cache.ForceUpdate => resource.updateLocalCache()
+ case Cache.CacheOnly => {}
}
-
+ return resource
+ }
+
+
+ /**
+ * A Proxy for WebID Resource info
+ */
+ class WebIDInfo(webId: UriRef) extends ResourceInfo(webId) {
/**
- * remote graphs are cache locally with this name
+ * Returns the graph with triples to which public read access can be granted.
+ *
+ * This will return a union of the following graphs.
+ * - minimum graph constructed for system graph
+ * - cached version of profile document from web, if available
+ * - as read/write graph: the public personal profile graph
+ *
+ * @return a GraphNode describing webId
*/
- lazy val localCacheUri = {
- new UriRef(representationGraphUriString+".cache")
- }
-
- lazy val localCache = try {
- val g = tcManager.getMGraph(localCacheUri)
- g
- } catch {
- case e: NoSuchEntityException => tcManager.createMGraph(localCacheUri)
- }
-
- lazy val representationGraphUriString = {
- val hashPos = uriString.indexOf('#')
- if (hashPos != -1) {
- uriString.substring(0, hashPos)
- } else {
- finalRedirectLocation
+ def publicUserGraph: MGraph = {
+ def systemTriples = {
+ val systemGraph = tcManager.getMGraph(SystemConfig.SYSTEM_GRAPH_URI)
+ val triples = systemGraph.filter(webId, PLATFORM.userName, null)
+ val result = new SimpleMGraph
+ while (triples.hasNext) {
+ result.add(triples.next())
+ }
+ result
}
+ AccessController.doPrivileged(new PrivilegedAction[MGraph]() {
+ def run() = {
+ val unionGraph = if (isLocal) {
+ new UnionMGraph(localGraph, systemTriples)
+ } else {
+ new UnionMGraph(localGraph, localCache, systemTriples)
+ }
+ new SecuredMGraph(unionGraph, localGraphUri, tcManager.getTcAccessController)
+ }
+ })
}
-
+
/**
* for web-ids with a # same as representationGraphUriString
*/
@@ -148,99 +118,24 @@ class WebIdGraphsService() {
uriString
}
}
-
+
+
+ //for the WebID Graph this is the place where local information in addition to remote
+ //information is stored.
+ //for the WebProxy would we want this to be the name for the local cache?
lazy val localGraph = try {
- tcManager.getMGraph(localGraphUri)
+ tcManager.getMGraph(localGraphUri)
} catch {
case e: NoSuchEntityException => {
- import scala.collection.JavaConversions._
- tcManager.getTcAccessController.
+ import scala.collection.JavaConversions._
+ tcManager.getTcAccessController.
setRequiredReadPermissionStrings(localGraphUri,
- List(new TcPermission(Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ).toString))
- tcManager.createMGraph(localGraphUri)
- }
- }
-
- lazy val representationGraphUri = {
- new UriRef(representationGraphUriString)
- }
- private lazy val finalRedirectLocation = {
- finalRedirectLocationFor(webId.getUnicodeString)
- }
- def finalRedirectLocationFor(us: String): String = {
- val url = new URL(us)
- val connection = url.openConnection()
- connection match {
- case hc : HttpURLConnection => {
- hc.setRequestMethod("HEAD");
- hc.setInstanceFollowRedirects(false)
- hc.addRequestProperty("Accept", acceptHeader)
- hc.getResponseCode match {
- case HttpURLConnection.HTTP_SEE_OTHER => {
- val location = hc.getHeaderField("Location")
- if (location == null) {
- throw new RuntimeException("No Location Headers in 303 response")
- }
- finalRedirectLocationFor(location)
- }
- case _ => us
- }
- }
- case _ => us
+ List(new TcPermission(Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ).toString))
+ tcManager.createMGraph(localGraphUri)
}
}
- //todo: follow redirects and keep track of them
- //todo: keep track of headers especially date and etag. test for etag similarity
- //todo: it may be important to have blank node identifiers for graphs as the same webid, when called by different
- // agents could have very different content
- //todo: for https connection allow user to specify his webid and send his key: ie allow web server to be an agent
- //todo: add GRDDL functionality, so that other return types can be processed too
- //todo: enable ftp and other formats (though content negotiation won't work there)
- def updateLocalCache() = {
- val url = new URL(representationGraphUriString)
- val connection = url.openConnection()
- connection match {
- case hc: HttpURLConnection => hc.addRequestProperty("Accept", acceptHeader);
- }
- connection.connect()
- val in = connection.getInputStream()
- val mediaType = connection.getContentType()
- val remoteTriples = parser.parse(in, mediaType, representationGraphUri)
- localCache.clear()
- localCache.addAll(remoteTriples)
- }
-
- /**
- * Returns the graph with triples to which public read access can be granted.
- *
- * This will return a union of the following graphs.
- * - minimum graph constructed for system graph
- * - cached version of profile document from web, if available
- * - as read/write graph: the public personal profile graph
- *
- * @return a GraphNode describing webId
- */
- def publicUserGraph: MGraph = {
- def systemTriples = {
- val systemGraph = tcManager.getMGraph(SystemConfig.SYSTEM_GRAPH_URI)
- val triples = systemGraph.filter(webId, PLATFORM.userName, null)
- val result = new SimpleMGraph
- while (triples.hasNext) {
- result.add(triples.next())
- }
- result
- }
- AccessController.doPrivileged(new PrivilegedAction[MGraph]() {
- def run() = {
- val unionGraph = if (isLocal) {
- new UnionMGraph(localGraph, systemTriples)
- } else {
- new UnionMGraph(localGraph, localCache, systemTriples)
- }
- new SecuredMGraph(unionGraph, localGraphUri, tcManager.getTcAccessController)
- }
- })
- }
+
}
+
}
\ No newline at end of file
Modified: incubator/clerezza/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/pom.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/pom.xml (original)
+++ incubator/clerezza/trunk/parent/pom.xml Fri Mar 18 17:32:11 2011
@@ -104,6 +104,7 @@
<module>rdf.stable.serializer</module>
<module>rdf.utils</module>
<module>rdf.web</module>
+ <module>rdf.web.proxy</module>
<module>shell</module>
<module>shell.felixshellcommand</module>
<module>sourcebundle</module>
@@ -648,6 +649,11 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy.core</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
<artifactId>rdf.web.ontologies</artifactId>
<version>0.2-incubating-SNAPSHOT</version>
</dependency>
Added: incubator/clerezza/trunk/parent/rdf.web.proxy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.web.proxy/pom.xml?rev=1082989&view=auto
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.web.proxy/pom.xml (added)
+++ incubator/clerezza/trunk/parent/rdf.web.proxy/pom.xml Fri Mar 18 17:32:11 2011
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy</artifactId>
+ <packaging>pom</packaging>
+ <version>0.2-incubating-SNAPSHOT</version>
+ <name>Clerezza - SCB RDF Web Caching Proxy Service</name>
+ <description>A service that returns graphs for given URLs, fetching them if needed from the source or returning a valid cached version otherwise</description>
+ <modules>
+ <module>rdf.web.proxy.core</module>
+ <!--module>ontologies</module-->
+ </modules>
+</project>
Added: incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/pom.xml?rev=1082989&view=auto
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/pom.xml (added)
+++ incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/pom.xml Fri Mar 18 17:32:11 2011
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.proxy.core</artifactId>
+ <packaging>bundle</packaging>
+ <version>0.2-incubating-SNAPSHOT</version>
+ <name>Clerezza - SCB RDF Web Caching Proxy Core</name>
+ <description>The core part of SCB RDF Web Proxy Caching Service</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>platform.typerendering.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>platform.typerendering.scalaserverpages</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.jena.serializer</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.jena.parser</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>jaxrs.utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.ontologies</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.web.ontologies</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>platform.dashboard.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>permissiondescriptions</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src/main/scala</sourceDirectory>
+ <!--testSourceDirectory>src/test/scala</testSourceDirectory-->
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- <scalaVersion>${scala.version}</scalaVersion> -->
+ <!-- <args>
+ <arg>-target:jvm-1.5</arg>
+ </args> -->
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
+ <Export-Package>org.apache.clerezza.rdf.web.proxy</Export-Package>
+ <Bundle-SymbolicName>org.apache.clerezza.rdf.web.proxy</Bundle-SymbolicName>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
+
Added: incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/resources/OSGI-INF/serviceComponents.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/resources/OSGI-INF/serviceComponents.xml?rev=1082989&view=auto
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/resources/OSGI-INF/serviceComponents.xml (added)
+++ incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/resources/OSGI-INF/serviceComponents.xml Fri Mar 18 17:32:11 2011
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+
+ <scr:component enabled="true" name="org.apache.clerezza.rdf.web.proxy.WebProxy">
+ <implementation class="org.apache.clerezza.rdf.web.proxy.WebProxy"/>
+ <service servicefactory="false">
+ <provide interface="org.apache.clerezza.rdf.web.proxy.WebProxy"/>
+ </service>
+ <reference name="tcManager" interface="org.apache.clerezza.rdf.core.access.TcManager"
+ cardinality="1..1" policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
+ <reference name="parser" interface="org.apache.clerezza.rdf.core.serializedform.Parser"
+ cardinality="1..1" policy="static" bind="bindParser" unbind="unbindParser"/>
+ <reference name="platformConfig" interface="org.apache.clerezza.platform.config.PlatformConfig"
+ cardinality="1..1" policy="static" bind="bindPlatformConfig" unbind="unbindPlatformConfig"/>
+
+ <!-- <reference name="tcManager" interface="org.apache.clerezza.platform.users.WebDescriptionProvider"
+ cardinality="1..1" policy="static" bind="bindWebDescriptionProvider" unbind="unbindWebDescriptionProvider"/> -->
+ </scr:component>
+
+</components>
Added: incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/web/proxy/WebProxy.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/web/proxy/WebProxy.scala?rev=1082989&view=auto
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/web/proxy/WebProxy.scala (added)
+++ incubator/clerezza/trunk/parent/rdf.web.proxy/rdf.web.proxy.core/src/main/scala/org/apache/clerezza/rdf/web/proxy/WebProxy.scala Fri Mar 18 17:32:11 2011
@@ -0,0 +1,265 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.clerezza.rdf.web.proxy
+
+import org.apache.clerezza.platform.Constants
+import org.apache.clerezza.rdf.utils.GraphNode
+import org.apache.clerezza.rdf.utils.UnionMGraph
+import org.osgi.service.component.ComponentContext
+import org.apache.clerezza.rdf.core.{MGraph, TripleCollection, UriRef}
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph
+import org.apache.clerezza.rdf.ontologies.PLATFORM
+import org.apache.clerezza.platform.config.{PlatformConfig, SystemConfig}
+import org.apache.clerezza.rdf.core.access.security.TcPermission
+import java.net.{HttpURLConnection, URL}
+import java.security.{PrivilegedAction, AccessController}
+import org.apache.clerezza.rdf.core.access.{SecuredMGraph, NoSuchEntityException, TcManager}
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat
+import org.apache.clerezza.rdf.core.serializedform.Parser
+
+
+/**
+ * The Web Proxy Service enables applications to request remote graphs. It keeps cached
+ * version of them in store for faster delivery.
+ *
+ */
+class WebProxy {
+
+
+ protected var tcManager: TcManager = null;
+
+ protected def bindTcManager(tcManager: TcManager) = {
+ this.tcManager = tcManager
+ }
+
+ protected def unbindTcManager(tcManager: TcManager) = {
+ this.tcManager = null
+ }
+
+ //todo: replace this with an appropriate graph
+ protected val authoritativeLocalGraphs = Constants.CONFIG_GRAPH_URI
+
+ private var cacheMetaGraph: TripleCollection = null
+
+ /**OSGI method, called on activation */
+ protected def activate(context: ComponentContext) = {
+
+ }
+
+ protected def deactivate(context: ComponentContext) = {
+ cacheMetaGraph = null
+ }
+
+ private var platformConfig: PlatformConfig = null;
+
+ protected def bindPlatformConfig(c: PlatformConfig) = {
+ this.platformConfig = c
+ }
+
+ protected def unbindPlatformConfig(c: PlatformConfig) = {
+ this.platformConfig = null
+ }
+
+ private var parser: Parser = null
+
+ protected def bindParser(p: Parser) = {
+ parser = p
+ }
+
+ protected def unbindParser(p: Parser) = {
+ parser = null
+ }
+
+
+ /**
+ * similar to cwm log:semantics relation. Fetches the graph associated with a URI
+ * this just returns a simple Graph for the representation at the given URI.121
+ *
+ * @param uri the URI to fetch
+ * @param update true if the local cache is to be updated, false otherwise
+ * @return the cached Node as an MGraph. (The wrapper here is Some/None, but could be more tuned for this
+ *
+ */
+ def fetchSemantics(uri: UriRef, update: Cache.Value= Cache.Fetch): Option[GraphNode] = {
+ val resource = getResourceInfo(uri, update)
+ return try {
+ Some(new GraphNode(uri,tcManager.getTriples(resource.localCacheUri)))
+ } catch {
+ case e: NoSuchEntityException => None
+ }
+
+ }
+
+ /**
+ *
+ * @param uri for which info should be fetched
+ * @param update, a Cache.Value for how much to force the info for the resource. By default get what is in the cache
+ * if this is still valid
+ * @return a resource info, more or less updated
+ */
+ def getResourceInfo(uri: UriRef, update: Cache.Value = Cache.Fetch): ResourceInfo = {
+ val resource = new ResourceInfo(uri)
+ if (resource.isLocal) return resource
+
+ //the logic here is not quite right, as we don't look at time of previous fetch.
+ update match {
+ case Cache.Fetch => if (resource.localCache.size() == 0) resource.updateLocalCache()
+ case Cache.ForceUpdate => resource.updateLocalCache()
+ case Cache.CacheOnly => {}
+ }
+ return resource
+ }
+
+ /**
+ * A Resource Info gives us access to a number of things about a resource:
+ * its semantics in the form of a cached graphs, representation URI(s), local cache uris
+ *
+ * currently the local cache of the remote graph is named by the resource name + ".cache"
+ * the local graph that can contain extra information is the name of the resource
+ *
+ *
+ * todo? access to representations
+ * todo? should the graphs returned contain metadata about their update time?
+ */
+ class ResourceInfo(url: UriRef) {
+ val uriString = url.getUnicodeString
+
+ lazy val isLocal: Boolean = {
+ import scala.collection.JavaConversions._
+ //todo: the base uris are checked on every invocation. This seems somewhat heavy.
+ platformConfig.getBaseUris.exists(baseUri => uriString.startsWith(baseUri.getUnicodeString))
+ }
+
+ /**
+ * remote graphs are cache locally with this name
+ */
+ //todo: work on a cache database. It could be that a URL redirects to another resource...
+ lazy val localCacheUri = {
+ new UriRef(representationUri + ".cache")
+ }
+
+ // the graph containing the local cache of the resource
+ //todo: watch out: if someone can just make us add graphs to tcmanager even when there is no data...
+ lazy val localCache: MGraph = try {
+ val g = tcManager.getMGraph(localCacheUri)
+ g
+ } catch {
+ case e: NoSuchEntityException => tcManager.createMGraph(localCacheUri)
+ }
+
+
+ lazy val representationUri = {
+ val hashPos = uriString.indexOf('#')
+ if (hashPos != -1) {
+ uriString.substring(0, hashPos)
+ } else {
+ finalRedirectLocation
+ }
+ }
+
+
+ lazy val representationGraphUri = {
+ new UriRef(representationUri)
+ }
+
+ private lazy val finalRedirectLocation = {
+ finalRedirectLocationFor(url.getUnicodeString)
+ }
+
+ def finalRedirectLocationFor(us: String): String = {
+ val url = new URL(us)
+ val connection = url.openConnection()
+ connection match {
+ case hc: HttpURLConnection => {
+ hc.setRequestMethod("HEAD");
+ hc.setInstanceFollowRedirects(false)
+ hc.addRequestProperty("Accept", acceptHeader)
+ hc.getResponseCode match {
+ case HttpURLConnection.HTTP_SEE_OTHER => {
+ val location = hc.getHeaderField("Location")
+ if (location == null) {
+ throw new RuntimeException("No Location Headers in 303 response")
+ }
+ finalRedirectLocationFor(location)
+ }
+ case _ => us
+ }
+ }
+ case _ => us
+ }
+ }
+
+ //todo: follow redirects and keep track of them
+ //todo: keep track of headers especially date and etag. test for etag similarity
+ //todo: it may be important to have blank node identifiers for graphs as the same webid, when called by different
+ // agents could have very different content
+ //todo: for https connection allow user to specify his webid and send his key: ie allow web server to be an agent
+ //todo: add GRDDL functionality, so that other return types can be processed too
+ //todo: enable ftp and other formats (though content negotiation won't work there)
+ def updateLocalCache() = {
+ val url = new URL(representationUri)
+ val connection = url.openConnection()
+ connection match {
+ case hc: HttpURLConnection => hc.addRequestProperty("Accept", acceptHeader);
+ }
+ connection.connect()
+ val in = connection.getInputStream()
+ val mediaType = connection.getContentType()
+ val remoteTriples = parser.parse(in, mediaType, representationGraphUri)
+ localCache.clear()
+ localCache.addAll(remoteTriples)
+ }
+
+
+ private lazy val acceptHeader = {
+ import scala.collection.JavaConversions._
+ (for (f <- parser.getSupportedFormats) yield {
+ val qualityOfFormat = {
+ f match {
+ //the default, well established format
+ case SupportedFormat.RDF_XML => "1.0";
+ //we prefer most dedicated formats to (X)HTML, not because those are "better",
+ //but just because it is quite likely that the pure RDF format will be
+ //lighter (contain less presentation markup), and it is also possible that HTML does not
+ //contain any RDFa, but just points to another format.
+ case SupportedFormat.XHTML => "0.5";
+ //we prefer XHTML over html, because parsing (should) be easier
+ case SupportedFormat.HTML => "0.4";
+ //all other formats known currently are structured formats
+ case _ => "0.8"
+ }
+ }
+ f + "; q=" + qualityOfFormat + ","
+ }).mkString + " *; q=.1" //is that for GRDDL?
+ }
+
+
+ }
+
+}
+
+object Cache extends Enumeration {
+ /**fetch if not in cache, if version in cache is out of date, or return cache */
+ val Fetch = Value
+ /**fetch from source whatever is in cache */
+ val ForceUpdate = Value
+ /**only get cached version. If none exists return empty graph */
+ val CacheOnly = Value
+}
Modified: incubator/clerezza/trunk/parent/ssl.keygen/base/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/ssl.keygen/base/pom.xml?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/ssl.keygen/base/pom.xml (original)
+++ incubator/clerezza/trunk/parent/ssl.keygen/base/pom.xml Fri Mar 18 17:32:11 2011
@@ -59,11 +59,6 @@
<dependencies>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
Modified: incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/CertSerialisation.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/CertSerialisation.java?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/CertSerialisation.java (original)
+++ incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/CertSerialisation.java Fri Mar 18 17:32:11 2011
@@ -32,14 +32,13 @@
package org.apache.clerezza.ssl.keygen;
-import javax.servlet.ServletResponse;
import java.io.IOException;
import java.io.OutputStream;
/**
* This makes it easier to send serialisations out in scripting languages such as velocity.
*
- * @author Henry K. Story
+ * @author Henry J. Story
*/
public interface CertSerialisation {
@@ -64,13 +63,5 @@ public interface CertSerialisation {
*/
void writeTo(OutputStream out) throws IOException;
- /**
- * Write the full response the response object, including headers, such as content length and mime type
- * Clients should use this method, as it reduces the risk of making a mistake
- *
- * @param response
- */
- void writeTo(ServletResponse response) throws IOException;
-
}
Modified: incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/bouncy/DefaultCertSerialisation.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/bouncy/DefaultCertSerialisation.java?rev=1082989&r1=1082988&r2=1082989&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/bouncy/DefaultCertSerialisation.java (original)
+++ incubator/clerezza/trunk/parent/ssl.keygen/base/src/main/java/org/apache/clerezza/ssl/keygen/bouncy/DefaultCertSerialisation.java Fri Mar 18 17:32:11 2011
@@ -35,7 +35,6 @@ package org.apache.clerezza.ssl.keygen.b
import org.apache.clerezza.ssl.keygen.CertSerialisation;
import org.apache.clerezza.ssl.keygen.Certificate;
-import javax.servlet.ServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
@@ -62,13 +61,6 @@ public abstract class DefaultCertSeriali
out.write(getContent());
}
- @Override
- public void writeTo(ServletResponse response) throws IOException {
- response.setContentLength(getLength());
- response.setContentType(getMimeType());
- writeTo(response.getOutputStream());
- }
-
/**
* Should not be used, only for testing!
*