You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/03/22 13:11:45 UTC

[49/51] [partial] clerezza git commit: CLEREZZA-966: started hierarchical project structure, moved platform bundles to platform, only moved RDF artifacts ported to use commons to the rdf folder.

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
deleted file mode 100644
index d46f9f1..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * 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.List
-import java.util.Arrays
-import java.util.Collections
-import java.util.Iterator
-import ontologies.CONTROLPANEL
-import org.apache.clerezza.rdf.utils.graphnodeprovider.GraphNodeProvider
-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.config.PlatformConfig
-import org.apache.clerezza.platform.usermanager.UserManager
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.platform.Constants
-import access.TcManager
-import impl.{SimpleMGraph, TripleImpl}
-import org.apache.clerezza.rdf.utils.GraphNode
-import org.apache.clerezza.rdf.utils.UnionMGraph
-import org.osgi.service.component.ComponentContext
-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.security.AccessController
-import java.security.PrivilegedAction
-import java.security.interfaces.RSAPublicKey
-import org.apache.clerezza.ssl.keygen.KeygenService
-import java.net.URI
-import org.apache.clerezza.rdf.core.access.security.TcPermission
-import org.apache.clerezza.rdf.ontologies._
-import org.slf4j.scala.Logging
-import org.apache.clerezza.platform.users.{WebIdInfo, WebIdGraphsService}
-import org.apache.clerezza.rdf.scala.utils._
-
-/**
- * Presents a panel where the user can create a webid and edit her profile.
- *
- * @author reto
- */
-
-@Path("/user/{id}/profile")
-class ProfilePanel extends Logging {
-
-  import collection.JavaConversions._
-  import Preamble._
-
-  /**
-   * Returns a GraphNode describing a ProfilePage for the user identified by
-   * the specified UserName. A ProfilePage resourcve is retuned for any user
-   * disregarding if they have a WebId and if this is local. The renderlet
-   * may provide instrcutions on how a WebId is created for users that do
-   * not have a WebId and redirect them to their WebId provider if they have
-   * a remote WebId.
-   */
-  @GET
-  def getPersonalProfilePage(@Context uriInfo: UriInfo,
-                             @PathParam(value = "id") userName: String): GraphNode = {
-    TrailingSlash.enforceNotPresent(uriInfo)
-    //not checking as public profile must be public, more selective access control TBD
-    //AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
-    val resultNode= getPersonalProfile(userName, uriInfo)
-    return resultNode
-  }
-
-  private def getPersonalProfile(userName: String, info: UriInfo): GraphNode = {
-    lazy val suggestedPPDUri = getSuggestedPPDUri(userName)
-
-    val profile = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
-      def run: GraphNode = {
-        val userInSysGraph = userManager.getUserInSystemGraph(userName)
-        val userResource = userInSysGraph.getNode
-        val profile: GraphNode = userResource match {
-          case blank: BNode => {
-            //user does not have a webId yet
-            val g = new EzMGraph()
-            import g._
-            val profile = bnode
-            (profile -- CONTROLPANEL.isLocalProfile --> bool2lit(true)
-            -- CONTROLPANEL.suggestedPPDUri --> suggestedPPDUri
-            -- FOAF.primaryTopic --> (bnode -- PLATFORM.userName --> userName))
-            profile
-          }
-          case webid: UriRef => {
-            var webIDInfo = webIdGraphsService.getWebIdInfo(webid)
-            var res = new GraphNode(suggestedPPDUri, new UnionMGraph(new SimpleMGraph, webIDInfo.localPublicUserData))
-            (res -- CONTROLPANEL.isLocalProfile --> bool2lit(webIDInfo.isLocal)
-              -- FOAF.primaryTopic --> webid)
-            res
-          }
-        }
-        /*val friendInfo:Iterator[TripleCollection] = for (kn: Triple <- profile.getGraph.filter(userResource.asInstanceOf[NonLiteral], FOAF.knows, null)
-                              if kn.getObject.isInstanceOf[UriRef];
-                              friend = kn.getObject.asInstanceOf[UriRef]
-                              if (friend != suggestedPPDUri)
-        ) yield {
-          try {
-            val friendGraph = tcManager.getGraph(FoafBrowser.removeHash(friend))
-            new RichGraphNode(friend, friendGraph).getNodeContext
-          } catch {
-            case e => {
-              logger.warn("cought exception trying to fetch graph - these graphs should already be in store " + friend, e)
-              new EzMGraph() {
-                friend -- SKOS.note --> ("problem with fetching this node: " + e)
-              }
-            }
-          }
-        }
-        //vera bad: mixing data from different sources
-        for (g <- friendInfo) profile.getGraph.addAll(g) */
-        profile
-      }
-    })
-
-
-    (profile a   PLATFORM.HeadedPage
-             a  CONTROLPANEL.ProfilePage)
-  }
-
-  /**
-   * @param userName
-   * @return the suggested Personal Profile Document URI
-   */
-  def getSuggestedPPDUri(userName: String): UriRef = {
-    return new UriRef(platformConfig.getDefaultBaseUri.getUnicodeString + "user/" + userName + "/profile")
-  }
-
-  @POST
-  @Path("set-existing-webid")
-  def setExistingWebId(@Context uriInfo: UriInfo,
-                       @FormParam("webid") webId: UriRef,
-                       @PathParam(value = "id") userName: String): Response = {
-    AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
-    return AccessController.doPrivileged(new PrivilegedAction[Response] {
-      def run: Response = {
-        var userInSystemGraph: GraphNode = userManager.getUserInSystemGraph(userName)
-        userInSystemGraph.replaceWith(webId)
-        return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
-      }
-    })
-  }
-
-  @POST
-  @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")
-    AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
-    return AccessController.doPrivileged(new PrivilegedAction[Response] {
-      def run: Response = {
-        userManager.assignPermissionsToUser(userName, java.util.Collections.singletonList(new TcPermission(
-            webId.getUnicodeString, TcPermission.READWRITE).toString))
-        tcManager.getTcAccessController.setRequiredReadPermissionStrings(
-          ppd, Collections.singleton(new TcPermission(
-              Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ).toString))
-        tcManager.createMGraph(ppd)
-        val webIDInfo = webIdGraphsService.getWebIdInfo(webId)
-        webIDInfo.localPublicUserData.addAll(
-          Arrays.asList(
-            new TripleImpl(ppd, RDF.`type`, FOAF.PersonalProfileDocument),
-            new TripleImpl(ppd, FOAF.primaryTopic, webId))
-        )
-        var userInSystemGraph: GraphNode = userManager.getUserInSystemGraph(userName)
-        userInSystemGraph.replaceWith(webId)
-        return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
-      }
-    })
-  }
-
-  /**
-   * Presents a confirmation form for adding a contact
-   */
-  @GET
-  @Path("addContact")
-  def addContactConfirm(@PathParam(value = "id") userName: String,
-    @QueryParam("contactWebId") contactWebId: UriRef): GraphNode = {
-    AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
-    val contactNode = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
-      def run = {
-        graphNodeProvider.get(contactWebId);
-      }
-    })
-    val resultGraph = new EzMGraph(new UnionMGraph(new SimpleMGraph, contactNode.getGraph))
-    import resultGraph._
-    val result: GraphNode = bnode
-    result a CONTROLPANEL.ContactConfirmPage
-    result -- FOAF.primaryTopic --> contactNode
-  }
-
-  @POST
-  @Path("addContact")
-  def addContact(@PathParam(value = "id") userName: String, @Context uriInfo: UriInfo,
-                 @FormParam("webId") newContacts: java.util.List[UriRef]): Response = {
-    import collection.JavaConversions._
-    if (newContacts.size > 0) {
-      var me: GraphNode = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
-        def run: GraphNode = {
-          return userManager.getUserGraphNode(userName)
-        }
-      })
-      for (contactWebID <- newContacts) {
-        val webIdGraphs = webIdGraphsService.getWebIdInfo(me.getNode.asInstanceOf[UriRef])
-        var meGrph: GraphNode = new GraphNode(me.getNode, webIdGraphs.localPublicUserData)
-        meGrph.addProperty(FOAF.knows, contactWebID)
-      } //todo: one should catch errors here (bad uris sent for ex
-    }
-    return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
-  }
-
-  /**
-   * Removes a contact
-   */
-  @POST
-  @Path("deleteContact")
-  def deleteContact(@PathParam(value = "id") userName: String, @Context uriInfo: UriInfo,
-                 @FormParam("contactWebId") contactWebId: UriRef): Response = {
-    import collection.JavaConversions._
-    var me: GraphNode = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
-      def run: GraphNode = {
-        return userManager.getUserGraphNode(userName)
-      }
-    })
-    val webIdGraphs = webIdGraphsService.getWebIdInfo(me.getNode.asInstanceOf[UriRef])
-    var meGrph: GraphNode = new GraphNode(me.getNode, webIdGraphs.localPublicUserData)
-    meGrph.deleteProperty(FOAF.knows, contactWebId)
-    return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
-  }
-
-  /**
-   * @parm webId: A list of WebIDs to be added as Subject Alternative Names
-   * @param cn Common Name, the name that usually appears in the certificate selection box
-   * @param spkac key request in format generated by  Netscape, Safari, Opera
-   * @param crmf hey request in format generated by M$ Explorer
-   * @param csr key request as generated by Javascript of Netscape
-   * @param hours the certificate should last  (hours and days add up)
-   * @param days the certificate should last
-   * @param comment a comment to be attached to the public key in the database
-   */
-  @POST
-  @Path("keygen")
-  def createCert(@FormParam("webId") webIds: java.util.List[URI],
-                 @FormParam("cn") commonName: String,
-                 @FormParam("spkac") spkac: String,
-                 @FormParam("crmf") crmf: String,
-                 @FormParam("csr") csr: String,
-                 @FormParam("hours") hours: String,
-                 @FormParam("days") days: String,
-                 @FormParam("comment") comment: String): Response = {
-    import scala.collection.JavaConversions._
-    var cert: Certificate = null
-    if (spkac != null && spkac.length > 0) {
-      cert = keygenSrvc.createFromSpkac(spkac)
-      if (cert == null) {
-        logger.warn("unable to create certificate from spkac request")
-      }
-    }
-    if (cert == null && crmf != null && crmf.length > 0) {
-      cert = keygenSrvc.createFromCRMF(crmf)
-      if (cert == null) {
-        logger.warn("unable to create certificate from crmf requrest :" + crmf)
-      }
-    }
-    if (cert == null && csr != null && csr.length > 0) {
-      cert = keygenSrvc.createFromPEM(csr)
-      if (cert == null) {
-        logger.warn("unable to create certificate from csr request :" + csr)
-      }
-    }
-    if (cert == null) {
-      throw new RuntimeException("The server was unable to create a certificate")
-    }
-    cert.setSubjectCommonName(commonName)
-    cert.addDurationInHours(hours)
-    cert.addDurationInDays(days)
-    cert.startEarlier("2")
-    for(san: URI<-webIds) {
-      cert.addSubjectAlternativeName(san.toString)
-    }
-    var ser: CertSerialisation = null
-    try {
-      ser = cert.getSerialisation
-    }
-    catch {
-      case ex: Exception => {
-        throw new RuntimeException(ex)
-      }
-    }
-    var pubKey: RSAPublicKey = cert.getSubjectPublicKey.getPublicKey.asInstanceOf[RSAPublicKey]
-    var publicExponent: BigInteger = pubKey.getPublicExponent
-    var modulus: BigInteger = pubKey.getModulus
-
-    for (webid: URI<-webIds
-         if (webid.getScheme=="https"||webid.getScheme=="http");
-          val webidRef = new UriRef(webid.toString);
-         val webIdInfo = webIdGraphsService.getWebIdInfo(webidRef);
-         if (webIdInfo.isLocal)
-    ) {
-      val certGraph = new EzMGraph(webIdInfo.localPublicUserData)
-      import certGraph._
-      val certNode = certGraph.bnode
-      ( (certNode a  RSA.RSAPublicKey)
-         -- CERT.identity -->  webidRef
-         -- RSA.modulus -->  modulus
-         -- RSA.public_exponent -->  publicExponent
-         -- DC.date -->  cert.getStartDate )
-      if (comment != null && comment.length > 0) {
-        certNode --  RDFS.comment -->  comment
-      }
-    }
-    var resBuild: Response.ResponseBuilder = Response.ok(ser.getContent, MediaType.valueOf(ser.getMimeType))
-    return resBuild.build
-  }
-
-  @POST
-  @Path("deletekey")
-  def deleteKey(@Context uriInfo: UriInfo,
-                @FormParam("webId") webId: UriRef,
-                @FormParam("keyhash") keys: List[String]): Response = {
-    val webIDInfo = webIdGraphsService.getWebIdInfo(webId)
-    val agent: GraphNode = new GraphNode(webId, webIDInfo.localPublicUserData)
-    var subjects: Iterator[GraphNode] = agent.getSubjectNodes(CERT.identity)
-    import scala.util.control.Breaks._
-    breakable {
-      import scala.collection.JavaConversions._
-      //to for loop through iterators
-      for (nl <- subjects) {
-        var modulusIt: Iterator[Resource] = nl.getObjects(RSA.modulus)
-        if (!modulusIt.hasNext) break
-        var modLit: Resource = modulusIt.next
-        if (modulusIt.hasNext) logger.warn("data error, a modulus too many in cert for " + webId)
-        if (!(modLit.isInstanceOf[TypedLiteral])) {
-          logger.warn("a public key has a modulus that is not a literal for " + webId)
-          break
-        }
-        var modulus: BigInteger = LiteralFactory.getInstance.createObject(classOf[BigInteger], modLit.asInstanceOf[TypedLiteral])
-        for (key <- keys) {
-          if (modulus.hashCode == Integer.decode(key)) {
-            nl.deleteNodeContext
-            break
-          }
-        }
-      }
-    }
-    return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
-  }
-
-  @POST
-  @Path("modify")
-  def modifyProfile(@Context uriInfo: UriInfo,
-                    @PathParam("id") userName: String,
-                    @FormParam("webId") webId: UriRef,
-                    @FormParam("name") name: String,
-                    @FormParam("description") description: String): Response = {
-    val webIDInfo = AccessController.doPrivileged(new PrivilegedAction[WebIdInfo] {
-      def run = {
-        webIdGraphsService.getWebIdInfo(webId)
-      }
-    })
-    val agent: GraphNode = new GraphNode(webId, webIDInfo.localPublicUserData)
-    agent.deleteProperties(FOAF.name)
-    agent.addPropertyValue(FOAF.name, name)
-    agent.deleteProperties(DC.description)
-    agent.addPropertyValue(DC.description, description)
-    logger.debug("local graph (uri: {}) is now of size {}".format(webIDInfo.webId, webIDInfo.localPublicUserData.size))
-    RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
-  }
-
-  protected def bindUserManager(usermanager: UserManager): Unit = {
-    userManager = usermanager
-  }
-
-  protected def unbindUserManager(usermanager: UserManager): Unit = {
-    if (userManager == usermanager) {
-      userManager = null
-    }
-  }
-
-  protected def bindGraphNodeProvider(graphNodeProvider: GraphNodeProvider): Unit = {
-    this.graphNodeProvider = graphNodeProvider
-  }
-
-  protected def unbindGraphNodeProvider(graphNodeProvider: GraphNodeProvider): Unit = {
-    this.graphNodeProvider = null
-  }
-
-  protected def bindKeygenSrvc(keygenservice: KeygenService): Unit = {
-    keygenSrvc = keygenservice
-  }
-
-  protected def unbindKeygenSrvc(keygenservice: KeygenService): Unit = {
-    if (keygenSrvc == keygenservice) {
-      keygenSrvc = null
-    }
-  }
-
-
-  protected def bindWebIdGraphsService(webidgraphsservice: WebIdGraphsService): Unit = {
-    webIdGraphsService = webidgraphsservice
-  }
-
-  protected def unbindWebIdGraphsService(webidgraphsservice: WebIdGraphsService): Unit = {
-    webIdGraphsService = null
-  }
-
-  protected def bindPlatformConfig(platformconfig: PlatformConfig): Unit = {
-    platformConfig = platformconfig
-  }
-
-  protected def unbindPlatformConfig(platformconfig: PlatformConfig): Unit = {
-    if (platformConfig == platformconfig) {
-      platformConfig = null
-    }
-  }
-
-  protected def bindTcManager(tcManager: TcManager) = {
-    this.tcManager = tcManager
-  }
-
-  protected def unbindTcManager(tcManager: TcManager) = {
-    this.tcManager = null
-  }
-
-  protected def activate(componentContext: ComponentContext): Unit = {
-    this.componentContext = componentContext
-  }
-
-
-  private var userManager: UserManager = null
-
-  private var graphNodeProvider: GraphNodeProvider = null
-
-  private var webIdGraphsService: WebIdGraphsService = null
-
-  private var keygenSrvc: KeygenService = null
-  private var platformConfig: PlatformConfig = null
-
-
-  private var componentContext: ComponentContext = null
-
-  private var tcManager: TcManager = null;
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.scala
deleted file mode 100644
index 3d8d929..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.scala
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * 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.io.ByteArrayInputStream
-import java.io.IOException
-import java.io.InputStream
-import java.io.UnsupportedEncodingException
-import java.net.URL
-import java.security.AccessControlException
-import java.security.AccessController
-import java.security.MessageDigest
-import java.security.NoSuchAlgorithmException
-import java.security.PrivilegedAction
-import java.util.Dictionary
-import java.util.HashMap
-import java.util.HashSet
-import java.util.Hashtable
-import java.util.Iterator
-import java.util.Map
-import java.util.Set
-import javax.ws.rs.Consumes
-import javax.ws.rs.FormParam
-import javax.ws.rs.GET
-import javax.ws.rs.POST
-import javax.ws.rs.Path
-import javax.ws.rs.PathParam
-import javax.ws.rs.QueryParam
-import javax.ws.rs.WebApplicationException
-import javax.ws.rs.core.Context
-import javax.ws.rs.core.MediaType
-import javax.ws.rs.core.Response
-import javax.ws.rs.core.Response.ResponseBuilder
-import javax.ws.rs.core.UriInfo
-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.ReferenceCardinality
-import org.apache.felix.scr.annotations.ReferencePolicy
-import org.apache.felix.scr.annotations.Service
-import org.osgi.framework.Bundle
-import org.osgi.framework.BundleException
-import org.osgi.service.cm.Configuration
-import org.osgi.service.cm.ConfigurationAdmin
-import org.osgi.service.component.ComponentContext
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-import org.apache.clerezza.jaxrs.utils.TrailingSlash
-import org.apache.clerezza.jaxrs.utils.RedirectUtil
-import org.apache.clerezza.jaxrs.utils.form.FormFile
-import org.apache.clerezza.jaxrs.utils.form.MultiPartBody
-import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
-import org.apache.clerezza.platform.config.SystemConfig
-import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider
-import org.apache.clerezza.platform.typerendering.RenderletManager
-import org.apache.clerezza.platform.typerendering.scala.PageRenderlet
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet
-import org.apache.clerezza.rdf.core.BNode
-import org.apache.clerezza.rdf.core.Graph
-import org.apache.clerezza.rdf.core.Literal
-import org.apache.clerezza.rdf.core.LiteralFactory
-import org.apache.clerezza.rdf.core.MGraph
-import org.apache.clerezza.rdf.core.NonLiteral
-import org.apache.clerezza.rdf.core.Triple
-import org.apache.clerezza.rdf.core.TypedLiteral
-import org.apache.clerezza.rdf.core.UriRef
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl
-import org.apache.clerezza.rdf.core.impl.SimpleLiteralFactory
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph
-import org.apache.clerezza.rdf.core.impl.TripleImpl
-import org.apache.clerezza.rdf.ontologies.OSGI
-import org.apache.clerezza.rdf.ontologies.PERMISSION
-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
-
-object SettingPanel {
-  val logger: Logger = LoggerFactory.getLogger(classOf[SettingsPanel])
-}
-
-/**
- *
- * Account control panel
- *
- * @author mir, hasan
- */
-@Path("/user/{id}/control-panel")
-class SettingsPanel {
-
-  import SettingPanel.logger
-
-  /**
-   * Mainpage
-   *
-   * @param id is the username as given in the URL
-   * @return an array of installed {@link Bundle}s to be managed
-   *
-   */
-  @GET
-  def settingsPage(@PathParam(value = "id") idP: String,
-              @QueryParam("changedPassword") changedPassword: String,
-              @Context uriInfo: UriInfo): GraphNode = {
-    TrailingSlash.enforceNotPresent(uriInfo)
-    val id: String = idP
-    var graphNode: GraphNode = null
-    AccessController.checkPermission(new AccountControlPanelAppPermission(id, ""))
-    try {
-      AccessController.checkPermission(new UserBundlePermission(id, ""))
-      graphNode = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
-        def run: GraphNode = {
-          var bundles: Array[Bundle] = userBundles(getAgent(id))
-          return asGraphNode(id, bundles)
-        }
-      })
-    }
-    catch {
-      case e: AccessControlException => {
-        graphNode = new GraphNode(new BNode, new SimpleMGraph)
-        graphNode.addProperty(CONTROLPANEL.userBundlePermission, LiteralFactory.getInstance.createTypedLiteral(false))
-      }
-    }
-    try {
-      AccessController.checkPermission(new ChangePasswordPermission(id, ""))
-      graphNode.addProperty(CONTROLPANEL.changePasswordPermission, LiteralFactory.getInstance.createTypedLiteral(true))
-    }
-    catch {
-      case e: AccessControlException => {
-        graphNode.addProperty(CONTROLPANEL.changePasswordPermission, LiteralFactory.getInstance.createTypedLiteral(false))
-      }
-    }
-    if (changedPassword != null && changedPassword.equals("false")) {
-      graphNode.addProperty(CONTROLPANEL.changedPassword, new PlainLiteralImpl("false"))
-    }
-    graphNode.addProperty(RDF.`type`, CONTROLPANEL.SettingsPage)
-    graphNode.addProperty(RDF.`type`, PLATFORM.HeadedPage)
-    return graphNode
-  }
-
-  private def addBundleDescriptionToGraph(responseGraph: MGraph, bundle: Bundle): Unit = {
-    var status: TypedLiteral = LiteralFactory.getInstance.createTypedLiteral(bundle.getState)
-    var bundleUri: UriRef = new UriRef(bundle.getLocation)
-    var triple: Triple = new TripleImpl(bundleUri, OSGI.status, status)
-    responseGraph.add(triple)
-    var bundleId: TypedLiteral = LiteralFactory.getInstance.createTypedLiteral(bundle.getBundleId)
-    triple = new TripleImpl(bundleUri, OSGI.bundle_id, bundleId)
-    responseGraph.add(triple)
-  }
-
-  private def asGraphNode(userId: String, bundles: Array[Bundle]): GraphNode = {
-    val responseGraph: MGraph = new SimpleMGraph
-    for (bundle <- bundles) {
-      addBundleDescriptionToGraph(responseGraph, bundle)
-    }
-    return AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
-      def run: GraphNode = {
-        var userDescriptionGraph: Graph = new GraphNode(getAgent(userId), systemGraph).getNodeContext
-        var unionGraph: UnionMGraph = new UnionMGraph(responseGraph, userDescriptionGraph)
-        var graphNode: GraphNode = new GraphNode(getAgent(userId), unionGraph)
-        graphNode.addProperty(CONTROLPANEL.userBundlePermission, LiteralFactory.getInstance.createTypedLiteral(true))
-        return graphNode
-      }
-    })
-  }
-
-  /**
-   * Retrieves all bundles owned by a user represented by agent
-   *
-   * @param agent represents the user who owns bundles to be returned
-   * @return an array of {@link Bundle}s owned by the user
-   *
-   */
-  private def userBundles(agent: NonLiteral): Array[Bundle] = {
-    logger.debug("Retrieve all bundles from user: {}", agent)
-    var installedBundles: Array[Bundle] = componentContext.getBundleContext.getBundles
-    val locationMapper: Map[String, Long] = new HashMap[String, Long]
-    for (b <- installedBundles) {
-      locationMapper.put(b.getLocation, b.getBundleId)
-    }
-    return AccessController.doPrivileged(new PrivilegedAction[Array[Bundle]] {
-      def run: Array[Bundle] = {
-        var bundles: Set[Bundle] = new HashSet[Bundle]
-        var agentBundles: Iterator[Triple] = systemGraph.filter(null, OSGI.owner, agent)
-        while (agentBundles.hasNext) {
-          val location: String = (agentBundles.next.getSubject.asInstanceOf[UriRef]).getUnicodeString
-          try {
-            val id: Long = locationMapper.get(location)
-            bundles.add(componentContext.getBundleContext.getBundle(id))
-          } catch {
-            case _:NumberFormatException => None
-          }
-        }
-        return bundles.toArray(new Array[Bundle](bundles.size))
-      }
-    })
-  }
-
-  private def getAgent(id: String): NonLiteral = {
-    logger.debug("Get agent with id {}", id)
-    var agents: Iterator[Triple] = systemGraph.filter(null, PLATFORM.userName, new PlainLiteralImpl(id))
-    if (agents.hasNext) {
-      return agents.next.getSubject
-    }
-    else {
-      logger.debug("System graph does not contain user: {}", id)
-      var responseBuilder: Response.ResponseBuilder = Response.ok("<html><body>User does not exist</body></html>")
-      throw new WebApplicationException(responseBuilder.build)
-    }
-  }
-
-  private def getAgentPathPrefix(agent: NonLiteral): PlainLiteralImpl = {
-    return AccessController.doPrivileged(new PrivilegedAction[PlainLiteralImpl] {
-      def run: PlainLiteralImpl = {
-        var pathPrefixes: Iterator[Triple] = systemGraph.filter(agent, OSGI.agent_path_prefix, null)
-        if (pathPrefixes.hasNext) {
-          return pathPrefixes.next.getObject.asInstanceOf[PlainLiteralImpl]
-        }
-        return null
-      }
-    })
-  }
-
-  /**
-   * Installs a bundle from the specified location.
-   *
-   * @param id is the username as given in the URL
-   * @param location specifies the URL of the bundle to be installed
-   * @return an array of installed {@link Bundle}s to be managed
-   *
-   */
-  @POST
-  @Path("install-bundle")
-  @Consumes def installBundle(@PathParam(value = "id") id: String, multiForm: MultiPartBody, @Context uriInfo: UriInfo): Response = {
-    AccessController.checkPermission(new AccountControlPanelAppPermission(id, ""))
-    AccessController.checkPermission(new UserBundlePermission(id, ""))
-    var formFiles: Array[FormFile] = multiForm.getFormFileParameterValues("bundle")
-    var filename: String = formFiles(0).getFileName
-    var bundleBytes: Array[Byte] = formFiles(0).getContent
-    if (bundleBytes.length == 0) {
-      var message: String = null
-      if (filename.equals("")) {
-        message = "No bundle specified"
-      }
-      else {
-        message = "Bundle has length 0"
-      }
-      var responseBuilder: Response.ResponseBuilder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message)
-      throw new WebApplicationException(responseBuilder.build)
-    }
-    val bundleInputStream: InputStream = new ByteArrayInputStream(bundleBytes)
-    val location: String = "userbundle:" + id + "/" + filename
-    logger.info("Install bundle {} to location {}", id, location)
-    AccessController.doPrivileged(new PrivilegedAction[AnyRef] {
-      def run: Array[Bundle] = {
-        val agent: NonLiteral = getAgent(id)
-        val triple: Triple = new TripleImpl(new UriRef(location), OSGI.owner, agent)
-        try {
-          systemGraph.add(triple)
-          var bundle: Bundle = componentContext.getBundleContext.installBundle(location, bundleInputStream)
-          var prefix: PlainLiteralImpl = getAgentPathPrefix(agent)
-          if (prefix != null) {
-            addBundlePrefix(bundle, prefix.getLexicalForm)
-          }
-          return null
-        }
-        catch {
-          case ex: BundleException => {
-            systemGraph.remove(triple)
-            logger.debug("Failed to install a bundle from: {}", location)
-            logger.error("Exception during install bundle: {}", ex)
-            var responseBuilder: Response.ResponseBuilder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ex.getMessage)
-            throw new WebApplicationException(responseBuilder.build)
-          }
-        }
-      }
-    })
-    return RedirectUtil.createSeeOtherResponse("../control-panel", uriInfo)
-  }
-
-  private def addBundlePrefix(bundle: Bundle, prefix: String): Unit = {
-    var symbolicName: String = bundle.getSymbolicName
-    /*if (configAdmin != null) {
-      try {
-        var configuration: Configuration = configAdmin.getConfiguration(classOf[TriaxrsPrefixManager].getName)
-        val properties = configuration.getProperties match {
-          case null => new Hashtable[String, AnyRef]()
-          case dict: Dictionary[String, AnyRef] => dict
-        }
-        var mappings = TriaxrsPrefixManager.parseMappings(properties.get(TriaxrsPrefixManager.TRIAXRS_MAPPINGS).asInstanceOf[Array[String]])
-        logger.debug("Prefix {} added to bundle {}", prefix, symbolicName)
-        mappings.put(symbolicName, prefix)
-        var newMappings: Array[String] = TriaxrsPrefixManager.unparseMappings(mappings)
-        properties.put(TriaxrsPrefixManager.TRIAXRS_MAPPINGS, newMappings)
-        configuration.update(properties)
-      }
-      catch {
-        case e: IOException => {
-          logger.warn("Unable to update configuration: {}", e.toString)
-        }
-      }
-    }
-    else {
-      logger.warn("Cannot add prefix mapping. Configuration Admin is missing")
-    }*/
-  }
-
-  private[accountcontrolpanel] def removeBundlePrefix(bundle: Bundle): Unit = {
-    var symbolicName: String = bundle.getSymbolicName
-    /*if ((this.configAdmin != null) && (symbolicName != null)) {
-      try {
-        val configuration: Configuration = configAdmin.getConfiguration(classOf[TriaxrsPrefixManager].getName)
-        val properties = configuration.getProperties match {
-          case null => new Hashtable[String, AnyRef]()
-          case dict: Dictionary[String, AnyRef] => dict
-        }
-        val mappings = TriaxrsPrefixManager.parseMappings(properties.get(TriaxrsPrefixManager.TRIAXRS_MAPPINGS).asInstanceOf[Array[String]])
-        mappings.remove(symbolicName)
-        val newMappings: Array[String] = TriaxrsPrefixManager.unparseMappings(mappings)
-        properties.put(TriaxrsPrefixManager.TRIAXRS_MAPPINGS, newMappings)
-        configuration.update(properties)
-      }
-      catch {
-        case e: IOException => {
-          logger.warn("Unable to update configuration: {}", e.toString)
-        }
-      }
-    }
-    else {
-      logger.warn("Cannot add prefix mapping. Configuration Admin is missing")
-    }*/
-  }
-
-  /**
-   * Starts the bundle with the specified bundle id.
-   *
-   * @param id is the username as given in the URL
-   * @param bundleIdString specifies the id of the bundle to be started
-   * @return an array of installed {@link Bundle}s to be managed
-   *
-   */
-  @POST
-  @Path("start-bundle")
-  def startBundle(@PathParam(value = "id") idP: String,
-             @FormParam("bundleId") bundleIdStringP: String,
-             @Context uriInfo: UriInfo): Response = {
-    val id: String = idP
-    val bundleIdString: String = bundleIdStringP
-    AccessController.checkPermission(new AccountControlPanelAppPermission(id, ""))
-    AccessController.checkPermission(new UserBundlePermission(id, ""))
-    logger.info("Start bundle {} ", id)
-    val bundleId: Long = bundleIdString.toLong
-    AccessController.doPrivileged(new PrivilegedAction[AnyRef] {
-      def run: Array[Bundle] = {
-        try {
-          val bundle: Bundle = componentContext.getBundleContext.getBundle(bundleId)
-          bundle.start
-        }
-        catch {
-          case e: BundleException => {
-            logger.debug("Failed to start bundle {}", bundleIdString)
-            logger.error("Exception during start bundle: {}", e)
-            var responseBuilder: Response.ResponseBuilder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage)
-            throw new WebApplicationException(responseBuilder.build)
-          }
-        }
-        return null
-      }
-    })
-    return RedirectUtil.createSeeOtherResponse("../control-panel", uriInfo)
-  }
-
-  /**
-   * Stops the bundle with the specified bundle id.
-   *
-   * @param id is the username as given in the URL
-   * @param bundleIdString specifies the id of the bundle to be stopped
-   * @return an array of installed {@link Bundle}s to be managed
-   *
-   */
-  @POST
-  @Path("stop-bundle") def stopBundle(@PathParam(value = "id") idP: String,
-                          @FormParam("bundleId") bundleIdStringP: String,
-                          @Context uriInfo: UriInfo): Response = {
-    val id: String = idP
-    val bundleIdString: String = bundleIdStringP
-    AccessController.checkPermission(new AccountControlPanelAppPermission(id, ""))
-    AccessController.checkPermission(new UserBundlePermission(id, ""))
-    logger.info("Stop bundle {}", id)
-    val bundleId: Long = bundleIdString.toLong
-    AccessController.doPrivileged(new PrivilegedAction[AnyRef] {
-      def run: Array[Bundle] = {
-        try {
-          var bundle: Bundle = componentContext.getBundleContext.getBundle(bundleId)
-          bundle.stop
-        }
-        catch {
-          case e: BundleException => {
-            logger.debug("Failed to stop bundle ", bundleIdString)
-            logger.error("Exception during stop bundle: {}", e)
-            var responseBuilder: Response.ResponseBuilder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage)
-            throw new WebApplicationException(responseBuilder.build)
-          }
-        }
-        return null
-      }
-    })
-    return RedirectUtil.createSeeOtherResponse("../control-panel", uriInfo)
-  }
-
-  /**
-   * Uninstalls the bundle with the specified bundle id.
-   *
-   * @param id is the username as given in the URL
-   * @param bundleIdString specifies the id of the bundle to be uninstalled
-   * @return an array of installed {@link Bundle}s to be managed
-   *
-   */
-  @POST
-  @Path("uninstall-bundle")
-  def uninstallBundle(@PathParam(value = "id") idP: String,
-                @FormParam("bundleId") bundleIdStringP: String,
-                @Context uriInfo: UriInfo): Response = {
-    val id: String = idP
-    val bundleIdString: String = bundleIdStringP
-    AccessController.checkPermission(new AccountControlPanelAppPermission(id, ""))
-    AccessController.checkPermission(new UserBundlePermission(id, ""))
-    logger.info("Uninstall bundle {}", id)
-    val bundleId: Long = bundleIdString.toLong
-    AccessController.doPrivileged(new PrivilegedAction[AnyRef] {
-      def run: Array[Bundle] = {
-        val agent: NonLiteral = getAgent(id)
-        try {
-          var bundle: Bundle = componentContext.getBundleContext.getBundle(bundleId)
-          bundle.uninstall
-          val triple: Triple = new TripleImpl(new UriRef(bundle.getLocation), OSGI.owner, agent)
-          systemGraph.remove(triple)
-          removeBundlePrefix(bundle)
-        }
-        catch {
-          case e: BundleException => {
-            logger.debug("Failed to uninstall bundle {}", bundleIdString)
-            logger.error("Exception during uninstall bundle: {}", e)
-            var responseBuilder: Response.ResponseBuilder = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage)
-            throw new WebApplicationException(responseBuilder.build)
-          }
-        }
-        return null
-      }
-    })
-    return RedirectUtil.createSeeOtherResponse("../control-panel", uriInfo)
-  }
-
-  /**
-   * changes the password of an user
-   *
-   * @param idP id is the username as given in the URL
-   * @param lang represents the user's new standard language.
-   * @return
-   */
-  @POST
-  @Path("change-language")
-  def changeUserLanguage(@PathParam(value = "id") idP: String,
-                  @FormParam("availablelanguages") lang: String,
-                  @Context uriInfo: UriInfo): Response = {
-    val id: String = idP
-    AccessController.checkPermission(new AccountControlPanelAppPermission(id, ""))
-    AccessController.doPrivileged(new PrivilegedAction[AnyRef] {
-      def run: AnyRef = {
-        var userNode: GraphNode = new GraphNode(getAgent(id), systemGraph)
-        userNode.deleteProperties(PLATFORM.preferredLangInISOCode)
-        userNode.addProperty(PLATFORM.preferredLangInISOCode, LiteralFactory.getInstance.createTypedLiteral(lang))
-        return null
-      }
-    })
-    return RedirectUtil.createSeeOtherResponse("../control-panel", uriInfo)
-  }
-
-  /**
-   * changes the password of an user
-   *
-   * @param idP id is the username as given in the URL
-   * @param oldPW the current user password
-   * @param newPW the new password
-   * @param confirmNewPW the new password
-   * @return
-   */
-  @POST
-  @Path("change-password")
-  def changePassword(@PathParam(value = "id") idP: String,
-               @FormParam("oldPW") oldPW: String,
-               @FormParam("newPW") newPW: String,
-               @FormParam("confirmNewPW") confirmNewPW: String,
-               @Context uriInfo: UriInfo): Response = {
-    val id: String = idP
-    AccessController.checkPermission(new AccountControlPanelAppPermission(id, ""))
-    AccessController.checkPermission(new ChangePasswordPermission(id, ""))
-    var changedPassword: Boolean = false
-    if (newPW.trim.equals(confirmNewPW.trim) && checkPWStrings(oldPW, newPW)) {
-      changedPassword = AccessController.doPrivileged(new PrivilegedAction[Boolean] {
-        private def getCurrentPassword(agent: NonLiteral): String = {
-          var currentPassword: String = null
-          var oldPWTriple: Iterator[Triple] = systemGraph.filter(agent, PERMISSION.passwordSha1, null)
-          if (oldPWTriple.hasNext) {
-            var currentPWLiteral: Literal = oldPWTriple.next.getObject.asInstanceOf[Literal]
-            currentPassword = currentPWLiteral.getLexicalForm
-          }
-          return currentPassword
-        }
-
-        def run: Boolean = {
-          val agent: NonLiteral = getAgent(id)
-          var encodedOlpPW: String = getEncodedPW(oldPW)
-          var currentPassword: String = getCurrentPassword(agent)
-          if ((currentPassword != null) && !currentPassword.equals(encodedOlpPW)) {
-            logger.info("Typed wrong current password!")
-            return false
-          }
-          else {
-            removeOldPwAndAddNewPW(agent, currentPassword, newPW)
-            return true
-          }
-        }
-
-        private def removeOldPwAndAddNewPW(agent: NonLiteral, currentPassword: String, newPW: String): Unit = {
-          var newPWTriple: Triple = new TripleImpl(agent, PERMISSION.passwordSha1, new PlainLiteralImpl(getEncodedPW(newPW)))
-          if (currentPassword != null) {
-            var oldPWTriple: Triple = new TripleImpl(agent, PERMISSION.passwordSha1, new PlainLiteralImpl(currentPassword))
-            systemGraph.remove(oldPWTriple)
-            logger.debug("removed old password from systemgraph")
-          }
-          systemGraph.add(newPWTriple)
-          logger.debug("user " + id + " changed password")
-        }
-
-        private def getEncodedPW(password: String): String = {
-          if (password == null) {
-            return null
-          }
-          try {
-            return bytes2HexString(MessageDigest.getInstance("SHA1").digest(password.getBytes("UTF-8")))
-          }
-          catch {
-            case e: NoSuchAlgorithmException => {
-              throw new RuntimeException(e)
-            }
-            case e: UnsupportedEncodingException => {
-              throw new RuntimeException(e)
-            }
-          }
-        }
-
-        private def bytes2HexString(bytes: Array[Byte]): String = {
-          val HEXDIGITS: Array[Char] = "0123456789abcdef".toCharArray
-          val result = new Array[Char](bytes.length << 1)
-          var j: Int = 0
-          for (i <- 0 to bytes.length - 1) {
-            result(j) = HEXDIGITS(bytes(i) >> 4 & 0xF)
-            result(j + 1) = HEXDIGITS(bytes(i) & 0xF)
-            j += 2
-          }
-          return new String(result)
-        }
-      })
-    }
-    else {
-      logger.info("Changing password failed!")
-      changedPassword = false
-    }
-    if (changedPassword) {
-      return RedirectUtil.createSeeOtherResponse("../control-panel", uriInfo)
-    }
-    else {
-      return RedirectUtil.createSeeOtherResponse("../control-panel?changedPassword=false", uriInfo)
-    }
-  }
-
-  /**
-   * checks if the typed strings are valid
-   */
-  private def checkPWStrings(oldPW: String, newPW: String): Boolean = {
-    if (newPW.length == 0) {
-      return false
-    }
-    return true
-  }
-
-  /**
-   * The activate method is called when SCR activates the component configuration.
-   *
-   * @param componentContext
-   */
-  protected def activate(componentContext: ComponentContext): Unit = {
-    this.componentContext = componentContext
-  }
-
-  protected def bindConfigurationAdmin(configAdmin: ConfigurationAdmin): Unit = {
-    logger.debug("Binding configuration admin")
-    this.configAdmin = configAdmin
-  }
-
-  protected def unbindConfigurationAdmin(configAdmin: ConfigurationAdmin): Unit = {
-    logger.debug("Unbinding configuration admin")
-    this.configAdmin = null
-  }
-
-  protected def bindSystemGraph(mgraph: MGraph): Unit = {
-    systemGraph = mgraph
-  }
-
-  protected def unbindSystemGraph(mgraph: MGraph): Unit = {
-    if (systemGraph == mgraph) {
-      systemGraph = null
-    }
-  }
-
-  protected def bindCgProvider(contentgraphprovider: ContentGraphProvider): Unit = {
-    cgProvider = contentgraphprovider
-  }
-
-  protected def unbindCgProvider(contentgraphprovider: ContentGraphProvider): Unit = {
-    if (cgProvider == contentgraphprovider) {
-      cgProvider = null
-    }
-  }
-
-  private var componentContext: ComponentContext = null
-  private var systemGraph: MGraph = null
-  private var cgProvider: ContentGraphProvider = null
-  private var configAdmin: ConfigurationAdmin = null
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ContactConfirmRenderlet.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ContactConfirmRenderlet.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ContactConfirmRenderlet.scala
deleted file mode 100644
index bb306aa..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ContactConfirmRenderlet.scala
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.clerezza.platform.accountcontrolpanel.html
-
-/*
- * 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.
- */
-import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.rdf.scala.utils._
-import org.apache.clerezza.rdf.ontologies.FOAF
-import org.apache.clerezza.rdf.ontologies.RDF
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import org.apache.clerezza.platform.typerendering.scala._
-
-
-
-/**
- * Metadata class for the person panel
- */
-class ContactConfirmRenderlet extends SRenderlet {
-  def getRdfType() = CONTROLPANEL.ContactConfirmPage
-
-
-  override def renderedPage(arguments: XmlResult.Arguments) = new XmlPerson(arguments)
-
-  /**
-   * Content class for the Person Panel
-   */
-  class XmlPerson(args: XmlResult.Arguments) extends XmlResult(args) {
-
-    import RenderingUtility._
-    
-    //
-    // the content itself.
-    // This is the piece that is closest to a pure ssp, though there is still too much code in it
-    //
-
-    override def content = {
-      val primarySubject = res/FOAF.primaryTopic
-      <div id="tx-content">
-        {
-        if (primarySubject.hasProperty(RDF.`type`, FOAF.Person)) {
-          <form action="addContact" method="post">
-            {render(primarySubject, "box-naked")}
-            <input type="hidden" name="webId" value={primarySubject*} />
-            <input type="submit" value="Add this contact" />
-          </form>
-        } else {
-          <div>
-          <span>The resource {primarySubject!} of type {primarySubject/RDF.`type`} is not known to be a Person</span>
-          {
-            import collection.JavaConversions._
-            val otherPersons = (for (t <- primarySubject.getNodeContext.filter(null, RDF.`type`, FOAF.Person))
-              yield t.getSubject).toList
-            val personsWithUri: List[UriRef] = for (otherPerson <- otherPersons;
-                if otherPerson.isInstanceOf[UriRef]) yield otherPerson.asInstanceOf[UriRef]
-            if (personsWithUri.isEmpty) {
-              <span>No person could be found</span>
-            } else {
-              <div>
-                Maybe you want to add {
-                  if (personsWithUri.size > 1) {
-                    "one of the following "+personsWithUri.size+" persons:"
-                  } else {
-                    "the person"
-                  }
-                }
-                {
-                  for (otherPerson <- personsWithUri) yield {
-                    <form action="addContact" method="post">
-                      <span>{otherPerson}</span>
-                      {render(otherPerson, "box-naked")}
-                      <input type="hidden" name="webId" value={otherPerson.getUnicodeString} />
-                      <input type="submit" value="Add this contact" />
-                    </form>
-                  }
-                }
-              </div>
-            }
-          }
-          {
-            <form action="addContact" method="post">
-            You can add {primarySubject} as contact even though it does not seem to be a person.
-            <input type="hidden" name="webId" value={primarySubject*} />
-            <input type="submit" value="Add anyway" />
-          </form>
-          } </div>
-        }
-      }
-      <a href="../profile" onclick="history.go(-1)">Cancel</a>
-      </div>
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonBox.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonBox.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonBox.scala
deleted file mode 100644
index 2b9913c..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/PersonBox.scala
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.clerezza.platform.accountcontrolpanel.html
-
-/*
- * 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.
- */
-import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.rdf.scala.utils._
-import org.apache.clerezza.rdf.ontologies.FOAF
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import org.apache.clerezza.platform.typerendering.scala._
-import scala.xml.Text
-
-
-
-/**
- * Metadata class for the person panel
- */
-class PersonBox extends SRenderlet {
-  def getRdfType() = FOAF.Person
-
-  override def getModePattern = "box-naked"
-
-  override def renderedPage(arguments: XmlResult.Arguments) = new XmlPerson(arguments)
-
-  /**
-   * Content class for the Person Panel
-   */
-  class XmlPerson(args: XmlResult.Arguments) extends XmlResult(args) {
-
-    import RenderingUtility._
-    
-    //
-    // the content itself.
-    // This is the piece that is closest to a pure ssp, though there is still too much code in it
-    //
-
-    override def content = {
-      val pixml= getAgentPix(res)
-      <div class="personInABox">
-        <table><tr><td>{pixml}</td></tr>
-        <tr><td>{new Text(getName(res))}</td></tr>
-        </table>
-      </div>
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala
deleted file mode 100644
index 7d65dff..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/ProfilePanel.scala
+++ /dev/null
@@ -1,295 +0,0 @@
-package org.apache.clerezza.platform.accountcontrolpanel.html
-
-/*
- * 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.
- */
-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.foafssl.ontologies.CERT
-import org.apache.clerezza.foafssl.ontologies.RSA
-import org.apache.clerezza.platform.typerendering.scala._
-import java.math.BigInteger
-import java.util.Date
-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}
-
-class ProfilePanel extends SRenderlet {
-
-  override def getRdfType() = CONTROLPANEL.ProfilePage
-
-  override def renderedPage(arguments: XmlResult.Arguments) = new ProfilePanelXHTML(arguments)
-
-  class ProfilePanelXHTML(arguments: XmlResult.Arguments) extends XmlResult(arguments ) {
-
-    //set header properties
-
-    resultDocModifier.addStyleSheet("/account-control-panel/style/profile.css");
-    resultDocModifier.addScriptReference("/account-control-panel/scripts/profile.js");
-    resultDocModifier.addScriptReference("/account-control-panel/scripts/IEKeygen.js");
-    resultDocModifier.setTitle("Account Control Panel");
-    resultDocModifier.addNodes2Elem("tx-module", <h1>Account Control Panel</h1>);
-    resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Profile</a></li>);
-    resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="control-panel">Settings</a></li>);
-
-    //constants and variables
-
-    lazy val agent: RichGraphNode = res / FOAF.primaryTopic
-
-
-    // the content itself
-    // clearly in this case there is so much more in the the methods, that one could hesitate to call this an ssp
-
-    override def content = {
-      <div id="tx-content">
-        <h2>Personal Profile</h2>{agent ! match {
-          case _: BNode => createWebId()
-          case _: UriRef => existingWebId()
-         }}
-      </div>
-
-    }
-
-    //methods used to create 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)
-
-
-    def createWebId() = {
-      <h3>Associate Profile to WebID</h3>
-      <div id="newOrExistingSelection">
-      <p>Your profile is not currently associated to a WebID. A WebID allows you
-        to link your friends as well as to log-in to many sites (supporting foaf+ssl
-        or open-id).
-      </p>
-      <p>You may either create a new WebID or associate your account to an
-        existing WebID. Only creating a WebID here will allow you to manage your
-        profile here.
-      </p>
-      <form action="#" id="associateSelection">
-        <button type="button" id="newWebIdButton">Create a new Web-Id</button>
-        <button type="button" id="existingWebIdButton">I already have a Web-ID and want to use it</button>
-      </form>
-      </div>
-      <div id="createNewWebId">
-      <p>You have chosen to create a new Web-Id.</p>
-      <p>The Web-ID will be created as follows:
-        <br/>
-        <ol>
-        <li>Web-Id:
-          {var webId = res / cp("suggestedPPDUri") *;
-          webId += "#me";
-          webId}
-        </li>
-        <li>Personal-Profile Document: {res/cp("suggestedPPDUri")*}</li>
-        </ol>
-      </p>
-      <form method="post" action="profile/create-new-web-id">
-        <input value="Create it!" type="submit"/>
-      </form>
-      </div>
-      <div id="setExistingWebId">
-      <p>Please enter your Web-Id, if your Web-Id supports Foaf+SSL you will
-        be able to use it to log in to this site.</p>
-      <form method="post" action="profile/set-existing-webid">
-        <label for="webid">WebID</label> <input type="text" name="webid" size="80" title="Web-ID"/>
-        <br/>
-        <input value="Associate Profile to Web-Id" type="submit"/>
-        <p/>
-      </form>
-      </div>
-
-    }
-
-    def existingWebId() = {
-      if ((res / cp("isLocalProfile")).as[Boolean]) {
-      existingLocalWebId()
-      } else {
-      roamingUser()
-      }
-    }
-
-
-    def existingLocalWebId() = {
-      <h3>Manage your profile</h3>
-       <p>Here you can change your public profile.</p>
-
-      <form method="post" action="profile/modify">
-      <input type="hidden" name="webId" value={agent *}/>
-      <table>
-        <tr><td class="formlabel">Name:</td>
-        <td><input type="text" name="name" value={agent / FOAF.name *}/></td>
-        </tr>
-        <tr><td class="formlabel multiline">Description:</td>
-        <td><textarea name="description" rows="3" cols="80">{agent / DC.description *}</textarea></td>
-        </tr>
-        <tr><td class="formlabel"><input value="Modify" type="submit"/></td><td/></tr>
-      </table>
-
-      <p/>
-      </form>
-
-      <h3>Contacts</h3>
-      
-      <table>{ var i =0
-        val friends = for (friend <- agent/FOAF.knows) yield {
-          <td><form method="post" action="profile/deleteContact">
-            {
-              friend! match {
-                case webId: UriRef => render(webId, "box-naked")
-                case _ => render(friend, "box-naked")
-              }
-            }
-            <br/>
-            <input type="hidden" name="contactWebId" value={friend*}/>
-            <input type="submit" value="remove contact" />
-          </form></td>
-        /*render(friend!.asInstanceOf[UriRef])
-              import PersonPanel._
-        <td class="personInABox">{personInABox(friend)}</td>*/
-       }
-       for (row <- friends.grouped(5)) yield <tr>{row}</tr>
-      }</table>
-      <form id="addContact" method="get" action="profile/addContact">
-      <label for="contactWebId">Add contact bei WebId:<br/></label>
-      <input type="text" name="contactWebId" size="80"/><input type="submit" value="add contact" />
-      </form>
-
-      <h3>Key and Certificate Creation</h3>
-
-      <script type="text/javascript"> <![CDATA[$(document).ready(  function() { configurePage(); }   ); ]]> </script>
-
-      <div id="iehelptext" style="display: none;">
-      <p>Using Internet Explorer under Windows Vista or above or Windows
-        Server 2008, you need to configure the following for this to work:</p>
-      <ul>
-        <li>Add this site to the <i>Trusted Sites</i> list: in Internet
-        Options -&gt; Security -&gt; Trusted Sites -&gt; Sites -&gt; Add ...</li>
-        <li>You may need to configure the trust level (in this tab), using
-        <i>Custom Level...</i>: enable <i>Initialize and script ActiveX
-          controls not marked as safe for scripting</i>.</li>
-        <li>If you are using Windows Vista without SP1 or above, you will
-        probably need to install <a href="cacert.crt">this certificate</a> as a
-        Trusted Root Certification Authority Certificate for your own
-        certificate installation to succeed. You should probably remove that
-        trusted root CA certificate afterwards.</li>
-      </ul>
-      </div>
-      <form id="keygenform" method="post" action="profile/keygen">
-      <input name="webId" id="webId" type="hidden" value={agent*} />
-      <table>
-        <colgroup><col width="1*"/><col/></colgroup>
-        <tr>
-        <td class="formlabel">Certificate Name:</td>
-        <td>
-          <input alt="create a certificate name that will help you distinguish it from others you may have" name="cn"
-              size="35" id="cn" type="text" value={ ((agent/FOAF.name*)+"@clerezza")}/>
-        </td>
-        </tr>
-        <tr>
-        <td class="formlabel">Key strength:</td>
-        <td id="keystrenghtd">
-          <keygen id="spkac" name="spkac" challenge="TheChallenge1"/>
-        </td>
-        </tr>
-        <tr>
-        <td class="formlabel">Valid for:</td>
-        <td>
-          <input type="text" name="days" value="365" size="4"/>
-          days <input type="text" name="hours" value="0.0" size="4"/> hours</td>
-        </tr>
-        <tr>
-        <td class="formlabel">Comment:</td>
-        <td><input type="text" name="comment" value="" size="80"/></td>
-        </tr>
-        <tr><td class="formlabel"><input id="keygensubmit" type="submit" value="create certificate" /></td><td/></tr>
-      </table>
-      </form>
-      <h3>Existing Certificates</h3>
-      <form method="post" action="profile/deletekey">
-      <table>
-        <tr><th>Delete</th><th>Certificate Details</th></tr>
-        <input name="webId" id="webId" type="hidden" value={agent*} />
-        <tbody>{
-          for (key <- agent/-CERT.identity )
-          yield { val modulus = (key/RSA.modulus).as[BigInteger]
-              if (modulus == null)  <span/> //todo: broken public key, should delete it
-              else <tr><td><input type="checkbox" name="keyhash" value={modulus.hashCode().toString()}/></td>
-            <td><table>
-              <tr><td class="propvalue">Created:</td><td>{beautifyDate(key/DC.date )}</td></tr>
-              <tr><td class="propvalue">Comment:</td><td>{ key/RDFS.comment* }</td></tr>
-              <tr><td class="propvalue multiline">Modulus:</td><td><code>{ beautifyHex(key/RSA.modulus) }</code></td></tr>
-              <tr><td class="propvalue">Exponent:</td><td><code>{ beautifyInt(key/RSA.public_exponent) }</code></td></tr>
-              </table>
-            </td>
-                </tr>}
-        }</tbody>
-      </table>
-      <input type="submit" value="Disable Keys"/>
-      </form>
-      <p></p>
-
-    }
-
-    def roamingUser() = {
-      <h3>Using remote profile</h3>
-       <p>
-      {agent / FOAF.nick *}, you have accessed this site using your WebID
-        {"<" + (agent *) + ">"}
-        which has not been
-        created on this site.To edit your profile you should visit the site issuing the
-        profile.</p>
-    }
-
-
-
-
-    def beautifyDate(dtIt: CollectedIter[RichGraphNode]) {
-      if (0 == dtIt.size) return "_"
-      DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.FULL).format(dtIt.as[Date])
-    }
-
-
-    def beautifyHex(dtIt: CollectedIter[RichGraphNode]): String = {
-      if (0 == dtIt.size) return "warning! missing. Key invalid"
-      //this is a problem, it should always be here or it is invalid, and key should be removed
-      val bigint: BigInteger = dtIt.as[BigInteger]
-      val bstr = bigint.toString(16).toUpperCase;
-      val sbuf = new StringBuffer(bstr.size + (bstr.size/2)+10)
-      var cnt = 0
-      for (c <- bstr.toCharArray) {
-      if ((cnt % 2) == 0) sbuf.append(' ')
-      sbuf.append(c)
-      cnt += 1
-      }
-      sbuf.toString
-    }
-
-
-
-    def beautifyInt(dtIt: CollectedIter[RichGraphNode] ) :String = {
-      if (0 == dtIt.size) return "warning! missing. Key invalid"
-      else return dtIt.as[BigInteger].toString
-    }
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/RenderingUtility.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/RenderingUtility.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/RenderingUtility.scala
deleted file mode 100644
index 735aee0..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/RenderingUtility.scala
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.html
-
-
-import scala.xml.Node
-import scala.xml.NodeSeq
-import scala.xml.Text
-import java.net.URLEncoder
-import org.apache.clerezza._
-import org.apache.clerezza.rdf.core.UriRef
-import org.apache.clerezza.rdf.ontologies.FOAF
-import org.apache.clerezza.rdf.ontologies.RDFS
-import rdf.scala.utils.CollectedIter
-import rdf.scala.utils.RichGraphNode
-import rdf.scala.utils.Preamble._
-/**
- * Some utility methods for the renderlets
- */
-object RenderingUtility {
-  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 getAgentPix(p: RichGraphNode) = {
-    val pix = firstOf(p, FOAF.depiction, FOAF.logo, FOAF.img).getNode match {
-      case uri: UriRef => uri.getUnicodeString
-      case _ => "http://upload.wikimedia.org/wikipedia/commons/0/0a/Gnome-stock_person.svg"
-    }
-    <a href={"/browse/person?uri="+encode(p*)}><img class="mugshot" src={pix}/></a>
-  }
-
-  private def encode(url: String): String =  URLEncoder.encode(url,"UTF8")
-
-  /**
-   * get a usable 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*
-
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala
deleted file mode 100644
index a2a58e6..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/html/SettingsPanel.scala
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.html
-
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import org.apache.clerezza.platform.accountcontrolpanel.ontologies.CONTROLPANEL
-import org.apache.clerezza.platform.typerendering.scala._
-
-
-class SettingsPanel extends SRenderlet {
-
-  val getRdfType = CONTROLPANEL.SettingsPage
-
-    override def renderedPage(arguments: XmlResult.Arguments) = new XmlResult(arguments ) {
-    override def content = {
-import org.apache.clerezza.rdf.core.UriRef
-import scala.xml.NodeBuffer
-import scala.collection.mutable.ListBuffer
-def cp(s: Any) = new UriRef("http://clerezza.org/2009/03/controlpanel#"+s)
-def osgi(s: Any) = new UriRef("http://clerezza.org/2008/11/osgi#"+s)
-def platform(s: Any) = new UriRef("http://clerezza.org/2009/08/platform#" + s)
-val nodeBuff = new ListBuffer[NodeBuffer]
-resultDocModifier.setTitle("Account Control Panel");
-resultDocModifier.addNodes2Elem("tx-module", <h1>Account Control Panel</h1>);
-resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="profile">Profile</a></li>);
-resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Settings</a></li>);
-
-if ((res/cp("userBundlePermission")*) == "true") {
-  nodeBuff +=(<h2>Bundle Control Panel</h2>
-  <h3>Install Bundle</h3>
-
-  <form method="post" action="control-panel/install-bundle" enctype="multipart/form-data">
-    <input type="file" class="FieldText" name="bundle" size="30" title="bundle path"/><br/><br/>
-    <input style="width: 5em;" value="Install" type="submit"/><p />
-  </form>
-  <br/><br/>
-  <h3>User Bundles</h3>
-  <table border="1">
-  <tbody>
-    <tr>
-      <th>Location</th>
-      <th>Status</th>
-      <th colspan="4">Action</th>
-    </tr>
-
-    {for (renderlet <- (res/-osgi("owner")).sort((a,b) => ((a*)<(b*)))) yield
-    <tr>
-      <td>{renderlet*}</td>
-      <td>{renderlet/osgi("status")* match {
-        case "2" => "Installed"
-        case "4" => "Resolved"
-        case "8" => "Starting"
-        case "16" => "Stopping"
-        case "32" => "Active"
-        }}
-      </td>
-      {if (((renderlet/osgi("bundle_id")).length) > 0)
-      <td>
-      <form method="post" action="control-panel/start-bundle">
-      <input name="bundleId" value={(renderlet/osgi("bundle_id"))*} type="hidden"/>
-      <input value="start" type="submit"/>
-      </form>
-      </td>
-      <td>
-      <form method="post" action="control-panel/stop-bundle">
-      <input name="bundleId" value={(renderlet/osgi("bundle_id"))*} type="hidden"/>
-      <input value="stop" type="submit"/>
-      </form>
-      </td>
-      <td>
-      <form method="post" action="control-panel/uninstall-bundle">
-      <input name="bundleId" value={(renderlet/osgi("bundle_id"))*} type="hidden"/>
-      <input value="uninstall" type="submit"/>
-      </form>
-      </td>
-      else
-      <td colspan="3">Not registered as bundle</td>}
-      </tr>
-      }
-    </tbody>
-  </table>
-  <br/>)
-}
-
-if((res/cp("changePasswordPermission")*) == "true") {
-  nodeBuff +=(<h2>Change Password</h2>
-
-
-  <form action="control-panel/change-password" method="post">
-    <fieldset>
-      <ol style="display: block;">
-        <li class="tx-line" style="background-image: none;">
-          <label>Current Password:</label>
-          <span class="tx-item">
-            <input type="password" name="oldPW"/>
-          </span>
-        </li>
-        <li class="tx-line" style="background-image: none;">
-          <label>New Password:</label>
-          <span class="tx-item">
-            <input type="password" name="newPW"/>
-          </span>
-        </li>
-        <li class="tx-line" style="background-image: none;">
-          <label>Confirm new Password:</label>
-          <span class="tx-item">
-            <input type="password" name="confirmNewPW"/>
-          </span>
-        </li>
-        <br />
-        <input style="width: 5em;" type="submit" name="submit" value="Submit"/>
-      </ol>
-      <br/>
-    </fieldset>
-  </form>)
-
-
-}
-
-if((res/cp("changedPassword")).length > 0) {
-  nodeBuff +=(<br /><span>Password has not changed, either wrong current password or the
-        new password and the confirmation didn't match!<br /><br /></span>)
-}
-
-
-nodeBuff +=(<h2>Change user's default language</h2>
-  <form method="post" action="control-panel/change-language">
-    {render(context/platform("instance")/platform("languages"), "naked")}
-    <br/><br/>
-    <script type="text/javascript">$("#availablelanguages").val({"'" + (context/platform("user")/platform("preferredLangInISOCode")*) + "'"})</script>
-    <input style="width: 5em;" type="submit" name="submit" value="Submit"/>
-    <br/><br/>
-  </form>)
-
-<div id="tx-content">
-  <div class="tx-edit" style="margin-left: 0.5em;">
-  {if(nodeBuff.isEmpty)
-    <span>There are no settings you can configure for this account!</span>
-  else
-    nodeBuff
-  }
-  </div>
-</div>
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala
----------------------------------------------------------------------
diff --git a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala b/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala
deleted file mode 100644
index ae7953f..0000000
--- a/platform.accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/permissions.scala
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.security.Permission
-import org.slf4j.scala.Logging
-
-//note: file has lower class name, as it contains many classes
-
-
-/**
- * superclass for the permission classes, to avoid a lot of boilerplate code
- *
- * @author bblfish, reto
- */
-abstract
-class AbstractPermission(val accountName: String, val actions: String ="")
-  extends Permission(accountName) with Logging  {
-
-  if (actions != "") {
-    throw new RuntimeException(getClass.getName+": actions must be an empty String "+
-      "(second argument only in constructor for supporting building from canonical form")
-  }
-
-  def getActions: String = actions
-
-  /**
-   * A subclass implies another permission if and only if they are equals
-   */
-   override
-  def implies(permission: Permission): Boolean = {
-    logger.debug("checking for "+permission+" is implied by "+ this)
-    var result: Boolean = equals(permission)
-    return result
-  }
-
-  override
-  def equals(other: Any): Boolean =
-      other match {
-      case that:  AbstractPermission  =>  
-        (that eq this ) || ((this.getClass == that.getClass) && accountName == that.accountName )
-      case _ => false
-      }
-
-  /**
-   * For the hashCode the class and the accountName is considered
-   */
-  override
-  def hashCode: Int = {
-    return  getClass.hashCode + (if (accountName != null) accountName.hashCode else 0)
-  }
-}
-
-/**
- * Permission to change the password
- * @author ali
- *
- */
-class ChangePasswordPermission(accountName: String, actions: String ="")
-  extends AbstractPermission(accountName, actions) {
-
-}
-
-/**
- * Permission to access the account control panel
- *
- * @author ali
- *
- */
-class AccountControlPanelAppPermission(accountName: String, actions: String ="")
-  extends AbstractPermission(accountName)  {
-
-
-}
-
-/**
- * Permission for user to have own bundles
- *
- * @author mir
- *
- */
-class UserBundlePermission( accountName: String, actions: String ="")
-  extends AbstractPermission(accountName)  {
-
-
-}
\ No newline at end of file