Return-Path: X-Original-To: apmail-clerezza-commits-archive@www.apache.org Delivered-To: apmail-clerezza-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8072CF5E1 for ; Wed, 3 Apr 2013 18:40:17 +0000 (UTC) Received: (qmail 75886 invoked by uid 500); 3 Apr 2013 18:40:17 -0000 Delivered-To: apmail-clerezza-commits-archive@clerezza.apache.org Received: (qmail 75830 invoked by uid 500); 3 Apr 2013 18:40:17 -0000 Mailing-List: contact commits-help@clerezza.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@clerezza.apache.org Delivered-To: mailing list commits@clerezza.apache.org Received: (qmail 75746 invoked by uid 99); 3 Apr 2013 18:40:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Apr 2013 18:40:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Apr 2013 18:39:40 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 60A5F2388B56; Wed, 3 Apr 2013 18:38:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1464148 [10/34] - in /clerezza/site/production: ./ architecture/ architecture/images/ bundle-doc/ bundle-doc/org.apache.clerezza.bundledevtool/ bundle-doc/org.apache.clerezza.bundledevtool/intro-content-el/ bundle-doc/org.apache.clerezza.p... Date: Wed, 03 Apr 2013 18:37:57 -0000 To: commits@clerezza.apache.org From: reto@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130403183853.60A5F2388B56@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,27 @@ + + + + + + + + 4 + + + + + + + + + 1 + + + + + + 0 + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content-el/4.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,113 @@ + + + + Accessing OSGi services + + + +
+ +
+ +
+ + +
+

Accessing OSGi services +

+
+ +
ScalaServerPages are used for rendering information, therefore services are typically accessed when producing the RDF and not from the ScalaServePage. Still you can access designated services from the ScalaServerPages, you get an instance with $[serviceInterface], eg.: +
+$[AdvertisingService].getBanner +
+ +You can only access services that are annotated with @org.apache.clerezza.platform.typerendering.WebRenderingService +
+ +
+ +
+ + + + + \ No newline at end of file Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,148 @@ + + + + + + Untitled Content + + + + +
ScalaServerPages allow using scala to render a response resource to a particular output format. +
+ +

Example +

+
+ +
The following shows a simple ScalaServerPage:
+
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- res/um("permission")) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+ +
+ +
The following iterates over an rdf:List represented by the root-resource +
+//a ScalaServePage to render a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +def typerendering(s: Any) = new UriRef("http://clerezza.org/2009/04/typerendering#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- res!!) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
You can sort rdf:List using the sort-method: +
+//sorting the URIs of a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- (res!!).sort((a,b) => ((a*) < (b*)))) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
same for properties: +
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +//sorting by java-permission-entry +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- (res/um("permission")) + .sort((a,b) => (a/perm("javaPermissionEntry")*) < + (b/perm("javaPermissionEntry")*))) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+
+ +
+
+ +

How does it work +

+
+ +
A ScalaServerPages is transformed into a Scala Source file and compiled. The content of the ScalaServerPage becomes the content of a method returning AnyRef, the returned Object will be transformed to a String and the to a byte-array to be written to the response stream +
+ +
+
+ +

Avialable values +

+
+ +
    +
  • renderer: CallbackRenderer, used to delegate to another Renderlet usally not used directly but wia the render method
  • +
  • res: GraphNode, the main response resource, as a GraphNode it is dynamically converted to a RichGraphNode allowing the functions provided by org.apache.clerezza.utils.scala
  • +
  • val context:GraphNode, a GraphNode with contextual information not specifically related to the current request, such as description on the current user
  • +
  • val mode: String, the rendering mode
  • +
  • val uriInfo: UriInfo, the UriRinf of the request, allows access to the request URI and query parameters
  • +
  • val sharedRenderingValues: java.util.Map[String, Object], a map used to share values across the different renderlets and ScalaServerPages involved in the creation of a representation, typically used to prevent repeated computation of the same values. Typically this map is not accessed directly, instead values are retrived with $("key") and set with $("key") = newvalue
  • +
+
+ +
+
+ +

Accessing OSGi services +

+
+ +
ScalaServerPages are used for rendering information, therefore services are typically accessed when producing the RDF and not from the ScalaServePage. Still you can access designated services from the ScalaServerPages, you get an instance with $[serviceInterface], eg.: +
+$[AdvertisingService].getBanner +
+ +You can only access services that are annotated with @org.apache.clerezza.platform.typerendering.WebRenderingService +
+ +
+
+ + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,45 @@ + + + + 2 + + + + 4 + + + + + + + + + + + + + + 0 + + + + + + + + 3 + + + + + 1 + + + + + + 1 + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-content.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,148 @@ + + + + + + Untitled Content + + + + +
ScalaServerPages allow using scala to render a response resource to a particular output format. +
+ +

Example +

+
+ +
The following shows a simple ScalaServerPage:
+
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- res/um("permission")) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+ +
+ +
The following iterates over an rdf:List represented by the root-resource +
+//a ScalaServePage to render a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +def typerendering(s: Any) = new UriRef("http://clerezza.org/2009/04/typerendering#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- res!!) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
You can sort rdf:List using the sort-method: +
+//sorting the URIs of a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- (res!!).sort((a,b) => ((a*) < (b*)))) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
same for properties: +
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +//sorting by java-permission-entry +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- (res/um("permission")) + .sort((a,b) => (a/perm("javaPermissionEntry")*) < + (b/perm("javaPermissionEntry")*))) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+
+ +
+
+ +

How does it work +

+
+ +
A ScalaServerPages is transformed into a Scala Source file and compiled. The content of the ScalaServerPage becomes the content of a method returning AnyRef, the returned Object will be transformed to a String and the to a byte-array to be written to the response stream +
+ +
+
+ +

Avialable values +

+
+ +
    +
  • renderer: CallbackRenderer, used to delegate to another Renderlet usally not used directly but wia the render method
  • +
  • res: GraphNode, the main response resource, as a GraphNode it is dynamically converted to a RichGraphNode allowing the functions provided by org.apache.clerezza.utils.scala
  • +
  • val context:GraphNode, a GraphNode with contextual information not specifically related to the current request, such as description on the current user
  • +
  • val mode: String, the rendering mode
  • +
  • val uriInfo: UriInfo, the UriRinf of the request, allows access to the request URI and query parameters
  • +
  • val sharedRenderingValues: java.util.Map[String, Object], a map used to share values across the different renderlets and ScalaServerPages involved in the creation of a representation, typically used to prevent repeated computation of the same values. Typically this map is not accessed directly, instead values are retrived with $("key") and set with $("key") = newvalue
  • +
+
+ +
+
+ +

Accessing OSGi services +

+
+ +
ScalaServerPages are used for rendering information, therefore services are typically accessed when producing the RDF and not from the ScalaServePage. Still you can access designated services from the ScalaServerPages, you get an instance with $[serviceInterface], eg.: +
+$[AdvertisingService].getBanner +
+ +You can only access services that are annotated with @org.apache.clerezza.platform.typerendering.WebRenderingService +
+ +
+
+ + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + ScalaServerPages + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,16 @@ + + + + ScalaServerPages + + + + + + + 0 + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro-title.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + ScalaServerPages + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,240 @@ + + + + ScalaServerPages + + + +
+ +
+ +
+ + +
+

ScalaServerPages +

+
+ +
ScalaServerPages allow using scala to render a response resource to a particular output format. +
+ +

Example +

+
+ +
The following shows a simple ScalaServerPage:
+
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- res/um("permission")) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+ +
+ +
The following iterates over an rdf:List represented by the root-resource +
+//a ScalaServePage to render a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +def typerendering(s: Any) = new UriRef("http://clerezza.org/2009/04/typerendering#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- res!!) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
You can sort rdf:List using the sort-method: +
+//sorting the URIs of a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- (res!!).sort((a,b) => ((a*) < (b*)))) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
same for properties: +
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +//sorting by java-permission-entry +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- (res/um("permission")) + .sort((a,b) => (a/perm("javaPermissionEntry")*) < + (b/perm("javaPermissionEntry")*))) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+
+ +
+
+ +

How does it work +

+
+ +
A ScalaServerPages is transformed into a Scala Source file and compiled. The content of the ScalaServerPage becomes the content of a method returning AnyRef, the returned Object will be transformed to a String and the to a byte-array to be written to the response stream +
+ +
+
+ +

Avialable values +

+
+ +
    +
  • renderer: CallbackRenderer, used to delegate to another Renderlet usally not used directly but wia the render method
  • +
  • res: GraphNode, the main response resource, as a GraphNode it is dynamically converted to a RichGraphNode allowing the functions provided by org.apache.clerezza.utils.scala
  • +
  • val context:GraphNode, a GraphNode with contextual information not specifically related to the current request, such as description on the current user
  • +
  • val mode: String, the rendering mode
  • +
  • val uriInfo: UriInfo, the UriRinf of the request, allows access to the request URI and query parameters
  • +
  • val sharedRenderingValues: java.util.Map[String, Object], a map used to share values across the different renderlets and ScalaServerPages involved in the creation of a representation, typically used to prevent repeated computation of the same values. Typically this map is not accessed directly, instead values are retrived with $("key") and set with $("key") = newvalue
  • +
+
+ +
+
+ +

Accessing OSGi services +

+
+ +
ScalaServerPages are used for rendering information, therefore services are typically accessed when producing the RDF and not from the ScalaServePage. Still you can access designated services from the ScalaServerPages, you get an instance with $[serviceInterface], eg.: +
+$[AdvertisingService].getBanner +
+ +You can only access services that are annotated with @org.apache.clerezza.platform.typerendering.WebRenderingService +
+ +
+
+ +
+ +
+ + + + + \ No newline at end of file Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,26 @@ + + + + + + + + + + + 1 + + + + + + 0 + + + + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.platform.typerendering.scalaserverpages/intro.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,240 @@ + + + + ScalaServerPages + + + +
+ +
+ +
+ + +
+

ScalaServerPages +

+
+ +
ScalaServerPages allow using scala to render a response resource to a particular output format. +
+ +

Example +

+
+ +
The following shows a simple ScalaServerPage:
+
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- res/um("permission")) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+ +
+ +
The following iterates over an rdf:List represented by the root-resource +
+//a ScalaServePage to render a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +def typerendering(s: Any) = new UriRef("http://clerezza.org/2009/04/typerendering#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- res!!) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
You can sort rdf:List using the sort-method: +
+//sorting the URIs of a http://clerezza.org/2009/05/renderletmanager#RenderletManagerPage +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Listing renderlets</title> + </head> + <body> + {for (renderlet <- (res!!).sort((a,b) => ((a*) < (b*)))) yield + <div id="renderlet"> + type: {renderlet*} + </div> + } + </body> +</html> +
+
+ +
same for properties: +
+//a ScalaServePage to render a http://clerezza.org/2009/05/usermanager#UserPermissionPage +//sorting by java-permission-entry +def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s) +def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#"+s) +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>Permissions for user {res/um("user")/FOAF.name}</title> + </head> + <body> + {for (permission <- (res/um("permission")) + .sort((a,b) => (a/perm("javaPermissionEntry")*) < + (b/perm("javaPermissionEntry")*))) yield + <div id="permission"> + {permission/perm("javaPermissionEntry")*} + </div> + } + </body> + +</html> +
+
+ +
+
+ +

How does it work +

+
+ +
A ScalaServerPages is transformed into a Scala Source file and compiled. The content of the ScalaServerPage becomes the content of a method returning AnyRef, the returned Object will be transformed to a String and the to a byte-array to be written to the response stream +
+ +
+
+ +

Avialable values +

+
+ +
    +
  • renderer: CallbackRenderer, used to delegate to another Renderlet usally not used directly but wia the render method
  • +
  • res: GraphNode, the main response resource, as a GraphNode it is dynamically converted to a RichGraphNode allowing the functions provided by org.apache.clerezza.utils.scala
  • +
  • val context:GraphNode, a GraphNode with contextual information not specifically related to the current request, such as description on the current user
  • +
  • val mode: String, the rendering mode
  • +
  • val uriInfo: UriInfo, the UriRinf of the request, allows access to the request URI and query parameters
  • +
  • val sharedRenderingValues: java.util.Map[String, Object], a map used to share values across the different renderlets and ScalaServerPages involved in the creation of a representation, typically used to prevent repeated computation of the same values. Typically this map is not accessed directly, instead values are retrived with $("key") and set with $("key") = newvalue
  • +
+
+ +
+
+ +

Accessing OSGi services +

+
+ +
ScalaServerPages are used for rendering information, therefore services are typically accessed when producing the RDF and not from the ScalaServePage. Still you can access designated services from the ScalaServerPages, you get an instance with $[serviceInterface], eg.: +
+$[AdvertisingService].getBanner +
+ +You can only access services that are annotated with @org.apache.clerezza.platform.typerendering.WebRenderingService +
+ +
+
+ +
+ +
+ + + + + \ No newline at end of file Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,30 @@ + + + + + + Untitled Content + + +

+ Smart Content Binding (SCB) is an open source framework developed by + clerezza.org aiming primarily at providing a java implementation of the + graph data model specified by W3C RDF [1] and + functionalities to operate on that data model. SCB offers a service + interface to access multiple named graphs and it can use various + providers to manage RDF graphs in a technology specific manner, e.g., + using Jena [2] (TBD) or Sesame [3]. + It also provides façades that allow an application to use Jena or Sesame (TBD) + APIs to process RDF graphs (note that the choice of a façade is independent of + the chosen backend; you can for example use the Jena façade to write + your code against the Jena API while using the Sesame provider to store + your data in a Sesame store). + Furthermore, SCB offers a serialization and a parsing service to convert + a graph into a certain representation (format) and vice versa. In order + to support ontologies usage, SCB provides a tool to convert ontologies + defined in various formats including RDF/XML into Java classes. +

+ + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,26 @@ + + + +

+ Smart Content Binding (SCB) is an open source framework developed by + clerezza.org aiming primarily at providing a java implementation of the + graph data model specified by W3C RDF [1] and + functionalities to operate on that data model. SCB offers a service + interface to access multiple named graphs and it can use various + providers to manage RDF graphs in a technology specific manner, e.g., + using Jena [2] (TBD) or Sesame [3]. + It also provides façades that allow an application to use Jena or Sesame (TBD) + APIs to process RDF graphs (note that the choice of a façade is independent of + the chosen backend; you can for example use the Jena façade to write + your code against the Jena API while using the Sesame provider to store + your data in a Sesame store). + Furthermore, SCB offers a serialization and a parsing service to convert + a graph into a certain representation (format) and vice versa. In order + to support ontologies usage, SCB provides a tool to convert ontologies + defined in various formats including RDF/XML into Java classes. +

+
+
+
Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-content.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,30 @@ + + + + + + Untitled Content + + +

+ Smart Content Binding (SCB) is an open source framework developed by + clerezza.org aiming primarily at providing a java implementation of the + graph data model specified by W3C RDF [1] and + functionalities to operate on that data model. SCB offers a service + interface to access multiple named graphs and it can use various + providers to manage RDF graphs in a technology specific manner, e.g., + using Jena [2] (TBD) or Sesame [3]. + It also provides façades that allow an application to use Jena or Sesame (TBD) + APIs to process RDF graphs (note that the choice of a façade is independent of + the chosen backend; you can for example use the Jena façade to write + your code against the Jena API while using the Sesame provider to store + your data in a Sesame store). + Furthermore, SCB offers a serialization and a parsing service to convert + a graph into a certain representation (format) and vice versa. In order + to support ontologies usage, SCB provides a tool to convert ontologies + defined in various formats including RDF/XML into Java classes. +

+ + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + Introduction + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,8 @@ + + + Introduction + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0-title.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + Introduction + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + Introduction + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,8 @@ + + + Introduction + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/0.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + Introduction + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,65 @@ + + + + + + Untitled Content + + +

+ SCB comprises the following architectural components as depicted in Fig. 1: +

+
    +
  • Core
  • +
  • Facades
  • +
  • Utilities
  • +
  • Storage Providers
  • +
  • Parsing Providers
  • +
  • Serializing Providers
  • +
  • Ontologies Tool
  • +
+ +

+ SCB Architecture +
Figure 1: SCB Architecture +

+

+ The Core contains interface definitions of the RDF graph data model and its + implementation. The three main classes are Graph, MGraph, + and TripleCollection. The class Graph represents an + immutable RDF Graph, as such its identity criterion is defined in terms of + graph-isomorphism. The class MGraph represents a mutable RDF Graph, + which enables triples to be added to or removed from a graph. The class + TripleCollection is the super class of both the class Graph + and MGraph. + SCB Core provides three services: TcManager [4] allows access to + the various TripleCollections, Parser [5] and + Serializer [6] to allow reading and writing graphs from and to + various formats. In an OSGi environment these services are accessed using the + service registry or injected using OSGi Declarative Services. In a non OSGi environment + static factory methods are used to return an instance. + The TcManager delegates actual processing tasks to a specific Storage Provider + chosen from a set of Storage Providers based on their priority number (weight). + Storage Providers can be dynamically bound to or unbound from the Core. + The functionality required by the Parser and Serializer is delegated to registered + Parsing and Serializing Providers respectively, according to their capability + (supported formats). Later registered providers shadow previous ones for the same format. +

+ +

+ The current implementation of SCB includes a Jena Façade. The Jena Façade allows an + application to use Jena API to manipulate a TC. +

+

+ In order to ease operations on a resource in a TC, the Utilities component provides + a class with a set of useful methods, e.g., to delete all triples (statements) with + the resource as subject and a specified predicate. +

+

+ Finally, the Ontologies Tool contains a standalone application called SchemaGen to + generate the Java source code with constants from an ontology description. +

+ + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,69 @@ + + + + <p xmlns="http://www.w3.org/1999/xhtml"> + SCB comprises the following architectural components as depicted in Fig. 1: + </p> + <ul xmlns="http://www.w3.org/1999/xhtml"> + <li>Core</li> + <li>Facades</li> + <li>Utilities</li> + <li>Storage Providers</li> + <li>Parsing Providers</li> + <li>Serializing Providers</li> + <li>Ontologies Tool</li> + </ul> + + <p xmlns="http://www.w3.org/1999/xhtml"> + <img alt="SCB Architecture" src="images/scb_architecture.png"/> + <br/><i>Figure 1: SCB Architecture</i> + </p> + <p xmlns="http://www.w3.org/1999/xhtml"> + The Core contains interface definitions of the RDF graph data model and its + implementation. The three main classes are <code>Graph</code>, <code>MGraph</code>, + and <code>TripleCollection</code>. The class <code>Graph</code> represents an + immutable RDF Graph, as such its identity criterion is defined in terms of + graph-isomorphism. The class <code>MGraph</code> represents a mutable RDF Graph, + which enables triples to be added to or removed from a graph. The class + <code>TripleCollection</code> is the super class of both the class <code>Graph</code> + and <code>M</code><code/><code/><code/><code/><code/><code/><code/><code>Graph</code>. + SCB Core provides three services: <code>TcManager</code> [<a href="#ref4">4</a>] allows access to + the various <code>TripleCollection</code>s, <code>Parser</code> [<a href="#ref5">5</a>] and + <code>Serializer</code> [<a href="#ref6">6</a>] to allow reading and writing graphs from and to + various formats. In an OSGi environment these services are accessed using the + service registry or injected using OSGi Declarative Services. In a non OSGi environment + static factory methods are used to return an instance. + The <code>TcManager</code> delegates actual processing tasks to a specific Storage Provider + chosen from a set of Storage Providers based on their priority number (weight). + Storage Providers can be dynamically bound to or unbound from the Core. + The functionality required by the Parser and Serializer is delegated to registered + Parsing and Serializing Providers respectively, according to their capability + (supported formats). Later registered providers shadow previous ones for the same format. + </p> + + <p xmlns="http://www.w3.org/1999/xhtml"> + The current implementation of SCB includes a Jena Façade. The Jena Façade allows an + application to use Jena API to manipulate a TC. + </p> + <p xmlns="http://www.w3.org/1999/xhtml"> + In order to ease operations on a resource in a TC, the Utilities component provides + a class with a set of useful methods, e.g., to delete all triples (statements) with + the resource as subject and a specified predicate. + </p> + <p xmlns="http://www.w3.org/1999/xhtml"> + Finally, the Ontologies Tool contains a standalone application called SchemaGen to + generate the Java source code with constants from an ontology description. + </p> + + + + + + + + 1 + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-content.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,65 @@ + + + + + + Untitled Content + + +

+ SCB comprises the following architectural components as depicted in Fig. 1: +

+
    +
  • Core
  • +
  • Facades
  • +
  • Utilities
  • +
  • Storage Providers
  • +
  • Parsing Providers
  • +
  • Serializing Providers
  • +
  • Ontologies Tool
  • +
+ +

+ SCB Architecture +
Figure 1: SCB Architecture +

+

+ The Core contains interface definitions of the RDF graph data model and its + implementation. The three main classes are Graph, MGraph, + and TripleCollection. The class Graph represents an + immutable RDF Graph, as such its identity criterion is defined in terms of + graph-isomorphism. The class MGraph represents a mutable RDF Graph, + which enables triples to be added to or removed from a graph. The class + TripleCollection is the super class of both the class Graph + and MGraph. + SCB Core provides three services: TcManager [4] allows access to + the various TripleCollections, Parser [5] and + Serializer [6] to allow reading and writing graphs from and to + various formats. In an OSGi environment these services are accessed using the + service registry or injected using OSGi Declarative Services. In a non OSGi environment + static factory methods are used to return an instance. + The TcManager delegates actual processing tasks to a specific Storage Provider + chosen from a set of Storage Providers based on their priority number (weight). + Storage Providers can be dynamically bound to or unbound from the Core. + The functionality required by the Parser and Serializer is delegated to registered + Parsing and Serializing Providers respectively, according to their capability + (supported formats). Later registered providers shadow previous ones for the same format. +

+ +

+ The current implementation of SCB includes a Jena Façade. The Jena Façade allows an + application to use Jena API to manipulate a TC. +

+

+ In order to ease operations on a resource in a TC, the Utilities component provides + a class with a set of useful methods, e.g., to delete all triples (statements) with + the resource as subject and a specified predicate. +

+

+ Finally, the Ontologies Tool contains a standalone application called SchemaGen to + generate the Java source code with constants from an ontology description. +

+ + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.html URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.html?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.html (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.html Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + Architecture + + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.rdf URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.rdf?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.rdf (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.rdf Wed Apr 3 18:37:39 2013 @@ -0,0 +1,16 @@ + + + 0 + + + + + + + + + Architecture + + Added: clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.xhtml URL: http://svn.apache.org/viewvc/clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.xhtml?rev=1464148&view=auto ============================================================================== --- clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.xhtml (added) +++ clerezza/site/production/bundle-doc/org.apache.clerezza.rdf.core/smart-content-binding-content-content-el/1-title.xhtml Wed Apr 3 18:37:39 2013 @@ -0,0 +1,12 @@ + + + + + + Untitled Content + + + Architecture + + +