incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reto Bachmann-Gmuer <reto.bachm...@trialox.org>
Subject Re: svn commit: r1081290 - in /incubator/clerezza/trunk/parent: internal.archetype/src/main/resources/archetype-resources/ platform.accountcontrolpanel/platform.accountcontrolpanel.core/ platform.accountcontrolpanel/platform.accountcontrolpanel.core/
Date Wed, 16 Mar 2011 20:04:58 GMT
Henry,

Most of the changes you did are really very valuable and I realise splitting
things and associating them to issues might be an unnecessary big effort, so
I wouldn't say -1 if you could go through your changes and fix some things:

- remove experiments (the public bundlecontext variable)
- rename classes to conform with coding conventions (e.g.
org.apache.clerezza.
platform.accountcontrolpanel.profile_panel)
- ideally also transform TODO into issues

Cheers,
Reto


On Mon, Mar 14, 2011 at 10:04 AM, <bblfish@apache.org> wrote:

> Author: bblfish
> Date: Mon Mar 14 09:04:51 2011
> New Revision: 1081290
>
> URL: http://svn.apache.org/viewvc?rev=1081290&view=rev
> Log:
> Merge branch 'foaf'
>
> Added:
>
>  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/person_panel.scala
> Modified:
>
>  incubator/clerezza/trunk/parent/internal.archetype/src/main/resources/archetype-resources/pom.xml
>
>  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/ProfilePanel.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.accountcontrolpanel/platform.accountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/ontologies/controlpanel.rdf
>    incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml
>
>  incubator/clerezza/trunk/parent/platform.security.foafssl/core/src/main/scala/org/apache/clerezza/foafssl/ssl/X509TrustManagerWrapperService.scala
>    incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml
>    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.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderer.java
>
>  incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderlet.java
>
>  incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebDescriptionProvider.scala
>
>  incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebIdGraphsService.scala
>
>  incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/CollectedIter.scala
>
>  incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala
>
> Modified:
> incubator/clerezza/trunk/parent/internal.archetype/src/main/resources/archetype-resources/pom.xml
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/internal.archetype/src/main/resources/archetype-resources/pom.xml?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> ---
> incubator/clerezza/trunk/parent/internal.archetype/src/main/resources/archetype-resources/pom.xml
> (original)
> +++
> incubator/clerezza/trunk/parent/internal.archetype/src/main/resources/archetype-resources/pom.xml
> Mon Mar 14 09:04:51 2011
> @@ -6,11 +6,11 @@
>                <artifactId>main.parent</artifactId>
>                <version>0.5-incubating-SNAPSHOT</version>
>        </parent>
> -       <groupId>${groupId}</groupId>
> -       <artifactId>${artifactId}</artifactId>
> +       <groupId>${project.groupId}</groupId>
> +       <artifactId>${project.artifactId}</artifactId>
>        <packaging>bundle</packaging>
> -       <version>${version}</version>
> -       <name>Clerezza - ${artifactId}</name>
> +       <version>${project.version}</version>
> +       <name>Clerezza - ${project.artifactId}</name>
>        <description>A clerezza project</description>
>        <dependencies>
>                <dependency>
>
> 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=1081290&r1=1081289&r2=1081290&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
> Mon Mar 14 09:04:51 2011
> @@ -45,7 +45,7 @@
>                                        <instructions>
>
>  <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
>
>  <Export-Package>org.apache.clerezza.platform.accountcontrolpanel</Export-Package>
> -
> <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
> +
> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
>                                        </instructions>
>                                </configuration>
>                        </plugin>
>
> 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=1081290&r1=1081289&r2=1081290&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
> Mon Mar 14 09:04:51 2011
> @@ -33,13 +33,33 @@
>         </service>
>         <property name="javax.ws.rs" type="Boolean" value="true"/>
>         <property name="service.pid"
> value="org.apache.clerezza.platform.accountcontrolpanel.ProfilePanel"/>
> -        <reference name="userManager"
> interface="org.apache.clerezza.platform.usermanager.UserManager"
> cardinality="1..1" policy="static" bind="bindUserManager"
> unbind="unbindUserManager"/>
> -        <reference name="keygenSrvc"
> interface="org.apache.clerezza.ssl.keygen.KeygenService" cardinality="1..1"
> policy="static" bind="bindKeygenSrvc" unbind="unbindKeygenSrvc"/>
> -        <reference name="tcManager"
> interface="org.apache.clerezza.rdf.core.access.TcManager" cardinality="1..1"
> policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
> -        <reference name="renderletManager"
> interface="org.apache.clerezza.platform.typerendering.RenderletManager"
> cardinality="1..1" policy="static" bind="bindRenderletManager"
> unbind="unbindRenderletManager"/>
> -        <reference name="webIdGraphsService"
> interface="org.apache.clerezza.platform.users.WebIdGraphsService"
> 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="userManager"
> interface="org.apache.clerezza.platform.usermanager.UserManager"
> +                                  cardinality="1..1" policy="static"
> bind="bindUserManager" unbind="unbindUserManager"/>
> +        <reference name="keygenSrvc"
> interface="org.apache.clerezza.ssl.keygen.KeygenService"
> +                                  cardinality="1..1" policy="static"
> bind="bindKeygenSrvc" unbind="unbindKeygenSrvc"/>
> +        <reference name="renderletManager"
> interface="org.apache.clerezza.platform.typerendering.RenderletManager"
> +                                  cardinality="1..1" policy="static"
> bind="bindRenderletManager" unbind="unbindRenderletManager"/>
> +        <reference name="webIdGraphsService"
> interface="org.apache.clerezza.platform.users.WebIdGraphsService"
> +                                  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"/>
> +               <service servicefactory="false">
> +                       <provide interface="java.lang.Object"/>
> +               </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>
>     <scr:component enabled="true"
> name="org.apache.clerezza.platform.accountcontrolpanel.profile_panel">
>         <implementation
> class="org.apache.clerezza.platform.accountcontrolpanel.profile_panel"/>
>         <service servicefactory="false">
> @@ -56,4 +76,12 @@
>         <property name="service.pid"
> value="org.apache.clerezza.platform.accountcontrolpanel.settings_panel"/>
>         <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.platform.accountcontrolpanel.person_panel">
> +                <implementation
> class="org.apache.clerezza.platform.accountcontrolpanel.person_panel"/>
> +                <service servicefactory="false">
> +                        <provide
> interface="org.apache.clerezza.platform.typerendering.Renderlet"/>
> +                </service>
> +                <property name="service.pid"
> value="org.apache.clerezza.platform.accountcontrolpanel.person_panel"/>
> +                <reference name="renderletManager"
> interface="org.apache.clerezza.platform.typerendering.RenderletManager"
> cardinality="1..1" policy="static" bind="bindRenderletManager"
> unbind="unbindRenderletManager"/>
> +        </scr:component>
>  </components>
>
> Added:
> 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=1081290&view=auto
>
> ==============================================================================
> ---
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/PersonPanel.scala
> (added)
> +++
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/PersonPanel.scala
> Mon Mar 14 09:04:51 2011
> @@ -0,0 +1,157 @@
> +/*
> + * 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.platform.accountcontrolpanel
> +
> +import java.util.ArrayList
> +import java.util.Arrays
> +import java.util.Iterator
> +import org.apache.clerezza.platform.security.UserUtil
> +import org.apache.clerezza.ssl.keygen.CertSerialisation
> +import org.apache.clerezza.ssl.keygen.Certificate
> +import org.apache.clerezza.foafssl.ontologies.CERT
> +import org.apache.clerezza.foafssl.ontologies.RSA
> +import org.apache.clerezza.jaxrs.utils.RedirectUtil
> +import org.apache.clerezza.jaxrs.utils.TrailingSlash
> +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
> +import org.apache.clerezza.rdf.ontologies.FOAF
> +import org.apache.clerezza.rdf.ontologies.PLATFORM
> +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
> +import javax.ws.rs._
> +import javax.ws.rs.core.Context
> +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 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])
> +}
> +
> +/**
> + * Presents a panel where the user can create a webid and edit her
> profile.
> + *
> + * @author bblfish
> + */
> +@Path("/user/{id}/people")
> +class PersonPanel  {
> +
> +       import PersonPanel.logger
> +
> +       protected def activate(componentContext: ComponentContext): Unit =
> {
> +//             this.componentContext = componentContext.
> +       }
> +
> +       @GET
> +       def viewPerson(@Context uriInfo: UriInfo,
> +                                               @QueryParam("uri") uri:
> UriRef): GraphNode = {
> +               if (uri != null) {//show some error page
> +                       System.out.println("uri =="+uri.getUnicodeString)
> +               }
> +
> +               //val foaf = descriptionProvider.fetchSemantics(uri,
> Cache.Fetch)
> +               //so here the initial fetch could be used to decide if
> information is available at all,
> +               //ie, if the URL is accessible, if there are error
> conditions - try later for example...
> +
> +
> +               //Here we make a BNode the subject of the properties as a
> workaround to CLEREZZA-447
> +               val resultNode: GraphNode = new GraphNode(new
> UriRef(uriInfo.getRequestUri().toString),new SimpleMGraph())
> +               resultNode.addProperty(RDF.`type`, PLATFORM.HeadedPage)
> +               resultNode.addProperty(RDF.`type`,
> CONTROLPANEL.ProfileViewerPage)
> +               resultNode.addProperty(FOAF.primaryTopic,uri)
> +//             val result = new GraphNode(new
> UriRef(uri.getUnicodeString),resultNode.fetchSemantics)
> +          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 = {
> +               renderletManager = renderletmanager
> +       }
> +
> +       protected def unbindRenderletManager(renderletmanager:
> RenderletManager): Unit = {
> +               if (renderletManager == renderletmanager) {
> +                       renderletManager = null
> +               }
> +       }
> +
> +
> +       //
> +       //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=1081290&r1=1081289&r2=1081290&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
> Mon Mar 14 09:04:51 2011
> @@ -18,7 +18,7 @@
>  */
>  package org.apache.clerezza.platform.accountcontrolpanel
>
> -import java.util.ArrayList
> +import java.util.List
>  import java.util.Arrays
>  import java.util.Iterator
>  import org.apache.clerezza.platform.security.UserUtil
> @@ -33,7 +33,6 @@ import org.apache.clerezza.platform.conf
>  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.platform.users.WebIdGraphsService
>  import org.apache.clerezza.rdf.core._
>  import org.apache.clerezza.rdf.core.access.TcManager
>  import org.apache.clerezza.rdf.core.impl.SimpleMGraph
> @@ -62,31 +61,30 @@ import java.net.URL
>  import java.security.AccessController
>  import java.security.PrivilegedAction
>  import java.security.interfaces.RSAPublicKey
> -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.{WebDescriptionProvider,
> WebIdGraphsService}
> +
> +object ProfilePanel {
> +       private val logger: Logger =
> LoggerFactory.getLogger(classOf[ProfilePanel])
> +}
>
>  /**
>  * Presents a panel where the user can create a webid and edit her profile.
>  *
>  * @author reto
>  */
> -@Path("/user/{id}/profile")
> -object ProfilePanel {
> -       private  val logger: Logger =
> LoggerFactory.getLogger(classOf[ProfilePanel])
> -}
>
>  @Path("/user/{id}/profile")
> -class ProfilePanel extends FileServer {
> +class ProfilePanel {
> +
>        import ProfilePanel.logger
>
> -       protected def activate(componentContext: ComponentContext): Unit =
> {
> -               configure(componentContext.getBundleContext,
> "profile-staticweb")
> -       }
>
>        @GET
> -       def getPersonalProfilePage(@Context uriInfo: UriInfo,
> @PathParam(value = "id") userName: String): GraphNode = {
> +       def getPersonalProfilePage(@Context uriInfo: UriInfo,
> +
>     @PathParam(value = "id") userName: String): GraphNode = {
>                TrailingSlash.enforceNotPresent(uriInfo)
>                var resultNode: GraphNode = getPersonalProfile(userName, new
> UriRef(uriInfo.getAbsolutePath.toString))
>                resultNode.addProperty(RDF.`type`, PLATFORM.HeadedPage)
> @@ -94,7 +92,8 @@ class ProfilePanel extends FileServer {
>                return resultNode
>        }
>
> -       private def getPersonalProfile(userName: String, profile: UriRef):
> GraphNode = {
> +       private def getPersonalProfile(userName: String,
> +
>              profile: UriRef): GraphNode = {
>                return AccessController.doPrivileged(new
> PrivilegedAction[GraphNode] {
>                        def run: GraphNode = {
>                                var userInSystemGraph: GraphNode =
> userManager.getUserInSystemGraph(userName)
> @@ -143,7 +142,10 @@ class ProfilePanel extends FileServer {
>        }
>
>        @POST
> -       @Path("set-existing-webid") def setExistingWebId(@Context uriInfo:
> UriInfo, @FormParam("webid") webId: UriRef, @PathParam(value = "id")
> userName: String): Response = {
> +       @Path("set-existing-webid")
> +       def setExistingWebId(@Context uriInfo: UriInfo,
> +
> @FormParam("webid") webId: UriRef,
> +
> @PathParam(value = "id") userName: String): Response = {
>                return AccessController.doPrivileged(new
> PrivilegedAction[Response] {
>                        def run: Response = {
>                                var userInSystemGraph: GraphNode =
> userManager.getUserInSystemGraph(userName)
> @@ -154,7 +156,9 @@ class ProfilePanel extends FileServer {
>        }
>
>        @POST
> -       @Path("create-new-web-id") def createNewWebId(@Context uriInfo:
> UriInfo, @PathParam(value = "id") userName: String): Response = {
> +       @Path("create-new-web-id")
> +       def createNewWebId(@Context uriInfo: UriInfo,
> +                                                        @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)
> @@ -169,24 +173,38 @@ class ProfilePanel extends FileServer {
>        }
>
>        @POST
> -       @Path("addContact") def addContact(@Context uriInfo: UriInfo,
> @FormParam("webId") contactWebID: UriRef): Response = {
> -               if (contactWebID != null) {
> +       @Path("addContact")
> +       def addContact(@Context uriInfo: UriInfo,
> +                                               @FormParam("webId")
> newContacts: java.util.List[UriRef]): Response = {
> +               import collection.JavaConversions._
> +               if (newContacts.size >0) {
>                        val userName: String = UserUtil.getCurrentUserName
>                        var me: GraphNode =
> AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
>                                def run: GraphNode = {
>                                        return
> userManager.getUserGraphNode(userName)
>                                }
>                        })
> -                       val webIdGraphs: WebIdGraphsService#WebIdGraphs =
> webIdGraphsService.getWebIdGraphs(me.getNode.asInstanceOf[UriRef])
> -                       var meGrph: GraphNode = new GraphNode(me.getNode,
> webIdGraphs.localGraph)
> -                       webIdGraphsService.getWebIdGraphs(contactWebID)
> -                       meGrph.addProperty(FOAF.knows, contactWebID)
> +                       for (contactWebID <- newContacts) {
> +                               val webIdGraphs:
> WebIdGraphsService#WebIdGraphs =
> webIdGraphsService.getWebIdGraphs(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
>                }
>                return RedirectUtil.createSeeOtherResponse("../profile",
> uriInfo)
>        }
>
> +
>        @POST
> -       @Path("keygen") def createCert(@FormParam("webId") webId: UriRef,
> @FormParam("cn") commonName: String, @FormParam("spkac") spkac: String,
> @FormParam("crmf") crmf: String, @FormParam("hours") hours: String,
> @FormParam("days") days: String, @FormParam("csr") csr: String,
> @FormParam("comment") comment: String): Response = {
> +       @Path("keygen")
> +       def createCert(@FormParam("webId") webId: UriRef,
> +                                               @FormParam("cn")
> commonName: String,
> +                                               @FormParam("spkac") spkac:
> String,
> +                                               @FormParam("crmf") crmf:
> String,
> +                                               @FormParam("hours") hours:
> String,
> +                                               @FormParam("days") days:
> String,
> +                                               @FormParam("csr") csr:
> String,
> +                                               @FormParam("comment")
> comment: String): Response = {
>                logger.info("in keygen code. webId={}", webId)
>                logger.info("cn={}", commonName)
>                logger.info("hours={}", hours)
> @@ -255,9 +273,10 @@ class ProfilePanel extends FileServer {
>                val webIdGraphs: WebIdGraphsService#WebIdGraphs =
> webIdGraphsService.getWebIdGraphs(webId)
>                val agent: GraphNode = new GraphNode(webId,
> webIdGraphs.localGraph)
>                var subjects: Iterator[GraphNode] =
> agent.getSubjectNodes(CERT.identity)
> -          import scala.util.control.Breaks._
> +               import scala.util.control.Breaks._
>                breakable {
> -                       import scala.collection.JavaConversions._    //to
> for loop through iterators
> +                       import scala.collection.JavaConversions._
> +                       //to for loop through iterators
>                        for (nl <- subjects) {
>                                var modulusIt: Iterator[Resource] =
> nl.getObjects(RSA.modulus)
>                                if (!modulusIt.hasNext) break
> @@ -316,16 +335,6 @@ class ProfilePanel extends FileServer {
>                }
>        }
>
> -       protected def bindTcManager(tcmanager: TcManager): Unit = {
> -               tcManager = tcmanager
> -       }
> -
> -       protected def unbindTcManager(tcmanager: TcManager): Unit = {
> -               if (tcManager == tcmanager) {
> -                       tcManager = null
> -               }
> -       }
> -
>        protected def bindRenderletManager(renderletmanager:
> RenderletManager): Unit = {
>                renderletManager = renderletmanager
>        }
> @@ -356,10 +365,33 @@ class ProfilePanel extends FileServer {
>                }
>        }
>
> +       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
> +       }
> +
> +
>        private var userManager: UserManager = null
> -       private var keygenSrvc: KeygenService = null
> -       private var tcManager: TcManager = null
> -       private var renderletManager: RenderletManager = 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
> +
> +       //todo: are these this needed? It's not used it seems
> +       private var renderletManager: RenderletManager = null
> +
> +       private var componentContext: ComponentContext = null
> +
>  }
> \ No newline at end of file
>
> Added:
> 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=1081290&view=auto
>
> ==============================================================================
> ---
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/person_panel.scala
> (added)
> +++
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/person_panel.scala
> Mon Mar 14 09:04:51 2011
> @@ -0,0 +1,215 @@
> +/*
> + * 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.platform.accountcontrolpanel
> +
> +import org.apache.clerezza.rdf.core._
> +import org.apache.clerezza.rdf.scala.utils._
> +import org.apache.clerezza.rdf.scala.utils.Preamble._
> +import org.apache.clerezza.platform.typerendering.scala._
> +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}
> +
> +object person_panel {
> +       final val emptyText = new Text("")
> +
> +       def ifE[T](arg:T)(template: T=>Node ):NodeSeq = {
> +               def isEmpty(arg: Any): Boolean = {
> +                       arg match {
> +                               case prod: Product =>
> prod.productIterator.forall(isEmpty(_))
> +                               case str: String => (str.size == 0)
> +                               case it: CollectedIter[RichGraphNode] =>
> (it.size == 0)
> +                               case node: RichGraphNode => (null == node)
> +                               case other: AnyRef => (null == other)
> +                               case _ => false //literals can't be empty
> +                       }
> +               }
> +               if (isEmpty(arg)) return emptyText else template(arg)
> +       }
> +
> +       def firstOf(node: RichGraphNode, uris:
> UriRef*):CollectedIter[RichGraphNode] = {
> +               for (uri <- uris) {
> +                       val res : CollectedIter[RichGraphNode] = node/uri
> +                       if (res.size>0) return res
> +               }
> +               return new CollectedIter[RichGraphNode]()
> +       }
> +
> +       /**
> +        * Show a person: a picture, a link to their local profile and
> their name
> +        * Different default icons should be shown if the agent is a
> person, company, group, robot...
> +        *
> +        * assumes the p is WebID node (can change later)
> +        */
> +       def personInABox(p: RichGraphNode): NodeSeq = {
> +               val pix = firstOf(p, FOAF.depiction, FOAF.logo).getNode
> match {
> +                       case uri: UriRef => uri.getUnicodeString
> +                       case _ => "
> http://upload.wikimedia.org/wikipedia/commons/0/0a/Gnome-stock_person.svg"
> +               }
> +
> +               val pixml= { <a href={"people?uri="+encode(p*)}><img
> src={pix} width="70px" /></a> }
> +               return pixml ++ new Text(getName(p))
> +       }
> +
> +       def encode(url: String): String =  URLEncoder.encode(url,"UTF8")
> +
> +       /**
> +        * get a useable name from the properties available including nick
> +        */
> +       def getName(p: RichGraphNode): String =  {
> +                val name = p/FOAF.name*;
> +                if ("" != name ) { return name }
> +                val firstNm: String = p/FOAF.firstName*;
> +                val fmlyNm :String = firstOf(p,
> FOAF.family_name,FOAF.familyName)*;
> +                if ("" != firstNm || "" != fmlyNm) { return firstNm+"
> "+fmlyNm }
> +                return p*
> +
> +       }
> +
> +       def personHtml(p: RichGraphNode): NodeSeq = {
> +               {<tr><td colspan="2">Person</td></tr>}++
> +               ifE(p!){case f:UriRef=>(<tr><td><input type="checkbox"
> name="webId" value={p*}/>Add as contact</td><td><a
> href={p*}>{p*}</a></td></tr>);
> +                                 case _ => emptyText;}++
> +
> ifE(p/FOAF.name){f=>(<tr><td>Name:</td><td>{f*}</td></tr>)}++
> +                ifE(p/FOAF.firstName){f=>(<tr><td>First
> Name:</td><td>{f}</td></tr>)} ++
> +
>  ifE(firstOf(p,FOAF.family_name,FOAF.familyName)){f=>(<tr><td>Family
> Name:</td><td>{f*}</td></tr>)} ++
> +                ifE(p/FOAF.mbox){f =>(<tr><td>Mbox:</td><td><ul>{for
> (m<-f)yield {<li><a href={m*}>{m*}</a></li>}}</ul></td></tr>)}++
> +                ifE(p/FOAF.homepage){f
> =>(<tr><td>Homepage:</td><td><ul>{for (x<-f)yield <li><a
> href={x*}>{x*}</a></li>}</ul></td></tr>)}++
> +                ifE(p/FOAF.currentProject){f =>(<tr><td>Current
> Project(s):</td><td><ul>{for (x<-f) yield
> <li>{linkNlabel(x)}</li>}</ul></td></tr>)}++
> +                ifE(p/FOAF.depiction){f=>(<tr><td>Depictions:</td><td><img
> src={f*} /></td></tr>)}++
> +                ifE(p/FOAF.logo){f=>(<tr><td>Logo:</td><td><img src={f*}
> /></td></tr>)}++
> +                ifE(p/FOAF.knows){k=>(<tr><td>claims to
> know</td><td><table>{for (fr<-k) yield displayAgent(fr)}</table></td></tr>)}
> +       }
> +
> +
> +       def groupHtml(grp: RichGraphNode): NodeSeq = {
> +
> ifE(grp/FOAF.name){f=>(<tr><td>Name:</td><td>{f}</td></tr>)}++
> +               ifE(grp/FOAF.logo*){f=>(<tr><td>Logo:</td><td><img src={f}
> /></td></tr>)}
> +       }
> +
> +
> +       def displayAgent(agent: RichGraphNode): NodeSeq = {
> +         val typ: Resource = (agent/RDF.`type`).!
> +         return typ match {
> +                       case FOAF.Person => personHtml(agent)
> +                       case FOAF.Group => groupHtml(agent)
> +                       case FOAF.Agent => agentHtml(agent)
> +                       case _ => emptyText
> +         }
> +       }
> +
> +       def linkNlabel(res: RichGraphNode): Node = {
> +               var label: String = res/RDFS.label! match {
> +                       case uri: UriRef => uri.toString
> +                       case _ => res*
> +               }
> +               return <a href={res*}>{label}</a>
> +       }
> +
> +       def agentHtml(agent: RichGraphNode) = {<table>{
> +                       ifE({agent/FOAF.name}){ case
> (f)=>(<tr><td>Name:</td><td>{f}</td></tr>)}++
> +
> ifE(agent/FOAF.logo*){f=>(<tr><td>Logo:</td><td><img src={f} /></td></tr>)}
> +       }</table> }
> +
> +}
> +
> +class person_panel extends PageRenderlet {
> +  val rdfType = CONTROLPANEL.ProfileViewerPage
> +  override def mode = "naked"
> +  import person_panel._
> +
> +
> +  override def renderedPage(arguments: RenderedPage.Arguments):
> RenderedPage = {
> +       new RenderedPage(arguments) {
> +
> +         override def content = {
> +               def cp(s: Any) =  new UriRef("
> http://clerezza.org/2009/03/controlpanel#" + s)
> +               def platform(s: Any) = new UriRef("
> http://clerezza.org/2009/08/platform#" + s)
> +
> resultDocModifier.addStyleSheet("profile/style/profile.css");
> +               resultDocModifier.setTitle("Profile Viewer");
> +               resultDocModifier.addNodes2Elem("tx-module", <h1>Account
> Control Panel</h1>);
> +               resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li
> class="tx-active"><a href="#">Profile Viewer</a></li>);
> +               resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a
> href="control-panel">Settings</a></li>);
> +          resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a
> href="profile">Profile</a></li>);
> +
> +          val it: CollectedIter[RichGraphNode] = res / FOAF.primaryTopic
> +          val primeTpc: RichGraphNode = it.apply(0)
> +               val agent : RichGraphNode= primeTpc! match {
> +                       case uri : UriRef => fetch(uri)
> +                       case _ => res
> +               }
> +
> +               def relations() = {
> +                       <table>{for (friend <- agent/FOAF.knows) {
> +                               <tr><td>{friend*}</td></tr>
> +                               }
> +                               <tr><td><form id="addContact" method="post"
> action="profile/people">
> +                               <input type="text" name="webId" size="80"/>
> +                               <input type="submit" value="add contact" />
> +                       </form></td></tr>
> +                       }</table>
> +               }
> +
> +
> +               def allAgentsHtml(tc: TripleCollection): Node = {<span>
> +                       <th><tr colspan="2">All agents found</tr></th>
> +                       { import collection.JavaConversions._
> +                         val base = new
> URL(primeTpc.getNode.asInstanceOf[UriRef].getUnicodeString());
> +                         val lclPrson = for (tr: Triple <- tc.filter(null,
> RDF.`type`, FOAF.Person);
> +                              subjUrl = try { new
> URL(tr.getSubject.asInstanceOf[UriRef].getUnicodeString) } catch  { case _
> => null }
> +                                        if (subjUrl != null &&
> base.sameFile(subjUrl))
> +                         ) yield tr.getSubject
> +                         for (p <- lclPrson) yield
> +                                  <tbody>{personHtml(new
> GraphNode(p,tc))}</tbody>
> +                       }
> +               </span>}
> +
> +               <div id="tx-content">
> +                        <h2>Profile Viewer</h2>
> +                       <form action="profile/addContact" method="POST">
> +                       <table>
> +                       { val typ: Resource = (agent/RDF.`type`).!
> +                    typ match {
> +                            case FOAF.Person => personHtml(agent)
> +                                 case FOAF.Group => groupHtml(agent)
> +                                 case FOAF.Agent => agentHtml(agent)
> +                                 case _ => allAgentsHtml(agent.getGraph)
> +                         }
> +                       }
> +                       </table>
> +                               <input type="submit" value="add contacts"/>
> +                  </form>
> +                       <code><pre>{
> +                         val s
> =org.apache.clerezza.rdf.core.serializedform.Serializer.getInstance();
> +                         import java.io._
> +                         val bout = new ByteArrayOutputStream()
> +                         s.serialize(bout,agent.getGraph(),"text/rdf+n3");
> +                         bout.toString("UTF-8")
> +                       }</pre></code>
> +               </div>
> +    }
> +
> +       }
> +  }
> +}
> +
> +
>
> 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=1081290&r1=1081289&r2=1081290&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
> Mon Mar 14 09:04:51 2011
> @@ -27,6 +27,7 @@ import java.text._
>  import org.apache.clerezza.rdf.core.UriRef
>  import
> org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
>  import org.apache.clerezza.rdf.ontologies.{RDFS, DC, FOAF}
> +import org.apache.clerezza.rdf.utils.GraphNode
>
>  class profile_panel extends PageRenderlet {
>   val rdfType = CONTROLPANEL.ProfilePage
> @@ -123,16 +124,22 @@ class profile_panel extends PageRenderle
>         </form>
>
>                  <h3>Contacts</h3>
> -
> -                 <table>{for (friend <- agent/FOAF.knows) {
> -                         <tr><td>{friend*}</td></tr>
> -                    }
> -                         <tr><td><form id="addContact" method="post"
> action="profile/addContact">
> -                         <input type="text" name="webId" size="80"/>
> -                         <input type="submit" value="add contact" />
> -                 </form></td></tr>
> -            }</table>
> -
> +                 <form id="addContact" method="get" action="people">
> +                 <table>{ var i =0
> +                         val friends = for (friend <- agent/FOAF.knows)
> yield {
> +                         import person_panel._
> +                         val node = friend.getNode() match {
> +                                 case uri: UriRef =>
> personInABox(fetch(uri))
> +                                 case _ => emptyText //one could show info
> with bnodes too...
> +                         }
> +                         <td>{node}</td>
> +                   }
> +                        for (row <- friends.grouped(5)) yield
> <tr>{row}</tr>
> +                 }<tr> <td><input type="submit" value="add contact"
> /></td>
> +                         <td><input type="text" name="uri" size="80"/><!--
> human input forms cannot require precise WebIds-->
> +                 </td></tr>
> +            </table>
> +                 </form>
>
>                  <h3>Key and Certificate Creation</h3>
>
> @@ -220,12 +227,13 @@ class profile_panel extends PageRenderle
>             profile.</p>
>                }
>
> -               <div id="tx-content">
> +         <div id="tx-content">
>                  <h2>Personal Profile</h2>{agent ! match {
> -                         case _: BNode => createWebId()
> -                         case _: UriRef => existingWebId()
> -                       }}
> -               </div>
> +                               case _: BNode => createWebId()
> +                               case _: UriRef => existingWebId()
> +                        }}
> +         </div>
> +
>          }
>        }
>   }
> @@ -244,7 +252,7 @@ class profile_panel extends PageRenderle
>          val sbuf = new StringBuffer(bstr.size + (bstr.size/2)+10)
>          var cnt = 0
>          for (c <- bstr.toCharArray) {
> -               if ((cnt % 2) == 0) { sbuf.append(' ') }
> +               if ((cnt % 2) == 0) sbuf.append(' ')
>                sbuf.append(c)
>                cnt += 1
>          }
>
> Modified:
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/ontologies/controlpanel.rdf
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/ontologies/controlpanel.rdf?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> ---
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/ontologies/controlpanel.rdf
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.accountcontrolpanel/platform.accountcontrolpanel.ontologies/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/ontologies/controlpanel.rdf
> Mon Mar 14 09:04:51 2011
> @@ -35,6 +35,15 @@
>        <rdfs:isDefinedBy rdf:resource="
> http://clerezza.org/2009/03/controlpanel#" />
>  </rdfs:Class>
>
> +<rdfs:Class rdf:about="#ProfileViewerPage">
> +       <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
> +       <rdfs:label xml:lang="en">profile viewer page</rdfs:label>
> +       <skos:definition xml:lang="en">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 contacts
> +       </skos:definition>
> +       <rdfs:isDefinedBy rdf:resource="
> http://clerezza.org/2009/03/controlpanel#" />
> +</rdfs:Class>
> +
>  <!-- Properties -->
>
>  <rdf:Property rdf:about="#userBundlePermission">
>
> 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=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> --- incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml
> (original)
> +++ incubator/clerezza/trunk/parent/platform.security.foafssl/core/pom.xml
> Mon Mar 14 09:04:51 2011
> @@ -100,7 +100,7 @@
>
>  <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
>
>  <Export-Package>!org.apache.clerezza.foafssl.ontologies,
>
>  org.apache.clerezza.foafssl.*</Export-Package>
> -
> <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
> +
> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
>                                        </instructions>
>                                </configuration>
>                        </plugin>
>
> 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=1081290&r1=1081289&r2=1081290&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
> 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.TrustAllClientsWrappingTrustManager
> -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 = Constants.SYSTEM_GRAPH_URI;
>
>        private def verify(uriRef: UriRef, publicKey: PublicKey): Unit = {
> -               var webDescription =
> descriptionProvider.getWebDescription(uriRef, false)
> +               var webDescription =
> descriptionProvider.getWebDescription(uriRef, Cache.CacheOnly)
>                if (
>                        !verify(uriRef, publicKey, webDescription.getGraph)
>                ) {
> -                       webDescription =
> descriptionProvider.getWebDescription(uriRef, true)
> +                       webDescription =
> 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.security.foafssl/test/pom.xml?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> --- incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml
> (original)
> +++ incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml
> Mon Mar 14 09:04:51 2011
> @@ -107,7 +107,7 @@
>                                        <instructions>
>
>  <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
>
>  <Export-Package>org.apache.clerezza.foafssl.testservlets</Export-Package>
> -
> <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
> +
> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
>                                        </instructions>
>                                </configuration>
>                        </plugin>
>
> 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=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> --- 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 @@
>                        <groupId>org.scala-lang</groupId>
>                        <artifactId>scala-library</artifactId>
>                </dependency>
> +               <dependency>
> +                       <groupId>org.apache.clerezza</groupId>
> +                       <artifactId>platform.users.core</artifactId>
> +               </dependency>
>        </dependencies>
>
>        <build>
>
> 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=1081290&r1=1081289&r2=1081290&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
> 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 = requestProperties.getRequestHeaders
>        val responseHeaders = requestProperties.getResponseHeaders
>
> -       def render(resource : GraphNode) : Seq[Node] = {
> +       def render(resource: GraphNode): Seq[Node] = {
>                modeOption match {
>                        case Some(m) => render(resource, m)
>                        case None => render(resource, "naked")
>                }
>        }
>
> -       def render(resource : GraphNode, mode : String) = {
> -               def parseNodeSeq(string : String)  = {
> -
> _root_.scala.xml.XML.loadString("<elem>"+string+"</elem>").child
> +       def render(resource: GraphNode, mode: String) = {
> +               def parseNodeSeq(string: String) = {
> +                       _root_.scala.xml.XML.loadString("<elem>" + string +
> "</elem>").child
>                }
>                val baos = new java.io.ByteArrayOutputStream
>                renderer.render(resource, context, mode, baos)
>                parseNodeSeq(new String(baos.toByteArray))
>        }
>
> +       def fetch(uri: UriRef) : GraphNode = {
> +               val webSrvc = AccessController.doPrivileged(new
> PrivilegedAction[WebDescriptionProvider] {
> +                       def run: WebDescriptionProvider = {
> +                               val cntxt: BundleContext =
> requestProperties.bundleContext
> +                               var serviceReference: ServiceReference =
> cntxt.getServiceReference("org.apache.clerezza.platform.users.WebDescriptionProvider")
> +                               if (serviceReference != 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 = webSrvc.fetchSemantics(uri,Cache.Fetch)
> +               return new GraphNode(uri,grph)
> +       }
> +
> +       /**
> +        * This is an object that allows one to use some nice shortcuts in
> scala based subclasses
> +        * - $variable will get the value of the sharedRenderingValues hash
> +        * - $variable = value allows one to update the
> sharedRenderingValues hash
> +        * - $? not sure there...
> +        */
>        object $ {
>                def apply(key: String) = sharedRenderingValues.get(key)
> +
>                def update(key: String, value: Object) =
> sharedRenderingValues.put(key, value)
> +
>                def apply[T](implicit m: Manifest[T]): T = {
>                        val clazz = m.erasure.asInstanceOf[Class[T]]
>                        requestProperties.getRenderingService(clazz)
>                }
>        }
>
> -       def ifx[T](con:  => Boolean)(f: => T) :  T = {
> +       def ifx[T](con: => Boolean)(f: => T): T = {
>                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 sharing
> values
> +        * across the different Renderlets involved in a rendering process
> +        * @param callbackRenderer  renderer for call backs.
> +        * @param renderingSpecification  the rendering specification
> +        * @param modeOption the mode this Renderlet was invoked with, this
> is mainly used
> +        * so that the callbackRenderer can be claeed inheriting the mode.
> +        * @param mediaType  the media type this media produces (a part of)
> +        * @param requestProperties properties of the http request, may be
> 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],
> +                                                               modeOption:
> Option[String],
> +                                                               mediaType:
> MediaType,
> +
> requestProperties: RequestProperties,
> +                                                               os:
> OutputStream);
>  }
> \ No newline at end of file
>
> Modified:
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderer.java
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderer.java?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> ---
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderer.java
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.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 use
>         * @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.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderlet.java
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderlet.java?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> ---
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderlet.java
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.typerendering/platform.typerendering.core/src/main/java/org/apache/clerezza/platform/typerendering/Renderlet.java
> Mon Mar 14 09:04:51 2011
> @@ -49,7 +49,7 @@ public interface Renderlet {
>                private UriInfo uriInfo;
>                private MultivaluedMap<String, Object> 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> T getRenderingService(final Class<T> 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 process
> +        * across the different Renderlets involved in a rendering process
>         * @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 mode.
> +        * 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/apache/clerezza/platform/users/WebDescriptionProvider.scala
> URL:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebDescriptionProvider.scala?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> ---
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/clerezza/platform/users/WebDescriptionProvider.scala
> (original)
> +++
> incubator/clerezza/trunk/parent/platform.users/core/src/main/scala/org/apache/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 = null
> -
> +
> +       /** OSGI method, called on activation */
>        protected def activate(context: ComponentContext) = {
>                val baseTripleCollections = for (uri <-
> authoritativeLocalGraphs) yield {
>                        tcManager.getTriples(uri)
> @@ -71,31 +73,61 @@ class WebDescriptionProvider {
>                authoritativeLocalGraphUnion = 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, for
> user processing
> +       //todo: why do we really need the merge with the system graph? How
> 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 graph
> as underlying graph
> +        * @return the cached Node as GraphNode with the
> authoritativeLocalGraphUnion
>         */
> -       def getWebDescription(uri: UriRef, update: Boolean): GraphNode = {
> +       def getWebDescription(uri: UriRef, update: Cache.Value): GraphNode
> = {
> +
> +               val grph = fetchSemantics(uri, update)
> +               val tc = new UnionMGraph(authoritativeLocalGraphUnion,
> grph, authoritativeLocalGraphUnion)
> +               new GraphNode(uri, tc)
>
> -               val webIdGraphs = 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 = {
> +                       val webIdGraphs =
> 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 => if
> (webIdGraphs.localCache.size() == 0) webIdGraphs.updateLocalCache()
> +                       case Cache.ForceUpdate =>
> webIdGraphs.updateLocalCache()
> +                       case Cache.CacheOnly => {}
>                }
> -               val cacheGraphOption: Option[TripleCollection] = try {
> -
> Some(tcManager.getTriples(webIdGraphs.localCacheUri))
> +                return try {
> +                        new
> SimpleMGraph(tcManager.getTriples(webIdGraphs.localCacheUri))
>                } catch {
> -                       case e: NoSuchEntityException =>  None
> -               }
> -               val tripleCollection = cacheGraphOption match {
> -                       case Some(g) => new
> UnionMGraph(authoritativeLocalGraphUnion, g)
> -                       case None => authoritativeLocalGraphUnion
> +                       case e: NoSuchEntityException =>  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 = 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/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=1081290&r1=1081289&r2=1081290&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
> 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 are
>  * grouped by <code>WebIdGraphs</code> which this service provides.
> @@ -188,7 +189,14 @@ class WebIdGraphsService() {
>                                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(representationGraphUriString)
>                        val connection = 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.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/CollectedIter.scala?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> ---
> 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: () => Iterator[T], readLock: Lock)
> extends immutable.Seq[T] {
>
>        def this(jList : java.util.List[T], readLock: Lock) = this(() =>
> jList.iterator(), readLock)
> +       def this() = this( ()=>
> java.util.Collections.emptyList[T].iterator(),null)
>
>        var iter = iterCreator()
>        var firstIter = 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.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala?rev=1081290&r1=1081289&r2=1081290&view=diff
>
> ==============================================================================
> ---
> 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 code.
> +        *
> +        * 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 ) = this(new
> GraphNode(node,graph))
>     /**
>      * Operator syntax shortcut to get all objects as
> <code>RichGraphNode</code>s
>      */
> @@ -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 * = {
> -               val wrappedNode = node.getNode();
> -               if (wrappedNode.isInstanceOf[Literal]) {
> -                       wrappedNode.asInstanceOf[Literal].getLexicalForm
> -               } else {
> -                       if (wrappedNode.isInstanceOf[UriRef]) {
> -
> wrappedNode.asInstanceOf[UriRef].getUnicodeString
> -                       } else {
> -                               wrappedNode.toString
> -                       }
> +       def * : String = {
> +               node.getNode() match {
> +                       case lit: Literal => lit.getLexicalForm
> +                       case uri: UriRef => uri.getUnicodeString
> +                       case wrappedNode => wrappedNode.toString
>                }
>        }
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message