Author: reto
Date: Thu May 12 21:55:54 2011
New Revision: 1102477

URL: http://svn.apache.org/viewvc?rev=1102477&view=rev
Log:
CLEREZZA-524: shell customizer for the clerezza platform

Added:
    incubator/clerezza/trunk/parent/platform.shellcustomizer/
      - copied from r1101649, incubator/clerezza/trunk/parent/bundledevtool/
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformDsl.scala
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformShellCustomizer.scala
Removed:
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/resources/META-INF/
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/resources/org/apache/clerezza/bundledevtool/skeletons/scala_with_activator/
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/bundledevtool/
    incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/sbt/
Modified:
    incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml
    incubator/clerezza/trunk/parent/platform.shellcustomizer/pom.xml
    
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/resources/OSGI-INF/serviceComponents.xml
    incubator/clerezza/trunk/parent/pom.xml

Modified: 
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml?rev=1102477&r1=1102476&r2=1102477&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml 
(original)
+++ 
incubator/clerezza/trunk/parent/platform.launcher.storageless.parent/pom.xml 
Thu May 12 21:55:54 2011
@@ -324,6 +324,10 @@
                </dependency>
                <dependency>
                        <groupId>org.apache.clerezza</groupId>
+                       <artifactId>platform.shellcustomizer</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
                        <artifactId>shell</artifactId>
                        <scope>runtime</scope>
                </dependency>

Modified: incubator/clerezza/trunk/parent/platform.shellcustomizer/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.shellcustomizer/pom.xml?rev=1102477&r1=1101649&r2=1102477&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.shellcustomizer/pom.xml (original)
+++ incubator/clerezza/trunk/parent/platform.shellcustomizer/pom.xml Thu May 12 
21:55:54 2011
@@ -5,33 +5,17 @@
                <artifactId>parent</artifactId>
                <version>0.2-incubating-SNAPSHOT</version>
        </parent>
-       <artifactId>bundledevtool</artifactId>
+       <artifactId>platform.shellcustomizer</artifactId>
        <version>0.1-incubating-SNAPSHOT</version>
        <packaging>bundle</packaging>
-       <name>Clerezza - Bundle Development Tools</name>
+       <name>Clerezza - Platform Shell customizer</name>
+    <description>Provides utilities to access platform features from the 
clerezza shell</description>
        <dependencies>
                <dependency>
-                       <groupId>org.apache.clerezza.scala</groupId>
-                       <artifactId>script-engine</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>jline</groupId>
-                       <artifactId>jline</artifactId>
-                       <version>0.9.94</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.scala-lang</groupId>
-                       <artifactId>scala-compiler</artifactId>
-               </dependency>
-               <dependency>
                        <groupId>org.scala-lang</groupId>
                        <artifactId>scala-library</artifactId>
                </dependency>
                <dependency>
-                       <groupId>org.apache.felix</groupId>
-                       
<artifactId>org.apache.felix.scr.annotations</artifactId>
-               </dependency>
-               <dependency>
                        <groupId>org.osgi</groupId>
                        <artifactId>org.osgi.compendium</artifactId>
                </dependency>
@@ -39,17 +23,21 @@
                        <groupId>org.osgi</groupId>
                        <artifactId>org.osgi.core</artifactId>
                </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
+                       <artifactId>utils</artifactId>
+               </dependency>
                <dependency>
-                       <groupId>org.ops4j.pax.swissbox</groupId>
-                       <artifactId>pax-swissbox-tinybundles</artifactId>
+                       <groupId>org.apache.clerezza</groupId>
+                       <artifactId>shell</artifactId>
                </dependency>
         <dependency>
                        <groupId>org.apache.clerezza</groupId>
-                       <artifactId>utils</artifactId>
+                       <artifactId>platform.graphprovider.content</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.apache.clerezza</groupId>
-                       <artifactId>shell</artifactId>
+                       <artifactId>rdf.scala.utils</artifactId>
                </dependency>
        </dependencies>
        <build>
@@ -62,9 +50,9 @@
                                <configuration>
                                        <instructions>
                                                
<Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
-                                               
<Export-Package>org.apache.clerezza.bundledevtool</Export-Package>
-                                               
<Private-Package>sbt,sbt.*</Private-Package>
-                                               
<Bundle-SymbolicName>org.apache.clerezza.bundledevtool</Bundle-SymbolicName>
+                                               
<Export-Package>${project.groupId}.${project.artifactId}</Export-Package>
+                                               <!-- 
<Export-Package>org.apache.clerezza.bundledevtool</Export-Package>
+                                               
<Bundle-SymbolicName>org.apache.clerezza.bundledevtool</Bundle-SymbolicName> -->
                                        </instructions>
                                </configuration>
                        </plugin>

Modified: 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/resources/OSGI-INF/serviceComponents.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/resources/OSGI-INF/serviceComponents.xml?rev=1102477&r1=1101649&r2=1102477&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/resources/OSGI-INF/serviceComponents.xml
 (original)
+++ 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/resources/OSGI-INF/serviceComponents.xml
 Thu May 12 21:55:54 2011
@@ -1,25 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0";>
-       <scr:component enabled="true" immediate="true" 
name="org.apache.clerezza.sourcebundle.BundleRoot">
-        <implementation class="org.apache.clerezza.bundledevtool.BundleRoot"/>
-        <property name="service.pid" 
value="org.apache.clerezza.bundledevtool.BundleRoot"/>
-               <service servicefactory="false">
-            <provide interface="org.apache.clerezza.bundledevtool.BundleRoot"/>
-        </service>
-               <reference name="CompilerService"
-                               
interface="org.apache.clerezza.scala.scripting.CompilerService"
-                               cardinality="1..1"
-                               bind="bindCompilerService" 
unbind="unbindCompilerService"/>
-               <reference name="PackageAdmin"
-                               
interface="org.osgi.service.packageadmin.PackageAdmin"
-                               cardinality="1..1"
-                               bind="bindPackageAdmin" 
unbind="unbindPackageAdmin"/>
-    </scr:component>
-       <scr:component enabled="true"  
name="org.apache.clerezza.sourcebundle.DevShellCustomizer">
-        <implementation 
class="org.apache.clerezza.bundledevtool.DevShellCustomizer"/>
-        <property name="service.pid" 
value="org.apache.clerezza.bundledevtool.DevShellCustomizer"/>
+       <scr:component enabled="true"  
name="org.apache.clerezza.platform.shellcustomizer.PlatformShellCustomizer">
+        <implementation 
class="org.apache.clerezza.platform.shellcustomizer.PlatformShellCustomizer"/>
+        <property name="service.pid" 
value="org.apache.clerezza.platform.shellcustomizer.PlatformShellCustomizer"/>
                <service servicefactory="false">
             <provide interface="org.apache.clerezza.shell.ShellCustomizer"/>
         </service>
+        <reference name="cgProvider" 
interface="org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider"
+               cardinality="1..1" policy="static" 
bind="bindContentGraphProvider" unbind="unbindContentGraphProvider"/>
     </scr:component>
 </components>

Added: 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformDsl.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformDsl.scala?rev=1102477&view=auto
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformDsl.scala
 (added)
+++ 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformDsl.scala
 Thu May 12 21:55:54 2011
@@ -0,0 +1,51 @@
+package org.apache.clerezza.platform.shellcustomizer
+
+/*
+ * 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 java.io.File
+import java.io.OutputStream
+import java.io.OutputStreamWriter
+import java.io.PrintWriter
+import org.osgi.framework.BundleContext
+import org.apache.clerezza.osgi.services.ServicesDsl
+import org.apache.clerezza
+import clerezza.platform.graphprovider.content.ContentGraphProvider
+import clerezza.rdf.core.serializedform.Parser
+
+/**
+ * A DSL to acces various services of the platform, mainly designed for usaged
+ * on the console.
+ */
+class PlatformDsl(outputStream: OutputStream, bundleContext: BundleContext) {
+
+       private lazy val out = new PrintWriter(new 
OutputStreamWriter(outputStream, "utf-8"), true)
+       private val serviceDsl = new ServicesDsl(bundleContext)
+       import serviceDsl._
+
+       lazy val contentGraph = $[ContentGraphProvider].getContentGraph
+       def parser = $[Parser]
+
+       def uname {
+               out println ("Clerezza on "+System.getProperty("java.vm.name"))
+       }
+
+
+       //here we could add a command to set the debug output to the console 
for some packages
+}

Added: 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformShellCustomizer.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformShellCustomizer.scala?rev=1102477&view=auto
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformShellCustomizer.scala
 (added)
+++ 
incubator/clerezza/trunk/parent/platform.shellcustomizer/src/main/scala/org/apache/clerezza/platform/shellcustomizer/PlatformShellCustomizer.scala
 Thu May 12 21:55:54 2011
@@ -0,0 +1,49 @@
+package org.apache.clerezza.platform.shellcustomizer
+
+/*
+ * 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.shell.Shell
+import org.apache.clerezza.shell.ShellCustomizer
+import org.apache.clerezza.rdf.scala.utils.{EasyGraph, Preamble}
+import org.apache.clerezza.rdf.core.MGraph
+import org.apache.clerezza.platform.graphprovider.content._
+
+class PlatformShellCustomizer extends ShellCustomizer {
+
+       var contentGraphProvider: ContentGraphProvider = null
+
+       def bindings(e: Shell.Environment): List[(String, String, Any)] = {
+               val bundleContext = e.componentContext.getBundleContext
+               List(("contentGraphPreamble", classOf[Preamble].getName, new 
Preamble(contentGraphProvider.getContentGraph)),
+                               ("platformDsl", classOf[PlatformDsl].getName, 
new PlatformDsl(e.out, bundleContext)))
+       }
+       def imports: List[String] = 
List("org.apache.clerezza.rdf.scala.utils.EasyGraph._", 
"contentGraphPreamble._",
+                                                                       
"platformDsl._", "org.apache.clerezza.rdf.core._",
+                                                                       
"org.apache.clerezza.rdf.core.access.TcManager",
+                                                                       
"org.apache.clerezza.rdf.ontologies._",
+                                                                       
"org.apache.clerezza.rdf.scala.utils._")
+
+       def bindContentGraphProvider(p: ContentGraphProvider) {
+               contentGraphProvider = p
+       }
+
+       def unbindContentGraphProvider(p: ContentGraphProvider) {
+               contentGraphProvider = null
+       }
+}

Modified: incubator/clerezza/trunk/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/pom.xml?rev=1102477&r1=1102476&r2=1102477&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/pom.xml (original)
+++ incubator/clerezza/trunk/parent/pom.xml Thu May 12 21:55:54 2011
@@ -73,6 +73,7 @@
                                <module>platform.security.foafssl</module>
                                <module>platform.security.conditions</module>
                                <module>platform.security</module>
+                               <module>platform.shellcustomizer</module>
                                <module>platform.typehandlerspace</module>
                                <module>platform.typerendering</module>
                                <module>platform.typerendering.gui</module>
@@ -1150,6 +1151,11 @@
                        </dependency>
                        <dependency>
                                <groupId>org.apache.clerezza</groupId>
+                               
<artifactId>platform.shellcustomizer</artifactId>
+                               <version>0.1-incubating-SNAPSHOT</version>
+                       </dependency>
+                       <dependency>
+                               <groupId>org.apache.clerezza</groupId>
                                <artifactId>app.webguiexamples</artifactId>
                                <version>0.2-incubating-SNAPSHOT</version>
                        </dependency>


Reply via email to