{agent ! match {
> - case _: BNode =3D> createWebId()
> - case _: UriRef =3D> existingWebId()
> - }}
> -
> + case _: BNode =3D> createWebId()
> + case _: UriRef =3D> existingWebId()
> + }}
> +
> +
> }
> }
> }
> @@ -244,7 +252,7 @@ class profile_panel extends PageRenderle
> val sbuf =3D new StringBuffer(bstr.size + (bstr.size/2)+10)
> var cnt =3D 0
> for (c <- bstr.toCharArray) {
> - if ((cnt % 2) =3D=3D 0) { sbuf.append(' ') }
> + if ((cnt % 2) =3D=3D 0) sbuf.append(' ')
> sbuf.append(c)
> cnt +=3D 1
> }
>
> Modified:
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.acc=
ountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform=
/accountcontrolpanel/ontologies/controlpanel.rdf
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.acc=
ountcontrolpanel/platform.accountcontrolpanel.ontologies/src/main/resources=
/org/apache/clerezza/platform/accountcontrolpanel/ontologies/controlpanel.r=
df?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Ddiff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.acc=
ountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform=
/accountcontrolpanel/ontologies/controlpanel.rdf
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.acc=
ountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform=
/accountcontrolpanel/ontologies/controlpanel.rdf
> Mon Mar 14 09:04:51 2011
> @@ -35,6 +35,15 @@
> http://clerezza.org/2009/03/controlpanel#" />
>
>
> +
> +
> + profile viewer page
> + A web page for viewing profiles =
of
> agents (individuals or groups) information on the
> + web. Should allow a logged in user to add them as contact=
s
> +
> + http://clerezza.org/2009/03/controlpanel#" />
> +
> +
>
>
>
>
> Modified:
> incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.sec=
urity.foafssl/core/pom.xml?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Dd=
iff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xm=
l
> (original)
> +++ incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xm=
l
> Mon Mar 14 09:04:51 2011
> @@ -100,7 +100,7 @@
>
> OSGI-INF/serviceComponents.xml
>
> !org.apache.clerezza.foafssl.ontologies,
>
> org.apache.clerezza.foafssl.*
> -
> ${groupId}.${artifactId}
> +
> ${project.groupId}.${project.artifactId}
>
>
>
>
> Modified:
> incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/s=
cala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.sec=
urity.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/X509Trust=
ManagerWrapperService.scala?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3D=
diff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/s=
cala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/s=
cala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala
> Mon Mar 14 09:04:51 2011
> @@ -30,7 +30,6 @@ import java.security.interfaces.RSAPubli
> import java.util.Date
> import javax.net.ssl.X509TrustManager;
> import org.apache.clerezza.foafssl.Utilities
> -import org.apache.clerezza.platform.users.WebDescriptionProvider
> import org.apache.clerezza.foafssl.ontologies.CERT
> import org.apache.clerezza.foafssl.ontologies.RSA
> import org.apache.clerezza.platform.Constants
> @@ -56,7 +55,8 @@ import org.apache.clerezza.rdf.ontologie
> import org.apache.clerezza.rdf.scala.utils.Preamble._
> import org.jsslutils.sslcontext.X509TrustManagerWrapper
> import
> org.jsslutils.sslcontext.trustmanagers.TrustAllClientsWrappingTrustManage=
r
> -import org.slf4j.LoggerFactory;
> +import org.slf4j.LoggerFactory
> +import org.apache.clerezza.platform.users.{Cache, WebDescriptionProvider=
}
>
> class X509TrustManagerWrapperService() extends X509TrustManagerWrapper {
>
> @@ -117,11 +117,11 @@ class X509TrustManagerWrapperService() e
> private val systemGraphUri =3D Constants.SYSTEM_GRAPH_URI;
>
> private def verify(uriRef: UriRef, publicKey: PublicKey): Unit =3D=
{
> - var webDescription =3D
> descriptionProvider.getWebDescription(uriRef, false)
> + var webDescription =3D
> descriptionProvider.getWebDescription(uriRef, Cache.CacheOnly)
> if (
> !verify(uriRef, publicKey, webDescription.getGraph=
)
> ) {
> - webDescription =3D
> descriptionProvider.getWebDescription(uriRef, true)
> + webDescription =3D
> descriptionProvider.getWebDescription(uriRef, Cache.ForceUpdate)
> if (
> !verify(uriRef, publicKey,
> webDescription.getGraph)
> ) throw new CertificateException
>
> Modified:
> incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.sec=
urity.foafssl/test/pom.xml?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Dd=
iff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xm=
l
> (original)
> +++ incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xm=
l
> Mon Mar 14 09:04:51 2011
> @@ -107,7 +107,7 @@
>
>
> OSGI-INF/serviceComponents.xml
>
> org.apache.clerezza.foafssl.testservlets
> -
> ${groupId}.${artifactId}
> +
> ${project.groupId}.${project.artifactId}
>
>
>
>
> Modified:
> incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typ=
erendering.scala/pom.xml?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Ddif=
f
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml
> (original)
> +++ incubator/clerezza/trunk/parent/platform.typerendering.scala/pom.xml
> Mon Mar 14 09:04:51 2011
> @@ -28,6 +28,10 @@
> org.scala-lang
> scala-library
>
> +
> + org.apache.clerezza
> + platform.users.core
> +
>
>
>
>
> Modified:
> incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/sca=
la/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typ=
erendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/=
scala/RenderedPage.scala?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Ddif=
f
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/sca=
la/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/sca=
la/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
> Mon Mar 14 09:04:51 2011
> @@ -5,7 +5,6 @@ import java.io.PrintWriter
> import java.net.URI
> import javax.ws.rs.core.HttpHeaders
> import javax.ws.rs.core.MediaType
> -import org.osgi.framework.BundleContext
> import scala.xml._
> import org.apache.clerezza.platform.typerendering._
> import
> org.apache.clerezza.platform.typerendering.Renderlet.RequestProperties
> @@ -14,14 +13,18 @@ import org.apache.clerezza.rdf.ontologie
> import org.apache.clerezza.rdf.core._
> 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.scala.utils.RichGraphNode
>
> /**
> * PageRenderlet.renderedPage returns an instance of this class,
> implementing
> - * the content method to produce an XML Elmenet suitable as response to
> the
> + * the content method to produce an XML Element suitable as response to
> the
> * request yielding to the arguments passed to the constructor.
> */
> abstract class RenderedPage(arguments: RenderedPage.Arguments) {
> +
> val RenderedPage.Arguments(
> res: GraphNode,
> context: GraphNode,
> @@ -41,32 +44,59 @@ abstract class RenderedPage(arguments: R
> val requestHeaders =3D requestProperties.getRequestHeaders
> val responseHeaders =3D requestProperties.getResponseHeaders
>
> - def render(resource : GraphNode) : Seq[Node] =3D {
> + def render(resource: GraphNode): Seq[Node] =3D {
> modeOption match {
> case Some(m) =3D> render(resource, m)
> case None =3D> render(resource, "naked")
> }
> }
>
> - def render(resource : GraphNode, mode : String) =3D {
> - def parseNodeSeq(string : String) =3D {
> -
> _root_.scala.xml.XML.loadString(""+string+"").child
> + def render(resource: GraphNode, mode: String) =3D {
> + def parseNodeSeq(string: String) =3D {
> + _root_.scala.xml.XML.loadString("" + string=
+
> "").child
> }
> val baos =3D new java.io.ByteArrayOutputStream
> renderer.render(resource, context, mode, baos)
> parseNodeSeq(new String(baos.toByteArray))
> }
>
> + def fetch(uri: UriRef) : GraphNode =3D {
> + val webSrvc =3D AccessController.doPrivileged(new
> PrivilegedAction[WebDescriptionProvider] {
> + def run: WebDescriptionProvider =3D {
> + val cntxt: BundleContext =3D
> requestProperties.bundleContext
> + var serviceReference: ServiceReference =
=3D
> cntxt.getServiceReference("org.apache.clerezza.platform.users.WebDescript=
ionProvider")
> + if (serviceReference !=3D null) {
> + return
> cntxt.getService(serviceReference).asInstanceOf[WebDescriptionProvider]
> + } else {
> + return null
> + }
> + }
> + })
> + //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 =3D webSrvc.fetchSemantics(uri,Cache.Fetch)
> + return new GraphNode(uri,grph)
> + }
> +
> + /**
> + * This is an object that allows one to use some nice shortcuts i=
n
> scala based subclasses
> + * - $variable will get the value of the sharedRenderingValues ha=
sh
> + * - $variable =3D value allows one to update the
> sharedRenderingValues hash
> + * - $? not sure there...
> + */
> object $ {
> def apply(key: String) =3D sharedRenderingValues.get(key)
> +
> def update(key: String, value: Object) =3D
> sharedRenderingValues.put(key, value)
> +
> def apply[T](implicit m: Manifest[T]): T =3D {
> val clazz =3D m.erasure.asInstanceOf[Class[T]]
> requestProperties.getRenderingService(clazz)
> }
> }
>
> - def ifx[T](con: =3D> Boolean)(f: =3D> T) : T =3D {
> + def ifx[T](con: =3D> Boolean)(f: =3D> T): T =3D {
> if (con) f else null.asInstanceOf[T]
> }
>
> @@ -82,17 +112,38 @@ abstract class RenderedPage(arguments: R
> )
> out.flush()
>
> - def content : AnyRef;
> + /**
> + * This is the main method/variable that needs to be implemented =
by
> subclasses
> + */
> + def content: AnyRef;
>
>
> }
> +
> object RenderedPage {
> - case class Arguments(res: GraphNode, context: GraphNode,
> - sharedRenderingValues:
> java.util.Map[String, Object],
> - renderer: CallbackRenderer ,
> - renderingSpecificationOption:
> Option[URI],
> - modeOption: Option[String],
> - mediaType: MediaType,
> - requestProperties:
> RequestProperties,
> - os: OutputStream);
> +
> + /**
> + * Class to encapsulate information sent to the rendering engine.
> + *
> + * @param res RDF resource to be rendered with the template.
> + * @param context RDF resource providing a rendering context.
> + * @param sharedRenderingValues a map that can be used for sharin=
g
> values
> + * across the different Renderlets involved in a rendering proces=
s
> + * @param callbackRenderer renderer for call backs.
> + * @param renderingSpecification the rendering specification
> + * @param modeOption the mode this Renderlet was invoked with, th=
is
> is mainly used
> + * so that the callbackRenderer can be claeed inheriting the mode=
.
> + * @param mediaType the media type this media produces (a part o=
f)
> + * @param requestProperties properties of the http request, may b=
e
> null
> + * @param os where the output will be written to.
> + */
> + case class Arguments(res: GraphNode,
> + context:
> GraphNode,
> +
> sharedRenderingValues: java.util.Map[String, Object],
> + renderer:
> CallbackRenderer,
> +
> renderingSpecificationOption: Option[URI],
> + modeOptio=
n:
> Option[String],
> + mediaType=
:
> MediaType,
> +
> requestProperties: RequestProperties,
> + os:
> OutputStream);
> }
> \ No newline at end of file
>
> Modified:
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerende=
ring.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderer=
.java
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typ=
erendering/platform.typerendering.core/src/main/java/org/apache/clerezza/pl=
atform/typerendering/Renderer.java?rev=3D1081290&r1=3D1081289&r2=3D1081290&=
view=3Ddiff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerende=
ring.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderer=
.java
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerende=
ring.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderer=
.java
> Mon Mar 14 09:04:51 2011
> @@ -64,7 +64,7 @@ public interface Renderer {
> * rendering specification.
> *
> * @param res RDF resource to be rendered with the template.
> - * @param context RDF resource providing a redering context.
> + * @param context RDF resource providing a rendering context.
> * @param uriInfo the uriInfo of the request, the renderlet may us=
e
> * @param httpHeaders the http-headers of the request
> * @param os where the output will be written to.
>
> Modified:
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerende=
ring.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderle=
t.java
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typ=
erendering/platform.typerendering.core/src/main/java/org/apache/clerezza/pl=
atform/typerendering/Renderlet.java?rev=3D1081290&r1=3D1081289&r2=3D1081290=
&view=3Ddiff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerende=
ring.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderle=
t.java
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerende=
ring.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderle=
t.java
> Mon Mar 14 09:04:51 2011
> @@ -49,7 +49,7 @@ public interface Renderlet {
> private UriInfo uriInfo;
> private MultivaluedMap responseHeaders;
> private HttpHeaders requestHeaders;
> - private final BundleContext bundleContext;
> + public final BundleContext bundleContext; //public
> only to test an idea
>
> public RequestProperties(UriInfo uriInfo,
> HttpHeaders requestHeaders,
> @@ -77,7 +77,7 @@ public interface Renderlet {
> * Rendering services
> *
> * @param type
> - * @return a intsance of the requested rendering services
> + * @return a instance of the requested rendering services
> */
> public T getRenderingService(final Class type) {
> return AccessController.doPrivileged(
> @@ -107,14 +107,14 @@ public interface Renderlet {
> * engine.
> *
> * @param res RDF resource to be rendered with the template.
> - * @param context RDF resource providing a redering context.
> + * @param context RDF resource providing a rendering context.
> * @param sharedRenderingValues a map that can be used for sharing
> values
> - * across the different renderlets involved in a rendering proces=
s
> + * across the different Renderlets involved in a rendering proces=
s
> * @param callbackRenderer renderer for call backs.
> * @param renderingSpecification the rendering specification
> * @param mediaType the media type this media produces (a part of=
)
> * @param mode the mode this Renderlet was invoked with, this is
> mainly used
> - * so that the callbackeRenderer can be claeed inheriting the mod=
e.
> + * so that the callbackRenderer can be claeed inheriting the mode=
.
> * @param requestProperties properties of the http request, may be
> null
> * @param os where the output will be written to.
> */
>
> Modified:
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/ap=
ache/clerezza/platform/users/WebDescriptionProvider.scala
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.use=
rs/core/src/main/scala/org/apache/clerezza/platform/users/WebDescriptionPro=
vider.scala?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Ddiff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/ap=
ache/clerezza/platform/users/WebDescriptionProvider.scala
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/ap=
ache/clerezza/platform/users/WebDescriptionProvider.scala
> Mon Mar 14 09:04:51 2011
> @@ -20,15 +20,16 @@
> package org.apache.clerezza.platform.users
>
> import org.apache.clerezza.platform.Constants
> -import org.apache.clerezza.rdf.core.TripleCollection
> -import org.apache.clerezza.rdf.core.UriRef
> import org.apache.clerezza.rdf.core.access.NoSuchEntityException
> import org.apache.clerezza.rdf.core.access.TcManager
> 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
>
> -
> +//todo: this class can be generalised to a generalised semweb caching
> service
> +//there's not really a reason to have it specialised for WebIDs.
> /**
> * delivers the description of a resource. This description is based on
> local
> * data as well as (cached) web-data
> @@ -59,7 +60,8 @@ class WebDescriptionProvider {
> Constants.CONFIG_GRAPH_URI)
>
> private var authoritativeLocalGraphUnion: TripleCollection =3D nul=
l
> -
> +
> + /** OSGI method, called on activation */
> protected def activate(context: ComponentContext) =3D {
> val baseTripleCollections =3D for (uri <-
> authoritativeLocalGraphs) yield {
> tcManager.getTriples(uri)
> @@ -71,31 +73,61 @@ class WebDescriptionProvider {
> authoritativeLocalGraphUnion =3D null
> }
>
> + //todo: this should probably return Some[GraphNode] as it is
> possible that there is no URI
> + //todo: or it should return an explanation of what went wrong, fo=
r
> user processing
> + //todo: why do we really need the merge with the system graph? Ho=
w
> doangerous is this?
> /**
> + * This graph merges remote information and local system
> information
> *
> * @param uri the URI to fetch
> * @param update true if the local cache is to be updated, false
> otherwise
> - * @return the cached Node as GraphNode with the
> authoritativeLocalGraphUnion and if available the cache of the remote gra=
ph
> as underlying graph
> + * @return the cached Node as GraphNode with the
> authoritativeLocalGraphUnion
> */
> - def getWebDescription(uri: UriRef, update: Boolean): GraphNode =
=3D {
> + def getWebDescription(uri: UriRef, update: Cache.Value): GraphNod=
e
> =3D {
> +
> + val grph =3D fetchSemantics(uri, update)
> + val tc =3D new UnionMGraph(authoritativeLocalGraphUnion,
> grph, authoritativeLocalGraphUnion)
> + new GraphNode(uri, tc)
>
> - val webIdGraphs =3D webIdGraphsService.getWebIdGraphs(uri=
)
> - if (webIdGraphs.isLocal) return new
> GraphNode(uri,webIdGraphs.localGraph)
> - if (update) {
> - webIdGraphs.updateLocalCache()
> + }
> +
> + /**
> + * 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
> + *
> + * todo: should this return an MGraph, or a TripleCollection, or
> something else?
> + *
> + * @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
> + *
> + */
> + def fetchSemantics(uri: UriRef, update: Cache.Value): MGraph =3D =
{
> + val webIdGraphs =3D
> webIdGraphsService.getWebIdGraphs(uri)
> + if (webIdGraphs.isLocal) return webIdGraphs.localGraph
> +
> + //the logic here is not quite right, as we don't look at
> time of previous fetch.
> + update match {
> + case Cache.Fetch =3D> if
> (webIdGraphs.localCache.size() =3D=3D 0) webIdGraphs.updateLocalCache()
> + case Cache.ForceUpdate =3D>
> webIdGraphs.updateLocalCache()
> + case Cache.CacheOnly =3D> {}
> }
> - val cacheGraphOption: Option[TripleCollection] =3D try {
> -
> Some(tcManager.getTriples(webIdGraphs.localCacheUri))
> + return try {
> + new
> SimpleMGraph(tcManager.getTriples(webIdGraphs.localCacheUri))
> } catch {
> - case e: NoSuchEntityException =3D> None
> - }
> - val tripleCollection =3D cacheGraphOption match {
> - case Some(g) =3D> new
> UnionMGraph(authoritativeLocalGraphUnion, g)
> - case None =3D> authoritativeLocalGraphUnion
> + case e: NoSuchEntityException =3D> new
> SimpleMGraph()
> }
> - new GraphNode(uri, tripleCollection)
> -
> +
> }
>
>
> }
> +
> +object Cache extends Enumeration {
> + /** fetch if not in cache, if version in cache is out of date, or
> return cache */
> + val Fetch =3D Value
> + /** fetch from source whatever is in cache */
> + val ForceUpdate =3D Value
> + /** only get cached version. If none exists return empty graph */
> + val CacheOnly =3D Value
> +}
>
> Modified:
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/ap=
ache/clerezza/platform/users/WebIdGraphsService.scala
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.use=
rs/core/src/main/scala/org/apache/clerezza/platform/users/WebIdGraphsServic=
e.scala?rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Ddiff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/ap=
ache/clerezza/platform/users/WebIdGraphsService.scala
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/ap=
ache/clerezza/platform/users/WebIdGraphsService.scala
> Mon Mar 14 09:04:51 2011
> @@ -38,6 +38,7 @@ import org.apache.clerezza.rdf.ontologie
> import org.apache.clerezza.rdf.utils.UnionMGraph
>
>
> +//todo: this class can be generalised to a generalised semweb caching
> service
> /**
> * For agents with a Web-Id various graphs are available, these graphs ar=
e
> * grouped by WebIdGraphs which this service provides.
> @@ -188,7 +189,14 @@ class WebIdGraphsService() {
> case _ =3D> 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 identifier=
s
> 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 typ=
es
> can be processed too
> + //todo: enable ftp and other formats (though content
> negotiation won't work there)
> def updateLocalCache() =3D {
> val url =3D new URL(representationGraphUriString)
> val connection =3D url.openConnection()
>
> Modified:
> incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache=
/clerezza/rdf/scala/utils/CollectedIter.scala
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.scala.ut=
ils/src/main/scala/org/apache/clerezza/rdf/scala/utils/CollectedIter.scala?=
rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Ddiff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache=
/clerezza/rdf/scala/utils/CollectedIter.scala
> (original)
> +++
> incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache=
/clerezza/rdf/scala/utils/CollectedIter.scala
> Mon Mar 14 09:04:51 2011
> @@ -38,6 +38,7 @@ import java.util.concurrent.locks.Lock
> class CollectedIter[T](iterCreator: () =3D> Iterator[T], readLock: Lock)
> extends immutable.Seq[T] {
>
> def this(jList : java.util.List[T], readLock: Lock) =3D this(() =
=3D>
> jList.iterator(), readLock)
> + def this() =3D this( ()=3D>
> java.util.Collections.emptyList[T].iterator(),null)
>
> var iter =3D iterCreator()
> var firstIter =3D true
>
> Modified:
> incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache=
/clerezza/rdf/scala/utils/RichGraphNode.scala
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.scala.ut=
ils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala?=
rev=3D1081290&r1=3D1081289&r2=3D1081290&view=3Ddiff
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> ---
> incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache=
/clerezza/rdf/scala/utils/RichGraphNode.scala
> (original)
> +++
> incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache=
/clerezza/rdf/scala/utils/RichGraphNode.scala
> Mon Mar 14 09:04:51 2011
> @@ -26,6 +26,14 @@ import _root_.scala.collection.JavaConve
> import _root_.scala.reflect.Manifest
>
> class RichGraphNode(node: GraphNode) extends GraphNode(node.getNode,
> node.getGraph) {
> +
> + /* because it is tedious to wrap nodes as happens in a lot of cod=
e.
> + *
> + * todo: does one really need to create the graph node? Is there =
a
> reason this is passed ike that,
> + * todo: or was that just a quick hack? If it is because we don't
> want to use any of the superclass implementations
> + * todo: then it would be worth creating an interface above
> GraphNode and implementing the interface instead...
> + */
> + def this(node: Resource, graph: GraphNode ) =3D this(new
> GraphNode(node,graph))
> /**
> * Operator syntax shortcut to get all objects as
> RichGraphNodes
> */
> @@ -56,17 +64,14 @@ class RichGraphNode(node: GraphNode) ext
> /**
> * returns the lexical form of literals, the unicode-string for
> UriRef for
> * BNodes the value returned by toString
> + * todo: not sure this is a good symbol as it is usually a binary
> symbol, and so if it is found at the end of a line the
> + * todo: the parsers expect the expression to go on the next line
> */
> - def * =3D {
> - val wrappedNode =3D node.getNode();
> - if (wrappedNode.isInstanceOf[Literal]) {
> - wrappedNode.asInstanceOf[Literal].getLexicalForm
> - } else {
> - if (wrappedNode.isInstanceOf[UriRef]) {
> -
> wrappedNode.asInstanceOf[UriRef].getUnicodeString
> - } else {
> - wrappedNode.toString
> - }
> + def * : String =3D {
> + node.getNode() match {
> + case lit: Literal =3D> lit.getLexicalForm
> + case uri: UriRef =3D> uri.getUnicodeString
> + case wrappedNode =3D> wrappedNode.toString
> }
> }
>
>
>
>
--bcaec5196ce531665f049e9f0f7d--